Return-Path: X-Original-To: apmail-zest-commits-archive@minotaur.apache.org Delivered-To: apmail-zest-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0812018493 for ; Fri, 31 Jul 2015 02:58:42 +0000 (UTC) Received: (qmail 96788 invoked by uid 500); 31 Jul 2015 02:58:42 -0000 Delivered-To: apmail-zest-commits-archive@zest.apache.org Received: (qmail 96756 invoked by uid 500); 31 Jul 2015 02:58:41 -0000 Mailing-List: contact commits-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list commits@zest.apache.org Received: (qmail 96667 invoked by uid 99); 31 Jul 2015 02:58:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jul 2015 02:58:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C172ADF9F2; Fri, 31 Jul 2015 02:58:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: niclas@apache.org To: commits@zest.apache.org Date: Fri, 31 Jul 2015 02:59:03 -0000 Message-Id: <80791e192ce34d9581f5931d1c2892c0@git.apache.org> In-Reply-To: <5417ada664c9445f83dd797fa0423974@git.apache.org> References: <5417ada664c9445f83dd797fa0423974@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [23/81] [abbrv] [partial] zest-java git commit: First round of changes to move to org.apache.zest namespace. http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java new file mode 100644 index 0000000..504f52d --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java @@ -0,0 +1,441 @@ +/* + * 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.bootstrap; + +import org.apache.zest.api.activation.ActivationException; +import org.apache.zest.api.common.Visibility; +import org.apache.zest.api.property.Property; +import org.apache.zest.api.service.importer.InstanceImporter; +import org.apache.zest.api.service.importer.NewObjectImporter; +import org.apache.zest.api.structure.Application; +import org.apache.zest.api.structure.ApplicationDescriptor; +import org.apache.zest.api.structure.Module; +import org.apache.zest.functional.Iterables; +import org.apache.zest.functional.Specification; + +public class DocumentationSupport +{ + + public static Specification hasMyTypeSpecification = new Specification() + { + + public boolean satisfiedBy( ObjectAssembly item ) + { + return Iterables.toList( item.types() ).contains( String.class ); + } + + }; + + public static class objects + implements Assembler + { + + public static class MyObject {} + + // START SNIPPET: objects + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.objects( MyObject.class ).visibleIn( Visibility.layer ); + } + // END SNIPPET: objects + + } + + public static class transients + implements Assembler + { + + public static interface MyTransient {} + + // START SNIPPET: transients + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.transients( MyTransient.class ).visibleIn( Visibility.layer ); + } + // END SNIPPET: transients + + } + + public static class values + implements Assembler + { + + public static interface MyValue {} + + // START SNIPPET: values + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.values( MyValue.class ).visibleIn( Visibility.layer ); + } + // END SNIPPET: values + + } + + public static class entities + implements Assembler + { + + public static interface MyEntity {} + + // START SNIPPET: entities + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.entities( MyEntity.class ).visibleIn( Visibility.layer ); + } + // END SNIPPET: entities + + } + + public static class services + implements Assembler + { + + public static interface MyService {} + + // START SNIPPET: services + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( MyService.class ).visibleIn( Visibility.layer ); + } + // END SNIPPET: services + + } + + public static class taggedServices + implements Assembler + { + + public static interface MyService {} + + // START SNIPPET: tagged-services + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( MyService.class ).taggedWith( "foo", "bar" ); + } + // END SNIPPET: tagged-services + } + + public static class importedServices + implements Assembler + { + + public static class MyService {} + + // START SNIPPET: imported-services + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.importedServices( MyService.class ). + importedBy( InstanceImporter.class ). + setMetaInfo( new MyService() ); + + // OR + + module.objects( MyService.class ); + module.importedServices( MyService.class ). + importedBy( NewObjectImporter.class ); + } + // END SNIPPET: imported-services + } + + public static class defaultPropertyValues + implements Assembler + { + + public interface MyValue { Property foo(); } + public interface MyEntity { Property cathedral(); } + + // START SNIPPET: properties-defaults + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.values( MyValue.class ); + MyValue myValueDefaults = module.forMixin( MyValue.class ).declareDefaults(); + myValueDefaults.foo().set( "bar" ); + + module.entities( MyEntity.class ); + MyEntity myEntityDefaults = module.forMixin( MyEntity.class ).declareDefaults(); + myEntityDefaults.cathedral().set( "bazar" ); + } + // END SNIPPET: properties-defaults + } + + public static class singleton + { + + public interface MyService { } + public interface Stuff { } + + void singleton() + throws ActivationException, AssemblyException + { + // START SNIPPET: singleton + SingletonAssembler assembler = new SingletonAssembler() + { + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( MyService.class ).identifiedBy( "Foo" ); + module.services( MyService.class ).identifiedBy( "Bar" ); + module.objects( Stuff.class ); + } + + }; + Module module = assembler.module(); + Stuff stuff = module.newObject( Stuff.class ); + // END SNIPPET: singleton + } + + } + + public static class pancake + { + + public static class LoginAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class MenuAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class PerspectivesAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class ViewsAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class ReportingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class PdfAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class BookkeepingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class CashFlowAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class BalanceSheetAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class PricingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class ProductAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } + + private static Energy4Java qi4j; + + // START SNIPPET: pancake + public static void main( String[] args ) + throws Exception + { + qi4j = new Energy4Java(); + Assembler[][][] assemblers = new Assembler[][][]{ + { // View Layer + { // Login Module + new LoginAssembler() + // : + }, + { // Main Workbench Module + new MenuAssembler(), + new PerspectivesAssembler(), + new ViewsAssembler() + // : + }, + { // Printing Module + new ReportingAssembler(), + new PdfAssembler() + // : + } + }, + { // Application Layer + { // Accounting Module + new BookkeepingAssembler(), + new CashFlowAssembler(), + new BalanceSheetAssembler() + // : + }, + { // Inventory Module + new PricingAssembler(), + new ProductAssembler() + // : + } + }, + { // Domain Layer + // : + }, + { // Infrastructure Layer + // : + } + }; + ApplicationDescriptor model = newApplication( assemblers ); + Application runtime = model.newInstance( qi4j.spi() ); + runtime.activate(); + } + + private static ApplicationDescriptor newApplication( final Assembler[][][] assemblers ) + throws AssemblyException + { + return qi4j.newApplicationModel( new ApplicationAssembler() + { + + @Override + public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory ) + throws AssemblyException + { + return appFactory.newApplicationAssembly( assemblers ); + } + + } ); + } + // END SNIPPET: pancake + + } + + public static class full + { + + public static class CustomerViewComposite{} + public static class CustomerEditComposite{} + public static class CustomerListViewComposite{} + public static class CustomerSearchComposite{} + public static class CustomerEntity{} + public static class CountryEntity{} + public static class AddressValue{} + public static class LdapAuthenticationAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class ThrinkAuthorizationAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class UserTrackingAuditAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } } + public static class NeoAssembler implements Assembler{ NeoAssembler( String path ) {} public void assemble( ModuleAssembly module ) throws AssemblyException { } } + + // START SNIPPET: full + private static Energy4Java qi4j; + + private static Application application; + + public static void main( String[] args ) + throws Exception + { + // Create a Zest Runtime + qi4j = new Energy4Java(); + application = qi4j.newApplication( new ApplicationAssembler() + { + + @Override + public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory ) + throws AssemblyException + { + ApplicationAssembly assembly = appFactory.newApplicationAssembly(); + buildAssembly( assembly ); + return assembly; + } + + } ); + // activate the application + application.activate(); + } + + static void buildAssembly( ApplicationAssembly app ) throws AssemblyException + { + LayerAssembly webLayer = createWebLayer( app ); + LayerAssembly domainLayer = createDomainLayer( app ); + LayerAssembly persistenceLayer = createInfrastructureLayer( app ); + LayerAssembly authLayer = createAuth2Layer( app ); + LayerAssembly messagingLayer = createMessagingLayer( app ); + + webLayer.uses( domainLayer ); + domainLayer.uses( authLayer ); + domainLayer.uses( persistenceLayer ); + domainLayer.uses( messagingLayer ); + } + + static LayerAssembly createWebLayer( ApplicationAssembly app ) throws AssemblyException + { + LayerAssembly layer = app.layer( "web-layer" ); + createCustomerWebModule( layer ); + return layer; + } + + static LayerAssembly createDomainLayer( ApplicationAssembly app ) throws AssemblyException + { + LayerAssembly layer = app.layer( "domain-layer" ); + createCustomerDomainModule( layer ); + // : + // : + return layer; + } + + static LayerAssembly createInfrastructureLayer( ApplicationAssembly app ) throws AssemblyException + { + LayerAssembly layer = app.layer( "infrastructure-layer" ); + createPersistenceModule( layer ); + return layer; + } + + static LayerAssembly createMessagingLayer( ApplicationAssembly app ) throws AssemblyException + { + LayerAssembly layer = app.layer( "messaging-layer" ); + createWebServiceModule( layer ); + createMessagingPersistenceModule( layer ); + return layer; + } + + static LayerAssembly createAuth2Layer( ApplicationAssembly application ) throws AssemblyException + { + LayerAssembly layer = application.layer( "auth2-layer" ); + createAuthModule( layer ); + return layer; + } + + static void createCustomerWebModule( LayerAssembly layer ) throws AssemblyException + { + ModuleAssembly assembly = layer.module( "customer-web-module" ); + assembly.transients( CustomerViewComposite.class, CustomerEditComposite.class, + CustomerListViewComposite.class, CustomerSearchComposite.class ); + } + + static void createCustomerDomainModule( LayerAssembly layer ) throws AssemblyException + { + ModuleAssembly assembly = layer.module( "customer-domain-module" ); + assembly.entities( CustomerEntity.class, CountryEntity.class ); + assembly.values( AddressValue.class ); + } + + static void createAuthModule( LayerAssembly layer ) throws AssemblyException + { + ModuleAssembly assembly = layer.module( "auth-module" ); + new LdapAuthenticationAssembler().assemble( assembly ); + new ThrinkAuthorizationAssembler().assemble( assembly ); + new UserTrackingAuditAssembler().assemble( assembly ); + } + + static void createPersistenceModule( LayerAssembly layer ) throws AssemblyException + { + ModuleAssembly assembly = layer.module( "persistence-module" ); + // Someone has created an assembler for the Neo EntityStore + new NeoAssembler( "./neostore" ).assemble( assembly ); + } + + // END SNIPPET: full + private static void createWebServiceModule( LayerAssembly layer ) throws AssemblyException + { + } + + private static void createMessagingPersistenceModule( LayerAssembly layer ) throws AssemblyException + { + } + + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/TestValue.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/TestValue.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/TestValue.java new file mode 100644 index 0000000..7fba35c --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/TestValue.java @@ -0,0 +1,28 @@ +/* + * 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.bootstrap; + +import org.apache.zest.api.value.ValueComposite; + +/** + */ +public interface TestValue + extends ValueComposite +{ +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/LayeredApplicationAssemblerTest.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/LayeredApplicationAssemblerTest.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/LayeredApplicationAssemblerTest.java new file mode 100644 index 0000000..8529ec9 --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/LayeredApplicationAssemblerTest.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.bootstrap.assembly; + +import org.junit.Test; +import org.apache.zest.api.activation.ActivationException; +import org.apache.zest.api.structure.Application; +import org.apache.zest.bootstrap.AssemblyException; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +public class LayeredApplicationAssemblerTest +{ + @Test + public void validateThatAssemblerCreatesApplication() + throws AssemblyException, ActivationException + { + TestApplication assembler = new TestApplication( "Test Application", "1.0.1", Application.Mode.test ); + assembler.start(); + + assertThat( assembler.application().name(), equalTo("Test Application") ); + assertThat( assembler.application().version(), equalTo("1.0.1") ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/TestApplication.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/TestApplication.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/TestApplication.java new file mode 100644 index 0000000..7b4f1ca --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/TestApplication.java @@ -0,0 +1,61 @@ +/* + * 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.bootstrap.assembly; + +import org.apache.zest.api.structure.Application; +import org.apache.zest.bootstrap.ApplicationAssembly; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.assembly.config.ConfigurationLayer; +import org.apache.zest.bootstrap.assembly.connectivity.ConnectivityLayer; +import org.apache.zest.bootstrap.assembly.domain.DomainLayer; +import org.apache.zest.bootstrap.assembly.infrastructure.InfrastructureLayer; +import org.apache.zest.bootstrap.assembly.service.ServiceLayer; + +// START SNIPPET: application +public class TestApplication extends LayeredApplicationAssembler +{ + + public TestApplication( String name, String version, Application.Mode mode ) + throws AssemblyException + { + super( name, version, mode ); + } + + @Override + protected void assembleLayers( ApplicationAssembly assembly ) + throws AssemblyException + { + LayerAssembly configLayer = createLayer( ConfigurationLayer.class ); + ModuleAssembly configModule = configLayer.module( "Configuration Module" ); + LayerAssembly infraLayer = new InfrastructureLayer( configModule ).assemble( assembly.layer( InfrastructureLayer.NAME )); + LayerAssembly domainLayer = createLayer( DomainLayer.class ); + LayerAssembly serviceLayer = createLayer( ServiceLayer.class ); + LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class ); + + connectivityLayer.uses( serviceLayer ); + connectivityLayer.uses( domainLayer ); + serviceLayer.uses( domainLayer ); + domainLayer.uses( infraLayer ); + infraLayer.uses( configLayer ); + } +} +// END SNIPPET: application http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/config/ConfigurationLayer.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/config/ConfigurationLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/config/ConfigurationLayer.java new file mode 100644 index 0000000..8d250ea --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/config/ConfigurationLayer.java @@ -0,0 +1,33 @@ +/* + * 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.bootstrap.assembly.config; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.layered.LayerAssembler; +import org.apache.zest.bootstrap.LayerAssembly; + +public class ConfigurationLayer implements LayerAssembler +{ + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + return layer; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/connectivity/ConnectivityLayer.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/connectivity/ConnectivityLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/connectivity/ConnectivityLayer.java new file mode 100644 index 0000000..570b526 --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/connectivity/ConnectivityLayer.java @@ -0,0 +1,35 @@ +/* + * 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.bootstrap.assembly.connectivity; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.layered.LayerAssembler; +import org.apache.zest.bootstrap.LayerAssembly; + +public class ConnectivityLayer implements LayerAssembler +{ + public static final String NAME = "Connectivity"; + + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + return null; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/DomainLayer.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/DomainLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/DomainLayer.java new file mode 100644 index 0000000..8976987 --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/DomainLayer.java @@ -0,0 +1,35 @@ +/* + * 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.bootstrap.assembly.domain; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; + +public class DomainLayer extends LayeredLayerAssembler +{ + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + createModule( layer, InvoicingModule.class ); + createModule( layer, OrderModule.class ); + return layer; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/InvoicingModule.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/InvoicingModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/InvoicingModule.java new file mode 100644 index 0000000..059416e --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/InvoicingModule.java @@ -0,0 +1,35 @@ +/* + * 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.bootstrap.assembly.domain; + +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 InvoicingModule + 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/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/OrderModule.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/OrderModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/OrderModule.java new file mode 100644 index 0000000..b3cc06b --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/OrderModule.java @@ -0,0 +1,56 @@ +/* + * 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.bootstrap.assembly.domain; + +import org.apache.zest.api.association.Association; +import org.apache.zest.api.property.Property; +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 OrderModule + implements ModuleAssembler +{ + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.entities( Order.class, Customer.class ); + module.values( Address.class ); + return module; + } + + public interface Order + { + Association customer(); + + Property
invoicingAddress(); + + Property
deliveryAddress(); + } + + public interface Customer + { + } + + public interface Address + { + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java new file mode 100644 index 0000000..c641f7b --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java @@ -0,0 +1,43 @@ +/* + * 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.bootstrap.assembly.infrastructure; + +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 IndexingModule + implements ModuleAssembler +{ + public static final String NAME = "Indexing Module"; + private final ModuleAssembly configModule; + + public IndexingModule( ModuleAssembly configModule ) + { + this.configModule = configModule; + } + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + return module; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java new file mode 100644 index 0000000..4a79404 --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java @@ -0,0 +1,47 @@ +/* + * 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.bootstrap.assembly.infrastructure; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.LayerAssembler; +import org.apache.zest.bootstrap.layered.LayeredLayerAssembler; + +public class InfrastructureLayer extends LayeredLayerAssembler + implements LayerAssembler +{ + public static final String NAME = "Infrastructure Layer"; + private final ModuleAssembly configModule; + + public InfrastructureLayer( ModuleAssembly configModule ) + { + this.configModule = configModule; + } + + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + new StorageModule( configModule ).assemble( layer, layer.module( StorageModule.NAME ) ); + new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) ); + createModule( layer, SerializationModule.class ); + return layer; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java new file mode 100644 index 0000000..8ac0e3d --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java @@ -0,0 +1,36 @@ +/* + * 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.bootstrap.assembly.infrastructure; + +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 SerializationModule + implements ModuleAssembler +{ + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module + ) + throws AssemblyException + { + return null; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java new file mode 100644 index 0000000..83c9f21 --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java @@ -0,0 +1,43 @@ +/* + * 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.bootstrap.assembly.infrastructure; + +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 StorageModule + implements ModuleAssembler +{ + public static final String NAME = "Storage Module"; + private final ModuleAssembly configModule; + + public StorageModule( ModuleAssembly configModule ) + { + this.configModule = configModule; + } + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + return module; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.java new file mode 100644 index 0000000..f9796d4 --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.java @@ -0,0 +1,35 @@ +/* + * 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.bootstrap.assembly.service; + +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.layered.LayerAssembler; +import org.apache.zest.bootstrap.LayerAssembly; + +public class ServiceLayer implements LayerAssembler +{ + public static final String NAME = "Service"; + + @Override + public LayerAssembly assemble( LayerAssembly layer ) + throws AssemblyException + { + return null; + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java new file mode 100644 index 0000000..2639c10 --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java @@ -0,0 +1,133 @@ +/* + * Copyright 2014 Niclas Hedhman. + * Copyright 2014 Paul Merlin. + * + * Licensed 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.bootstrap.builder; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import org.json.JSONException; +import org.junit.Test; +import org.apache.zest.api.activation.ActivationException; +import org.apache.zest.api.mixin.Mixins; +import org.apache.zest.api.structure.Application; +import org.apache.zest.api.structure.Module; +import org.apache.zest.bootstrap.Assembler; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; +import static org.apache.zest.bootstrap.ClassScanner.findClasses; +import static org.apache.zest.bootstrap.ClassScanner.matches; +import static org.apache.zest.functional.Iterables.filter; + +public class ApplicationBuilderTest +{ + @Test + public void givenBuilderUseWhenBuildingApplicationExpectSuccess() + throws AssemblyException, ActivationException + { + ApplicationBuilder builder = new ApplicationBuilder( "Build from API test." ); + builder.withLayer( "layer1" ).using( "layer2" ).using( "layer3" ); + builder.withLayer( "layer2" ); + builder.withLayer( "layer3" ).withModule( "test module" ). + withAssemblers( filter( matches( ".*ServiceAssembler" ), findClasses( getClass() ) ) ); + Application application = builder.newApplication(); + Module module = application.findModule( "layer3", "test module" ); + TestService service = module.findService( TestService.class ).get(); + assertThat( service.sayHello(), equalTo( "Hello Zest!" ) ); + } + + @Test + public void givenJsonWhenBuildingApplicationExpectSuccess() + throws JSONException, ActivationException, AssemblyException + { + ApplicationBuilder builder = ApplicationBuilder.fromJson( APPLICATION ); + Application application = builder.newApplication(); + Module module = application.findModule( "layer3", "test module" ); + TestService service = module.findService( TestService.class ).get(); + assertThat( service.sayHello(), equalTo( "Hello Zest!" ) ); + } + + @Test + public void givenJsonInputStreamWhenBuildingApplicationExpectSuccess() + throws IOException, JSONException, ActivationException, AssemblyException + { + InputStream input = new ByteArrayInputStream( APPLICATION.getBytes( "UTF-8" ) ); + ApplicationBuilder builder = ApplicationBuilder.fromJson( input ); + Application application = builder.newApplication(); + Module module = application.findModule( "layer3", "test module" ); + TestService service = module.findService( TestService.class ).get(); + assertThat( service.sayHello(), equalTo( "Hello Zest!" ) ); + } + + + private static final String APPLICATION = + "{\n" + + " \"name\": \"Build from JSON test.\",\n" + + " \"layers\": [\n" + + " {\n" + + " \"name\": \"layer1\",\n" + + " \"uses\": [ \"layer2\", \"layer3\"]\n" + + " },\n" + + " {\n" + + " \"name\": \"layer2\"\n" + + " },\n" + + " {\n" + + " \"name\": \"layer3\",\n" + + " \"modules\" : [\n" + + " {\n" + + " \"name\" : \"test module\",\n" + + " \"assemblers\" : [\n" + + " \"org.qi4j.bootstrap.builder.ApplicationBuilderTest$TestServiceAssembler\"\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + "}"; + + public static class TestServiceAssembler + implements Assembler + { + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.addServices( TestService.class ); + } + } + + @Mixins( TestService.TestMixin.class ) + public interface TestService + { + String sayHello(); + + class TestMixin + implements TestService + { + + @Override + public String sayHello() + { + return "Hello Zest!"; + } + } + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.java new file mode 100644 index 0000000..edd7635 --- /dev/null +++ b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.java @@ -0,0 +1,28 @@ +/* + * 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.bootstrap.somepackage; + +import org.apache.zest.api.value.ValueComposite; + +/** + */ +public interface Test2Value + extends ValueComposite +{ +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/ClassScannerTest.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/ClassScannerTest.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/ClassScannerTest.java deleted file mode 100644 index 33c9e21..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/ClassScannerTest.java +++ /dev/null @@ -1,64 +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.qi4j.bootstrap; - -import org.junit.Assert; -import org.junit.Test; -import org.qi4j.api.activation.ActivationException; -import org.qi4j.bootstrap.somepackage.Test2Value; -import org.qi4j.functional.Iterables; - -import static org.qi4j.bootstrap.ClassScanner.findClasses; -import static org.qi4j.bootstrap.ClassScanner.matches; -import static org.qi4j.functional.Iterables.filter; - -/** - * Test and showcase of the ClassScanner assembly utility. - */ -public class ClassScannerTest -{ - @Test - public void testClassScannerFiles() - throws ActivationException, AssemblyException - { - SingletonAssembler singleton = new SingletonAssembler() - { - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - // Find all classes starting from TestValue, but include only the ones that are named *Value - - for( Class aClass : filter( matches( ".*Value" ), findClasses( TestValue.class ) ) ) - { - module.values( aClass ); - } - } - }; - - singleton.module().newValueBuilder( TestValue.class ); - singleton.module().newValueBuilder( Test2Value.class ); - } - - @Test - public void testClassScannerJar() - { - Assert.assertEquals( 138, Iterables.count( findClasses( Test.class ) ) ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java deleted file mode 100644 index ae57305..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +++ /dev/null @@ -1,441 +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.qi4j.bootstrap; - -import org.qi4j.api.activation.ActivationException; -import org.qi4j.api.common.Visibility; -import org.qi4j.api.property.Property; -import org.qi4j.api.service.importer.InstanceImporter; -import org.qi4j.api.service.importer.NewObjectImporter; -import org.qi4j.api.structure.Application; -import org.qi4j.api.structure.ApplicationDescriptor; -import org.qi4j.api.structure.Module; -import org.qi4j.functional.Iterables; -import org.qi4j.functional.Specification; - -public class DocumentationSupport -{ - - public static Specification hasMyTypeSpecification = new Specification() - { - - public boolean satisfiedBy( ObjectAssembly item ) - { - return Iterables.toList( item.types() ).contains( String.class ); - } - - }; - - public static class objects - implements Assembler - { - - public static class MyObject {} - - // START SNIPPET: objects - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.objects( MyObject.class ).visibleIn( Visibility.layer ); - } - // END SNIPPET: objects - - } - - public static class transients - implements Assembler - { - - public static interface MyTransient {} - - // START SNIPPET: transients - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.transients( MyTransient.class ).visibleIn( Visibility.layer ); - } - // END SNIPPET: transients - - } - - public static class values - implements Assembler - { - - public static interface MyValue {} - - // START SNIPPET: values - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.values( MyValue.class ).visibleIn( Visibility.layer ); - } - // END SNIPPET: values - - } - - public static class entities - implements Assembler - { - - public static interface MyEntity {} - - // START SNIPPET: entities - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.entities( MyEntity.class ).visibleIn( Visibility.layer ); - } - // END SNIPPET: entities - - } - - public static class services - implements Assembler - { - - public static interface MyService {} - - // START SNIPPET: services - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( MyService.class ).visibleIn( Visibility.layer ); - } - // END SNIPPET: services - - } - - public static class taggedServices - implements Assembler - { - - public static interface MyService {} - - // START SNIPPET: tagged-services - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( MyService.class ).taggedWith( "foo", "bar" ); - } - // END SNIPPET: tagged-services - } - - public static class importedServices - implements Assembler - { - - public static class MyService {} - - // START SNIPPET: imported-services - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.importedServices( MyService.class ). - importedBy( InstanceImporter.class ). - setMetaInfo( new MyService() ); - - // OR - - module.objects( MyService.class ); - module.importedServices( MyService.class ). - importedBy( NewObjectImporter.class ); - } - // END SNIPPET: imported-services - } - - public static class defaultPropertyValues - implements Assembler - { - - public interface MyValue { Property foo(); } - public interface MyEntity { Property cathedral(); } - - // START SNIPPET: properties-defaults - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.values( MyValue.class ); - MyValue myValueDefaults = module.forMixin( MyValue.class ).declareDefaults(); - myValueDefaults.foo().set( "bar" ); - - module.entities( MyEntity.class ); - MyEntity myEntityDefaults = module.forMixin( MyEntity.class ).declareDefaults(); - myEntityDefaults.cathedral().set( "bazar" ); - } - // END SNIPPET: properties-defaults - } - - public static class singleton - { - - public interface MyService { } - public interface Stuff { } - - void singleton() - throws ActivationException, AssemblyException - { - // START SNIPPET: singleton - SingletonAssembler assembler = new SingletonAssembler() - { - - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( MyService.class ).identifiedBy( "Foo" ); - module.services( MyService.class ).identifiedBy( "Bar" ); - module.objects( Stuff.class ); - } - - }; - Module module = assembler.module(); - Stuff stuff = module.newObject( Stuff.class ); - // END SNIPPET: singleton - } - - } - - public static class pancake - { - - public static class LoginAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class MenuAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class PerspectivesAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class ViewsAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class ReportingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class PdfAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class BookkeepingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class CashFlowAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class BalanceSheetAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class PricingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class ProductAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } } - - private static Energy4Java qi4j; - - // START SNIPPET: pancake - public static void main( String[] args ) - throws Exception - { - qi4j = new Energy4Java(); - Assembler[][][] assemblers = new Assembler[][][]{ - { // View Layer - { // Login Module - new LoginAssembler() - // : - }, - { // Main Workbench Module - new MenuAssembler(), - new PerspectivesAssembler(), - new ViewsAssembler() - // : - }, - { // Printing Module - new ReportingAssembler(), - new PdfAssembler() - // : - } - }, - { // Application Layer - { // Accounting Module - new BookkeepingAssembler(), - new CashFlowAssembler(), - new BalanceSheetAssembler() - // : - }, - { // Inventory Module - new PricingAssembler(), - new ProductAssembler() - // : - } - }, - { // Domain Layer - // : - }, - { // Infrastructure Layer - // : - } - }; - ApplicationDescriptor model = newApplication( assemblers ); - Application runtime = model.newInstance( qi4j.spi() ); - runtime.activate(); - } - - private static ApplicationDescriptor newApplication( final Assembler[][][] assemblers ) - throws AssemblyException - { - return qi4j.newApplicationModel( new ApplicationAssembler() - { - - @Override - public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory ) - throws AssemblyException - { - return appFactory.newApplicationAssembly( assemblers ); - } - - } ); - } - // END SNIPPET: pancake - - } - - public static class full - { - - public static class CustomerViewComposite{} - public static class CustomerEditComposite{} - public static class CustomerListViewComposite{} - public static class CustomerSearchComposite{} - public static class CustomerEntity{} - public static class CountryEntity{} - public static class AddressValue{} - public static class LdapAuthenticationAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class ThrinkAuthorizationAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class UserTrackingAuditAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } } - public static class NeoAssembler implements Assembler{ NeoAssembler( String path ) {} public void assemble( ModuleAssembly module ) throws AssemblyException { } } - - // START SNIPPET: full - private static Energy4Java qi4j; - - private static Application application; - - public static void main( String[] args ) - throws Exception - { - // Create a Zest Runtime - qi4j = new Energy4Java(); - application = qi4j.newApplication( new ApplicationAssembler() - { - - @Override - public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory ) - throws AssemblyException - { - ApplicationAssembly assembly = appFactory.newApplicationAssembly(); - buildAssembly( assembly ); - return assembly; - } - - } ); - // activate the application - application.activate(); - } - - static void buildAssembly( ApplicationAssembly app ) throws AssemblyException - { - LayerAssembly webLayer = createWebLayer( app ); - LayerAssembly domainLayer = createDomainLayer( app ); - LayerAssembly persistenceLayer = createInfrastructureLayer( app ); - LayerAssembly authLayer = createAuth2Layer( app ); - LayerAssembly messagingLayer = createMessagingLayer( app ); - - webLayer.uses( domainLayer ); - domainLayer.uses( authLayer ); - domainLayer.uses( persistenceLayer ); - domainLayer.uses( messagingLayer ); - } - - static LayerAssembly createWebLayer( ApplicationAssembly app ) throws AssemblyException - { - LayerAssembly layer = app.layer( "web-layer" ); - createCustomerWebModule( layer ); - return layer; - } - - static LayerAssembly createDomainLayer( ApplicationAssembly app ) throws AssemblyException - { - LayerAssembly layer = app.layer( "domain-layer" ); - createCustomerDomainModule( layer ); - // : - // : - return layer; - } - - static LayerAssembly createInfrastructureLayer( ApplicationAssembly app ) throws AssemblyException - { - LayerAssembly layer = app.layer( "infrastructure-layer" ); - createPersistenceModule( layer ); - return layer; - } - - static LayerAssembly createMessagingLayer( ApplicationAssembly app ) throws AssemblyException - { - LayerAssembly layer = app.layer( "messaging-layer" ); - createWebServiceModule( layer ); - createMessagingPersistenceModule( layer ); - return layer; - } - - static LayerAssembly createAuth2Layer( ApplicationAssembly application ) throws AssemblyException - { - LayerAssembly layer = application.layer( "auth2-layer" ); - createAuthModule( layer ); - return layer; - } - - static void createCustomerWebModule( LayerAssembly layer ) throws AssemblyException - { - ModuleAssembly assembly = layer.module( "customer-web-module" ); - assembly.transients( CustomerViewComposite.class, CustomerEditComposite.class, - CustomerListViewComposite.class, CustomerSearchComposite.class ); - } - - static void createCustomerDomainModule( LayerAssembly layer ) throws AssemblyException - { - ModuleAssembly assembly = layer.module( "customer-domain-module" ); - assembly.entities( CustomerEntity.class, CountryEntity.class ); - assembly.values( AddressValue.class ); - } - - static void createAuthModule( LayerAssembly layer ) throws AssemblyException - { - ModuleAssembly assembly = layer.module( "auth-module" ); - new LdapAuthenticationAssembler().assemble( assembly ); - new ThrinkAuthorizationAssembler().assemble( assembly ); - new UserTrackingAuditAssembler().assemble( assembly ); - } - - static void createPersistenceModule( LayerAssembly layer ) throws AssemblyException - { - ModuleAssembly assembly = layer.module( "persistence-module" ); - // Someone has created an assembler for the Neo EntityStore - new NeoAssembler( "./neostore" ).assemble( assembly ); - } - - // END SNIPPET: full - private static void createWebServiceModule( LayerAssembly layer ) throws AssemblyException - { - } - - private static void createMessagingPersistenceModule( LayerAssembly layer ) throws AssemblyException - { - } - - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/TestValue.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/TestValue.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/TestValue.java deleted file mode 100644 index c94b1ff..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/TestValue.java +++ /dev/null @@ -1,28 +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.qi4j.bootstrap; - -import org.qi4j.api.value.ValueComposite; - -/** - */ -public interface TestValue - extends ValueComposite -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/LayeredApplicationAssemblerTest.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/LayeredApplicationAssemblerTest.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/LayeredApplicationAssemblerTest.java deleted file mode 100644 index b1212ae..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/LayeredApplicationAssemblerTest.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.qi4j.bootstrap.assembly; - -import org.junit.Test; -import org.qi4j.api.activation.ActivationException; -import org.qi4j.api.structure.Application; -import org.qi4j.bootstrap.AssemblyException; - -import static org.hamcrest.core.IsEqual.equalTo; -import static org.junit.Assert.assertThat; - -public class LayeredApplicationAssemblerTest -{ - @Test - public void validateThatAssemblerCreatesApplication() - throws AssemblyException, ActivationException - { - TestApplication assembler = new TestApplication( "Test Application", "1.0.1", Application.Mode.test ); - assembler.start(); - - assertThat( assembler.application().name(), equalTo("Test Application") ); - assertThat( assembler.application().version(), equalTo("1.0.1") ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/TestApplication.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/TestApplication.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/TestApplication.java deleted file mode 100644 index 03422cc..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/TestApplication.java +++ /dev/null @@ -1,61 +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.qi4j.bootstrap.assembly; - -import org.qi4j.api.structure.Application; -import org.qi4j.bootstrap.ApplicationAssembly; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.layered.LayeredApplicationAssembler; -import org.qi4j.bootstrap.LayerAssembly; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.bootstrap.assembly.config.ConfigurationLayer; -import org.qi4j.bootstrap.assembly.connectivity.ConnectivityLayer; -import org.qi4j.bootstrap.assembly.domain.DomainLayer; -import org.qi4j.bootstrap.assembly.infrastructure.InfrastructureLayer; -import org.qi4j.bootstrap.assembly.service.ServiceLayer; - -// START SNIPPET: application -public class TestApplication extends LayeredApplicationAssembler -{ - - public TestApplication( String name, String version, Application.Mode mode ) - throws AssemblyException - { - super( name, version, mode ); - } - - @Override - protected void assembleLayers( ApplicationAssembly assembly ) - throws AssemblyException - { - LayerAssembly configLayer = createLayer( ConfigurationLayer.class ); - ModuleAssembly configModule = configLayer.module( "Configuration Module" ); - LayerAssembly infraLayer = new InfrastructureLayer( configModule ).assemble( assembly.layer( InfrastructureLayer.NAME )); - LayerAssembly domainLayer = createLayer( DomainLayer.class ); - LayerAssembly serviceLayer = createLayer( ServiceLayer.class ); - LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class ); - - connectivityLayer.uses( serviceLayer ); - connectivityLayer.uses( domainLayer ); - serviceLayer.uses( domainLayer ); - domainLayer.uses( infraLayer ); - infraLayer.uses( configLayer ); - } -} -// END SNIPPET: application http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/config/ConfigurationLayer.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/config/ConfigurationLayer.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/config/ConfigurationLayer.java deleted file mode 100644 index 1a35879..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/config/ConfigurationLayer.java +++ /dev/null @@ -1,33 +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.qi4j.bootstrap.assembly.config; - -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.layered.LayerAssembler; -import org.qi4j.bootstrap.LayerAssembly; - -public class ConfigurationLayer implements LayerAssembler -{ - @Override - public LayerAssembly assemble( LayerAssembly layer ) - throws AssemblyException - { - return layer; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/connectivity/ConnectivityLayer.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/connectivity/ConnectivityLayer.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/connectivity/ConnectivityLayer.java deleted file mode 100644 index 1002d37..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/connectivity/ConnectivityLayer.java +++ /dev/null @@ -1,35 +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.qi4j.bootstrap.assembly.connectivity; - -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.layered.LayerAssembler; -import org.qi4j.bootstrap.LayerAssembly; - -public class ConnectivityLayer implements LayerAssembler -{ - public static final String NAME = "Connectivity"; - - @Override - public LayerAssembly assemble( LayerAssembly layer ) - throws AssemblyException - { - return null; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/DomainLayer.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/DomainLayer.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/DomainLayer.java deleted file mode 100644 index 8eac88b..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/DomainLayer.java +++ /dev/null @@ -1,35 +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.qi4j.bootstrap.assembly.domain; - -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.LayerAssembly; -import org.qi4j.bootstrap.layered.LayeredLayerAssembler; - -public class DomainLayer extends LayeredLayerAssembler -{ - @Override - public LayerAssembly assemble( LayerAssembly layer ) - throws AssemblyException - { - createModule( layer, InvoicingModule.class ); - createModule( layer, OrderModule.class ); - return layer; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/InvoicingModule.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/InvoicingModule.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/InvoicingModule.java deleted file mode 100644 index 62a4640..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/InvoicingModule.java +++ /dev/null @@ -1,35 +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.qi4j.bootstrap.assembly.domain; - -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.LayerAssembly; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.bootstrap.layered.ModuleAssembler; - -public class InvoicingModule - 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/061ddaa0/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/OrderModule.java ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/OrderModule.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/OrderModule.java deleted file mode 100644 index 9e506e3..0000000 --- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/assembly/domain/OrderModule.java +++ /dev/null @@ -1,56 +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.qi4j.bootstrap.assembly.domain; - -import org.qi4j.api.association.Association; -import org.qi4j.api.property.Property; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.LayerAssembly; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.bootstrap.layered.ModuleAssembler; - -public class OrderModule - implements ModuleAssembler -{ - @Override - public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) - throws AssemblyException - { - module.entities( Order.class, Customer.class ); - module.values( Address.class ); - return module; - } - - public interface Order - { - Association customer(); - - Property
invoicingAddress(); - - Property
deliveryAddress(); - } - - public interface Customer - { - } - - public interface Address - { - } -}