http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneSPITest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneSPITest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneSPITest.java new file mode 100644 index 0000000..7c60d87 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneSPITest.java @@ -0,0 +1,129 @@ +/* + * 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.runtime; + +import org.hamcrest.CoreMatchers; +import org.junit.Test; +import org.apache.polygene.api.association.AbstractAssociation; +import org.apache.polygene.api.association.Association; +import org.apache.polygene.api.association.AssociationStateDescriptor; +import org.apache.polygene.api.association.AssociationStateHolder; +import org.apache.polygene.api.association.ManyAssociation; +import org.apache.polygene.api.common.Optional; +import org.apache.polygene.api.entity.EntityBuilder; +import org.apache.polygene.api.entity.EntityComposite; +import org.apache.polygene.api.entity.EntityDescriptor; +import org.apache.polygene.api.property.Property; +import org.apache.polygene.api.unitofwork.UnitOfWork; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.test.AbstractPolygeneTest; +import org.apache.polygene.test.EntityTestAssembler; + +import static org.junit.Assert.assertThat; + +/** + * JAVADOC + */ +public class PolygeneSPITest + extends AbstractPolygeneTest +{ + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + new EntityTestAssembler().assemble( module ); + module.entities( TestEntity.class, TestEntity2.class ); + } + + @Test + public void givenEntityWhenGettingStateThenGetCorrectState() + throws Exception + { + UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork(); + TestEntity testEntity; + try + { + EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class ); + + testEntity = builder.newInstance(); + + AssociationStateHolder state = spi.stateOf( testEntity ); + + validateState( state, spi.entityDescriptorFor( testEntity ) ); + + unitOfWork.complete(); + } + finally + { + unitOfWork.discard(); + } + + UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); + try + { + testEntity = uow.get( testEntity ); + validateState( spi.stateOf( testEntity ), spi.entityDescriptorFor( testEntity ) ); + uow.complete(); + } + finally + { + uow.discard(); + } + } + + private void validateState( AssociationStateHolder state, EntityDescriptor entityDescriptor ) + { + entityDescriptor.state().properties().forEach( propertyDescriptor -> { + Property<?> prop = state.propertyFor( propertyDescriptor.accessor() ); + assertThat( "Properties could be listed", prop, CoreMatchers.notNullValue() ); + } ); + + AssociationStateDescriptor descriptor = entityDescriptor.state(); + descriptor.associations().forEach( associationDescriptor -> { + AbstractAssociation assoc = state.associationFor( associationDescriptor.accessor() ); + assertThat( "Assocs could be listed", assoc, CoreMatchers.notNullValue() ); + } ); + } + + public interface TestEntity + extends EntityComposite + { + @Optional + Property<String> property(); + + @Optional + Association<TestEntity> association(); + + ManyAssociation<TestEntity> manyAssociation(); + } + + public interface TestEntity2 + extends EntityComposite + { + @Optional + Property<String> property(); + + @Optional + Association<TestEntity> association(); + + ManyAssociation<TestEntity> manyAssociation(); + } +}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/ZestAPITest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/ZestAPITest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/ZestAPITest.java deleted file mode 100644 index 24419d6..0000000 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/ZestAPITest.java +++ /dev/null @@ -1,87 +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.runtime; - -import org.junit.Test; -import org.apache.polygene.api.composite.TransientComposite; -import org.apache.polygene.api.entity.EntityComposite; -import org.apache.polygene.api.service.ServiceComposite; -import org.apache.polygene.api.unitofwork.UnitOfWork; -import org.apache.polygene.api.value.ValueComposite; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; -import org.apache.polygene.test.EntityTestAssembler; - -/** - * JAVADOC - */ -public class PolygeneAPITest - extends AbstractPolygeneTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - new EntityTestAssembler().assemble( module ); - module.transients( TestTransient.class ); - module.entities( TestEntity.class ); - module.values( TestValue.class ); - module.services( TestService.class ); - } - - @Test - public void testGetModuleOfComposite() - throws Exception - { - UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork(); - TestEntity testEntity = unitOfWork.newEntity( TestEntity.class ); - - api.moduleOf( testEntity ); - - unitOfWork.discard(); - - api.moduleOf( valueBuilderFactory.newValue( TestValue.class ) ); - - api.moduleOf( transientBuilderFactory.newTransient( TestTransient.class ) ); - - api.moduleOf( serviceFinder.findService( TestService.class ).get() ); - } - - public interface TestTransient - extends TransientComposite - { - } - - public interface TestEntity - extends EntityComposite - { - } - - public interface TestValue - extends ValueComposite - { - } - - public interface TestService - extends ServiceComposite - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/ZestSPITest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/ZestSPITest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/ZestSPITest.java deleted file mode 100644 index 7c60d87..0000000 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/ZestSPITest.java +++ /dev/null @@ -1,129 +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.runtime; - -import org.hamcrest.CoreMatchers; -import org.junit.Test; -import org.apache.polygene.api.association.AbstractAssociation; -import org.apache.polygene.api.association.Association; -import org.apache.polygene.api.association.AssociationStateDescriptor; -import org.apache.polygene.api.association.AssociationStateHolder; -import org.apache.polygene.api.association.ManyAssociation; -import org.apache.polygene.api.common.Optional; -import org.apache.polygene.api.entity.EntityBuilder; -import org.apache.polygene.api.entity.EntityComposite; -import org.apache.polygene.api.entity.EntityDescriptor; -import org.apache.polygene.api.property.Property; -import org.apache.polygene.api.unitofwork.UnitOfWork; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; -import org.apache.polygene.test.EntityTestAssembler; - -import static org.junit.Assert.assertThat; - -/** - * JAVADOC - */ -public class PolygeneSPITest - extends AbstractPolygeneTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - new EntityTestAssembler().assemble( module ); - module.entities( TestEntity.class, TestEntity2.class ); - } - - @Test - public void givenEntityWhenGettingStateThenGetCorrectState() - throws Exception - { - UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork(); - TestEntity testEntity; - try - { - EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class ); - - testEntity = builder.newInstance(); - - AssociationStateHolder state = spi.stateOf( testEntity ); - - validateState( state, spi.entityDescriptorFor( testEntity ) ); - - unitOfWork.complete(); - } - finally - { - unitOfWork.discard(); - } - - UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - try - { - testEntity = uow.get( testEntity ); - validateState( spi.stateOf( testEntity ), spi.entityDescriptorFor( testEntity ) ); - uow.complete(); - } - finally - { - uow.discard(); - } - } - - private void validateState( AssociationStateHolder state, EntityDescriptor entityDescriptor ) - { - entityDescriptor.state().properties().forEach( propertyDescriptor -> { - Property<?> prop = state.propertyFor( propertyDescriptor.accessor() ); - assertThat( "Properties could be listed", prop, CoreMatchers.notNullValue() ); - } ); - - AssociationStateDescriptor descriptor = entityDescriptor.state(); - descriptor.associations().forEach( associationDescriptor -> { - AbstractAssociation assoc = state.associationFor( associationDescriptor.accessor() ); - assertThat( "Assocs could be listed", assoc, CoreMatchers.notNullValue() ); - } ); - } - - public interface TestEntity - extends EntityComposite - { - @Optional - Property<String> property(); - - @Optional - Association<TestEntity> association(); - - ManyAssociation<TestEntity> manyAssociation(); - } - - public interface TestEntity2 - extends EntityComposite - { - @Optional - Property<String> property(); - - @Optional - Association<TestEntity> association(); - - ManyAssociation<TestEntity> manyAssociation(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java index 62b89d2..4fe8ba0 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.runtime.appliesto; import java.lang.reflect.Method; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Assert; import org.junit.Test; import org.apache.polygene.api.common.AppliesTo; @@ -30,7 +31,6 @@ import org.apache.polygene.api.concern.GenericConcern; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; /** * Test of the AppliesToFilter http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java b/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java index ebb86d9..6a01c0c 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java @@ -25,6 +25,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.common.AppliesTo; import org.apache.polygene.api.common.Optional; @@ -39,7 +40,6 @@ import org.apache.polygene.api.service.ServiceReference; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.assertTrue; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java index 8f1e294..9d968f0 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java @@ -19,6 +19,7 @@ */ package org.apache.polygene.runtime.association; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.association.Association; import org.apache.polygene.api.association.AssociationDescriptor; @@ -29,7 +30,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.api.value.ValueBuilder; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; import static org.hamcrest.CoreMatchers.equalTo; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java index 3c5bd1a..f7afdee 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.runtime.bootstrap; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.PolygeneAPI; import org.apache.polygene.api.composite.Composite; @@ -33,7 +34,6 @@ import org.apache.polygene.api.mixin.NoopMixin; import org.apache.polygene.api.service.ServiceComposite; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java index e12c8f1..1575f50 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java @@ -21,6 +21,7 @@ package org.apache.polygene.runtime.composite; import java.lang.reflect.Method; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Assert; import org.junit.Test; import org.apache.polygene.api.common.Optional; @@ -34,7 +35,6 @@ import org.apache.polygene.api.property.Property; import org.apache.polygene.api.structure.Module; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; /** * JAVADOC http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java index e40ae6e..f13c0b0 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java @@ -22,6 +22,7 @@ package org.apache.polygene.runtime.composite; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.util.Properties; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.common.AppliesTo; import org.apache.polygene.api.common.AppliesToFilter; @@ -31,7 +32,6 @@ import org.apache.polygene.api.composite.TransientComposite; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.fail; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java index 840ffa8..06fc1e4 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Ignore; import org.junit.Test; import org.apache.polygene.api.composite.Composite; @@ -33,7 +34,6 @@ import org.apache.polygene.api.injection.scope.This; import org.apache.polygene.api.value.ValueBuilder; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertThat; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java index 689f238..d39ed6e 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java @@ -21,12 +21,12 @@ package org.apache.polygene.runtime.composite; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.composite.TransientComposite; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java index 767d626..f189593 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java @@ -23,10 +23,10 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import org.apache.polygene.api.concern.ConcernOf; import org.apache.polygene.api.concern.Concerns; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertThat; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java index 7463f82..2de631a 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java @@ -24,13 +24,13 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.composite.TransientComposite; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; /** * Tests for GenericConcern http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java index 7a2dd06..12550f2 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java @@ -21,6 +21,7 @@ package org.apache.polygene.runtime.concerns; import java.util.ArrayList; import java.util.List; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.common.InvalidApplicationException; import org.apache.polygene.api.common.UseDefaults; @@ -30,7 +31,6 @@ import org.apache.polygene.api.property.InvalidPropertyTypeException; import org.apache.polygene.api.property.Property; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertThat; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java index 8ae4ebd..f560439 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java @@ -23,6 +23,7 @@ import java.lang.annotation.Retention; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.common.Optional; import org.apache.polygene.api.composite.TransientComposite; @@ -35,7 +36,6 @@ import org.apache.polygene.api.constraint.Name; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static java.lang.annotation.RetentionPolicy.RUNTIME; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java index e7a7536..f648549 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.runtime.entity; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.association.Association; import org.apache.polygene.api.association.ManyAssociation; @@ -32,7 +33,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.api.usecase.UsecaseBuilder; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; import static org.junit.Assert.fail; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java index 9d2ca9b..c2ca024 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java @@ -19,6 +19,7 @@ */ package org.apache.polygene.runtime.entity; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -29,7 +30,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; import static org.hamcrest.CoreMatchers.equalTo; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java index e79326b..4766868 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java @@ -37,7 +37,7 @@ import org.junit.Test; * Test case for http://team.ops4j.org/browse/QI-274 */ public class EntityCreationTest - extends AbstractPolygeneTest + extends AbstractPolygeneTest { @Mixins( SomeEntityMixin.class ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/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 728bfcf..c5ef312 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 @@ -21,13 +21,13 @@ package org.apache.polygene.runtime.entity; import org.apache.polygene.api.identity.StringIdentity; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.entity.EntityBuilder; import org.apache.polygene.api.entity.EntityComposite; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; public class EntityTypeTest http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java index a5f9f68..97627ba 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java @@ -20,6 +20,7 @@ package org.apache.polygene.runtime.entity; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.entity.EntityComposite; import org.apache.polygene.api.injection.scope.This; @@ -27,7 +28,6 @@ import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.api.property.Property; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; /** http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java index 05a61b6..f049c40 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java @@ -22,6 +22,7 @@ package org.apache.polygene.runtime.entity.associations; import java.io.Serializable; import javax.swing.Icon; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Assert; import org.junit.Test; import org.apache.polygene.api.association.Association; @@ -33,7 +34,6 @@ import org.apache.polygene.api.property.Property; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; /** http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java index f659997..57c02dc 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.runtime.entity.associations; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.association.Association; import org.apache.polygene.api.association.ManyAssociation; @@ -30,7 +31,6 @@ import org.apache.polygene.api.property.Immutable; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; /** http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java index 07056d8..ca41d50 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.runtime.injection; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.composite.TransientComposite; import org.apache.polygene.api.injection.scope.State; @@ -27,7 +28,6 @@ import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; import static org.junit.Assert.fail; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java index a4aa796..2b94d47 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java @@ -19,6 +19,7 @@ */ package org.apache.polygene.runtime.injection; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.composite.TransientBuilder; import org.apache.polygene.api.composite.TransientComposite; @@ -26,7 +27,6 @@ import org.apache.polygene.api.injection.scope.Uses; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java index 360309d..d42c846 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java @@ -20,12 +20,12 @@ package org.apache.polygene.runtime.injection; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Assert; import org.junit.Test; import org.apache.polygene.api.injection.scope.Uses; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java b/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java index f8ddbd4..214c4bc 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java @@ -19,6 +19,7 @@ */ package org.apache.polygene.runtime.instantiation; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Assert; import org.junit.Test; import org.apache.polygene.api.configuration.Configuration; @@ -28,7 +29,6 @@ import org.apache.polygene.api.property.Property; import org.apache.polygene.api.service.ServiceReference; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; public class ServiceInstantiationTests http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/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 814ec42..e0ed2ba 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 @@ -21,6 +21,7 @@ package org.apache.polygene.runtime.mixin; import org.apache.polygene.api.identity.StringIdentity; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.composite.TransientComposite; import org.apache.polygene.api.entity.EntityComposite; @@ -28,7 +29,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; import static org.hamcrest.CoreMatchers.equalTo; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java index 694c3a6..36d7f2a 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java @@ -20,13 +20,13 @@ package org.apache.polygene.runtime.mixin; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.api.mixin.NoopMixin; import org.apache.polygene.api.service.ServiceComposite; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.fail; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java index a0a0e49..8885e8a 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java @@ -23,6 +23,7 @@ package org.apache.polygene.runtime.mixin; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.concern.ConcernOf; import org.apache.polygene.api.concern.Concerns; @@ -32,7 +33,6 @@ import org.apache.polygene.api.service.ServiceComposite; import org.apache.polygene.api.service.ServiceReference; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java index a51b2d3..438089a 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java @@ -19,13 +19,13 @@ */ package org.apache.polygene.runtime.mixin; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.composite.TransientComposite; import org.apache.polygene.api.injection.scope.This; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java index d6d4d41..e2d2b5a 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java @@ -23,12 +23,12 @@ package org.apache.polygene.runtime.mixin; import java.util.Collection; import java.util.Collections; import java.util.List; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.api.service.ServiceComposite; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; public class Qi228Test extends AbstractPolygeneTest http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java index e2d5a61..c3518dc 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java @@ -19,6 +19,7 @@ */ package org.apache.polygene.runtime.property; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Assert; import org.junit.Test; import org.apache.polygene.api.composite.TransientBuilder; @@ -30,7 +31,6 @@ import org.apache.polygene.api.property.Property; import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java index 357d53f..179e2eb 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java @@ -20,13 +20,13 @@ package org.apache.polygene.runtime.property; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.composite.TransientBuilder; import org.apache.polygene.api.composite.TransientComposite; import org.apache.polygene.api.property.Property; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java index def5256..530cd71 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java @@ -23,6 +23,7 @@ package org.apache.polygene.runtime.property; import java.io.Serializable; import java.lang.reflect.Method; import javax.swing.Icon; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.common.AppliesTo; import org.apache.polygene.api.composite.TransientBuilder; @@ -33,7 +34,6 @@ import org.apache.polygene.api.property.PropertyMixin; import org.apache.polygene.api.property.PropertyWrapper; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java index 2755239..3549165 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java @@ -22,6 +22,7 @@ package org.apache.polygene.runtime.query; import java.util.ArrayList; import java.util.List; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Before; import org.junit.Test; import org.apache.polygene.api.composite.TransientBuilder; @@ -31,7 +32,6 @@ import org.apache.polygene.api.query.Query; import org.apache.polygene.api.query.QueryBuilder; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java index 918ec92..baef5c0 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java @@ -34,7 +34,7 @@ import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.assertEquals; public class ComplexActivatableTest - extends AbstractPolygeneTest + extends AbstractPolygeneTest { public void assemble( ModuleAssembly module ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java index 7fcb04c..9bddd31 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java @@ -20,12 +20,12 @@ package org.apache.polygene.runtime.service; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.api.service.ServiceReference; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsNull.notNullValue; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java index dc0a3e5..4ff5e2b 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java @@ -21,6 +21,7 @@ package org.apache.polygene.runtime.sideeffects; import java.lang.reflect.Method; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.common.AppliesTo; import org.apache.polygene.api.common.AppliesToFilter; @@ -33,7 +34,6 @@ import org.apache.polygene.api.sideeffect.GenericSideEffect; import org.apache.polygene.api.sideeffect.SideEffects; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java index ed7b5f6..022f1f0 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.runtime.sideeffects; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.common.UseDefaults; import org.apache.polygene.api.composite.TransientBuilderFactory; @@ -30,7 +31,6 @@ import org.apache.polygene.api.sideeffect.SideEffectOf; import org.apache.polygene.api.sideeffect.SideEffects; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java index e8394f1..fcc0ee8 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java @@ -19,6 +19,7 @@ */ package org.apache.polygene.runtime.threaded; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.Test; import org.apache.polygene.api.common.UseDefaults; import org.apache.polygene.api.composite.CompositeContext; @@ -27,7 +28,6 @@ import org.apache.polygene.api.composite.TransientComposite; import org.apache.polygene.api.property.Property; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java index f29cba4..3c10c1f 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java @@ -19,6 +19,7 @@ */ package org.apache.polygene.runtime.unitofwork; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.After; import org.junit.Test; import org.apache.polygene.api.constraint.ConstraintViolationException; @@ -28,7 +29,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.test.EntityTestAssembler; import static org.hamcrest.CoreMatchers.is; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java index 23e74aa..2ad6db4 100644 --- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java @@ -19,6 +19,7 @@ */ package org.apache.polygene.runtime.value; +import org.apache.polygene.test.AbstractPolygeneTest; import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService; import org.junit.Test; import org.apache.polygene.api.injection.scope.This; @@ -27,7 +28,6 @@ import org.apache.polygene.api.property.Property; import org.apache.polygene.api.value.ValueBuilder; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java index 1dd72a3..c863dc2 100644 --- a/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java @@ -20,6 +20,7 @@ package org.apache.polygene.spi.service.importer; +import org.apache.polygene.test.AbstractPolygeneTest; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test; @@ -27,7 +28,6 @@ import org.apache.polygene.api.injection.scope.Service; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ImportedServiceDeclaration; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; /** * JAVADOC http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/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 ed4ea9b..6a891c4 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 @@ -21,6 +21,7 @@ package org.apache.polygene.spi.service.importer; import org.apache.polygene.api.identity.StringIdentity; +import org.apache.polygene.test.AbstractPolygeneTest; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test; @@ -33,7 +34,6 @@ import org.apache.polygene.api.service.ServiceImporterException; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ImportedServiceDeclaration; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; /** * JAVADOC http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java b/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java index 92b517c..c504baf 100644 --- a/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java +++ b/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java @@ -24,6 +24,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; +import org.apache.polygene.test.AbstractPolygeneTest; import org.junit.BeforeClass; import org.junit.Test; import org.apache.polygene.api.concern.Concerns; @@ -31,7 +32,6 @@ import org.apache.polygene.api.concern.GenericConcern; import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.test.AbstractPolygeneTest; import static org.hamcrest.core.IsNull.notNullValue; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/spi/src/main/java/org/apache/polygene/spi/PolygeneSPI.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/polygene/spi/PolygeneSPI.java b/core/spi/src/main/java/org/apache/polygene/spi/PolygeneSPI.java new file mode 100644 index 0000000..b8571aa --- /dev/null +++ b/core/spi/src/main/java/org/apache/polygene/spi/PolygeneSPI.java @@ -0,0 +1,75 @@ +/* + * 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.spi; + +import java.util.Map; +import java.util.stream.Stream; +import org.apache.polygene.api.PolygeneAPI; +import org.apache.polygene.api.association.Association; +import org.apache.polygene.api.association.AssociationStateHolder; +import org.apache.polygene.api.association.ManyAssociation; +import org.apache.polygene.api.association.NamedAssociation; +import org.apache.polygene.api.composite.TransientComposite; +import org.apache.polygene.api.entity.EntityComposite; +import org.apache.polygene.api.entity.EntityReference; +import org.apache.polygene.api.property.StateHolder; +import org.apache.polygene.api.value.ValueComposite; +import org.apache.polygene.spi.entity.EntityState; + +/** + * Encapsulation of the Polygene SPI. This is implemented by the runtime. + */ +public interface PolygeneSPI + extends PolygeneAPI +{ + StateHolder stateOf( TransientComposite composite ); + + AssociationStateHolder stateOf( EntityComposite composite ); + + AssociationStateHolder stateOf( ValueComposite composite ); + + // Entities + EntityState entityStateOf( EntityComposite composite ); + + /** + * Fetches the EntityReference without loading the referenced entity. + * + * @param assoc The Association for which we want to obtain the EntityReference + * @return The EntityReference of the given Association. + */ + EntityReference entityReferenceOf( Association<?> assoc ); + + /** + * Fetches the EntityReferences without loading the referenced entities. + * + * @param assoc The ManyAssociation for which we want to obtain the EntityReferences. + * @return A stream of all the EntityReferences of the given ManyAssociation. + */ + Stream<EntityReference> entityReferencesOf( ManyAssociation<?> assoc ); + + /** + * Fetches the EntityReferences without loading the referenced entities. + * + * @param assoc The NamedAssociation for which we want to obtain the EntityReference + * @return A stream of Map.Entry with the names and EntityReferences of the given NamedAssociation. + */ + Stream<Map.Entry<String, EntityReference>> entityReferencesOf( NamedAssociation<?> assoc ); +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/spi/src/main/java/org/apache/polygene/spi/ZestSPI.java ---------------------------------------------------------------------- diff --git a/core/spi/src/main/java/org/apache/polygene/spi/ZestSPI.java b/core/spi/src/main/java/org/apache/polygene/spi/ZestSPI.java deleted file mode 100644 index b8571aa..0000000 --- a/core/spi/src/main/java/org/apache/polygene/spi/ZestSPI.java +++ /dev/null @@ -1,75 +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.spi; - -import java.util.Map; -import java.util.stream.Stream; -import org.apache.polygene.api.PolygeneAPI; -import org.apache.polygene.api.association.Association; -import org.apache.polygene.api.association.AssociationStateHolder; -import org.apache.polygene.api.association.ManyAssociation; -import org.apache.polygene.api.association.NamedAssociation; -import org.apache.polygene.api.composite.TransientComposite; -import org.apache.polygene.api.entity.EntityComposite; -import org.apache.polygene.api.entity.EntityReference; -import org.apache.polygene.api.property.StateHolder; -import org.apache.polygene.api.value.ValueComposite; -import org.apache.polygene.spi.entity.EntityState; - -/** - * Encapsulation of the Polygene SPI. This is implemented by the runtime. - */ -public interface PolygeneSPI - extends PolygeneAPI -{ - StateHolder stateOf( TransientComposite composite ); - - AssociationStateHolder stateOf( EntityComposite composite ); - - AssociationStateHolder stateOf( ValueComposite composite ); - - // Entities - EntityState entityStateOf( EntityComposite composite ); - - /** - * Fetches the EntityReference without loading the referenced entity. - * - * @param assoc The Association for which we want to obtain the EntityReference - * @return The EntityReference of the given Association. - */ - EntityReference entityReferenceOf( Association<?> assoc ); - - /** - * Fetches the EntityReferences without loading the referenced entities. - * - * @param assoc The ManyAssociation for which we want to obtain the EntityReferences. - * @return A stream of all the EntityReferences of the given ManyAssociation. - */ - Stream<EntityReference> entityReferencesOf( ManyAssociation<?> assoc ); - - /** - * Fetches the EntityReferences without loading the referenced entities. - * - * @param assoc The NamedAssociation for which we want to obtain the EntityReference - * @return A stream of Map.Entry with the names and EntityReferences of the given NamedAssociation. - */ - Stream<Map.Entry<String, EntityReference>> entityReferencesOf( NamedAssociation<?> assoc ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java new file mode 100644 index 0000000..18e1c24 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java @@ -0,0 +1,135 @@ +/* + * 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; + +import org.apache.polygene.test.util.NotYetImplemented; +import org.junit.After; +import org.junit.Before; +import org.apache.polygene.api.PolygeneAPI; +import org.apache.polygene.api.structure.Application; +import org.apache.polygene.api.structure.ApplicationDescriptor; +import org.apache.polygene.bootstrap.ApplicationAssembler; +import org.apache.polygene.bootstrap.ApplicationAssembly; +import org.apache.polygene.bootstrap.ApplicationAssemblyFactory; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.Energy4Java; +import org.apache.polygene.spi.PolygeneSPI; +import org.junit.Rule; + +public abstract class AbstractPolygeneBaseTest +{ + @Rule public NotYetImplemented.Rule notYetImplementedRule = new NotYetImplemented.Rule(); + + protected PolygeneAPI api; + protected PolygeneSPI spi; + + protected Energy4Java polygene; + protected ApplicationDescriptor applicationModel; + protected Application application; + + @Before + public void setUp() + throws Exception + { + polygene = new Energy4Java(); + applicationModel = newApplication(); + if( applicationModel == null ) + { + // An AssemblyException has occurred that the Test wants to check for. + return; + } + application = newApplicationInstance( applicationModel ); + initApplication( application ); + api = spi = polygene.spi(); + application.activate(); + } + + /** Called by the superclass for the test to define the entire application, every layer, every module and all + * the contents of each module. + * + * @param applicationAssembly the {@link org.apache.polygene.bootstrap.ApplicationAssembly} to be populated. + * + * @throws AssemblyException on invalid assembly + */ + protected abstract void defineApplication( ApplicationAssembly applicationAssembly ) + throws AssemblyException; + + protected Application newApplicationInstance( ApplicationDescriptor applicationModel ) + { + return applicationModel.newInstance( polygene.api() ); + } + + protected ApplicationDescriptor newApplication() + throws AssemblyException + { + ApplicationAssembler assembler = new ApplicationAssembler() + { + @Override + public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory ) + throws AssemblyException + { + ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly(); + applicationAssembly.setMode( Application.Mode.test ); + defineApplication( applicationAssembly ); + return applicationAssembly; + } + }; + + try + { + return polygene.newApplicationModel( assembler ); + } + catch( AssemblyException e ) + { + assemblyException( e ); + return null; + } + } + + /** + * This method is called when there was an AssemblyException in the creation of the Polygene application model. + * <p> + * Override this method to catch valid failures to place into satisfiedBy suites. + * </p> + * @param exception the exception thrown. + * + * @throws org.apache.polygene.bootstrap.AssemblyException The default implementation of this method will simply re-throw the exception. + */ + protected void assemblyException( AssemblyException exception ) + throws AssemblyException + { + throw exception; + } + + protected void initApplication( Application app ) + throws Exception + { + } + + @After + public void tearDown() + throws Exception + { + if( application != null ) + { + application.passivate(); + } + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneScenarioTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneScenarioTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneScenarioTest.java new file mode 100644 index 0000000..4f85962 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneScenarioTest.java @@ -0,0 +1,142 @@ +/* + * 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; + +import org.apache.polygene.api.PolygeneAPI; +import org.apache.polygene.api.structure.Application; +import org.apache.polygene.api.structure.ApplicationDescriptor; +import org.apache.polygene.api.structure.Module; +import org.apache.polygene.api.unitofwork.UnitOfWork; +import org.apache.polygene.api.unitofwork.UnitOfWorkFactory; +import org.apache.polygene.bootstrap.ApplicationAssembler; +import org.apache.polygene.bootstrap.Assembler; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.Energy4Java; +import org.apache.polygene.spi.PolygeneSPI; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * Base class for Polygene scenario tests. This will create one Polygene application per class instead of per test. + */ +public abstract class AbstractPolygeneScenarioTest + implements Assembler +{ + static protected PolygeneAPI api; + static protected PolygeneSPI spi; + + static protected Energy4Java polygene; + static protected ApplicationDescriptor applicationModel; + static protected Application application; + + static protected Module module; + + static protected Assembler assembler; // Initialize this in static block of subclass + private static UnitOfWorkFactory uowf; + + @BeforeClass + public static void setUp() + throws Exception + { + polygene = new Energy4Java(); + applicationModel = newApplication(); + if( applicationModel == null ) + { + // An AssemblyException has occurred that the Test wants to check for. + return; + } + application = applicationModel.newInstance( polygene.spi() ); + initApplication( application ); + api = spi = polygene.spi(); + application.activate(); + + // Assume only one module + module = application.findModule( "Layer 1", "Module 1" ); + uowf = module.unitOfWorkFactory(); + } + + static protected ApplicationDescriptor newApplication() + throws AssemblyException + { + final Assembler asm = assembler; + + ApplicationAssembler assembler = applicationFactory -> applicationFactory.newApplicationAssembly( asm ); + try + { + return polygene.newApplicationModel( assembler ); + } + catch( AssemblyException e ) + { + assemblyException( e ); + return null; + } + } + + /** + * This method is called when there was an AssemblyException in the creation of the Polygene application model. + * <p> + * Override this method to catch valid failures to place into satisfiedBy suites. + * </p> + * + * @param exception the exception thrown. + * + * @throws org.apache.polygene.bootstrap.AssemblyException The default implementation of this method will simply re-throw the exception. + */ + static protected void assemblyException( AssemblyException exception ) + throws AssemblyException + { + throw exception; + } + + static protected void initApplication( Application app ) + throws Exception + { + } + + @AfterClass + public void tearDown() + throws Exception + { + if( uowf != null && uowf.isUnitOfWorkActive() ) + { + while( uowf.isUnitOfWorkActive() ) + { + UnitOfWork uow = uowf.currentUnitOfWork(); + if( uow.isOpen() ) + { + uow.discard(); + } + else + { + throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened. First is" + uow + .usecase() + .name() ); + } + } + new Exception( "UnitOfWork not properly cleaned up" ).printStackTrace(); + } + + if( application != null ) + { + application.passivate(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneTest.java new file mode 100644 index 0000000..db3c8d8 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneTest.java @@ -0,0 +1,120 @@ +/* + * 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; + +import org.apache.polygene.api.composite.TransientBuilderFactory; +import org.apache.polygene.api.injection.scope.Structure; +import org.apache.polygene.api.object.ObjectFactory; +import org.apache.polygene.api.query.QueryBuilderFactory; +import org.apache.polygene.api.service.ServiceFinder; +import org.apache.polygene.api.structure.Module; +import org.apache.polygene.api.structure.ModuleDescriptor; +import org.apache.polygene.api.unitofwork.UnitOfWork; +import org.apache.polygene.api.unitofwork.UnitOfWorkFactory; +import org.apache.polygene.api.value.ValueBuilderFactory; +import org.apache.polygene.bootstrap.ApplicationAssembly; +import org.apache.polygene.bootstrap.Assembler; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.LayerAssembly; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler; +import org.junit.After; +import org.junit.Before; + +/** + * Base class for Composite tests. + */ +public abstract class AbstractPolygeneTest extends AbstractPolygeneBaseTest + implements Assembler +{ + @Structure + protected UnitOfWorkFactory unitOfWorkFactory; + + @Structure + protected TransientBuilderFactory transientBuilderFactory; + + @Structure + protected ValueBuilderFactory valueBuilderFactory; + + @Structure + protected ServiceFinder serviceFinder; + + @Structure + protected ObjectFactory objectFactory; + + @Structure + protected QueryBuilderFactory queryBuilderFactory; + + @Structure + protected ModuleDescriptor module; + + @Before + @Override + public void setUp() + throws Exception + { + super.setUp(); + if( application == null ) + { + return; // failure in Assembly. + } + Module module = application.findModule( "Layer 1", "Module 1" ); + module.injectTo( this ); + } + + @Override + protected void defineApplication( ApplicationAssembly applicationAssembly ) + throws AssemblyException + { + LayerAssembly layer = applicationAssembly.layer( "Layer 1" ); + ModuleAssembly module = layer.module( "Module 1" ); + new DefaultUnitOfWorkAssembler().assemble( module ); + module.objects( AbstractPolygeneTest.this.getClass() ); + assemble( module ); + } + + @After + @Override + public void tearDown() + throws Exception + { + if( unitOfWorkFactory != null && unitOfWorkFactory.isUnitOfWorkActive() ) + { + while( unitOfWorkFactory.isUnitOfWorkActive() ) + { + UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork(); + if( uow.isOpen() ) + { + System.err.println( "UnitOfWork not cleaned up:" + uow.usecase().name() ); + uow.discard(); + } + else + { + throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened. First is: " + uow + .usecase() + .name() ); + } + } + new Exception( "UnitOfWork not properly cleaned up" ).printStackTrace(); + } + super.tearDown(); + } +} \ No newline at end of file
