Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8DAC4200CC1 for ; Mon, 10 Jul 2017 08:53:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8C2E5167244; Mon, 10 Jul 2017 06:53:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BA1A3167185 for ; Mon, 10 Jul 2017 08:53:07 +0200 (CEST) Received: (qmail 82310 invoked by uid 500); 10 Jul 2017 06:53:06 -0000 Mailing-List: contact commits-help@polygene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@polygene.apache.org Delivered-To: mailing list commits@polygene.apache.org Received: (qmail 81713 invoked by uid 99); 10 Jul 2017 06:53:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jul 2017 06:53:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id F22F6F5527; Mon, 10 Jul 2017 06:53:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: niclas@apache.org To: commits@polygene.apache.org Date: Mon, 10 Jul 2017 06:53:13 -0000 Message-Id: <13dbde87d37d44079ce9ff72f0329e2d@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [11/50] polygene-java git commit: POLYGENE-260 - Fixed the "duplicate should be allowed" for ManyAssociations. POLYGENE-261 - Documentation of "No order is defined" for NamedAssociation Changed StringIdentity creation to use static factory method, and ch archived-at: Mon, 10 Jul 2017 06:53:10 -0000 POLYGENE-260 - Fixed the "duplicate should be allowed" for ManyAssociations. POLYGENE-261 - Documentation of "No order is defined" for NamedAssociation Changed StringIdentity creation to use static factory method, and changing the name from "fromString" to "identityOf" Signed-off-by: niclas Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/0d9e8a1b Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/0d9e8a1b Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/0d9e8a1b Branch: refs/heads/es-jooq Commit: 0d9e8a1b462790d23af235a43b374c58787fdf0b Parents: 55ddd14 Author: niclas Authored: Thu Jun 15 18:42:50 2017 +0800 Committer: niclas Committed: Thu Jun 15 18:42:50 2017 +0800 ---------------------------------------------------------------------- .../api/association/ManyAssociation.java | 5 + .../api/association/NamedAssociation.java | 13 +- .../polygene/api/entity/EntityReference.java | 2 +- .../polygene/api/identity/StringIdentity.java | 2 +- .../api/identity/UuidGeneratorMixin.java | 2 +- .../org/apache/polygene/api/OperatorsTest.java | 2 +- .../polygene/api/type/ValueTypeFactoryTest.java | 2 +- .../polygene/api/unitofwork/RemovalTest.java | 2 +- .../api/unitofwork/ToEntityConversionTest.java | 2 +- .../api/unitofwork/ToValueConversionTest.java | 12 +- .../bootstrap/ImportedServiceAssemblyImpl.java | 6 +- .../runtime/bootstrap/ModuleAssemblyImpl.java | 4 +- .../bootstrap/ServiceDeclarationImpl.java | 2 +- .../runtime/unitofwork/ModuleUnitOfWork.java | 2 +- .../apache/polygene/api/common/RemovalTest.java | 2 +- .../qi377/SetAssociationInSideEffectTest.java | 4 +- ...alueCollisionWithRelatedReturnTypesTest.java | 2 +- .../polygene/regression/qi382/Qi382Test.java | 4 +- .../polygene/regression/qi383/Qi383Test.java | 6 +- .../ImportedServiceActivationTest.java | 2 +- .../polygene/runtime/entity/EntityTypeTest.java | 6 +- .../runtime/entity/EntityVisibilityTest.java | 2 +- .../runtime/injection/ServiceInjectionTest.java | 2 +- .../injection/UnitOfWorkInjectionTest.java | 2 +- .../runtime/mixin/AssemblyMixinTest.java | 4 +- .../runtime/mixin/AssemblyRoleTest.java | 4 +- .../polygene/runtime/mixin/JDKMixinTest.java | 4 +- .../runtime/objects/ObjectVisibilityTest.java | 2 +- .../runtime/query/IterableQuerySourceTest.java | 2 +- .../apache/polygene/runtime/query/Network.java | 4 +- .../runtime/service/ServiceVisibilityTest.java | 2 +- .../transients/TransientVisibilityTest.java | 2 +- .../unitofwork/PrivateEntityUnitOfWorkTest.java | 2 +- .../runtime/unitofwork/RemovalTest.java | 2 +- .../runtime/value/AssociationToValueTest.java | 4 +- .../value/ValueSerializationRegressionTest.java | 2 +- .../runtime/value/ValueVisibilityTest.java | 2 +- .../runtime/value/ValueWithAssociationTest.java | 6 +- .../visibility/VisibilityInUnitOfWorkTest.java | 4 +- .../importer/ServiceInstanceImporterTest.java | 2 +- .../helpers/DefaultNamedAssociationState.java | 6 +- .../helpers/JSONMapEntityStoreMixin.java | 2 +- .../helpers/MapEntityStoreMixin.java | 2 +- .../spi/serialization/BuiltInConverters.java | 2 +- .../spi/entitystore/Polygene142Test.java | 2 +- .../test/entity/model/EntityStoreTestSuite.java | 20 ++- .../test/entity/model/legal/LegalService.java | 2 +- .../entity/model/people/PeopleRepository.java | 10 +- .../test/indexing/AbstractQueryTest.java | 6 +- .../apache/polygene/test/indexing/TestData.java | 8 +- .../metrics/AbstractPolygeneMetricsTest.java | 4 +- ...AbstractValueCompositeSerializationTest.java | 8 +- .../cassandra/CassandraEntityStoreMixin.java | 2 +- .../CassandraEntityStoreTestSuite.java | 80 ++++++++++++ .../file/FileEntityStoreTestSuite.java | 50 ++++++++ .../geode/GeodeEntityStoreTestSuite.java | 38 ++++++ .../HazelcastEntityStoreTestSuite.java | 48 ++++++++ .../jclouds/JCloudsFilesystemTestSuite.java | 52 ++++++++ .../entitystore/jclouds/JCloudsS3TestSuite.java | 53 ++++++++ .../jclouds/JCloudsTransientTestSuite.java | 39 ++++++ .../jdbm/JdbmEntityStoreTestSuite.java | 8 -- .../JavaLevelDBEntityStoreTestSuite.java | 52 ++++++++ .../leveldb/JniLevelDBEntityStoreTest.java | 21 ++-- .../memory/MemoryEntityStoreTestSuite.java | 37 ++++++ .../EmbedMongoDBMapEntityStoreTestSuite.java | 84 +++++++++++++ .../mongodb/MongoDBEntityStoreTestSuite.java | 77 ++++++++++++ .../PreferencesEntityStoreAssembler.java | 9 +- .../PreferencesEntityStoreTestSuite.java | 56 +++++++++ .../redis/RedisEntityStoreTestSuite.java | 74 +++++++++++ .../riak/RiakEntityStoreTestSuite.java | 70 +++++++++++ .../AbstractSQLEntityStoreAssembler.java | 2 +- .../sql/DerbySQLEntityStoreTestSuite.java | 94 ++++++++++++++ .../sql/H2SQLEntityStoreTestSuite.java | 56 +++++++++ .../sql/MySQLEntityStoreTestSuite.java | 122 +++++++++++++++++++ .../sql/PostgreSQLEntityStoreTest.java | 34 ------ .../sql/PostgreSQLEntityStoreTestSuite.java | 111 +++++++++++++++++ .../sql/SQLiteEntityStoreTestSuite.java | 65 ++++++++++ .../polygene/index/rdf/RDFPerformanceTest.java | 4 +- .../AbstractSQLIndexQueryAssembler.java | 2 +- .../polygene/library/alarm/AlarmSystem.java | 2 +- .../polygene/library/alarm/AlarmProxyTest.java | 4 +- .../jmx/ConfigurationManagerService.java | 2 +- .../rdf/entity/EntitySerializerTest.java | 4 +- .../rdf/entity/EntityTypeSerializerTest.java | 4 +- .../server/restlet/RequestReaderDelegator.java | 2 +- .../server/restlet/ResponseWriterDelegator.java | 2 +- .../requestreader/DefaultRequestReader.java | 4 +- .../library/rest/admin/EntityResource.java | 3 +- .../library/rest/admin/DummyDataService.java | 6 +- .../polygene/library/rest/admin/RestTest.java | 8 +- .../library/restlet/crud/EntityResource.java | 4 +- .../restlet/identity/IdentityManager.java | 4 +- .../restlet/resource/EntryPointResource.java | 6 +- .../restlet/resource/ResourceBuilder.java | 2 +- .../sql/assembly/DataSourceAssembler.java | 2 +- .../assembly/ExternalDataSourceAssembler.java | 2 +- .../DataSourceConfigurationManagerService.java | 2 +- .../moneytransfer/context/PayBillsContext.java | 4 +- .../moneytransfer/context/PayBillsContext2.java | 4 +- .../dci/moneytransfer/test/AccountIds.java | 8 +- .../sample/forum/data/entity/Forums.java | 2 +- .../sample/forum/data/entity/Users.java | 2 +- .../rest/resource/forum/BoardResource.java | 2 +- .../rest/resource/forum/ForumResource.java | 2 +- .../rest/resource/forum/ForumsResource.java | 2 +- .../sample/rental/domain/dev/InitialData.java | 2 +- .../polygene/sample/rental/web/BookingPage.java | 4 +- .../polygene/sample/rental/web/MainPage.java | 2 +- .../AbstractEntityStorePerformanceTest.java | 4 +- .../initialdata/SamplePersonInitialData.java | 2 +- .../polygene/tutorials/hello/HelloTest4.java | 2 +- 111 files changed, 1436 insertions(+), 219 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java index 2471b94..98f7fcf 100644 --- a/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java +++ b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java @@ -28,6 +28,11 @@ import org.apache.polygene.api.identity.Identity; /** * Association to a collection of entities. + * + *

+ * Duplication of entities (defined as Identity equality) is allowed and for each add, there will be + * an additional item in the collection/iterator. If de-duplication is requested, see {@link #toSet()} method. + *

*/ public interface ManyAssociation extends Iterable, AbstractAssociation { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java index b8a62da..8597ba0 100644 --- a/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java +++ b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java @@ -24,8 +24,15 @@ import java.util.stream.Stream; import org.apache.polygene.api.entity.EntityReference; /** - * Association to named Entities. - * The Iterable<String> returns the names in the association set. + * Named Association to Entities. + *

+ * This works similar to a Map with a String key. + *

+ *

+ * The Iterable<String> returns the names in the association set. The order during iteration is random by + * definition, even if other behaviors can possibly be observed. The depends on the underlying entity store + * implementation. + *

* @param Parameterized associatee type */ public interface NamedAssociation @@ -47,7 +54,7 @@ public interface NamedAssociation * Adds a named association. * @param name The name of the association. * @param entity The entity for this named association. - * @return true if putted, false otherwise + * @return true if value has been updated to a new value. */ boolean put( String name, T entity ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java b/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java index 68e2232..c2a7327 100644 --- a/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java +++ b/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java @@ -41,7 +41,7 @@ public final class EntityReference public static EntityReference parseEntityReference(String identityString) { Objects.requireNonNull( identityString, "identityString must not be null" ); - return new EntityReference( StringIdentity.identity( identityString ) ); + return new EntityReference( StringIdentity.identityOf( identityString ) ); } /** http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java b/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java index 3eba611..faacf25 100644 --- a/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java +++ b/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java @@ -55,7 +55,7 @@ public class StringIdentity return value; } - public static Identity identity( String serializedState ) + public static Identity identityOf( String serializedState ) { return new StringIdentity( serializedState ); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java b/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java index 6f85ca7..6e71bac 100644 --- a/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java +++ b/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java @@ -27,6 +27,6 @@ public class UuidGeneratorMixin @Override public Identity generate(Class compositeType) { - return StringIdentity.identity( UUID.randomUUID().toString() ); + return StringIdentity.identityOf( UUID.randomUUID().toString() ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java b/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java index f018907..9f3be8e 100644 --- a/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java +++ b/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java @@ -63,7 +63,7 @@ public class OperatorsTest try { - EntityBuilder entityBuilder = uow.newEntityBuilder( TestEntity.class, StringIdentity.identity( "123" ) ); + EntityBuilder entityBuilder = uow.newEntityBuilder( TestEntity.class, StringIdentity.identityOf( "123" ) ); entityBuilder.instance().value().set( assembler.module().newValue( TestValue.class ) ); TestEntity testEntity = entityBuilder.newInstance(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/test/java/org/apache/polygene/api/type/ValueTypeFactoryTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/polygene/api/type/ValueTypeFactoryTest.java b/core/api/src/test/java/org/apache/polygene/api/type/ValueTypeFactoryTest.java index 48ac6a5..95d328a 100644 --- a/core/api/src/test/java/org/apache/polygene/api/type/ValueTypeFactoryTest.java +++ b/core/api/src/test/java/org/apache/polygene/api/type/ValueTypeFactoryTest.java @@ -125,7 +125,7 @@ public class ValueTypeFactoryTest extends AbstractPolygeneTest try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork() ) { assertThat( - valueTypeFactory.valueTypeOf( module, uow.newEntity( SomeState.class, StringIdentity.identity( "abc" ) ) ), + valueTypeFactory.valueTypeOf( module, uow.newEntity( SomeState.class, StringIdentity.identityOf( "abc" ) ) ), instanceOf( EntityCompositeType.class ) ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java b/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java index f3a01d9..c401167 100644 --- a/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java +++ b/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java @@ -49,7 +49,7 @@ public class RemovalTest UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); try { - EntityBuilder builder = uow.newEntityBuilder( TestEntity.class, StringIdentity.identity( "123" ) ); + EntityBuilder builder = uow.newEntityBuilder( TestEntity.class, StringIdentity.identityOf( "123" ) ); builder.instance().test().set( "habba" ); TestEntity test = builder.newInstance(); uow.remove( test ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToEntityConversionTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToEntityConversionTest.java b/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToEntityConversionTest.java index 86ac547..52d4901 100644 --- a/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToEntityConversionTest.java +++ b/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToEntityConversionTest.java @@ -65,7 +65,7 @@ public class ToEntityConversionTest public void testPropertyConversionToEntity() throws Exception { - Identity identity = StringIdentity.identity( "Niclas" ); + Identity identity = StringIdentity.identityOf( "Niclas" ); ValueBuilder vb = valueBuilderFactory.newValueBuilder( SomeType.class ); SomeType prototype = vb.prototype(); prototype.identity().set( identity ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToValueConversionTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToValueConversionTest.java b/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToValueConversionTest.java index 910cf72..3b768bb 100644 --- a/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToValueConversionTest.java +++ b/core/api/src/test/java/org/apache/polygene/api/unitofwork/ToValueConversionTest.java @@ -73,11 +73,11 @@ public class ToValueConversionTest SomeType value; try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(usecase) ) { - SomeType entity1 = createEntity( uow, StringIdentity.identity( "Niclas" ) ); - SomeType entity2 = createEntity( uow, StringIdentity.identity( "Paul" ) ); - SomeType entity3 = createEntity( uow, StringIdentity.identity( "Jiri" ) ); - SomeType entity4 = createEntity( uow, StringIdentity.identity( "Kent" ) ); - SomeType entity5 = createEntity( uow, StringIdentity.identity( "Stan" ) ); + SomeType entity1 = createEntity( uow, StringIdentity.identityOf( "Niclas" ) ); + SomeType entity2 = createEntity( uow, StringIdentity.identityOf( "Paul" ) ); + SomeType entity3 = createEntity( uow, StringIdentity.identityOf( "Jiri" ) ); + SomeType entity4 = createEntity( uow, StringIdentity.identityOf( "Kent" ) ); + SomeType entity5 = createEntity( uow, StringIdentity.identityOf( "Stan" ) ); entity1.assoc().set( entity2 ); entity1.many().add( entity3 ); entity1.named().put( "kent", entity4 ); @@ -89,7 +89,7 @@ public class ToValueConversionTest } try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(usecase) ) { - assertThat( value.identity().get(), equalTo( StringIdentity.identity( "Niclas" ) ) ); + assertThat( value.identity().get(), equalTo( StringIdentity.identityOf( "Niclas" ) ) ); assertThat( value.name().get(), equalTo( "[Niclas]" ) ); assertThat( uow.toValue( SomeType.class, value.assoc().get()).name().get(), equalTo( "[Paul]" )); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java index 614df0b..8319f32 100644 --- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java +++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java @@ -78,7 +78,7 @@ public final class ImportedServiceAssemblyImpl } else { - id = StringIdentity.identity( identity ); + id = StringIdentity.identityOf( identity ); } ImportedServiceModel serviceModel = new ImportedServiceModel( module, @@ -103,7 +103,7 @@ public final class ImportedServiceAssemblyImpl { // Find reference that is not yet used int idx = 0; - Identity id = StringIdentity.identity( serviceType.getSimpleName() ); + Identity id = StringIdentity.identityOf( serviceType.getSimpleName() ); boolean invalid; do { @@ -113,7 +113,7 @@ public final class ImportedServiceAssemblyImpl if( serviceModel.identity().equals( id ) ) { idx++; - id = StringIdentity.identity( serviceType.getSimpleName() + "_" + idx ); + id = StringIdentity.identityOf( serviceType.getSimpleName() + "_" + idx ); invalid = true; break; } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java index 225857d..5c30117 100644 --- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java +++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java @@ -708,7 +708,7 @@ final class ModuleAssemblyImpl Class serviceType = serviceTypes.findFirst() .orElse(null); // Use the first, which *SHOULD* be the main serviceType int idx = 0; - Identity id = StringIdentity.identity( serviceType.getSimpleName() ); + Identity id = StringIdentity.identityOf( serviceType.getSimpleName() ); boolean invalid; do { @@ -718,7 +718,7 @@ final class ModuleAssemblyImpl if (serviceAssembly.identity() != null && serviceAssembly.identity().equals(id)) { idx++; - id = StringIdentity.identity( serviceType.getSimpleName() + "_" + idx ); + id = StringIdentity.identityOf( serviceType.getSimpleName() + "_" + idx ); invalid = true; break; } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java index 92db867..beb3480 100644 --- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java +++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java @@ -59,7 +59,7 @@ public final class ServiceDeclarationImpl for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies ) { if( identity != null ) { - serviceAssembly.identity = StringIdentity.identity( identity ); + serviceAssembly.identity = StringIdentity.identityOf( identity ); } } return this; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java index 071d2c3..a863364 100644 --- a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java +++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java @@ -264,7 +264,7 @@ public class ModuleUnitOfWork } else { - identity = StringIdentity.identity( propertyState ); + identity = StringIdentity.identityOf( propertyState ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/api/common/RemovalTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/api/common/RemovalTest.java b/core/runtime/src/test/java/org/apache/polygene/api/common/RemovalTest.java index 6c514c9..b58c6c9 100644 --- a/core/runtime/src/test/java/org/apache/polygene/api/common/RemovalTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/api/common/RemovalTest.java @@ -48,7 +48,7 @@ public class RemovalTest throws Exception { UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - EntityBuilder builder = uow.newEntityBuilder( TestEntity.class, StringIdentity.identity( "123" ) ); + EntityBuilder builder = uow.newEntityBuilder( TestEntity.class, StringIdentity.identityOf( "123" ) ); builder.instance().test().set( "habba" ); TestEntity test = builder.newInstance(); uow.remove( test ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/regression/qi377/SetAssociationInSideEffectTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi377/SetAssociationInSideEffectTest.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi377/SetAssociationInSideEffectTest.java index 84b6aed..1a73631 100644 --- a/core/runtime/src/test/java/org/apache/polygene/regression/qi377/SetAssociationInSideEffectTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi377/SetAssociationInSideEffectTest.java @@ -61,8 +61,8 @@ public class SetAssociationInSideEffectTest { try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Purchase Steinway" ) ) ) { - Pianist chris = uow.newEntity( Pianist.class, StringIdentity.identity( "Chris" ) ); - Steinway modelD = uow.newEntity( Steinway.class, StringIdentity.identity( "ModelD-274" ) ); + Pianist chris = uow.newEntity( Pianist.class, StringIdentity.identityOf( "Chris" ) ); + Steinway modelD = uow.newEntity( Steinway.class, StringIdentity.identityOf( "ModelD-274" ) ); assertThat( modelD.owner().get(), is( nullValue() ) ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java index 45e8658..6b6bb0a 100644 --- a/core/runtime/src/test/java/org/apache/polygene/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java @@ -36,7 +36,7 @@ public class ValueCollisionWithRelatedReturnTypesTest extends AbstractPolygeneTest { - public static final Identity NICLAS = StringIdentity.identity( "niclas" ); + public static final Identity NICLAS = StringIdentity.identityOf( "niclas" ); @Override public void assemble( ModuleAssembly module ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/regression/qi382/Qi382Test.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi382/Qi382Test.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi382/Qi382Test.java index 140fd9d..d645308 100644 --- a/core/runtime/src/test/java/org/apache/polygene/regression/qi382/Qi382Test.java +++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi382/Qi382Test.java @@ -44,8 +44,8 @@ import static org.junit.Assert.assertThat; public class Qi382Test extends AbstractPolygeneTest { - public static final Identity FERRARI = StringIdentity.identity( "Ferrari" ); - public static final Identity NICLAS = StringIdentity.identity( "Niclas" ); + public static final Identity FERRARI = StringIdentity.identityOf( "Ferrari" ); + public static final Identity NICLAS = StringIdentity.identityOf( "Niclas" ); @Override public void assemble( ModuleAssembly module ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java index 96f0cad..efa6bc0 100644 --- a/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java +++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java @@ -47,9 +47,9 @@ public class Qi383Test extends AbstractPolygeneTest { try( UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork() ) { - unitOfWork.newEntity( Car.class, StringIdentity.identity( "Ferrari" ) ); - unitOfWork.newEntity( Car.class, StringIdentity.identity( "Ford" ) ); - unitOfWork.newEntity( Car.class, StringIdentity.identity( "Ferrari" ) ); + unitOfWork.newEntity( Car.class, StringIdentity.identityOf( "Ferrari" ) ); + unitOfWork.newEntity( Car.class, StringIdentity.identityOf( "Ford" ) ); + unitOfWork.newEntity( Car.class, StringIdentity.identityOf( "Ferrari" ) ); unitOfWork.complete(); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java index 07674f0..c13d019 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java @@ -179,7 +179,7 @@ public class ImportedServiceActivationTest module -> { module.importedServices( TestedService.class ). importedBy( ImportedServiceDeclaration.SERVICE_IMPORTER ). - setMetaInfo( StringIdentity.identity( "testimporter" ) ). + setMetaInfo( StringIdentity.identityOf( "testimporter" ) ). withActivators( TestedActivator.class ). importOnStartup(); module.services( TestedServiceImporterService.class ).identifiedBy( "testimporter" ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java index 1c63573..d814e50 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java @@ -40,9 +40,9 @@ public class EntityTypeTest UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); try { - EntityBuilder builder3 = uow.newEntityBuilder( Rst.class, StringIdentity.identity( "123" ) ); - EntityBuilder builder2 = uow.newEntityBuilder( Def.class, StringIdentity.identity( "456" ) ); - EntityBuilder builder1 = uow.newEntityBuilder( Abc.class, StringIdentity.identity( "789" ) ); + EntityBuilder builder3 = uow.newEntityBuilder( Rst.class, StringIdentity.identityOf( "123" ) ); + EntityBuilder builder2 = uow.newEntityBuilder( Def.class, StringIdentity.identityOf( "456" ) ); + EntityBuilder builder1 = uow.newEntityBuilder( Abc.class, StringIdentity.identityOf( "789" ) ); } finally { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java index 519d2a7..d1d510b 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java @@ -47,7 +47,7 @@ import org.junit.Test; public class EntityVisibilityTest { - public static final Identity TEST_IDENTITY = StringIdentity.identity( "123" ); + public static final Identity TEST_IDENTITY = StringIdentity.identityOf( "123" ); private Energy4Java polygene; private Module module; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java index 637a141..c9cdd4e 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java @@ -82,7 +82,7 @@ public class ServiceInjectionTest ServiceUser user = factory.newObject( ServiceUser.class ); assertEquals( "X", user.testSingle() ); - assertThat( user.testIdentity(), equalTo( StringIdentity.identity( "Foo" ) ) ); + assertThat( user.testIdentity(), equalTo( StringIdentity.identityOf( "Foo" ) ) ); assertEquals( "FooX", user.testServiceReference() ); assertEquals( "Bar", user.testQualifier() ); assertEquals( "A", user.testStringIterable() ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UnitOfWorkInjectionTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UnitOfWorkInjectionTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UnitOfWorkInjectionTest.java index cd61437..4dd7111 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UnitOfWorkInjectionTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UnitOfWorkInjectionTest.java @@ -53,7 +53,7 @@ public class UnitOfWorkInjectionTest UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( usecase ); try { - Trial trial = uow.newEntity( Trial.class, StringIdentity.identity( "123" ) ); + Trial trial = uow.newEntity( Trial.class, StringIdentity.identityOf( "123" ) ); trial.doSomething(); uow.complete(); uow = unitOfWorkFactory.newUnitOfWork( usecase ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java index 2b3b6af..9e67af3 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java @@ -62,11 +62,11 @@ public class AssemblyMixinTest throws UnitOfWorkCompletionException { UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - FooEntity entity = uow.newEntity( FooEntity.class, StringIdentity.identity( "123" ) ); + FooEntity entity = uow.newEntity( FooEntity.class, StringIdentity.identityOf( "123" ) ); uow.complete(); uow = unitOfWorkFactory.newUnitOfWork(); - Foo foo = uow.get( Foo.class, StringIdentity.identity( "123" ) ); + Foo foo = uow.get( Foo.class, StringIdentity.identityOf( "123" ) ); try { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyRoleTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyRoleTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyRoleTest.java index f051aec..ca15bc4 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyRoleTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyRoleTest.java @@ -71,11 +71,11 @@ public class AssemblyRoleTest throws UnitOfWorkCompletionException { UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - uow.newEntity( FooEntity.class, StringIdentity.identity( "123" ) ); + uow.newEntity( FooEntity.class, StringIdentity.identityOf( "123" ) ); uow.complete(); uow = unitOfWorkFactory.newUnitOfWork(); - Foo foo = uow.get( Foo.class, StringIdentity.identity( "123" ) ); + Foo foo = uow.get( Foo.class, StringIdentity.identityOf( "123" ) ); try { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/JDKMixinTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/JDKMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/JDKMixinTest.java index 831babd..47e1203 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/JDKMixinTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/JDKMixinTest.java @@ -98,8 +98,8 @@ public class JDKMixinTest extends AbstractPolygeneTest } } - private static final Identity EXTENDS_IDENTITY = StringIdentity.identity( ExtendsJDKMixin.class.getName() ); - private static final Identity COMPOSE_IDENTITY = StringIdentity.identity( ComposeWithJDKMixin.class.getName() ); + private static final Identity EXTENDS_IDENTITY = StringIdentity.identityOf( ExtendsJDKMixin.class.getName() ); + private static final Identity COMPOSE_IDENTITY = StringIdentity.identityOf( ComposeWithJDKMixin.class.getName() ); private static final Predicate> EXTENDS_IDENTITY_SPEC = new ServiceIdentitySpec( EXTENDS_IDENTITY ); private static final Predicate> COMPOSE_IDENTITY_SPEC = new ServiceIdentitySpec( http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java index d80d4e5..59c5a98 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java @@ -47,7 +47,7 @@ import org.junit.Test; public class ObjectVisibilityTest { - public static final Identity TEST_IDENTITY = StringIdentity.identity( "123" ); + public static final Identity TEST_IDENTITY = StringIdentity.identityOf( "123" ); private Energy4Java polygene; private Module module; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/query/IterableQuerySourceTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/query/IterableQuerySourceTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/query/IterableQuerySourceTest.java index 9dbf52f..810eab2 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/query/IterableQuerySourceTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/query/IterableQuerySourceTest.java @@ -214,7 +214,7 @@ public class IterableQuerySourceTest { QueryBuilder qb = qbf.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); - City kl = uow.get( City.class, StringIdentity.identity( "kualalumpur" ) ); + City kl = uow.get( City.class, StringIdentity.identityOf( "kualalumpur" ) ); Query query = qb.where( eq( person.mother().get().placeOfBirth(), kl ) ).newQuery( Network.persons() ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/query/Network.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/query/Network.java b/core/runtime/src/test/java/org/apache/polygene/runtime/query/Network.java index 727d168..dfd3253 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/query/Network.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/query/Network.java @@ -44,8 +44,8 @@ import org.apache.polygene.runtime.query.model.values.ContactsValue; */ class Network { - public static final Identity KUALALUMPUR = StringIdentity.identity( "kualalumpur" ); - public static final Identity PENANG = StringIdentity.identity( "penang" ); + public static final Identity KUALALUMPUR = StringIdentity.identityOf( "kualalumpur" ); + public static final Identity PENANG = StringIdentity.identityOf( "penang" ); private static List domains; private static List persons; private static List males; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java index 289be4b..e82a092 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java @@ -46,7 +46,7 @@ import org.junit.Test; public class ServiceVisibilityTest { - public static final Identity TEST_IDENTITY = StringIdentity.identity( "123" ); + public static final Identity TEST_IDENTITY = StringIdentity.identityOf( "123" ); private Energy4Java polygene; private Module module; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java index 6e6abab..ba92bf1 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java @@ -47,7 +47,7 @@ import org.junit.Test; public class TransientVisibilityTest { - public static final Identity TEST_IDENTITY = StringIdentity.identity( "123" ); + public static final Identity TEST_IDENTITY = StringIdentity.identityOf( "123" ); private Energy4Java polygene; private Module module; private Application app; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java index 425ae18..c1a04f0 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/PrivateEntityUnitOfWorkTest.java @@ -52,7 +52,7 @@ import static org.junit.Assert.fail; */ public class PrivateEntityUnitOfWorkTest { - private static final Identity TEST_IDENTITY = StringIdentity.identity( "1" ); + private static final Identity TEST_IDENTITY = StringIdentity.identityOf( "1" ); @Structure private UnitOfWorkFactory uowf; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/RemovalTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/RemovalTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/RemovalTest.java index 1a95f2f..617914a 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/RemovalTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/RemovalTest.java @@ -40,7 +40,7 @@ public class RemovalTest extends AbstractPolygeneTest { - private static final Identity TEST_IDENTITY = StringIdentity.identity( "123" ); + private static final Identity TEST_IDENTITY = StringIdentity.identityOf( "123" ); public void assemble(ModuleAssembly module ) throws AssemblyException http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/value/AssociationToValueTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/AssociationToValueTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/AssociationToValueTest.java index ffbe234..d43cfc9 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/AssociationToValueTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/AssociationToValueTest.java @@ -151,7 +151,7 @@ public class AssociationToValueTest extends AbstractPolygeneTest public Person findPersonByName( String name ) { UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork(); - return uow.toValue( Person.class, uow.get( Person.class, StringIdentity.identity( name ) ) ); + return uow.toValue( Person.class, uow.get( Person.class, StringIdentity.identityOf( name ) ) ); } } @@ -206,7 +206,7 @@ public class AssociationToValueTest extends AbstractPolygeneTest private Person createPerson( String name ) { UnitOfWork uow = uowf.currentUnitOfWork(); - return uow.newEntity( Person.class, StringIdentity.identity( name ) ); + return uow.newEntity( Person.class, StringIdentity.identityOf( name ) ); } } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueSerializationRegressionTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueSerializationRegressionTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueSerializationRegressionTest.java index f48bfe3..2bb600a 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueSerializationRegressionTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueSerializationRegressionTest.java @@ -50,7 +50,7 @@ public class ValueSerializationRegressionTest extends AbstractPolygeneTest throws UnitOfWorkCompletionException { ValueBuilder builder = valueBuilderFactory.newValueBuilder( DualFaced.class ); - builder.prototype().identity().set( StringIdentity.identity( "1234" ) ); + builder.prototype().identity().set( StringIdentity.identityOf( "1234" ) ); builder.prototype().name().set( "Hedhman" ); DualFaced value = builder.newInstance(); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java index 191808b..500d255 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java @@ -48,7 +48,7 @@ import org.junit.Test; public class ValueVisibilityTest { - public static final Identity TEST_IDENTIY = StringIdentity.identity( "123" ); + public static final Identity TEST_IDENTIY = StringIdentity.identityOf( "123" ); private Energy4Java polygene; private Module module; private Application app; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueWithAssociationTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueWithAssociationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueWithAssociationTest.java index 655505c..c53a1a5 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueWithAssociationTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueWithAssociationTest.java @@ -113,7 +113,7 @@ public class ValueWithAssociationTest extends AbstractPolygeneTest throws UnitOfWorkCompletionException { ValueBuilder builder = valueBuilderFactory.newValueBuilder( DualFaced.class ); - builder.prototype().identity().set( StringIdentity.identity( "1234" ) ); + builder.prototype().identity().set( StringIdentity.identityOf( "1234" ) ); builder.prototype().name().set( "Hedhman" ); DualFaced value = builder.newInstance(); @@ -125,8 +125,8 @@ public class ValueWithAssociationTest extends AbstractPolygeneTest try (UnitOfWork uow = unitOfWorkFactory.newUnitOfWork()) { - DualFaced entity = uow.get( DualFaced.class, StringIdentity.identity( "1234" ) ); - assertThat( entity.identity().get(), equalTo( StringIdentity.identity( "1234" ) ) ); + DualFaced entity = uow.get( DualFaced.class, StringIdentity.identityOf( "1234" ) ); + assertThat( entity.identity().get(), equalTo( StringIdentity.identityOf( "1234" ) ) ); assertThat( entity.name().get(), equalTo( "Hedhman" ) ); uow.complete(); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java index ec9d072..239e7fe 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java @@ -41,8 +41,8 @@ import org.junit.Test; public class VisibilityInUnitOfWorkTest { - public static final Identity TEST_IDENTITY1 = StringIdentity.identity( "123" ); - public static final Identity TEST_IDENTITY2 = StringIdentity.identity( "345" ); + public static final Identity TEST_IDENTITY1 = StringIdentity.identityOf( "123" ); + public static final Identity TEST_IDENTITY2 = StringIdentity.identityOf( "345" ); @Test public void givenTwoModulesWithServiceAndEntityInOneAndEntityInOtherWhenOtherEntityAccessServiceWhichUsesItsEntityExpectServiceToHaveVisibility() http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java index 237e8ab..b5f79a7 100644 --- a/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java @@ -46,7 +46,7 @@ public class ServiceInstanceImporterTest { module.importedServices( TestService.class ). identifiedBy( "test" ). - setMetaInfo( StringIdentity.identity( "testimporter" ) ). + setMetaInfo( StringIdentity.identityOf( "testimporter" ) ). importedBy( ImportedServiceDeclaration.SERVICE_IMPORTER ); module.services( TestImporterService.class ).identifiedBy( "testimporter" ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/DefaultNamedAssociationState.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/DefaultNamedAssociationState.java b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/DefaultNamedAssociationState.java index 94f30ca..c182180 100644 --- a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/DefaultNamedAssociationState.java +++ b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/DefaultNamedAssociationState.java @@ -21,6 +21,7 @@ package org.apache.polygene.spi.entitystore.helpers; import java.util.Iterator; import java.util.Map; +import java.util.Objects; import org.apache.polygene.api.entity.EntityReference; import org.apache.polygene.spi.entity.NamedAssociationState; @@ -55,7 +56,10 @@ public final class DefaultNamedAssociationState @Override public boolean put( String name, EntityReference entityReference ) { - if( references.put( name, entityReference ) == null ) + Objects.requireNonNull(name, "name"); + Objects.requireNonNull(entityReference, "entityReference"); + EntityReference oldReference = references.put( name, entityReference ); + if( entityReference.equals( oldReference ) ) { return false; } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java index cedcedc..aa0bdc4 100644 --- a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java +++ b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java @@ -419,7 +419,7 @@ public class JSONMapEntityStoreMixin String version = parsedState.getString( JSONKeys.VERSION ); Instant modified = Instant.ofEpochMilli( parsedState.getJsonNumber( JSONKeys.MODIFIED ).longValueExact() ); - Identity identity = StringIdentity.identity( parsedState.getString( JSONKeys.IDENTITY ) ); + Identity identity = StringIdentity.identityOf( parsedState.getString( JSONKeys.IDENTITY ) ); // Check if version is correct JsonObject state; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java index 2c98677..2dde5dc 100644 --- a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java +++ b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/MapEntityStoreMixin.java @@ -382,7 +382,7 @@ public class MapEntityStoreMixin String version = parsedState.getString( JSONKeys.VERSION ); Instant modified = Instant.ofEpochMilli( parsedState.getJsonNumber( JSONKeys.MODIFIED ).longValueExact() ); - Identity identity = StringIdentity.identity( parsedState.getString( JSONKeys.IDENTITY ) ); + Identity identity = StringIdentity.identityOf( parsedState.getString( JSONKeys.IDENTITY ) ); // Check if version is correct JsonObject state; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/spi/src/main/java/org/apache/polygene/spi/serialization/BuiltInConverters.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/polygene/spi/serialization/BuiltInConverters.java b/core/spi/src/main/java/org/apache/polygene/spi/serialization/BuiltInConverters.java index d86b81d..ab7448e 100644 --- a/core/spi/src/main/java/org/apache/polygene/spi/serialization/BuiltInConverters.java +++ b/core/spi/src/main/java/org/apache/polygene/spi/serialization/BuiltInConverters.java @@ -108,7 +108,7 @@ public interface BuiltInConverters @Override public Identity fromString( String string ) { - return StringIdentity.identity( string ); + return StringIdentity.identityOf( string ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/spi/src/test/java/org/apache/polygene/spi/entitystore/Polygene142Test.java ---------------------------------------------------------------------- diff --git a/core/spi/src/test/java/org/apache/polygene/spi/entitystore/Polygene142Test.java b/core/spi/src/test/java/org/apache/polygene/spi/entitystore/Polygene142Test.java index b9030bd..b8af6ca 100644 --- a/core/spi/src/test/java/org/apache/polygene/spi/entitystore/Polygene142Test.java +++ b/core/spi/src/test/java/org/apache/polygene/spi/entitystore/Polygene142Test.java @@ -61,7 +61,7 @@ public class Polygene142Test extends AbstractPolygeneTest value = serialization.deserialize( module, Regression142Type.class, serialized ); // ok } { - Identity valueId = StringIdentity.identity( "abcdefg" ); + Identity valueId = StringIdentity.identityOf( "abcdefg" ); { try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "create" ) ) ) { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java index 507526d..8a004a7 100644 --- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java +++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/EntityStoreTestSuite.java @@ -19,7 +19,6 @@ */ package org.apache.polygene.test.entity.model; -import java.util.Iterator; import org.apache.polygene.api.association.NamedAssociation; import org.apache.polygene.api.common.Visibility; import org.apache.polygene.api.constraint.ConstraintViolationException; @@ -56,7 +55,7 @@ import org.apache.polygene.test.entity.model.people.Rent; import org.junit.Before; import org.junit.Test; -import static org.hamcrest.core.Is.is; +import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertThat; @@ -65,6 +64,8 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest private static final String FRIEND = "Friend"; private static final String COLLEAGUE = "Colleague"; + protected ModuleAssembly configModule; + @Structure private ObjectFactory obf; @@ -80,14 +81,14 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest private Identity montpellierId; private Identity hannoverId; private Identity malmoId; - private Identity cherasId; + private Identity cherasId; private Identity unknown3Id; private Identity unknown2Id; private Identity unknown1Id; private Identity varnhemId; - private Identity canaryId; + private Identity canaryId; private Identity switzerlandId; private Identity franceId; private Identity denmarkId; @@ -240,15 +241,7 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest try( UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - whenIteratingNamedAssociationExpectIterationToSucceed" ) ) ) { Person niclas = peopleRepository.findPersonByName( "Niclas" ); - Iterator numbers = niclas.phoneNumbers().iterator(); - assertThat( numbers.hasNext(), is( true ) ); - assertThat( numbers.next(), equalTo( "Home" ) ); - assertThat( numbers.hasNext(), is( true ) ); - assertThat( numbers.next(), equalTo( "Chinese" ) ); - assertThat( numbers.hasNext(), is( true ) ); - assertThat( numbers.next(), equalTo( "Swedish" ) ); - assertThat( numbers.hasNext(), is( true ) ); - assertThat( numbers.next(), equalTo( "German" ) ); + assertThat( niclas.phoneNumbers(), containsInAnyOrder("Home", "Chinese", "Swedish", "German")); } } @@ -542,5 +535,6 @@ public abstract class EntityStoreTestSuite extends AbstractPolygeneBaseTest { module.defaultServices(); module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.module ); + configModule = module; } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java index 925e500..c90a64c 100644 --- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java +++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/legal/LegalService.java @@ -52,7 +52,7 @@ public interface LegalService public Identity createWill( Person principal, Map amounts, Map percentages, Map specificItems ) { UnitOfWork uow = uowf.currentUnitOfWork(); - Identity identity = StringIdentity.identity( "will-" + principal.name().get() ); + Identity identity = StringIdentity.identityOf( "will-" + principal.name().get() ); EntityBuilder builder = uow.newEntityBuilder( Will.class, identity ); Will instance = builder.instance(); for( Map.Entry entry : amounts.entrySet() ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/PeopleRepository.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/PeopleRepository.java b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/PeopleRepository.java index 0aeb8ea..7e31aab9 100644 --- a/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/PeopleRepository.java +++ b/core/testsupport/src/main/java/org/apache/polygene/test/entity/model/people/PeopleRepository.java @@ -27,7 +27,7 @@ import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.api.unitofwork.UnitOfWorkFactory; -import static org.apache.polygene.api.identity.StringIdentity.identity; +import static org.apache.polygene.api.identity.StringIdentity.identityOf; @Mixins( PeopleRepository.Mixin.class ) public interface PeopleRepository @@ -66,7 +66,7 @@ public interface PeopleRepository public Person createPerson( String name, Country nationality, Address address, Person spouse, PhoneNumber homeNumber ) { UnitOfWork uow = uowf.currentUnitOfWork(); - EntityBuilder builder = uow.newEntityBuilder( Person.class, identity( "person-" + name ) ); + EntityBuilder builder = uow.newEntityBuilder( Person.class, identityOf( "person-" + name ) ); Person instance = builder.instance(); instance.name().set( name ); instance.nationality().set( nationality ); @@ -89,14 +89,14 @@ public interface PeopleRepository public Person findPersonByName( String name ) { UnitOfWork uow = uowf.currentUnitOfWork(); - return uow.get( Person.class, identity( "person-" + name ) ); + return uow.get( Person.class, identityOf( "person-" + name ) ); } @Override public Country createCountry( String countryCode, String countryName ) { UnitOfWork uow = uowf.currentUnitOfWork(); - EntityBuilder builder = uow.newEntityBuilder( Country.class, identity( "country-" + countryCode ) ); + EntityBuilder builder = uow.newEntityBuilder( Country.class, identityOf( "country-" + countryCode ) ); builder.instance().name().set( countryName ); return builder.newInstance(); } @@ -105,7 +105,7 @@ public interface PeopleRepository public Country findCountryByCountryCode( String countryCode ) { - return findCountryByIdentity( identity( "country-" + countryCode ) ); + return findCountryByIdentity( identityOf( "country-" + countryCode ) ); } @Override http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java index 0592b1d..c5d1d99 100644 --- a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java +++ b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java @@ -465,7 +465,7 @@ public abstract class AbstractQueryTest { QueryBuilder qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); - Domain gaming = unitOfWork.get( Domain.class, StringIdentity.identity( "Gaming" ) ); + Domain gaming = unitOfWork.get( Domain.class, StringIdentity.identityOf( "Gaming" ) ); Query query = unitOfWork.newQuery( qb.where( contains( person.interests(), gaming ) ) ); System.out.println( "*** script33: " + query ); @@ -477,7 +477,7 @@ public abstract class AbstractQueryTest { QueryBuilder qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); - Female annDoe = unitOfWork.get( Female.class, StringIdentity.identity( "anndoe" ) ); + Female annDoe = unitOfWork.get( Female.class, StringIdentity.identityOf( "anndoe" ) ); Query query = unitOfWork.newQuery( qb.where( eq( person.mother(), annDoe ) ) ); System.out.println( "*** script34: " + query ); @@ -500,7 +500,7 @@ public abstract class AbstractQueryTest { QueryBuilder qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); - Account anns = unitOfWork.get( Account.class, StringIdentity.identity( "accountOfAnnDoe" ) ); + Account anns = unitOfWork.get( Account.class, StringIdentity.identityOf( "accountOfAnnDoe" ) ); Query query = unitOfWork.newQuery( qb.where( contains( person.accounts(), anns ) ) ); System.out.println( "*** script36: " + query ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/TestData.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/TestData.java b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/TestData.java index 40df6ba..5434005 100644 --- a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/TestData.java +++ b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/TestData.java @@ -59,7 +59,7 @@ public class TestData NameableAssert.clear(); Domain gaming; { - EntityBuilder domainBuilder = unitOfWork.newEntityBuilder( Domain.class, StringIdentity.identity( "Gaming" ) ); + EntityBuilder domainBuilder = unitOfWork.newEntityBuilder( Domain.class, StringIdentity.identityOf( "Gaming" ) ); gaming = domainBuilder.instance(); gaming.name().set( "Gaming" ); gaming.description().set( "Gaming domain" ); @@ -121,7 +121,7 @@ public class TestData Account annsAccount; { - EntityBuilder accountBuilder = unitOfWork.newEntityBuilder( Account.class, StringIdentity.identity( "accountOfAnnDoe" ) ); + EntityBuilder accountBuilder = unitOfWork.newEntityBuilder( Account.class, StringIdentity.identityOf( "accountOfAnnDoe" ) ); annsAccount = accountBuilder.instance(); annsAccount.number().set( "accountOfAnnDoe" ); annsAccount = accountBuilder.newInstance(); @@ -129,7 +129,7 @@ public class TestData Account jacksAccount; { - EntityBuilder accountBuilder = unitOfWork.newEntityBuilder( Account.class, StringIdentity.identity( "accountOfJackDoe" ) ); + EntityBuilder accountBuilder = unitOfWork.newEntityBuilder( Account.class, StringIdentity.identityOf( "accountOfJackDoe" ) ); jacksAccount = accountBuilder.instance(); jacksAccount.number().set( "accountOfJackDoe" ); jacksAccount = accountBuilder.newInstance(); @@ -143,7 +143,7 @@ public class TestData Female annDoe; { - EntityBuilder femaleBuilder = unitOfWork.newEntityBuilder( Female.class, StringIdentity.identity( "anndoe" ) ); + EntityBuilder femaleBuilder = unitOfWork.newEntityBuilder( Female.class, StringIdentity.identityOf( "anndoe" ) ); annDoe = femaleBuilder.instance(); annDoe.name().set( "Ann Doe" ); annDoe.title().set( Person.Title.MRS ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java index f07a202..e9e0c1c 100644 --- a/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java +++ b/core/testsupport/src/main/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java @@ -71,7 +71,7 @@ public abstract class AbstractPolygeneMetricsTest extends AbstractPolygeneBaseTe public interface PersonList { - Identity LIST_ID = StringIdentity.identity( "person-list" ); + Identity LIST_ID = StringIdentity.identityOf( "person-list" ); ManyAssociation all(); } @@ -274,7 +274,7 @@ public abstract class AbstractPolygeneMetricsTest extends AbstractPolygeneBaseTe Commands commands = services.findService( Commands.class ).get(); Queries queries = services.findService( Queries.class ).get(); - Identity identity = StringIdentity.identity( "1" ); + Identity identity = StringIdentity.identityOf( "1" ); try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork( newUsecase( "Step 1" ) ) ) { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java index ddea6d2..9f0d87c 100644 --- a/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java +++ b/core/testsupport/src/main/java/org/apache/polygene/test/serialization/AbstractValueCompositeSerializationTest.java @@ -253,7 +253,7 @@ public abstract class AbstractValueCompositeSerializationTest // JSONEntityState does not allow for polymorphic serialization public void valueAndEntityTypeEquality() { - Identity identity = StringIdentity.identity( "42" ); + Identity identity = StringIdentity.identityOf( "42" ); Some createdValue, loadedValue; try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( newUsecase( "create" ) ) ) @@ -301,7 +301,7 @@ public abstract class AbstractValueCompositeSerializationTest { EntityBuilder builder = uow.newEntityBuilder( Some.class ); Some proto = builder.instance(); - proto.identity().set( StringIdentity.identity( identity ) ); + proto.identity().set( StringIdentity.identityOf( identity ) ); setSomeValueState( module, uow, proto ); return builder.newInstance(); } @@ -313,7 +313,7 @@ public abstract class AbstractValueCompositeSerializationTest { ValueBuilder builder = module.newValueBuilder( Some.class ); Some proto = builder.prototype(); - proto.identity().set( StringIdentity.identity( identity ) ); + proto.identity().set( StringIdentity.identityOf( identity ) ); setSomeValueState( module, uow, proto ); return builder.newInstance(); } @@ -322,7 +322,7 @@ public abstract class AbstractValueCompositeSerializationTest { ValueBuilder builder = module.newValueBuilder( SomeExtended.class ); SomeExtended proto = builder.prototype(); - proto.identity().set( StringIdentity.identity( identity ) ); + proto.identity().set( StringIdentity.identityOf( identity ) ); setSomeValueState( module, uow, proto ); proto.extraProperty().set( "extra property" ); proto.extraAssociation().set( buildBarEntity( module, uow, "extra association" ) ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java index 2895d53..549e0dc 100644 --- a/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java +++ b/extensions/entitystore-cassandra/src/main/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreMixin.java @@ -427,7 +427,7 @@ public class CassandraEntityStoreMixin Identity newIdentity; if( idGenerator == null ) { - newIdentity = StringIdentity.identity( UUID.randomUUID().toString() ); + newIdentity = StringIdentity.identityOf( UUID.randomUUID().toString() ); } else { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTestSuite.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTestSuite.java b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTestSuite.java new file mode 100644 index 0000000..3908a73 --- /dev/null +++ b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraEntityStoreTestSuite.java @@ -0,0 +1,80 @@ +/* + * 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.entitystore.cassandra; + +import org.apache.polygene.api.common.Visibility; +import org.apache.polygene.api.service.ServiceReference; +import org.apache.polygene.api.structure.Module; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.entitystore.cassandra.assembly.CassandraEntityStoreAssembler; +import org.apache.polygene.test.docker.DockerRule; +import org.apache.polygene.test.entity.CanRemoveAll; +import org.apache.polygene.test.entity.model.EntityStoreTestSuite; +import org.junit.ClassRule; + +/** + * Test the CassandraEntityStoreService. + *

Installing Cassandra and starting it should suffice as the test use Cassandra defaults: 127.0.0.1:3000

+ */ +public class CassandraEntityStoreTestSuite extends EntityStoreTestSuite +{ + @ClassRule + public static final DockerRule DOCKER = new DockerRule( "cassandra", "Starting listening for CQL clients" ); + + @Override + protected void defineStorageModule( ModuleAssembly module ) + { + module.defaultServices(); + new CassandraEntityStoreAssembler() + .visibleIn( Visibility.application ) + .withConfig( configModule, Visibility.application ) + .assemble( module ); + + module.services( CassandraEntityStoreService.class ) + .withTypes( CanRemoveAll.class ) + .withMixins( EmptyCassandraTableMixin.class ) + .visibleIn( Visibility.application ); + + + CassandraEntityStoreConfiguration cassandraDefaults = configModule.forMixin( CassandraEntityStoreConfiguration.class ).declareDefaults(); + String host = DOCKER.getDockerHost(); + int port = DOCKER.getExposedContainerPort( "9042/tcp" ); + System.out.println("Cassandra: " + host + ":" + port); + cassandraDefaults.hostnames().set( host + ':' + port ); + cassandraDefaults.createIfMissing().set( true ); + } + + @Override + public void tearDown() + throws Exception + { + Module module = application.findModule( "Infrastructure Layer", "Storage Module" ); + ServiceReference cleaner = module.serviceFinder().findService( CanRemoveAll.class ); + if( cleaner.isActive() && cleaner.isAvailable() ) + { + cleaner.get().removeAll(); + } + else + { + throw new IllegalStateException( "Clean up operation of Cassandra database was not availeble." ); + } + super.tearDown(); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTestSuite.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTestSuite.java b/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTestSuite.java new file mode 100644 index 0000000..b28afff --- /dev/null +++ b/extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTestSuite.java @@ -0,0 +1,50 @@ +/* + * 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.entitystore.file; + +import org.apache.polygene.api.common.Visibility; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.entitystore.file.assembly.FileEntityStoreAssembler; +import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; +import org.apache.polygene.library.fileconfig.FileConfigurationOverride; +import org.apache.polygene.test.entity.model.EntityStoreTestSuite; +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; + +public class FileEntityStoreTestSuite + extends EntityStoreTestSuite +{ + @Rule + public final TemporaryFolder tmpDir = new TemporaryFolder(); + + @Override + protected void defineStorageModule( ModuleAssembly module ) + { + module.defaultServices(); + new FileConfigurationAssembler() + .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) + .visibleIn( Visibility.application ) + .assemble( module ); + new FileEntityStoreAssembler() + .withConfig( configModule, Visibility.application ) + .visibleIn( Visibility.application ) + .assemble( module ); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0d9e8a1b/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTestSuite.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTestSuite.java b/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTestSuite.java new file mode 100644 index 0000000..73dc13c --- /dev/null +++ b/extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTestSuite.java @@ -0,0 +1,38 @@ +/* + * 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.entitystore.geode; + +import org.apache.polygene.api.common.Visibility; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.entitystore.geode.assembly.GeodeEntityStoreAssembler; +import org.apache.polygene.test.entity.model.EntityStoreTestSuite; + +public class GeodeEntityStoreTestSuite extends EntityStoreTestSuite +{ + @Override + protected void defineStorageModule( ModuleAssembly module ) + { + module.defaultServices(); + new GeodeEntityStoreAssembler() + .visibleIn( Visibility.application ) + .withConfig( configModule, Visibility.application ) + .assemble( module ); + } +}