You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2017/02/03 07:58:11 UTC
[10/19] polygene-java git commit: Serialization 3 step 1
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java
deleted file mode 100644
index 44ab1f4..0000000
--- a/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.test.value;
-
-import java.io.ByteArrayOutputStream;
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.OffsetDateTime;
-import java.time.ZoneOffset;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.test.AbstractPolygeneTest;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.apache.polygene.api.association.Association;
-import org.apache.polygene.api.association.ManyAssociation;
-import org.apache.polygene.api.association.NamedAssociation;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.common.UseDefaults;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.entity.EntityBuilder;
-import org.apache.polygene.api.entity.EntityComposite;
-import org.apache.polygene.api.entity.EntityReference;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.This;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.value.ValueBuilder;
-import org.apache.polygene.api.value.ValueComposite;
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.EntityTestAssembler;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Assert that ValueSerialization behaviour on ValueComposites is correct.
- */
-// TODO Assert Arrays behaviour!
-// TODO Assert Generics behaviour!
-public abstract class AbstractValueCompositeSerializationTest
- extends AbstractPolygeneTest
-{
- @Rule
- public TestName testName = new TestName();
-
- @Structure
- Module moduleInstance;
-
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.values( SomeValue.class, AnotherValue.class, FooValue.class, CustomFooValue.class,
- SpecificCollection.class /*, SpecificValue.class, GenericValue.class */ );
-
- new EntityTestAssembler().visibleIn( Visibility.layer ).assemble( module.layer().module( "persistence" ) );
- module.entities( BarEntity.class );
- }
-
- @Service
- protected ValueSerialization valueSerialization;
-
- @Test
- public void givenValueCompositeWhenSerializingAndDeserializingExpectEquals()
- throws Exception
- {
- try(UnitOfWork uow = unitOfWorkFactory.newUnitOfWork())
- {
- SomeValue some = buildSomeValue();
-
- // Serialize using injected service
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- valueSerialization.serialize( some, output );
- String stateString = output.toString( "UTF-8" );
-
- // Deserialize using Module API
- System.out.println(stateString);
- SomeValue some2 = moduleInstance.newValueFromSerializedState( SomeValue.class, stateString );
-
- assertThat( "String Integer Map", some2.stringIntMap().get().get( "foo" ), equalTo( 42 ) );
- assertThat( "String Value Map", some2.stringValueMap().get().get( "foo" ).internalVal(), equalTo( "Bar" ) );
- assertThat( "Nested Entities", some2.barAssociation().get().cathedral().get(), equalTo( "bazar in barAssociation" ) );
-
- assertThat( "Same value", some, equalTo( some2 ) );
- assertThat( "Same JSON value toString", stateString, equalTo( some2.toString() ) );
- assertThat( "Same JSON value", some.customFoo().get() instanceof CustomFooValue, is( true ) );
- assertThat( "Same JSON value explicit", some.customFooValue().get() instanceof CustomFooValue, is( true ) );
- assertThat( "Same value toString", some.toString(), equalTo( some2.toString() ) );
- }
- }
-
- /**
- * @return a SomeValue ValueComposite whose state is populated with test data.
- */
- private SomeValue buildSomeValue()
- {
- ValueBuilder<SomeValue> builder = moduleInstance.newValueBuilder( SomeValue.class );
- SomeValue proto = builder.prototype();
- proto.anotherList().get().add( moduleInstance.newValue( AnotherValue.class ) );
-
- ValueBuilder<SpecificCollection> specificColBuilder = moduleInstance.newValueBuilder( SpecificCollection.class );
- SpecificCollection specificColProto = specificColBuilder.prototype();
- List<String> genericList = new ArrayList<>( 2 );
- genericList.add( "Some" );
- genericList.add( "String" );
- specificColProto.genericList().set( genericList );
- proto.specificCollection().set( specificColBuilder.newInstance() );
-
- AnotherValue anotherValue1 = createAnotherValue( "Foo", "Bar" );
- AnotherValue anotherValue2 = createAnotherValue( "Habba", "ZoutZout" );
- AnotherValue anotherValue3 = createAnotherValue( "Niclas", "Hedhman" );
-
- // FIXME Some Control Chars are not supported in JSON nor in XML, what should we do about it?
- // Should Polygene Core ensure the chars used in strings are supported by the whole stack?
- // proto.string().set( "Foo\"Bar\"\nTest\f\t\b" );
- proto.string().set( "Foo\"Bar\"\nTest\t" );
- proto.string2().set( "/Foo/bar" );
- proto.number().set( 43L );
- proto.localTime().set( LocalTime.now() );
- proto.dateTime().set( OffsetDateTime.of( 2020, 3, 4, 13, 24, 35, 0, ZoneOffset.ofHours( 1 ) ) );
- proto.localDate().set( LocalDate.now() );
- proto.localDateTime().set( LocalDateTime.now() );
- proto.entityReference().set( EntityReference.parseEntityReference( "12345" ) );
- proto.stringIntMap().get().put( "foo", 42 );
-
- // Can't put more than one entry in Map because this test rely on the fact that the underlying implementations
- // maintain a certain order but it's not the case on some JVMs. On OpenJDK 8 they are reversed for example.
- // This should not be enforced tough as both the Map API and the JSON specification state that name-value pairs
- // are unordered.
- // As a consequence this test should be enhanced to be Map order independant.
- //
- // proto.stringIntMap().get().put( "bar", 67 );
-
- proto.stringValueMap().get().put( "foo", anotherValue1 );
- proto.another().set( anotherValue1 );
- // proto.arrayOfValues().set( new AnotherValue[] { anotherValue1, anotherValue2, anotherValue3 } );
- proto.serializable().set( new SerializableObject() );
- proto.foo().set( moduleInstance.newValue( FooValue.class ) );
- proto.fooValue().set( moduleInstance.newValue( FooValue.class ) );
- proto.customFoo().set( moduleInstance.newValue( CustomFooValue.class ) );
- proto.customFooValue().set( moduleInstance.newValue( CustomFooValue.class ) );
-
- // Arrays
- // TODO FIXME Disabled as ValueComposite equality fails here
- //proto.primitiveByteArray().set( new byte[]
- // {
- // 9, -12, 42, -12, 127, 23, -128, 73
- // } );
- //proto.byteArray().set( new Byte[]
- // {
- // 9, null, -12, 23, -12, 127, -128, 73
- // } );
-
- // NestedEntities
- proto.barAssociation().set( buildBarEntity( "bazar in barAssociation" ) );
- proto.barEntityAssociation().set( buildBarEntity( "bazar in barEntityAssociation" ) );
- proto.barManyAssociation().add( buildBarEntity( "bazar ONE in barManyAssociation" ) );
- proto.barManyAssociation().add( buildBarEntity( "bazar TWO in barManyAssociation" ) );
- proto.barEntityManyAssociation().add( buildBarEntity( "bazar ONE in barEntityManyAssociation" ) );
- proto.barEntityManyAssociation().add( buildBarEntity( "bazar TWO in barEntityManyAssociation" ) );
- proto.barNamedAssociation().put( "bazar", buildBarEntity( "bazar in barNamedAssociation" ) );
- proto.barNamedAssociation().put( "cathedral", buildBarEntity( "cathedral in barNamedAssociation" ) );
- proto.barEntityNamedAssociation().put( "bazar", buildBarEntity( "bazar in barEntityNamedAssociation" ) );
- proto.barEntityNamedAssociation().put( "cathedral", buildBarEntity( "cathedral in barEntityNamedAssociation" ) );
-
- return builder.newInstance();
- }
-
- private AnotherValue createAnotherValue( String val1, String val2 )
- {
- ValueBuilder<AnotherValue> valueBuilder = moduleInstance.newValueBuilder( AnotherValue.class );
- valueBuilder.prototype().val1().set( val1 );
- valueBuilder.prototypeFor( AnotherValueInternalState.class ).val2().set( val2 );
- return valueBuilder.newInstance();
- }
-
- private BarEntity buildBarEntity( String cathedral )
- {
- EntityBuilder<BarEntity> barBuilder = unitOfWorkFactory.currentUnitOfWork().newEntityBuilder( BarEntity.class );
- barBuilder.instance().cathedral().set( cathedral );
- return barBuilder.newInstance();
- }
-
- public enum TestEnum
- {
- somevalue, anothervalue
- }
-
- public interface SomeValue
- extends ValueComposite
- {
- Property<String> string();
-
- Property<String> string2();
-
- @Optional
- Property<String> nullString();
-
- @UseDefaults
- Property<String> emptyString();
-
- @UseDefaults
- Property<Long> number();
-
- Property<LocalTime> localTime();
-
- Property<OffsetDateTime> dateTime();
-
- Property<LocalDate> localDate();
-
- Property<LocalDateTime> localDateTime();
-
- Property<EntityReference> entityReference();
-
- @UseDefaults
- Property<List<String>> stringList();
-
- @UseDefaults
- Property<Map<String, Integer>> stringIntMap();
-
- @UseDefaults
- Property<Map<String, AnotherValue>> stringValueMap();
-
- Property<AnotherValue> another();
-
- // Property<AnotherValue[]> arrayOfValues();
-
- @Optional
- Property<AnotherValue> anotherNull();
-
- @UseDefaults
- Property<List<AnotherValue>> anotherList();
-
- @Optional
- Property<List<AnotherValue>> anotherListNull();
-
- @UseDefaults
- Property<List<AnotherValue>> anotherListEmpty();
-
- @UseDefaults
- Property<TestEnum> testEnum();
-
- // TODO FIXME Disabled as ValueComposite equality fails here
- //Property<byte[]> primitiveByteArray();
- //
- //@Optional
- //Property<byte[]> primitiveByteArrayNull();
- //
- //Property<Byte[]> byteArray();
- //
- //@Optional
- //Property<Byte[]> byteArrayNull();
-
- Property<Object> serializable();
-
- Property<Foo> foo();
-
- Property<FooValue> fooValue();
-
- Property<Foo> customFoo();
-
- Property<FooValue> customFooValue();
-
- Property<SpecificCollection> specificCollection();
-
- /* Too complicated to do generics here for now
- Property<SpecificValue> specificValue();
- */
- @Optional
- Association<Bar> barAssociationOptional();
-
- Association<Bar> barAssociation();
-
- Association<BarEntity> barEntityAssociation();
-
- ManyAssociation<Bar> barManyAssociationEmpty();
-
- ManyAssociation<Bar> barManyAssociation();
-
- ManyAssociation<BarEntity> barEntityManyAssociation();
-
- NamedAssociation<Bar> barNamedAssociationEmpty();
-
- NamedAssociation<Bar> barNamedAssociation();
-
- NamedAssociation<BarEntity> barEntityNamedAssociation();
- }
-
- public interface SpecificCollection
- extends GenericCollection<String>
- {
- }
-
- public interface GenericCollection<TYPE>
- extends ValueComposite
- {
- @UseDefaults
- Property<List<TYPE>> genericList();
- }
-
- public interface SpecificValue
- extends GenericValue<String>
- {
- }
-
- public interface GenericValue<TYPE>
- extends ValueComposite
- {
- @Optional
- Property<TYPE> item();
- }
-
- @Mixins( AnotherValueMixin.class )
- public interface AnotherValue
- extends ValueComposite
- {
- @UseDefaults
- Property<String> val1();
-
- String internalVal();
- }
-
- public interface AnotherValueInternalState
- {
- @UseDefaults
- Property<String> val2();
- }
-
- public static abstract class AnotherValueMixin
- implements AnotherValue
- {
- @This
- private AnotherValueInternalState internalState;
-
- @Override
- public String internalVal()
- {
- return internalState.val2().get();
- }
- }
-
- public interface Foo
- {
- @UseDefaults
- Property<String> bar();
- }
-
- public interface FooValue
- extends Foo, ValueComposite
- {
- }
-
- public interface CustomFooValue
- extends FooValue
- {
- @UseDefaults
- Property<String> custom();
- }
-
- public interface Bar
- {
- @UseDefaults
- Property<String> cathedral();
- }
-
- public interface BarEntity
- extends Bar, EntityComposite
- {
- }
-
- public static class SerializableObject
- implements Serializable
- {
- private static final long serialVersionUID = 1L;
- private final String foo = "Foo";
- private final int val = 35;
-
- @Override
- public boolean equals( Object o )
- {
- if( this == o )
- {
- return true;
- }
- if( o == null || getClass() != o.getClass() )
- {
- return false;
- }
- SerializableObject that = (SerializableObject) o;
- return val == that.val && foo.equals( that.foo );
- }
-
- @Override
- public int hashCode()
- {
- int result = foo.hashCode();
- result = 31 * result + val;
- return result;
- }
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/core/testsupport/src/main/java/org/apache/polygene/test/value/package.html
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/value/package.html b/core/testsupport/src/main/java/org/apache/polygene/test/value/package.html
deleted file mode 100644
index 31f0033..0000000
--- a/core/testsupport/src/main/java/org/apache/polygene/test/value/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- ~
- -->
-<html>
- <body>
- <h2>ValueSerialization SPI Test Support.</h2>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/dependencies.gradle
----------------------------------------------------------------------
diff --git a/dependencies.gradle b/dependencies.gradle
index 6f6f0b9..90b4cb7 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -28,13 +28,13 @@ dependencies.repositoriesUrls << [
// Core dependencies
def asmVersion = '5.1'
-def orgJsonVersion = '20130213'
+def javaxJsonVersion = '1.0'
def osgiVersion = '4.3.1'
dependencies.libraries << [
asm : "org.ow2.asm:asm:$asmVersion",
asm_commons: "org.ow2.asm:asm-commons:$asmVersion",
asm_util : "org.ow2.asm:asm-util:$asmVersion",
- org_json : "org.codeartisans:org.json:$orgJsonVersion",
+ javax_json : "javax.json:javax.json-api:$javaxJsonVersion",
osgi_core : "org.osgi:org.osgi.core:$osgiVersion",
]
@@ -60,10 +60,13 @@ def jcloudsVersion = '1.9.2' // 2.0.0 exists
def jdbmVersion = '2.4'
def jedisVersion = '2.9.0'
def jettyVersion = '9.2.17.v20160517' // 9.3.x Tests fail!
+def johnzonVersion = '1.0.0'
+def jooqVersion = '3.9.0'
def leveldbVersion = '0.9'
def leveldbJniVersion = '1.8'
def liquibaseVersion = '3.5.3'
def mongodbVersion = '3.4.0'
+def msgpackVersion = '0.8.11'
def restletVersion = '2.3.7'
def rdfVersion = '2.7.16' // 2.8.x change query results!! 4.x exists
def riakVersion = '2.1.1'
@@ -112,6 +115,8 @@ dependencies.libraries << [
jetty_continuation : "org.eclipse.jetty:jetty-continuation:$jettyVersion",
jetty_client : "org.eclipse.jetty:jetty-client:$jettyVersion",
jetty_xml : "org.eclipse.jetty:jetty-xml:$jettyVersion",
+ johnzon : "org.apache.johnzon:johnzon-core:$johnzonVersion",
+ jooq : "org.jooq:jooq:$jooqVersion",
jdbm : "jdbm:jdbm:$jdbmVersion",
jedis : "redis.clients:jedis:$jedisVersion",
leveldb_api : "org.iq80.leveldb:leveldb-api:$leveldbVersion",
@@ -119,6 +124,7 @@ dependencies.libraries << [
leveldb_jni_all : "org.fusesource.leveldbjni:leveldbjni-all:$leveldbJniVersion",
liquibase : "org.liquibase:liquibase-core:$liquibaseVersion",
mongodb : "org.mongodb:mongo-java-driver:$mongodbVersion",
+ msgpack : "org.msgpack:msgpack-core:$msgpackVersion",
osgi_compendium : "org.osgi:org.osgi.compendium:$osgiVersion",
osgi_enterprise : "org.osgi:org.osgi.enterprise:$osgiVersion",
restlet : [ "org.restlet.jee:org.restlet:$restletVersion",
@@ -176,11 +182,12 @@ def embedMongoVersion = '1.50.5'
def h2Version = '1.4.193'
def hamcrestVersion = '1.3'
def junitVersion = '4.12'
-def logbackVersion = '1.1.7'
+def logbackVersion = '1.1.7' // TODO Replace with Apache Log4j 2
def mockitoVersion = '2.2.9'
def mysqlVersion = '6.0.4'
def postgresqlVersion = '9.4.1211'
def sqliteVersion = '3.14.2.1'
+def xmlUnitVersion = '2.3.0'
dependencies.libraries << [
ant : "org.apache.ant:ant:$antVersion",
ant_junit : "org.apache.ant:ant-junit:$antVersion",
@@ -200,6 +207,7 @@ dependencies.libraries << [
postgres : "org.postgresql:postgresql:$postgresqlVersion",
spring_testsupport: "org.springframework:spring-test:$springVersion",
sqlite : "org.xerial:sqlite-jdbc:$sqliteVersion",
+ xmlunit : "org.xmlunit:xmlunit-matchers:$xmlUnitVersion",
]
// Default dependencies
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/cache-ehcache/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/cache-ehcache/build.gradle b/extensions/cache-ehcache/build.gradle
index 2e7ae19..c5b1ad7 100644
--- a/extensions/cache-ehcache/build.gradle
+++ b/extensions/cache-ehcache/build.gradle
@@ -32,7 +32,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/cache-memcache/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/build.gradle b/extensions/cache-memcache/build.gradle
index 5251c4d..41c6fcc 100644
--- a/extensions/cache-memcache/build.gradle
+++ b/extensions/cache-memcache/build.gradle
@@ -31,7 +31,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.internals.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-file/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/build.gradle b/extensions/entitystore-file/build.gradle
index a1b6378..9c841ce 100644
--- a/extensions/entitystore-file/build.gradle
+++ b/extensions/entitystore-file/build.gradle
@@ -31,7 +31,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-file/src/main/java/org/apache/polygene/entitystore/file/FileEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/src/main/java/org/apache/polygene/entitystore/file/FileEntityStoreMixin.java b/extensions/entitystore-file/src/main/java/org/apache/polygene/entitystore/file/FileEntityStoreMixin.java
index f1605a5..270503d 100644
--- a/extensions/entitystore-file/src/main/java/org/apache/polygene/entitystore/file/FileEntityStoreMixin.java
+++ b/extensions/entitystore-file/src/main/java/org/apache/polygene/entitystore/file/FileEntityStoreMixin.java
@@ -154,7 +154,7 @@ public class FileEntityStoreMixin
@Override
public void applyChanges( MapChanges changes )
- throws IOException
+ throws Exception
{
try
{
@@ -183,7 +183,7 @@ public class FileEntityStoreMixin
}
@Override
- public Writer updateEntity( final EntityReference ref, EntityDescriptor descriptor )
+ public Writer updateEntity( MapChange mapChange )
throws IOException
{
return new StringWriter( 1000 )
@@ -194,7 +194,7 @@ public class FileEntityStoreMixin
{
super.close();
String state = this.toString();
- File dataFile = getDataFile( ref );
+ File dataFile = getDataFile( mapChange.reference() );
store( dataFile, state );
}
};
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTest.java b/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTest.java
index 14ba8a8..d18be11 100644
--- a/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTest.java
+++ b/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTest.java
@@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -49,7 +48,6 @@ public class FileEntityStoreTest
.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
// START SNIPPET: assembly
new FileEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreWithCacheTest.java b/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreWithCacheTest.java
index 512feb0..95988da 100644
--- a/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreWithCacheTest.java
@@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -47,7 +46,6 @@ public class FileEntityStoreWithCacheTest
.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
new FileEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-geode/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/build.gradle b/extensions/entitystore-geode/build.gradle
index 146993c..4b72890 100644
--- a/extensions/entitystore-geode/build.gradle
+++ b/extensions/entitystore-geode/build.gradle
@@ -32,7 +32,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java
index 0cfe27a..c140c28 100644
--- a/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java
+++ b/extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreMixin.java
@@ -154,7 +154,7 @@ public class GeodeEntityStoreMixin
}
@Override
- public void applyChanges( MapChanges changes ) throws IOException
+ public void applyChanges( MapChanges changes ) throws Exception
{
changes.visitMap( new MapChanger()
{
@@ -177,10 +177,10 @@ public class GeodeEntityStoreMixin
}
@Override
- public Writer updateEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer updateEntity( MapChange mapChange )
throws IOException
{
- return newEntity( ref, entityDescriptor );
+ return newEntity( mapChange.reference(), mapChange.descriptor() );
}
@Override
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTest.java b/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTest.java
index 5f2a4f9..a6aa1e1 100644
--- a/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTest.java
+++ b/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTest.java
@@ -25,7 +25,6 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.geode.assembly.GeodeEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
public class GeodeEntityStoreTest
extends AbstractEntityStoreTest
@@ -39,7 +38,6 @@ public class GeodeEntityStoreTest
super.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
// START SNIPPET: assembly
new GeodeEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreWithCacheTest.java b/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreWithCacheTest.java
index 6dd02c4..3b30a1b 100644
--- a/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreWithCacheTest.java
@@ -25,7 +25,6 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.geode.assembly.GeodeEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
public class GeodeEntityStoreWithCacheTest
extends AbstractEntityStoreWithCacheTest
@@ -37,7 +36,6 @@ public class GeodeEntityStoreWithCacheTest
super.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
new GeodeEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-hazelcast/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/build.gradle b/extensions/entitystore-hazelcast/build.gradle
index 15c84b2..a8c6382 100644
--- a/extensions/entitystore-hazelcast/build.gradle
+++ b/extensions/entitystore-hazelcast/build.gradle
@@ -32,7 +32,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java
index 57d646c..749d980 100644
--- a/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java
+++ b/extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreMixin.java
@@ -104,7 +104,7 @@ public class HazelcastEntityStoreMixin
@Override
public void applyChanges( MapChanges changes )
- throws IOException
+ throws Exception
{
changes.visitMap( new MapChanger()
{
@@ -127,10 +127,10 @@ public class HazelcastEntityStoreMixin
}
@Override
- public Writer updateEntity( EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer updateEntity( MapChange mapChange )
throws IOException
{
- return newEntity( ref, entityDescriptor );
+ return newEntity( mapChange.reference(), mapChange.descriptor());
}
@Override
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreTest.java b/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreTest.java
index de6c474..c2d705f 100644
--- a/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreTest.java
+++ b/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreTest.java
@@ -19,8 +19,6 @@
*/
package org.apache.polygene.entitystore.hazelcast;
-import org.junit.After;
-import org.junit.Test;
import org.apache.polygene.api.common.Visibility;
import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
import org.apache.polygene.bootstrap.AssemblyException;
@@ -28,7 +26,8 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.hazelcast.assembly.HazelcastEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.After;
+import org.junit.Test;
public class HazelcastEntityStoreTest
extends AbstractEntityStoreTest
@@ -43,7 +42,6 @@ public class HazelcastEntityStoreTest
super.assemble( module );
ModuleAssembly configModule = module.layer().module( "config" );
new EntityTestAssembler().assemble( configModule );
- new OrgJsonValueSerializationAssembler().assemble( module );
// START SNIPPET: assembly
new HazelcastEntityStoreAssembler().withConfig( configModule, Visibility.layer ).assemble( module );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java b/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java
index f0a86c3..2b0cfa1 100644
--- a/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java
@@ -25,7 +25,6 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.hazelcast.assembly.HazelcastEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
public class HazelcastEntityStoreWithCacheTest
extends AbstractEntityStoreWithCacheTest
@@ -37,7 +36,6 @@ public class HazelcastEntityStoreWithCacheTest
super.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
new HazelcastEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jclouds/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/build.gradle b/extensions/entitystore-jclouds/build.gradle
index 5e29bf0..b66bdc3 100644
--- a/extensions/entitystore-jclouds/build.gradle
+++ b/extensions/entitystore-jclouds/build.gradle
@@ -35,7 +35,6 @@ dependencies {
runtime libraries.jaxb_api
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testCompile libraries.jclouds_filesystem
testRuntime libraries.logback
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java
index 21a2abb..794d5f2 100644
--- a/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java
+++ b/extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreMixin.java
@@ -186,7 +186,7 @@ public class JCloudsMapEntityStoreMixin
@Override
public void applyChanges( MapChanges changes )
- throws IOException
+ throws Exception
{
final BlobStore blobStore = storeContext.getBlobStore();
changes.visitMap(
@@ -212,12 +212,13 @@ public class JCloudsMapEntityStoreMixin
}
@Override
- public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer updateEntity( MapChange mapChange )
throws IOException
{
- if( !blobStore.blobExists( container, ref.identity().toString() ) )
+ String identity = mapChange.reference().identity().toString();
+ if( !blobStore.blobExists( container, identity ) )
{
- throw new EntityNotFoundException( ref );
+ throw new EntityNotFoundException( mapChange.reference() );
}
return new StringWriter()
{
@@ -226,9 +227,9 @@ public class JCloudsMapEntityStoreMixin
throws IOException
{
super.close();
- Blob blob = blobStore.blobBuilder( ref.identity().toString() )
- .payload( ByteSource.wrap( toString().getBytes( UTF_8 ) ) )
- .build();
+ Blob blob = blobStore.blobBuilder( identity )
+ .payload( ByteSource.wrap( toString().getBytes( UTF_8 ) ) )
+ .build();
blobStore.putBlob( container, blob );
}
};
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java
index fc0a16a..91abf14 100644
--- a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java
+++ b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsFilesystemTest.java
@@ -22,12 +22,10 @@ package org.apache.polygene.entitystore.jclouds;
import java.util.Collections;
import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.jclouds.assembly.JCloudsEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.jclouds.filesystem.reference.FilesystemConstants;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -40,12 +38,10 @@ public class JCloudsFilesystemTest
@Override
public void assemble( ModuleAssembly module )
- throws AssemblyException
{
super.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
JCloudsMapEntityStoreConfiguration defaults = config.forMixin( JCloudsMapEntityStoreConfiguration.class )
.declareDefaults();
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsTransientTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsTransientTest.java b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsTransientTest.java
index 62074a6..266c0e1 100644
--- a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsTransientTest.java
+++ b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsTransientTest.java
@@ -21,28 +21,22 @@
package org.apache.polygene.entitystore.jclouds;
import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.jclouds.assembly.JCloudsEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
public class JCloudsTransientTest
extends AbstractEntityStoreTest
{
-
@Override
public void assemble( ModuleAssembly module )
- throws AssemblyException
{
super.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
// START SNIPPET: assembly
new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
// END SNIPPET: assembly
}
-
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsWithCacheTest.java b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsWithCacheTest.java
index 3f18f58..72f89cf 100644
--- a/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsWithCacheTest.java
+++ b/extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsWithCacheTest.java
@@ -25,7 +25,6 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.jclouds.assembly.JCloudsEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
public class JCloudsWithCacheTest
extends AbstractEntityStoreWithCacheTest
@@ -37,7 +36,6 @@ public class JCloudsWithCacheTest
super.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jdbm/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/build.gradle b/extensions/entitystore-jdbm/build.gradle
index 60f68a5..61824ca 100644
--- a/extensions/entitystore-jdbm/build.gradle
+++ b/extensions/entitystore-jdbm/build.gradle
@@ -33,7 +33,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java
index ec1f703..312c002 100644
--- a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java
+++ b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java
@@ -140,7 +140,7 @@ public class JdbmEntityStoreMixin
changes.visitMap( new MapChanger()
{
@Override
- public Writer newEntity( final EntityReference ref, EntityDescriptor descriptor )
+ public Writer newEntity( EntityReference ref, EntityDescriptor descriptor )
throws IOException
{
return new StringWriter( 1000 )
@@ -160,7 +160,7 @@ public class JdbmEntityStoreMixin
}
@Override
- public Writer updateEntity( final EntityReference ref, EntityDescriptor descriptor )
+ public Writer updateEntity( MapChange mapChange )
throws IOException
{
return new StringWriter( 1000 )
@@ -171,7 +171,7 @@ public class JdbmEntityStoreMixin
{
super.close();
- Long stateIndex = getStateIndex( ref.identity() );
+ Long stateIndex = getStateIndex( mapChange.reference().identity() );
byte[] stateArray = toString().getBytes( "UTF-8" );
recordManager.update( stateIndex, stateArray, serializer );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java b/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java
index 2d1351b..bd3cef4 100644
--- a/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java
+++ b/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java
@@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -49,7 +48,6 @@ public class JdbmEntityStoreTest
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
.assemble( module );
- new OrgJsonValueSerializationAssembler().assemble( module );
new JdbmEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java b/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
index 0b633ea..b6bed70 100644
--- a/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
@@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -49,7 +48,6 @@ public class JdbmEntityStoreWithCacheTest
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
.assemble( module );
- new OrgJsonValueSerializationAssembler().assemble( module );
new JdbmEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-leveldb/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/build.gradle b/extensions/entitystore-leveldb/build.gradle
index 1da5d20..5d56b8c 100644
--- a/extensions/entitystore-leveldb/build.gradle
+++ b/extensions/entitystore-leveldb/build.gradle
@@ -35,7 +35,6 @@ dependencies {
runtime libraries.leveldb_jni_all
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java
index bcc9975..1db246e 100644
--- a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java
+++ b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java
@@ -234,7 +234,7 @@ public class LevelDBEntityStoreMixin
@Override
public void applyChanges( MapChanges changes )
- throws IOException
+ throws Exception
{
final WriteBatch writeBatch = db.createWriteBatch();
try
@@ -243,7 +243,7 @@ public class LevelDBEntityStoreMixin
{
@Override
- public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
throws IOException
{
return new StringWriter( 1000 )
@@ -262,7 +262,7 @@ public class LevelDBEntityStoreMixin
}
@Override
- public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer updateEntity( MapChange mapChange )
throws IOException
{
return new StringWriter( 1000 )
@@ -274,7 +274,8 @@ public class LevelDBEntityStoreMixin
{
super.close();
String jsonState = toString();
- writeBatch.put( ref.identity().toString().getBytes( charset ), jsonState.getBytes( charset ) );
+ writeBatch.put( mapChange.reference().identity().toString().getBytes( charset ),
+ jsonState.getBytes( charset ) );
}
};
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java
index 1b5ff6a..c5d4cdc 100644
--- a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java
+++ b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java
@@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -46,7 +45,6 @@ public class JavaLevelDBEntityStoreTest
super.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().visibleIn( Visibility.module ).assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java
index e0f14b2..819d930 100644
--- a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java
+++ b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java
@@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -45,7 +44,6 @@ public class JniLevelDBEntityStoreTest
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().visibleIn( Visibility.module ).assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java
index f512a14..9840501 100644
--- a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java
@@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -44,7 +43,6 @@ public class LevelDBEntityStoreWithCacheTest
super.assemble( module );
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().visibleIn( Visibility.module ).assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-memory/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-memory/build.gradle b/extensions/entitystore-memory/build.gradle
index 72b45e6..f57b11b 100644
--- a/extensions/entitystore-memory/build.gradle
+++ b/extensions/entitystore-memory/build.gradle
@@ -28,7 +28,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java b/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java
index ed74805..f36cca5 100644
--- a/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java
+++ b/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java
@@ -19,24 +19,19 @@
*/
package org.apache.polygene.entitystore.memory;
-import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
public class MemoryEntityStoreTest
extends AbstractEntityStoreTest
{
-
// START SNIPPET: assembly
@Override
public void assemble( ModuleAssembly module )
- throws AssemblyException
{
new MemoryEntityStoreAssembler().assemble( module );
// END SNIPPET: assembly
- new OrgJsonValueSerializationAssembler().assemble( module );
super.assemble( module );
// START SNIPPET: assembly
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java b/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java
index c3ccaff..28dc102 100644
--- a/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java
@@ -23,7 +23,6 @@ import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
public class MemoryEntityStoreWithCacheTest
extends AbstractEntityStoreWithCacheTest
@@ -33,7 +32,6 @@ public class MemoryEntityStoreWithCacheTest
throws AssemblyException
{
super.assemble( module );
- new OrgJsonValueSerializationAssembler().assemble( module );
new MemoryEntityStoreAssembler().assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-mongodb/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/build.gradle b/extensions/entitystore-mongodb/build.gradle
index 425485d..81a122f 100644
--- a/extensions/entitystore-mongodb/build.gradle
+++ b/extensions/entitystore-mongodb/build.gradle
@@ -32,7 +32,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testCompile libraries.embed_mongo
testRuntime libraries.logback
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java
index bda729c..106325d 100644
--- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java
+++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java
@@ -222,14 +222,14 @@ public class MongoMapEntityStoreMixin
@Override
public void applyChanges( MapChanges changes )
- throws IOException
+ throws Exception
{
final MongoCollection<Document> entities = db.getCollection( collectionName );
changes.visitMap( new MapChanger()
{
@Override
- public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
throws IOException
{
return new StringWriter( 1000 )
@@ -249,7 +249,7 @@ public class MongoMapEntityStoreMixin
}
@Override
- public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer updateEntity( MapChange mapChange )
throws IOException
{
return new StringWriter( 1000 )
@@ -261,9 +261,9 @@ public class MongoMapEntityStoreMixin
super.close();
Document bsonState = Document.parse( toString() );
Document entity = new Document();
- entity.put( IDENTITY_COLUMN, ref.identity().toString() );
+ entity.put( IDENTITY_COLUMN, mapChange.reference().identity().toString() );
entity.put( STATE_COLUMN, bsonState );
- entities.replaceOne( byIdentity( ref ), entity );
+ entities.replaceOne( byIdentity( mapChange.reference() ), entity );
}
};
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java
index f0188e4..b364264 100644
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java
@@ -31,7 +31,6 @@ import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssemb
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
import org.apache.polygene.test.util.FreePortFinder;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
@@ -76,8 +75,6 @@ public class EmbedMongoMapEntityStoreTest extends AbstractEntityStoreTest
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
-
new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java
index f893aff..aa9b9e3 100644
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java
@@ -20,14 +20,13 @@
package org.apache.polygene.entitystore.mongodb;
import com.mongodb.Mongo;
-import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
-import org.junit.BeforeClass;
import org.apache.polygene.api.common.Visibility;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.BeforeClass;
import static org.apache.polygene.test.util.Assume.assumeConnectivity;
@@ -55,8 +54,6 @@ public class MongoMapEntityStoreTest
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
-
// START SNIPPET: assembly
new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
// END SNIPPET: assembly
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
index de356f1..cad95ea 100644
--- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
@@ -20,14 +20,13 @@
package org.apache.polygene.entitystore.mongodb;
import com.mongodb.Mongo;
-import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
-import org.junit.BeforeClass;
import org.apache.polygene.api.common.Visibility;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.BeforeClass;
import static org.apache.polygene.test.util.Assume.assumeConnectivity;
@@ -53,8 +52,6 @@ public class MongoMapEntityStoreWithCacheTest
ModuleAssembly config = module.layer().module( "config" );
new EntityTestAssembler().assemble( config );
- new OrgJsonValueSerializationAssembler().assemble( module );
-
new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
MongoEntityStoreConfiguration mongoConfig = config.forMixin( MongoEntityStoreConfiguration.class ).declareDefaults();
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-preferences/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/build.gradle b/extensions/entitystore-preferences/build.gradle
index f1e418f..c364b08 100644
--- a/extensions/entitystore-preferences/build.gradle
+++ b/extensions/entitystore-preferences/build.gradle
@@ -31,7 +31,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.core.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java
index 72f4298..5370854 100644
--- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java
@@ -43,7 +43,8 @@ import org.apache.polygene.api.injection.scope.Uses;
import org.apache.polygene.api.property.PropertyDescriptor;
import org.apache.polygene.api.service.ServiceActivation;
import org.apache.polygene.api.service.ServiceDescriptor;
-import org.apache.polygene.api.service.qualifier.Tagged;
+import org.apache.polygene.api.serialization.Serialization;
+import org.apache.polygene.api.serialization.SerializationException;
import org.apache.polygene.api.structure.Application;
import org.apache.polygene.api.structure.ModuleDescriptor;
import org.apache.polygene.api.time.SystemTime;
@@ -56,8 +57,6 @@ import org.apache.polygene.api.unitofwork.NoSuchEntityException;
import org.apache.polygene.api.unitofwork.NoSuchEntityTypeException;
import org.apache.polygene.api.usecase.Usecase;
import org.apache.polygene.api.usecase.UsecaseBuilder;
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.api.value.ValueSerializationException;
import org.apache.polygene.spi.PolygeneSPI;
import org.apache.polygene.spi.entity.EntityState;
import org.apache.polygene.spi.entity.EntityStatus;
@@ -80,7 +79,7 @@ import org.slf4j.LoggerFactory;
* (one reference per line), and NamedAssociations are stored as multi-line strings (one name on a line, reference on the
* next line).
* </p>
- * <p>Nested ValuesComposites, Collections and Maps are stored using available ValueSerialization service.</p>
+ * <p>Nested ValuesComposites, Collections and Maps are stored using available StateSerialization service.</p>
*/
public class PreferencesEntityStoreMixin
implements ServiceActivation, EntityStore, EntityStoreSPI
@@ -98,8 +97,7 @@ public class PreferencesEntityStoreMixin
private Application application;
@Service
- @Tagged( ValueSerialization.Formats.JSON )
- private ValueSerialization valueSerialization;
+ private Serialization serialization;
private Preferences root;
@@ -263,16 +261,16 @@ public class PreferencesEntityStoreMixin
else
{
// Load as string even though it's a number
- String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName()
- .name(), null );
+ String string = propsPrefs.get( persistentPropertyDescriptor.qualifiedName()
+ .name(), null );
Object value;
- if( json == null )
+ if( string == null )
{
value = null;
}
else
{
- value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json );
+ value = serialization.deserialize( module, propertyType, string );
}
properties.put( persistentPropertyDescriptor.qualifiedName(), value );
}
@@ -289,27 +287,27 @@ public class PreferencesEntityStoreMixin
|| propertyType instanceof CollectionType
|| propertyType instanceof EnumType )
{
- String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null );
+ String string = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null );
Object value;
- if( json == null )
+ if( string == null )
{
value = null;
}
else
{
- value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json );
+ value = serialization.deserialize( module, propertyType, string );
}
properties.put( persistentPropertyDescriptor.qualifiedName(), value );
}
else
{
- String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null );
- if( json == null )
+ String string = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null );
+ if( string == null )
{
if( persistentPropertyDescriptor.initialValue( module ) != null )
{
- properties.put( persistentPropertyDescriptor.qualifiedName(), persistentPropertyDescriptor
- .initialValue( module ) );
+ properties.put( persistentPropertyDescriptor.qualifiedName(),
+ persistentPropertyDescriptor.initialValue( module ) );
}
else
{
@@ -318,7 +316,7 @@ public class PreferencesEntityStoreMixin
}
else
{
- Object value = valueSerialization.deserialize( module, propertyType, json );
+ Object value = serialization.deserialize( module, propertyType, string );
properties.put( persistentPropertyDescriptor.qualifiedName(), value );
}
}
@@ -402,7 +400,7 @@ public class PreferencesEntityStoreMixin
namedAssociations
);
}
- catch( ValueSerializationException | BackingStoreException e )
+ catch( SerializationException | BackingStoreException e )
{
throw new EntityStoreException( e );
}
@@ -528,8 +526,8 @@ public class PreferencesEntityStoreMixin
else
{
// Store as string even though it's a number
- String jsonString = valueSerialization.serialize( value );
- propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
+ String string = serialization.serialize( value );
+ propsPrefs.put( persistentProperty.qualifiedName().name(), string );
}
}
else if( primaryType.equals( Boolean.class ) )
@@ -542,13 +540,13 @@ public class PreferencesEntityStoreMixin
|| valueType instanceof CollectionType
|| valueType instanceof EnumType )
{
- String jsonString = valueSerialization.serialize( value );
- propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
+ String string = serialization.serialize( value );
+ propsPrefs.put( persistentProperty.qualifiedName().name(), string );
}
else
{
- String jsonString = valueSerialization.serialize( value );
- propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
+ String string = serialization.serialize( value );
+ propsPrefs.put( persistentProperty.qualifiedName().name(), string );
}
}
} );
@@ -616,7 +614,7 @@ public class PreferencesEntityStoreMixin
}
}
}
- catch( ValueSerializationException e )
+ catch( SerializationException e )
{
throw new EntityStoreException( "Could not store EntityState", e );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java
index f2cf4e4..8e0c60b 100644
--- a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java
+++ b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java
@@ -25,7 +25,6 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreInfo;
import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreService;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -51,6 +50,5 @@ public class PreferencesEntityStoreTest
PreferencesEntityStoreInfo metaInfo = new PreferencesEntityStoreInfo( node );
Thread.currentThread().setContextClassLoader( cl );
module.services( PreferencesEntityStoreService.class ).setMetaInfo( metaInfo ).instantiateOnStartup();
- new OrgJsonValueSerializationAssembler().assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-redis/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/build.gradle b/extensions/entitystore-redis/build.gradle
index 2bd25af..823eb68 100644
--- a/extensions/entitystore-redis/build.gradle
+++ b/extensions/entitystore-redis/build.gradle
@@ -32,7 +32,6 @@ dependencies {
runtime polygene.core.runtime
testCompile polygene.internals.testsupport
- testCompile polygene.extension( 'valueserialization-orgjson' )
testRuntime libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e4cca11e/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java
index c080082..0fcb2c5 100644
--- a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java
+++ b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java
@@ -98,14 +98,14 @@ public class RedisMapEntityStoreMixin
@Override
public void applyChanges( MapChanges changes )
- throws IOException
+ throws Exception
{
try( Jedis jedis = pool.getResource() )
{
changes.visitMap( new MapChanger()
{
@Override
- public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor )
throws IOException
{
return new StringWriter( 1000 )
@@ -125,7 +125,7 @@ public class RedisMapEntityStoreMixin
}
@Override
- public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
+ public Writer updateEntity( MapChange mapChange )
throws IOException
{
return new StringWriter( 1000 )
@@ -135,10 +135,12 @@ public class RedisMapEntityStoreMixin
throws IOException
{
super.close();
- String statusCode = jedis.set( ref.identity().toString(), toString(), "XX" );
+ String statusCode = jedis.set( mapChange.reference().identity().toString(),
+ toString(),
+ "XX" );
if( !"OK".equals( statusCode ) )
{
- throw new EntityNotFoundException( ref );
+ throw new EntityNotFoundException( mapChange.reference() );
}
}
};