Repository: zest-java Updated Branches: refs/heads/ZEST-132 5d2a62bef -> 6138c3057
Multi Layer abstract test framework for indexing in multi-layered applications, as it should work. Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/6138c305 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/6138c305 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/6138c305 Branch: refs/heads/ZEST-132 Commit: 6138c3057cb6a8546ca4d026fd30f26efa7bcfc0 Parents: 5d2a62b Author: Niclas Hedhman <[email protected]> Authored: Tue Dec 15 12:17:55 2015 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Tue Dec 15 12:17:55 2015 +0800 ---------------------------------------------------------------------- .../layered/LayeredLayerAssembler.java | 2 +- .../AbstractMultiLayeredIndexingTest.java | 86 ++++++++++++++------ .../zest/test/indexing/layered/AccessLayer.java | 39 --------- .../test/indexing/layered/AccountModule.java | 52 ------------ .../indexing/layered/ApplicationAssembler.java | 52 ------------ .../zest/test/indexing/layered/ConfigLayer.java | 37 --------- .../test/indexing/layered/ConfigModule.java | 41 ---------- .../zest/test/indexing/layered/DomainLayer.java | 38 --------- .../test/indexing/layered/FamilyModule.java | 54 ------------ .../test/indexing/layered/IndexingLayer.java | 37 --------- .../test/indexing/layered/PersistenceLayer.java | 37 --------- .../indexing/layered/PersistenceModule.java | 44 ---------- .../zest/test/indexing/layered/Suite1Case1.java | 76 +++++++++++++++++ .../zest/test/indexing/layered/Suite1Case2.java | 76 +++++++++++++++++ .../zest/test/indexing/layered/TestCase.java | 2 +- .../zest/test/indexing/layered/TestCase1.java | 76 ----------------- .../zest/test/indexing/layered/TestCase2.java | 76 ----------------- .../test/indexing/layered/TestSuite1Module.java | 40 --------- .../test/indexing/layered/TestSuite2Module.java | 38 --------- .../test/indexing/layered/TestSuite3Module.java | 38 --------- .../indexing/layered/assembly/AccessLayer.java | 65 +++++++++++++++ .../layered/assembly/AccountModule.java | 52 ++++++++++++ .../layered/assembly/ApplicationAssembler.java | 71 ++++++++++++++++ .../indexing/layered/assembly/ConfigLayer.java | 37 +++++++++ .../indexing/layered/assembly/ConfigModule.java | 41 ++++++++++ .../indexing/layered/assembly/DomainLayer.java | 38 +++++++++ .../indexing/layered/assembly/FamilyModule.java | 54 ++++++++++++ .../layered/assembly/IndexingLayer.java | 38 +++++++++ .../layered/assembly/PersistenceLayer.java | 37 +++++++++ .../layered/assembly/PersistenceModule.java | 44 ++++++++++ .../layered/assembly/TestExecutionModule.java | 46 +++++++++++ .../layered/assembly/TestSuite1Module.java | 53 ++++++++++++ .../layered/assembly/TestSuite2Module.java | 38 +++++++++ .../layered/assembly/TestSuite3Module.java | 38 +++++++++ 34 files changed, 867 insertions(+), 726 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java index 898591e..ccec8d2 100644 --- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java +++ b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java @@ -60,7 +60,7 @@ public abstract class LayeredLayerAssembler return moduleName; } - private ModuleAssembler instantiateAssembler( LayerAssembly layer, + protected ModuleAssembler instantiateAssembler( LayerAssembly layer, Class<? extends ModuleAssembler> modulerAssemblerClass ) throws InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException, NoSuchMethodException http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AbstractMultiLayeredIndexingTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AbstractMultiLayeredIndexingTest.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AbstractMultiLayeredIndexingTest.java index 7a55fe0..a4f6790 100644 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AbstractMultiLayeredIndexingTest.java +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AbstractMultiLayeredIndexingTest.java @@ -21,23 +21,51 @@ package org.apache.zest.test.indexing.layered; import org.apache.zest.api.activation.ActivationException; +import org.apache.zest.api.common.Optional; +import org.apache.zest.api.injection.scope.Service; +import org.apache.zest.api.injection.scope.Structure; import org.apache.zest.api.service.ServiceReference; +import org.apache.zest.api.service.qualifier.Tagged; import org.apache.zest.api.structure.Application; import org.apache.zest.api.structure.Module; +import org.apache.zest.api.unitofwork.UnitOfWork; +import org.apache.zest.api.unitofwork.UnitOfWorkFactory; +import org.apache.zest.api.usecase.UsecaseBuilder; import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.layered.ModuleAssembler; import org.apache.zest.test.indexing.TestData; +import org.apache.zest.test.indexing.layered.assembly.ApplicationAssembler; import org.junit.Before; import org.junit.Test; public abstract class AbstractMultiLayeredIndexingTest { - static Class<? extends ModuleAssembler> indexingAssembler; + public static Class<? extends ModuleAssembler> indexingAssembler; protected Application application; - private Iterable<ServiceReference<TestCase>> suite1; - private Iterable<ServiceReference<TestCase>> suite2; - private Iterable<ServiceReference<TestCase>> suite3; + + @Structure + private UnitOfWorkFactory uowf; + + @Optional + @Service + @Tagged( "Suite1Case1" ) + private ServiceReference<TestCase> suite1Case1; + + @Optional + @Service + @Tagged( "Suite1Case2" ) + private ServiceReference<TestCase> suite1Case2; + + @Optional + @Service + @Tagged( "Suite2Case1" ) + private ServiceReference<TestCase> suite2Case1; + + @Optional + @Service + @Tagged( "Suite3Case1" ) + private ServiceReference<TestCase> suite3Case1; public AbstractMultiLayeredIndexingTest( Class<? extends ModuleAssembler> indexingAssembler ) { @@ -49,53 +77,61 @@ public abstract class AbstractMultiLayeredIndexingTest throws AssemblyException, ActivationException { ApplicationAssembler assembler = - new ApplicationAssembler( "Multi Layered Indexing Test", "1.0", Application.Mode.development ); + new ApplicationAssembler( "Multi Layered Indexing Test", "1.0", Application.Mode.development, getClass() ); assembler.initialize(); assembler.start(); application = assembler.application(); Module familyModule = application.findModule( "Domain Layer", "Family Module" ); TestData.populate( familyModule ); - Module suite1Module = application.findModule( "Access Layer", "TestSuite1 Module" ); - suite1 = suite1Module.findServices( TestCase.class ); - - Module suite2Module = application.findModule( "Access Layer", "TestSuite2 Module" ); - suite2 = suite2Module.findServices( TestCase.class ); + Module executionModule = application.findModule( "Access Layer", "TestExecution Module" ); + executionModule.injectTo( this ); + } - Module suite3Module = application.findModule( "Access Layer", "TestSuite3 Module" ); - suite3 = suite3Module.findServices( TestCase.class ); + @Test + public void suite1Case1() + throws Exception + { + runTest( suite1Case1, "suite1Case1" ); } @Test - public void suite1Tests() + public void suite1Case2() throws Exception { - Iterable<ServiceReference<TestCase>> suite = this.suite1; - runTest( suite ); + runTest( suite1Case2, "suite1Case2" ); } @Test - public void suite2Tests() + public void suite2Case1() throws Exception { - runTest( suite2 ); + runTest( suite2Case1, "suite2Case1" ); } @Test - public void suite3Tests() + public void suite3Case1() throws Exception { - runTest( suite3 ); + runTest( suite3Case1, "suite3Case1" ); } - private void runTest( Iterable<ServiceReference<TestCase>> suite ) + private void runTest( ServiceReference<TestCase> testCaseRef, String testName ) throws Exception { - for( ServiceReference<TestCase> ref : suite ) + if( testCaseRef == null ) + { + System.err.println( "TestCase is not defined." ); + } + else { - TestCase testCase = ref.get(); - testCase.when(); - testCase.given(); - testCase.expect(); + TestCase testCase = testCaseRef.get(); + try(UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( testName ) )) + { + testCase.given(); + testCase.when(); + testCase.expect(); + uow.complete(); + } } } } http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AccessLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AccessLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AccessLayer.java deleted file mode 100644 index 6b1b4e7..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AccessLayer.java +++ /dev/null @@ -1,39 +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.zest.test.indexing.layered; - -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; - -class AccessLayer extends LayeredLayerAssembler -{ - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - throws AssemblyException - { - createModule( layer, TestSuite1Module.class ); - createModule( layer, TestSuite2Module.class ); - createModule( layer, TestSuite3Module.class ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AccountModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AccountModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AccountModule.java deleted file mode 100644 index 0df4aee..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/AccountModule.java +++ /dev/null @@ -1,52 +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.zest.test.indexing.layered; - -import org.apache.zest.api.common.Visibility; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.layered.ModuleAssembler; -import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; -import org.apache.zest.test.indexing.model.Account; -import org.apache.zest.test.indexing.model.Domain; -import org.apache.zest.test.indexing.model.File; -import org.apache.zest.test.indexing.model.Host; -import org.apache.zest.test.indexing.model.Port; -import org.apache.zest.test.indexing.model.Protocol; -import org.apache.zest.test.indexing.model.QueryParam; -import org.apache.zest.test.indexing.model.URL; - -class AccountModule - implements ModuleAssembler -{ - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.entities( Account.class, Domain.class ).visibleIn( Visibility.layer ); - module.values( File.class, Host.class, Port.class, Protocol.class, QueryParam.class, URL.class ) - .visibleIn( Visibility.layer ); - module.services( UuidIdentityGeneratorService.class ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ApplicationAssembler.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ApplicationAssembler.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ApplicationAssembler.java deleted file mode 100644 index 1b11738..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ApplicationAssembler.java +++ /dev/null @@ -1,52 +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.zest.test.indexing.layered; - -import org.apache.zest.api.structure.Application; -import org.apache.zest.bootstrap.ApplicationAssembly; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler; - -class ApplicationAssembler extends LayeredApplicationAssembler -{ - - public ApplicationAssembler( String name, String version, Application.Mode mode ) - throws AssemblyException - { - super( name, version, mode ); - } - - @Override - protected void assembleLayers( ApplicationAssembly assembly ) - throws AssemblyException - { - LayerAssembly accessLayer = createLayer( AccessLayer.class ); - LayerAssembly domainLayer = createLayer( DomainLayer.class ); - LayerAssembly persistenceLayer = createLayer( PersistenceLayer.class ); - LayerAssembly indexingLayer = createLayer( IndexingLayer.class ); - LayerAssembly configLayer = createLayer( ConfigLayer.class ); - accessLayer.uses( domainLayer ); - domainLayer.uses( persistenceLayer, indexingLayer ); - persistenceLayer.uses( configLayer ); - indexingLayer.uses( configLayer ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ConfigLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ConfigLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ConfigLayer.java deleted file mode 100644 index 0b4fada..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ConfigLayer.java +++ /dev/null @@ -1,37 +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.zest.test.indexing.layered; - -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; - -class ConfigLayer extends LayeredLayerAssembler -{ - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - throws AssemblyException - { - createModule( layer, ConfigModule.class ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ConfigModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ConfigModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ConfigModule.java deleted file mode 100644 index 00265f6..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/ConfigModule.java +++ /dev/null @@ -1,41 +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.zest.test.indexing.layered; - -import org.apache.zest.api.common.Visibility; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.layered.ModuleAssembler; -import org.apache.zest.entitystore.memory.MemoryEntityStoreService; - -class ConfigModule - implements ModuleAssembler -{ - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.application ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/DomainLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/DomainLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/DomainLayer.java deleted file mode 100644 index 5704d48..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/DomainLayer.java +++ /dev/null @@ -1,38 +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.zest.test.indexing.layered; - -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; - -class DomainLayer extends LayeredLayerAssembler -{ - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - throws AssemblyException - { - createModule( layer, FamilyModule.class ); - createModule( layer, AccountModule.class ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/FamilyModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/FamilyModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/FamilyModule.java deleted file mode 100644 index 56a4939..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/FamilyModule.java +++ /dev/null @@ -1,54 +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.zest.test.indexing.layered; - -import org.apache.zest.api.common.Visibility; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.layered.ModuleAssembler; -import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; -import org.apache.zest.test.indexing.model.Address; -import org.apache.zest.test.indexing.model.Cat; -import org.apache.zest.test.indexing.model.City; -import org.apache.zest.test.indexing.model.Dog; -import org.apache.zest.test.indexing.model.Female; -import org.apache.zest.test.indexing.model.Male; - -class FamilyModule - implements ModuleAssembler -{ - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.entities( Male.class, - Female.class, - City.class, - Cat.class, - Dog.class ).visibleIn( Visibility.application ); - - module.values( Address.class ).visibleIn( Visibility.application ); - module.services( UuidIdentityGeneratorService.class ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/IndexingLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/IndexingLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/IndexingLayer.java deleted file mode 100644 index 489092d..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/IndexingLayer.java +++ /dev/null @@ -1,37 +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.zest.test.indexing.layered; - -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; - -class IndexingLayer extends LayeredLayerAssembler -{ - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - throws AssemblyException - { - createModule( layer, AbstractMultiLayeredIndexingTest.indexingAssembler ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/PersistenceLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/PersistenceLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/PersistenceLayer.java deleted file mode 100644 index cc22513..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/PersistenceLayer.java +++ /dev/null @@ -1,37 +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.zest.test.indexing.layered; - -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; - -class PersistenceLayer extends LayeredLayerAssembler -{ - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - throws AssemblyException - { - createModule( layer, PersistenceModule.class ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/PersistenceModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/PersistenceModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/PersistenceModule.java deleted file mode 100644 index 0b92f56..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/PersistenceModule.java +++ /dev/null @@ -1,44 +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.zest.test.indexing.layered; - -import org.apache.zest.api.common.Visibility; -import org.apache.zest.api.value.ValueSerialization; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.layered.ModuleAssembler; -import org.apache.zest.entitystore.memory.MemoryEntityStoreService; -import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService; - -class PersistenceModule - implements ModuleAssembler -{ - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.application ); - module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/Suite1Case1.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/Suite1Case1.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/Suite1Case1.java new file mode 100644 index 0000000..366533d --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/Suite1Case1.java @@ -0,0 +1,76 @@ +/* + * 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.zest.test.indexing.layered; + +import org.apache.zest.api.injection.scope.Structure; +import org.apache.zest.api.query.Query; +import org.apache.zest.api.query.QueryBuilder; +import org.apache.zest.api.query.QueryBuilderFactory; +import org.apache.zest.api.query.QueryExpressions; +import org.apache.zest.api.unitofwork.UnitOfWork; +import org.apache.zest.api.unitofwork.UnitOfWorkFactory; +import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation; +import org.apache.zest.test.indexing.model.Male; +import org.apache.zest.test.indexing.model.Person; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +public class Suite1Case1 + implements TestCase +{ + @Structure + private UnitOfWorkFactory uowf; + + @Structure + private QueryBuilderFactory qbf; + + private QueryBuilder<Male> builder; + + private Query<Male> query; + + @Override + public void given() + throws Exception + { + QueryBuilder<Male> qb = qbf.newQueryBuilder( Male.class ); + Male prototype = QueryExpressions.templateFor( Male.class ); + builder = qb.where( QueryExpressions.eq(prototype.name(), "Joe Doe" ) ); + } + + @Override + public void when() + throws Exception + { + UnitOfWork uow = uowf.currentUnitOfWork(); + query = uow.newQuery( builder ); + } + + @Override + public void expect() + throws Exception + { + assertThat( query.count(), equalTo(1) ); + Male male = query.find(); + assertThat( male.title().get(), equalTo( Person.Title.MR )); + assertThat( male.name().get(), equalTo( "Joe Doe" )); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/Suite1Case2.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/Suite1Case2.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/Suite1Case2.java new file mode 100644 index 0000000..cdc4dc2 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/Suite1Case2.java @@ -0,0 +1,76 @@ +/* + * 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.zest.test.indexing.layered; + +import org.apache.zest.api.injection.scope.Structure; +import org.apache.zest.api.query.Query; +import org.apache.zest.api.query.QueryBuilder; +import org.apache.zest.api.query.QueryBuilderFactory; +import org.apache.zest.api.query.QueryExpressions; +import org.apache.zest.api.unitofwork.UnitOfWork; +import org.apache.zest.api.unitofwork.UnitOfWorkFactory; +import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation; +import org.apache.zest.test.indexing.model.Male; +import org.apache.zest.test.indexing.model.Person; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +public class Suite1Case2 + implements TestCase +{ + @Structure + private UnitOfWorkFactory uowf; + + @Structure + private QueryBuilderFactory qbf; + + private QueryBuilder<Male> builder; + + private Query<Male> query; + + @Override + public void given() + throws Exception + { + QueryBuilder<Male> qb = qbf.newQueryBuilder( Male.class ); + Male prototype = QueryExpressions.templateFor( Male.class ); + builder = qb.where( QueryExpressions.eq(prototype.name(), "Joe Doe" ) ); + } + + @Override + @UnitOfWorkPropagation + public void when() + throws Exception + { + UnitOfWork uow = uowf.currentUnitOfWork(); + query = uow.newQuery( builder ); + } + + @Override + public void expect() + throws Exception + { + assertThat( query.count(), equalTo(1) ); + Male male = query.find(); + assertThat( male.title().get(), equalTo( Person.Title.MR )); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase.java index 5dd2e71..b5e0bc4 100644 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase.java +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase.java @@ -20,7 +20,7 @@ package org.apache.zest.test.indexing.layered; -interface TestCase +public interface TestCase { void given() throws Exception; http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase1.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase1.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase1.java deleted file mode 100644 index e2dd860..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase1.java +++ /dev/null @@ -1,76 +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.zest.test.indexing.layered; - -import org.apache.zest.api.injection.scope.Structure; -import org.apache.zest.api.query.Query; -import org.apache.zest.api.query.QueryBuilder; -import org.apache.zest.api.query.QueryBuilderFactory; -import org.apache.zest.api.query.QueryExpressions; -import org.apache.zest.api.unitofwork.UnitOfWork; -import org.apache.zest.api.unitofwork.UnitOfWorkFactory; -import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation; -import org.apache.zest.test.indexing.model.Male; -import org.apache.zest.test.indexing.model.Person; - -import static org.hamcrest.core.IsEqual.equalTo; -import static org.junit.Assert.assertThat; - -public class TestCase1 - implements TestCase -{ - @Structure - private UnitOfWorkFactory uowf; - - @Structure - private QueryBuilderFactory qbf; - - private QueryBuilder<Male> builder; - - private Query<Male> query; - - @Override - public void given() - throws Exception - { - QueryBuilder<Male> qb = qbf.newQueryBuilder( Male.class ); - Male prototype = QueryExpressions.templateFor( Male.class ); - builder = qb.where( QueryExpressions.eq(prototype.name(), "Joe Doe" ) ); - } - - @Override - @UnitOfWorkPropagation - public void when() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - query = uow.newQuery( builder ); - } - - @Override - public void expect() - throws Exception - { - assertThat( query.count(), equalTo(1) ); - Male male = query.find(); - assertThat( male.title().get(), equalTo( Person.Title.MR )); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase2.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase2.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase2.java deleted file mode 100644 index dcd448a..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestCase2.java +++ /dev/null @@ -1,76 +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.zest.test.indexing.layered; - -import org.apache.zest.api.injection.scope.Structure; -import org.apache.zest.api.query.Query; -import org.apache.zest.api.query.QueryBuilder; -import org.apache.zest.api.query.QueryBuilderFactory; -import org.apache.zest.api.query.QueryExpressions; -import org.apache.zest.api.unitofwork.UnitOfWork; -import org.apache.zest.api.unitofwork.UnitOfWorkFactory; -import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation; -import org.apache.zest.test.indexing.model.Male; -import org.apache.zest.test.indexing.model.Person; - -import static org.hamcrest.core.IsEqual.equalTo; -import static org.junit.Assert.assertThat; - -public class TestCase2 - implements TestCase -{ - @Structure - private UnitOfWorkFactory uowf; - - @Structure - private QueryBuilderFactory qbf; - - private QueryBuilder<Male> builder; - - private Query<Male> query; - - @Override - public void given() - throws Exception - { - QueryBuilder<Male> qb = qbf.newQueryBuilder( Male.class ); - Male prototype = QueryExpressions.templateFor( Male.class ); - builder = qb.where( QueryExpressions.eq(prototype.name(), "Joe Doe" ) ); - } - - @Override - @UnitOfWorkPropagation - public void when() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - query = uow.newQuery( builder ); - } - - @Override - public void expect() - throws Exception - { - assertThat( query.count(), equalTo(1) ); - Male male = query.find(); - assertThat( male.title().get(), equalTo( Person.Title.MR )); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite1Module.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite1Module.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite1Module.java deleted file mode 100644 index 01011db..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite1Module.java +++ /dev/null @@ -1,40 +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.zest.test.indexing.layered; - -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.layered.ModuleAssembler; - -class TestSuite1Module - implements ModuleAssembler -{ - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.services( TestCase.class ).withMixins( TestCase1.class ); - module.services( TestCase.class ).withMixins( TestCase2.class ); - return module; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite2Module.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite2Module.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite2Module.java deleted file mode 100644 index 3d8a9e6..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite2Module.java +++ /dev/null @@ -1,38 +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.zest.test.indexing.layered; - -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.layered.ModuleAssembler; - -class TestSuite2Module - implements ModuleAssembler -{ - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - return module; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite3Module.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite3Module.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite3Module.java deleted file mode 100644 index 2c41329..0000000 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/TestSuite3Module.java +++ /dev/null @@ -1,38 +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.zest.test.indexing.layered; - -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.layered.ModuleAssembler; - -class TestSuite3Module - implements ModuleAssembler -{ - - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - return module; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/AccessLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/AccessLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/AccessLayer.java new file mode 100644 index 0000000..0d349ff --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/AccessLayer.java @@ -0,0 +1,65 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import java.lang.reflect.InvocationTargetException; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; +import org.apache.zest.bootstrap.layered.ModuleAssembler; + +class AccessLayer extends LayeredLayerAssembler +{ + + private final Class<?> testClass; + + AccessLayer( Class<?> testClass ) + { + this.testClass = testClass; + } + + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + createModule( layer, TestExecutionModule.class ); + createModule( layer, TestSuite1Module.class ); + createModule( layer, TestSuite2Module.class ); + createModule( layer, TestSuite3Module.class ); + return layer; + } + + @Override + protected ModuleAssembler instantiateAssembler( LayerAssembly layer, + Class<? extends ModuleAssembler> moduleAssemblerClass + ) + throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException + { + if( moduleAssemblerClass.equals(TestExecutionModule.class)) + { + return new TestExecutionModule( testClass ); + } + else + { + return super.instantiateAssembler( layer, moduleAssemblerClass ); + } + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/AccountModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/AccountModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/AccountModule.java new file mode 100644 index 0000000..d398e6f --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/AccountModule.java @@ -0,0 +1,52 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import org.apache.zest.api.common.Visibility; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; +import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; +import org.apache.zest.test.indexing.model.Account; +import org.apache.zest.test.indexing.model.Domain; +import org.apache.zest.test.indexing.model.File; +import org.apache.zest.test.indexing.model.Host; +import org.apache.zest.test.indexing.model.Port; +import org.apache.zest.test.indexing.model.Protocol; +import org.apache.zest.test.indexing.model.QueryParam; +import org.apache.zest.test.indexing.model.URL; + +class AccountModule + implements ModuleAssembler +{ + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.entities( Account.class, Domain.class ).visibleIn( Visibility.layer ); + module.values( File.class, Host.class, Port.class, Protocol.class, QueryParam.class, URL.class ) + .visibleIn( Visibility.layer ); + module.services( UuidIdentityGeneratorService.class ); + return module; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ApplicationAssembler.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ApplicationAssembler.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ApplicationAssembler.java new file mode 100644 index 0000000..399cc9b --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ApplicationAssembler.java @@ -0,0 +1,71 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import java.lang.reflect.InvocationTargetException; +import org.apache.zest.api.structure.Application; +import org.apache.zest.bootstrap.ApplicationAssembly; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.layered.IllegalLayerAssemblerException; +import org.apache.zest.bootstrap.layered.LayerAssembler; +import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler; + +public class ApplicationAssembler extends LayeredApplicationAssembler +{ + + private final Class<?> testClass; + + public ApplicationAssembler( String name, String version, Application.Mode mode, Class<?> testClass ) + throws AssemblyException + { + super( name, version, mode ); + this.testClass = testClass; + } + + @Override + protected void assembleLayers( ApplicationAssembly assembly ) + throws AssemblyException + { + LayerAssembly accessLayer = createLayer( AccessLayer.class ); + LayerAssembly domainLayer = createLayer( DomainLayer.class ); + LayerAssembly persistenceLayer = createLayer( PersistenceLayer.class ); + LayerAssembly indexingLayer = createLayer( IndexingLayer.class ); + LayerAssembly configLayer = createLayer( ConfigLayer.class ); + accessLayer.uses( domainLayer ); + domainLayer.uses( persistenceLayer, indexingLayer ); + persistenceLayer.uses( configLayer ); + indexingLayer.uses( configLayer ); + } + + @Override + protected <T extends LayerAssembler> LayerAssembler instantiateLayerAssembler( Class<T> layerAssemblerClass, + LayerAssembly layer + ) + throws InstantiationException, IllegalAccessException, InvocationTargetException, IllegalLayerAssemblerException + { + if( layerAssemblerClass.equals( AccessLayer.class )) + { + return new AccessLayer( testClass ); + } + return super.instantiateLayerAssembler( layerAssemblerClass, layer ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ConfigLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ConfigLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ConfigLayer.java new file mode 100644 index 0000000..04c732c --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ConfigLayer.java @@ -0,0 +1,37 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; + +class ConfigLayer extends LayeredLayerAssembler +{ + + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + createModule( layer, ConfigModule.class ); + return layer; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ConfigModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ConfigModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ConfigModule.java new file mode 100644 index 0000000..ecd4939 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/ConfigModule.java @@ -0,0 +1,41 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import org.apache.zest.api.common.Visibility; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; +import org.apache.zest.entitystore.memory.MemoryEntityStoreService; + +class ConfigModule + implements ModuleAssembler +{ + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.application ); + return module; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/DomainLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/DomainLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/DomainLayer.java new file mode 100644 index 0000000..e5ca391 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/DomainLayer.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.zest.test.indexing.layered.assembly; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; + +class DomainLayer extends LayeredLayerAssembler +{ + + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + createModule( layer, FamilyModule.class ); + createModule( layer, AccountModule.class ); + return layer; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/FamilyModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/FamilyModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/FamilyModule.java new file mode 100644 index 0000000..9e24b3f --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/FamilyModule.java @@ -0,0 +1,54 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import org.apache.zest.api.common.Visibility; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; +import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; +import org.apache.zest.test.indexing.model.Address; +import org.apache.zest.test.indexing.model.Cat; +import org.apache.zest.test.indexing.model.City; +import org.apache.zest.test.indexing.model.Dog; +import org.apache.zest.test.indexing.model.Female; +import org.apache.zest.test.indexing.model.Male; + +class FamilyModule + implements ModuleAssembler +{ + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.entities( Male.class, + Female.class, + City.class, + Cat.class, + Dog.class ).visibleIn( Visibility.application ); + + module.values( Address.class ).visibleIn( Visibility.application ); + module.services( UuidIdentityGeneratorService.class ); + return module; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/IndexingLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/IndexingLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/IndexingLayer.java new file mode 100644 index 0000000..63933ea --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/IndexingLayer.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.zest.test.indexing.layered.assembly; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; +import org.apache.zest.test.indexing.layered.AbstractMultiLayeredIndexingTest; + +class IndexingLayer extends LayeredLayerAssembler +{ + + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + createModule( layer, AbstractMultiLayeredIndexingTest.indexingAssembler ); + return layer; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/PersistenceLayer.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/PersistenceLayer.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/PersistenceLayer.java new file mode 100644 index 0000000..fe0cd25 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/PersistenceLayer.java @@ -0,0 +1,37 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; + +class PersistenceLayer extends LayeredLayerAssembler +{ + + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + createModule( layer, PersistenceModule.class ); + return layer; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/PersistenceModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/PersistenceModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/PersistenceModule.java new file mode 100644 index 0000000..b6ae1e7 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/PersistenceModule.java @@ -0,0 +1,44 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import org.apache.zest.api.common.Visibility; +import org.apache.zest.api.value.ValueSerialization; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; +import org.apache.zest.entitystore.memory.MemoryEntityStoreService; +import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService; + +class PersistenceModule + implements ModuleAssembler +{ + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON ); + module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.application ); + return module; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestExecutionModule.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestExecutionModule.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestExecutionModule.java new file mode 100644 index 0000000..bf3fe2b --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestExecutionModule.java @@ -0,0 +1,46 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import org.apache.zest.api.common.Visibility; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; + +public class TestExecutionModule + implements ModuleAssembler +{ + private final Class<?> testClass; + + public TestExecutionModule( Class<?> testClass) + { + this.testClass = testClass; + } + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.objects( testClass ).visibleIn( Visibility.layer ); + return module; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite1Module.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite1Module.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite1Module.java new file mode 100644 index 0000000..efcb64b --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite1Module.java @@ -0,0 +1,53 @@ +/* + * 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.zest.test.indexing.layered.assembly; + +import org.apache.zest.api.common.Visibility; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; +import org.apache.zest.test.indexing.layered.Suite1Case1; +import org.apache.zest.test.indexing.layered.Suite1Case2; +import org.apache.zest.test.indexing.layered.TestCase; + +class TestSuite1Module + implements ModuleAssembler +{ + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + declareTestCase( module, Suite1Case1.class ); + declareTestCase( module, Suite1Case2.class ); + return module; + } + + private void declareTestCase( ModuleAssembly module, Class<?> testcaseMixin ) + { + module.services( TestCase.class ) + .withMixins( testcaseMixin ) + .visibleIn( Visibility.layer ) + .taggedWith( testcaseMixin.getSimpleName() ); + + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite2Module.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite2Module.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite2Module.java new file mode 100644 index 0000000..ac3f655 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite2Module.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.zest.test.indexing.layered.assembly; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; + +class TestSuite2Module + implements ModuleAssembler +{ + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + return module; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/6138c305/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite3Module.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite3Module.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite3Module.java new file mode 100644 index 0000000..f93ddf7 --- /dev/null +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/layered/assembly/TestSuite3Module.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.zest.test.indexing.layered.assembly; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; + +class TestSuite3Module + implements ModuleAssembler +{ + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + return module; + } +}
