You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/07/31 04:47:42 UTC
[23/51] [abbrv] [partial] zest-java git commit: Revert "First round
of changes to move to org.apache.zest namespace."
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/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
deleted file mode 100644
index 504f52d..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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<ObjectAssembly> hasMyTypeSpecification = new Specification<ObjectAssembly>()
- {
-
- 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<String> foo(); }
- public interface MyEntity { Property<String> 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/a789141d/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
deleted file mode 100644
index 7fba35c..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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/a789141d/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
deleted file mode 100644
index 8529ec9..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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/a789141d/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
deleted file mode 100644
index 7b4f1ca..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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/a789141d/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
deleted file mode 100644
index 8d250ea..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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/a789141d/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
deleted file mode 100644
index 570b526..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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/a789141d/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
deleted file mode 100644
index 8976987..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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/a789141d/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
deleted file mode 100644
index 059416e..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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/a789141d/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
deleted file mode 100644
index b3cc06b..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/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.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> customer();
-
- Property<Address> invoicingAddress();
-
- Property<Address> deliveryAddress();
- }
-
- public interface Customer
- {
- }
-
- public interface Address
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/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
deleted file mode 100644
index c641f7b..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java
+++ /dev/null
@@ -1,43 +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.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/a789141d/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
deleted file mode 100644
index 4a79404..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java
+++ /dev/null
@@ -1,47 +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.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/a789141d/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
deleted file mode 100644
index 8ac0e3d..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java
+++ /dev/null
@@ -1,36 +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.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/a789141d/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
deleted file mode 100644
index 83c9f21..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java
+++ /dev/null
@@ -1,43 +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.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/a789141d/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
deleted file mode 100644
index f9796d4..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.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.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/a789141d/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
deleted file mode 100644
index 2639c10..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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/a789141d/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
deleted file mode 100644
index edd7635..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.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.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/a789141d/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
new file mode 100644
index 0000000..33c9e21
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/bootstrap/ClassScannerTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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/a789141d/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
new file mode 100644
index 0000000..ae57305
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.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<ObjectAssembly> hasMyTypeSpecification = new Specification<ObjectAssembly>()
+ {
+
+ 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<String> foo(); }
+ public interface MyEntity { Property<String> 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/a789141d/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
new file mode 100644
index 0000000..c94b1ff
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.qi4j.bootstrap;
+
+import org.qi4j.api.value.ValueComposite;
+
+/**
+ */
+public interface TestValue
+ extends ValueComposite
+{
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/a789141d/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
new file mode 100644
index 0000000..b1212ae
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.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/a789141d/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
new file mode 100644
index 0000000..03422cc
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.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/a789141d/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
new file mode 100644
index 0000000..1a35879
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.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/a789141d/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
new file mode 100644
index 0000000..1002d37
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.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/a789141d/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
new file mode 100644
index 0000000..8eac88b
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.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/a789141d/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
new file mode 100644
index 0000000..62a4640
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.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/a789141d/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
new file mode 100644
index 0000000..9e506e3
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/qi4j/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.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> customer();
+
+ Property<Address> invoicingAddress();
+
+ Property<Address> deliveryAddress();
+ }
+
+ public interface Customer
+ {
+ }
+
+ public interface Address
+ {
+ }
+}