POLYGENE-257 Fix documentation snippets for serialization API

Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/50bd2c93
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/50bd2c93
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/50bd2c93

Branch: refs/heads/develop
Commit: 50bd2c930361ec53d059c372ac74bc364a101c6a
Parents: 0e01c14
Author: Paul Merlin <[email protected]>
Authored: Sat May 27 11:45:39 2017 +0200
Committer: Paul Merlin <[email protected]>
Committed: Sat May 27 11:45:39 2017 +0200

----------------------------------------------------------------------
 core/api/build.gradle                            |  1 +
 core/api/src/docs/serialization.txt              |  1 +
 .../polygene/api/value/DocumentationSupport.java | 19 +++++++++++++++----
 3 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/50bd2c93/core/api/build.gradle
----------------------------------------------------------------------
diff --git a/core/api/build.gradle b/core/api/build.gradle
index 67c5f96..8e8cc7e 100644
--- a/core/api/build.gradle
+++ b/core/api/build.gradle
@@ -24,6 +24,7 @@ jar { manifest { name = "Apache Polygene™ Core API" } }
 
 dependencies {
   testImplementation polygene.core.testsupport
+  testImplementation polygene.extension( 'serialization-javaxjson' )
   testImplementation polygene.library( 'constraints' )
 
   testRuntimeOnly polygene.core.runtime

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/50bd2c93/core/api/src/docs/serialization.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/serialization.txt 
b/core/api/src/docs/serialization.txt
index 07b2459..192c276 100644
--- a/core/api/src/docs/serialization.txt
+++ b/core/api/src/docs/serialization.txt
@@ -71,6 +71,7 @@ Reading this first example step by step we ;
 
     . declare a ValueComposite,
     . assemble it,
+    . assemble default services including default `Serialization`,
     . create a new Value instance,
     . use the +ValueComposite#toString()+ method to get a JSON representation 
of the Value,
     . and finally, use the +Module#newValueFromSerializedState()+ method to 
create a new Value instance from the JSON

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/50bd2c93/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
----------------------------------------------------------------------
diff --git 
a/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
 
b/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
index 245cc16..725e33e 100644
--- 
a/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
+++ 
b/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
@@ -31,6 +31,7 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.serialization.Deserializer;
 import org.apache.polygene.api.serialization.Serializer;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import 
org.apache.polygene.serialization.javaxjson.assembly.JavaxJsonSerializationAssembler;
 import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 
@@ -57,6 +58,16 @@ public class DocumentationSupport extends 
AbstractPolygeneTest
     public void assemble( ModuleAssembly module )
     {
         module.values( SomeValue.class ); // (2)
+        // END SNIPPET: default
+        // END SNIPPET: service
+        // START SNIPPET: default
+        module.defaultServices(); // (3)
+        // END SNIPPET: default
+        // START SNIPPET: service
+        new JavaxJsonSerializationAssembler().assemble( module ); // (3)
+        // END SNIPPET: service
+        // START SNIPPET: default
+        // START SNIPPET: service
     }
     // END SNIPPET: default
     // END SNIPPET: service
@@ -65,9 +76,9 @@ public class DocumentationSupport extends AbstractPolygeneTest
     // START SNIPPET: default
     public void defaultSerialization()
     {
-        SomeValue someValue = someNewValueInstance(); // (3)
-        String json = someValue.toString(); // (4)
-        SomeValue someNewValue = 
valueBuilderFactory.newValueFromSerializedState( SomeValue.class, json ); // (5)
+        SomeValue someValue = someNewValueInstance(); // (4)
+        String json = someValue.toString(); // (5)
+        SomeValue someNewValue = 
valueBuilderFactory.newValueFromSerializedState( SomeValue.class, json ); // (6)
         // END SNIPPET: default
 
         assertThat( json, equalTo( "{\"foo\":\"bar\"}" ) );
@@ -100,7 +111,7 @@ public class DocumentationSupport extends 
AbstractPolygeneTest
     }
     // END SNIPPET: service
 
-    static enum AcmeValue
+    enum AcmeValue
     {
         foo,
         bar

Reply via email to