http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java b/core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java deleted file mode 100644 index b423a58..0000000 --- a/core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java +++ /dev/null @@ -1,275 +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.api.docsupport; - -import org.apache.zest.api.structure.Application; -import org.apache.zest.api.structure.ApplicationDescriptor; -import org.apache.zest.bootstrap.ApplicationAssembler; -import org.apache.zest.bootstrap.ApplicationAssembly; -import org.apache.zest.bootstrap.ApplicationAssemblyFactory; -import org.apache.zest.bootstrap.Assembler; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.Energy4Java; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.SingletonAssembler; - -public class ApplicationDocs -{ - public static void someMethod( String[] args ) - throws Exception - { - { -// START SNIPPET: application1 - SingletonAssembler zest = new SingletonAssembler() - { - public void assemble( ModuleAssembly assembly ) - throws AssemblyException - { - assembly.values( MyStuffValueComposite.class ); - } - }; -// END SNIPPET: application1 - } - { - Assembler customerListEditAssembler = new DummyAssembler(); - Assembler customerEditAssembler = new DummyAssembler(); - Assembler customerSearchAssembler = new DummyAssembler(); - Assembler accountsListEditAssembler = new DummyAssembler(); - Assembler accountsEditAssembler = new DummyAssembler(); - Assembler accountsSearchAssembler = new DummyAssembler(); - Assembler customerDomainAssembler = new DummyAssembler(); - Assembler accountsDomainAssembler = new DummyAssembler(); -// START SNIPPET: application2 - final Assembler[][][] assemblers = - { - { // web layer - { // Customer Module - customerListEditAssembler, - customerEditAssembler, - customerSearchAssembler - }, - { // Accounts Module - accountsListEditAssembler, - accountsEditAssembler, - accountsSearchAssembler - } - }, - { // domain layer - { // Customer Module - customerDomainAssembler, - }, - { // Accounts Module - accountsDomainAssembler, - } - } - }; - Energy4Java zest = new Energy4Java(); - Application app = zest.newApplication( new ApplicationAssembler() - { - - @Override - public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory ) - throws AssemblyException - { - return applicationFactory.newApplicationAssembly( assemblers ); - } - } ); - app.activate(); -// END SNIPPET: application2 - } - } - - public interface MyStuffValueComposite - { - } - - private static class DummyAssembler implements Assembler - { - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - - } - } - - // START SNIPPET: application3 - private static Energy4Java zest; - - public static void main( String[] args ) - throws Exception - { - zest = new Energy4Java(); - ApplicationDescriptor model = zest.newApplicationModel( new ApplicationAssembler() - { - @Override - public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory ) - throws AssemblyException - { - return createAssembly( applicationFactory ); - } - } ); - Application application = model.newInstance( zest.spi() ); - } - - private static ApplicationAssembly createAssembly( ApplicationAssemblyFactory factory ) - throws AssemblyException - { - String applicationName = "Example Application"; - ApplicationAssembly app = factory.newApplicationAssembly(); - app.setName( applicationName ); - LayerAssembly webLayer = createWebLayer( app ); - LayerAssembly domainLayer = createDomainLayer( app ); - LayerAssembly infraLayer = createInfrastructureLayer( app ); - webLayer.uses( domainLayer ); - webLayer.uses( infraLayer ); // Accesses the WebService - domainLayer.uses( infraLayer ); // For persistence - return app; - } - - private static LayerAssembly createWebLayer( - ApplicationAssembly application - ) - { - LayerAssembly layer = application.layer( "Web Layer" ); - createCustomerWebModule( layer ); - return layer; - } - - private static LayerAssembly createDomainLayer( - ApplicationAssembly application - ) - { - LayerAssembly layer = application.layer( "Domain Layer" ); - createCustomerDomainModule( layer ); - // : - // : - return layer; - } - - private static LayerAssembly createInfrastructureLayer( - ApplicationAssembly application - ) - throws AssemblyException - { - LayerAssembly layer = application.layer( "Infrastructure Layer" ); - createWebServiceModule( layer ); - createPersistenceModule( layer ); - return layer; - } - - private static void createCustomerWebModule( LayerAssembly layer ) - { - ModuleAssembly assembly = layer.module( "Customer Web Module" ); - assembly.transients( CustomerViewComposite.class ); - assembly.transients( CustomerEditComposite.class ); - assembly.transients( CustomerListViewComposite.class ); - assembly.transients( CustomerSearchComposite.class ); - } - - private static void createCustomerDomainModule( LayerAssembly layer ) - { - ModuleAssembly assembly = layer.module( "Customer Domain Module" ); - assembly.entities( CustomerEntity.class ); - assembly.entities( CountryEntity.class ); - assembly.transients( AddressComposite.class ); - } - - private static void createWebServiceModule( LayerAssembly layer ) - throws AssemblyException - { - ModuleAssembly assembly = layer.module( "Web Service Module" ); - // Someone has created an assembler for a Jetty Web Service. - JettyAssembler jetty = new JettyAssembler( 8080 ); - jetty.assemble( assembly ); - } - - private static void createPersistenceModule( LayerAssembly layer ) - throws AssemblyException - { - ModuleAssembly assembly = layer.module( "Persistence Module" ); - // Someone has created an assembler for the Neo EntityStore - NeoAssembler neo = new NeoAssembler( "./neostore" ); - neo.assemble( assembly ); - } -// START SNIPPET: application3 - - 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 AddressComposite - { - - } - - public static class JettyAssembler - implements Assembler - { - - public JettyAssembler( int port ) - { - } - - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - } - } - public static class NeoAssembler - implements Assembler - { - - public NeoAssembler( String s ) - { - } - - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - } - } -} -
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java b/core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java deleted file mode 100644 index ecccf62..0000000 --- a/core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java +++ /dev/null @@ -1,57 +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.api.docsupport; - -import org.apache.zest.api.mixin.Mixins; -import org.apache.zest.bootstrap.ModuleAssembly; - -public class CompositionDocs -{ -// START SNIPPET: comp1 - @Mixins( { BalanceCheckMixin.class } ) - public interface BankAccount - { - Money checkBalance(); -// END SNIPPET: comp1 -// START SNIPPET: comp1 - } -// END SNIPPET: comp1 - -// START SNIPPET: comp2 - public void assemble( ModuleAssembly module ) - { - module.entities( BankAccount.class ); - } -// END SNIPPET: comp2 - - public static class BalanceCheckMixin - implements BankAccount - { - @Override - public Money checkBalance() - { - return null; - } - } - - public static class Money - { - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/docsupport/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/docsupport/package.html b/core/api/src/test/java/org/apache/zest/api/docsupport/package.html deleted file mode 100644 index 6fbef81..0000000 --- a/core/api/src/test/java/org/apache/zest/api/docsupport/package.html +++ /dev/null @@ -1,24 +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. - ~ - ~ - --> -<html> -<body> -This package exists to contain snippets for documentation. -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/injection/scope/StateFieldTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/injection/scope/StateFieldTest.java b/core/api/src/test/java/org/apache/zest/api/injection/scope/StateFieldTest.java deleted file mode 100644 index ee0d512..0000000 --- a/core/api/src/test/java/org/apache/zest/api/injection/scope/StateFieldTest.java +++ /dev/null @@ -1,149 +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.api.injection.scope; - -import org.junit.Assert; -import org.junit.Test; -import org.apache.zest.api.association.Association; -import org.apache.zest.api.association.ManyAssociation; -import org.apache.zest.api.common.Optional; -import org.apache.zest.api.common.UseDefaults; -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.mixin.Mixins; -import org.apache.zest.api.property.Property; -import org.apache.zest.api.unitofwork.UnitOfWork; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.test.AbstractPolygeneTest; -import org.apache.zest.test.EntityTestAssembler; - -/** - * Define a field to be a Property - */ -public class StateFieldTest - extends AbstractPolygeneTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - new EntityTestAssembler().assemble( module ); - module.entities( PersonEntity.class ); - } - - @Test - public void givenEntityWithFieldPropertiesWhenUpdatedThenReturnCorrect() - throws Exception - { - UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork(); - try - { - PersonEntity charles = unitOfWork.newEntity( PersonEntity.class ); - charles.changeName( "Charles" ); - Assert.assertEquals( charles.getName(), "Charles" ); - - PersonEntity daniel = unitOfWork.newEntity( PersonEntity.class ); - daniel.changeName( "Daniel" ); - Assert.assertEquals( daniel.getName(), "Daniel" ); - - PersonEntity lisa = unitOfWork.newEntity( PersonEntity.class ); - lisa.changeName( "Lisa" ); - Assert.assertEquals( lisa.getName(), "Lisa" ); - - charles.befriend( daniel ); - charles.befriend( lisa ); - charles.marry( lisa ); - - unitOfWork.complete(); - - unitOfWork = unitOfWorkFactory.newUnitOfWork(); - - charles = unitOfWork.get( charles ); - daniel = unitOfWork.get( daniel ); - Assert.assertTrue( charles.isFriend( daniel ) ); - - unitOfWork.complete(); - } - finally - { - unitOfWork.discard(); - } - } - - @Mixins( PersonEntity.Mixin.class ) - public interface PersonEntity - extends EntityComposite - { - void changeName( String newName ); - - void marry( PersonEntity entity ); - - void befriend( PersonEntity entity ); - - boolean isFriend( PersonEntity entity ); - - String getName(); - - abstract class Mixin - implements PersonEntity - { - @State - @UseDefaults - public Property<String> name; - - @State - @Optional - public Association<PersonEntity> spouse; - - @State - public ManyAssociation<PersonEntity> friends; - - @Override - public void changeName( String newName ) - { - name.set( newName ); - } - - @Override - public void marry( PersonEntity entity ) - { - spouse.set( entity ); - } - - @Override - public void befriend( PersonEntity entity ) - { - friends.add( entity ); - } - - @Override - public String getName() - { - return name.get(); - } - - @Override - public boolean isFriend( PersonEntity entity ) - { - return friends.contains( entity ); - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/injection/scope/ThisTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/injection/scope/ThisTest.java b/core/api/src/test/java/org/apache/zest/api/injection/scope/ThisTest.java deleted file mode 100644 index 05c0b9c..0000000 --- a/core/api/src/test/java/org/apache/zest/api/injection/scope/ThisTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.injection.scope; - -import java.lang.annotation.Annotation; -import org.junit.Test; -import org.apache.zest.api.common.Optional; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -/** - * Tests public api exposed by This annotation. - * This will ensure that the public api does not get changed by mistake. - */ -public class ThisTest -{ - - @Test - public void retention() - throws NoSuchFieldException - { - Annotation[] annotations = Annotated.class.getDeclaredField( "uses" ).getDeclaredAnnotations(); - assertNotNull( "annotations should not be null", annotations ); - assertEquals( "number of annotations", 1, annotations.length ); - assertEquals( "annotation type", This.class, annotations[ 0 ].annotationType() ); - } - - private static class Annotated - { - @This - String uses; - @Optional - @This - String usesOptional; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java b/core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java deleted file mode 100644 index 0a224d7..0000000 --- a/core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java +++ /dev/null @@ -1,115 +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.api.metrics; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; -import org.apache.zest.api.injection.scope.Service; - -public class DocumentationSupport -{ - // START SNIPPET: common - @Service - private MetricsProvider provider; - // END SNIPPET: common - - public void forDocumentationOnly() - { - // START SNIPPET: gauge - final BlockingQueue queue = new LinkedBlockingQueue( 20 ); - // END SNIPPET: gauge - // START SNIPPET: gauge - MetricsGaugeFactory gaugeFactory = provider.createFactory( MetricsGaugeFactory.class ); - MetricsGauge<Integer> gauge = gaugeFactory.registerGauge( "Sample Gauge", new MetricsGauge<Integer>() - { - @Override - public Integer value() - { - return queue.size(); - } - } ); - // END SNIPPET: gauge - - // START SNIPPET: counter - MetricsCounterFactory counterFactory = provider.createFactory( MetricsCounterFactory.class ); - MetricsCounter counter = counterFactory.createCounter( "Sample Counter" ); - // END SNIPPET: counter - - // START SNIPPET: histogram - MetricsHistogramFactory histoFactory = provider.createFactory( MetricsHistogramFactory.class ); - MetricsHistogram histogram = histoFactory.createHistogram( "Sample Histogram" ); - // END SNIPPET: histogram - - // START SNIPPET: meter - MetricsMeterFactory meterFactory = provider.createFactory( MetricsMeterFactory.class ); - MetricsMeter meter = meterFactory.createMeter( "Sample Meter" ); - // END SNIPPET: meter - - // START SNIPPET: timer - MetricsTimerFactory timerFactory = provider.createFactory( MetricsTimerFactory.class ); - MetricsTimer timer = timerFactory.createTimer( "Sample Timer" ); - // END SNIPPET: timer - - // START SNIPPET: healthcheck - MetricsHealthCheckFactory healthFactory = provider.createFactory( MetricsHealthCheckFactory.class ); - MetricsHealthCheck healthCheck = healthFactory.registerHealthCheck( - "Sample Healthcheck", - new MetricsHealthCheck() - { - @Override - public Result check() - throws Exception - { - ServiceStatus status = pingMyService(); - return new Result( status.isOk(), status.getErrorMessage(), status.getException() ); - } - } ); - // END SNIPPET: healthcheck - - } - - private ServiceStatus pingMyService() - { - return new ServiceStatus(); - } - - private static class ServiceStatus - { - String errorMessage; - Exception exception; - - public String getErrorMessage() - { - return errorMessage; - } - - public Exception getException() - { - return exception; - } - - public boolean isOk() - { - return errorMessage.equals( "OK" ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java b/core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java deleted file mode 100644 index 57ebee1..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java +++ /dev/null @@ -1,31 +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.api.mixin; - - -// START SNIPPET: mixinType -public interface BankAccount -{ - Money checkBalance(); -} -// END SNIPPET: mixinType - -class Money {} - http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/Car.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/Car.java b/core/api/src/test/java/org/apache/zest/api/mixin/Car.java deleted file mode 100644 index a3b719d..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/Car.java +++ /dev/null @@ -1,26 +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.api.mixin; - -// START SNIPPET: mixin -@Mixins( { StartMixin.class, VehicleMixin.class } ) -public interface Car extends Startable, Vehicle -{} -// END SNIPPET: mixin http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/Something.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/Something.java b/core/api/src/test/java/org/apache/zest/api/mixin/Something.java deleted file mode 100644 index 0a24c2d..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/Something.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.api.mixin; - -// START SNIPPET: something -@Mixins( SomethingMixin.class ) -public interface Something -{} -// END SNIPPET: something - - http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java deleted file mode 100644 index 5c019de..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.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.api.mixin; - -// START SNIPPET: something -public class SomethingMixin - implements Something -{ - // State is allowed. - - public void doSomething() - { - // do stuff... - } -} -// END SNIPPET: something http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/StartMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/StartMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/StartMixin.java deleted file mode 100644 index f761468..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/StartMixin.java +++ /dev/null @@ -1,23 +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.api.mixin; - -public abstract class StartMixin implements Startable -{} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/Startable.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/Startable.java b/core/api/src/test/java/org/apache/zest/api/mixin/Startable.java deleted file mode 100644 index 6bdce19..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/Startable.java +++ /dev/null @@ -1,29 +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.api.mixin; - -// START SNIPPET: mixin -public interface Startable -{ - boolean start(); - void stop(); -} - -// END SNIPPET: mixin http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java b/core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java deleted file mode 100644 index 9feb1c9..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java +++ /dev/null @@ -1,32 +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.api.mixin; - -// START SNIPPET: mixin -public interface Vehicle -{ - void turn(float angle); - - void accelerate(float acceleration); - - // more methods -} - -// END SNIPPET: mixin http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/VehicleMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/VehicleMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/VehicleMixin.java deleted file mode 100644 index 10b5829..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/VehicleMixin.java +++ /dev/null @@ -1,23 +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.api.mixin; - -public abstract class VehicleMixin -{} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java deleted file mode 100644 index 4a0d2b4..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java +++ /dev/null @@ -1,92 +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.api.mixin.decoratorMixin; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Proxy; -import org.junit.Test; -import org.apache.zest.api.composite.TransientBuilder; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.test.AbstractPolygeneTest; - -import static org.hamcrest.core.IsEqual.equalTo; -import static org.junit.Assert.assertThat; - -public class DecoratorMixinTest extends AbstractPolygeneTest -{ - // START SNIPPET: assembly - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.transients( View1.class ); - module.transients( View2.class ); - module.transients( FooModel.class ); - } -// END SNIPPET: assembly - -// START SNIPPET: test - - @Test - public void testDecoration() - { - FooModelImpl model = new FooModelImpl( "Init" ); - View1 view1 = createView1( model ); - View2 view2 = createView2( model ); - assertThat( view1.bar(), equalTo( "Init" ) ); - assertThat( view2.bar(), equalTo( "Init" ) ); - model.setBar( "New Value" ); - assertThat( view1.bar(), equalTo( "New Value" ) ); - assertThat( view2.bar(), equalTo( "New Value" ) ); - } -// END SNIPPET: test - - @Test - public void testDecorationWithGenericMixin() - { - InvocationHandler handler = new FooModelInvocationHandler("Init"); - ClassLoader cl = getClass().getClassLoader(); - FooModel model = (FooModel) Proxy.newProxyInstance( cl, new Class[]{ FooModel.class }, handler ); - View1 view1 = createView1( model ); - View2 view2 = createView2( model ); - assertThat( view1.bar(), equalTo( "Init" ) ); - assertThat( view2.bar(), equalTo( "Init" ) ); - model.setBar( "New Value" ); - assertThat( view1.bar(), equalTo( "New Value" ) ); - assertThat( view2.bar(), equalTo( "New Value" ) ); - } - - // START SNIPPET: create - public View1 createView1( FooModel model ) - { - TransientBuilder<View1> builder = transientBuilderFactory.newTransientBuilder( View1.class ); - builder.use( model ); - return builder.newInstance(); - } -// END SNIPPET: create - - public View2 createView2( FooModel model ) - { - TransientBuilder<View2> builder = transientBuilderFactory.newTransientBuilder( View2.class ); - builder.use( model ); - return builder.newInstance(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java deleted file mode 100644 index 5a43502..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.mixin.decoratorMixin; - -import org.apache.zest.api.composite.DecoratorMixin; -import org.apache.zest.api.mixin.Mixins; - -// START SNIPPET: decorator -@Mixins(DecoratorMixin.class) -// START SNIPPET: plain -public interface FooModel -// END SNIPPET: decorator -{ - String getBar(); - void setBar(String value); -// END SNIPPET: plain - -// START SNIPPET: plain -} -// END SNIPPET: plain http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelImpl.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelImpl.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelImpl.java deleted file mode 100644 index 5bab32c..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelImpl.java +++ /dev/null @@ -1,42 +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.api.mixin.decoratorMixin; - -public class FooModelImpl - implements FooModel -{ - private String bar; - - public FooModelImpl( String bar ) - { - this.bar = bar; - } - - @Override - public String getBar() - { - return bar; - } - - public void setBar( String bar ) - { - this.bar = bar; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelInvocationHandler.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelInvocationHandler.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelInvocationHandler.java deleted file mode 100644 index a94a7eb..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelInvocationHandler.java +++ /dev/null @@ -1,48 +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.api.mixin.decoratorMixin; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -public class FooModelInvocationHandler - implements InvocationHandler -{ - private String value; - - public FooModelInvocationHandler( String value ) - { - this.value = value; - } - - @Override - public Object invoke( Object proxy, Method method, Object[] args ) - throws Throwable - { - if(method.getName().equals( "hashCode" )) - return hashCode(); - if(method.getName().equals( "equals" )) - return equals(args[0]); - if(args==null || args.length==0) - return value; - value = (String) args[0]; - return null; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java deleted file mode 100644 index 7ffe104..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.mixin.decoratorMixin; - -import org.apache.zest.api.injection.scope.This; -import org.apache.zest.api.mixin.Mixins; - -// START SNIPPET: decorator -@Mixins(View1.Mixin.class) -public interface View1 -{ - String bar(); - - public class Mixin - implements View1 - { - @This - FooModel model; - - @Override - public String bar() - { - return model.getBar(); - } - } -} -// END SNIPPET: decorator http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View2.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View2.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View2.java deleted file mode 100644 index 1232058..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View2.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.api.mixin.decoratorMixin; - -import org.apache.zest.api.injection.scope.This; -import org.apache.zest.api.mixin.Mixins; - -@Mixins(View2.Mixin.class) -public interface View2 -{ - String bar(); - public class Mixin - implements View2 - { - @This - FooModel model; - - @Override - public String bar() - { - return model.getBar(); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java deleted file mode 100644 index 1d8e8d4..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java +++ /dev/null @@ -1,31 +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.api.mixin.partial; - -import org.apache.zest.api.mixin.Mixins; -import org.apache.zest.api.mixin.StartMixin; -import org.apache.zest.api.mixin.Startable; - -// START SNIPPET: partial -@Mixins( { StartMixin.class, SpeedMixin.class, CrashResultMixin.class } ) -public interface Car extends Startable, Vehicle -{} - -// END SNIPPET: partial http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/CrashResultMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/CrashResultMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/CrashResultMixin.java deleted file mode 100644 index a6521f9..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/CrashResultMixin.java +++ /dev/null @@ -1,24 +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.api.mixin.partial; - -public class CrashResultMixin implements Crashable -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/Crashable.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Crashable.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/Crashable.java deleted file mode 100644 index cf8637d..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Crashable.java +++ /dev/null @@ -1,24 +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.api.mixin.partial; - -public interface Crashable -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java deleted file mode 100644 index e33d548..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java +++ /dev/null @@ -1,29 +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.api.mixin.partial; - -// START SNIPPET: partial -public interface SpeedLocation -{ - void turn(float angle); - - void accelerate(float acceleration); -} -// END SNIPPET: partial http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java deleted file mode 100644 index 39ed93a..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java +++ /dev/null @@ -1,34 +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.api.mixin.partial; - -// START SNIPPET: partial -public abstract class SpeedMixin - implements SpeedLocation -{ - // state for speed - - public void accelerate( float acceleration ) - { - // logic - } -} - -// END SNIPPET: partial \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java deleted file mode 100644 index 474b3f7..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java +++ /dev/null @@ -1,27 +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.api.mixin.partial; - -// START SNIPPET: partial -public interface Vehicle extends SpeedLocation, Crashable -{ -} - -// END SNIPPET: partial \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java b/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java deleted file mode 100644 index 410d255..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.api.mixin.privateMixin; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.mixin.Mixins; - -// START SNIPPET: private -@Mixins( CargoMixin.class ) -public interface Cargo extends EntityComposite -{ - String origin(); - - String destination(); - - void changeDestination( String newDestination ); - -} - -// END SNIPPET: private http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java deleted file mode 100644 index 6b5fb58..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.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.api.mixin.privateMixin; - -import org.apache.zest.api.injection.scope.This; - -// START SNIPPET: private -public abstract class CargoMixin - implements Cargo -{ - @This - private CargoState state; - - public String origin() - { - return state.origin().get(); - } - - public String destination() - { - return state.destination().get(); - } - - public void changeDestination( String newDestination ) - { - state.destination().set( newDestination ); - } -} - -// END SNIPPET: private \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java b/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java deleted file mode 100644 index d7e2516..0000000 --- a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java +++ /dev/null @@ -1,31 +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.api.mixin.privateMixin; - -import org.apache.zest.api.property.Property; - -// START SNIPPET: private -public interface CargoState -{ - Property<String> origin(); - Property<String> destination(); -} - -// END SNIPPET: private \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/object/ObjectBuilderTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/object/ObjectBuilderTest.java b/core/api/src/test/java/org/apache/zest/api/object/ObjectBuilderTest.java deleted file mode 100644 index 1213cee..0000000 --- a/core/api/src/test/java/org/apache/zest/api/object/ObjectBuilderTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.api.object; - -import org.junit.Test; -import org.apache.zest.api.injection.scope.Uses; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.test.AbstractPolygeneTest; - -import static org.junit.Assert.assertNotNull; - -/** - * JAVADOC - */ -public class ObjectBuilderTest - extends AbstractPolygeneTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.objects( A.class, B.class, C.class, D.class ); - } - - @Test - public void testNotProvidedUses() - { - A a = objectFactory.newObject( A.class ); - assertNotNull( a ); - assertNotNull( a.b ); - assertNotNull( a.b.c ); - assertNotNull( a.b.c.d ); - } - - public static class A - { - @Uses - B b; - } - - public static class B - { - @Uses - C c; - } - - public static class C - { - @Uses - D d; - } - - public static class D - { - - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/property/PropertyErrorTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/property/PropertyErrorTest.java b/core/api/src/test/java/org/apache/zest/api/property/PropertyErrorTest.java deleted file mode 100644 index e0136c6..0000000 --- a/core/api/src/test/java/org/apache/zest/api/property/PropertyErrorTest.java +++ /dev/null @@ -1,67 +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.api.property; - -import org.junit.Test; -import org.apache.zest.api.constraint.ConstraintViolationException; -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.unitofwork.UnitOfWork; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.test.AbstractPolygeneTest; -import org.apache.zest.test.EntityTestAssembler; - -/** - * Error messages for Properties - */ -public class PropertyErrorTest - extends AbstractPolygeneTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - new EntityTestAssembler().assemble( module ); - module.entities( PersonEntity.class ); - } - - @Test( expected = ConstraintViolationException.class ) - public void givenEntityWithNonOptionPropertyWhenInstantiatedThenException() - throws Exception - { - UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork(); - try - { - PersonEntity person = unitOfWork.newEntity( PersonEntity.class ); - - unitOfWork.complete(); - } - finally - { - unitOfWork.discard(); - } - } - - interface PersonEntity - extends EntityComposite - { - Property<String> foo(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java b/core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java deleted file mode 100644 index fe50761..0000000 --- a/core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java +++ /dev/null @@ -1,139 +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.api.service; - -import java.util.List; -import org.apache.zest.api.activation.Activators; -import org.apache.zest.api.injection.scope.Service; -import org.apache.zest.api.mixin.Mixins; -import org.apache.zest.api.service.qualifier.ServiceTags; -import org.apache.zest.bootstrap.Assembler; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.ServiceDeclaration; - -public class DocumentationSupport - implements Assembler -{ - // START SNIPPET: tag - // START SNIPPET: instantiateOnStartup - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - ServiceDeclaration service = module.addServices( MyDemoService.class ); - // END SNIPPET: tag - service.instantiateOnStartup(); - // END SNIPPET: instantiateOnStartup - // START SNIPPET: tag - service.taggedWith( "Important", "Drain" ); - // END SNIPPET: tag - } - - private static class MyDemoService - { - } - - private static class MyOtherDemoService - { - // START SNIPPET: UseTag - @Service - private List<ServiceReference<MyDemoService>> services; - - public MyDemoService locateImportantService() - { - for( ServiceReference<MyDemoService> ref : services ) - { - ServiceTags serviceTags = ref.metaInfo( ServiceTags.class ); - if( serviceTags.hasTag( "Important" ) ) - { - return ref.get(); - } - } - return null; - } - // END SNIPPET: UseTag - } - - // START SNIPPET: activation1 - @Mixins( MyActivationMixin.class ) - public static interface MyActivationDemoService - extends ServiceComposite, ServiceActivation - { - } - - public static class MyActivationMixin - implements ServiceActivation - { - @Override - public void activateService() - throws Exception - { - // Activation code - } - - @Override - public void passivateService() - throws Exception - { - // Passivation code - } - } - // END SNIPPET: activation1 - - // START SNIPPET: activation2 - @Activators( MyActivator.class ) - public static interface MyOtherActivationDemoService - extends ServiceComposite - { - } - - public static class MyActivator - extends ServiceActivatorAdapter<MyOtherActivationDemoService> - { - @Override - public void afterActivation( ServiceReference<MyOtherActivationDemoService> activated ) - throws Exception - { - // Activation code - } - - @Override - public void beforePassivation( ServiceReference<MyOtherActivationDemoService> passivating ) - throws Exception - { - // Passivation code - } - } - // END SNIPPET: activation2 - - static class Activation3 - implements Assembler - { - // START SNIPPET: activation3 - @Override - public void assemble( ModuleAssembly module ) - { - module.services( MyDemoService.class ).withActivators( MyActivator.class ); - } - // END SNIPPET: activation3 - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/unitofwork/RemovalTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/unitofwork/RemovalTest.java b/core/api/src/test/java/org/apache/zest/api/unitofwork/RemovalTest.java deleted file mode 100644 index bfbeeb6..0000000 --- a/core/api/src/test/java/org/apache/zest/api/unitofwork/RemovalTest.java +++ /dev/null @@ -1,134 +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.api.unitofwork; - -import org.apache.zest.api.identity.HasIdentity; -import org.apache.zest.api.identity.StringIdentity; -import org.junit.Test; -import org.apache.zest.api.common.Optional; -import org.apache.zest.api.entity.EntityBuilder; -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.property.Property; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.test.AbstractPolygeneTest; -import org.apache.zest.test.EntityTestAssembler; - -public class RemovalTest - extends AbstractPolygeneTest -{ - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.entities( TestEntity.class ); - module.entities( PidRegulator.class ); - new EntityTestAssembler().assemble( module ); - } - - @Test - public void givenEntityIsCreatedAndUnitOfWorkIsNotCompletedWhenEntityIsRemoveThenSuccessfulRemoval() - throws Exception - { - UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - try - { - EntityBuilder<TestEntity> builder = uow.newEntityBuilder( TestEntity.class, new StringIdentity( "123" ) ); - builder.instance().test().set( "habba" ); - TestEntity test = builder.newInstance(); - uow.remove( test ); - uow.complete(); - } - finally - { - uow.discard(); - } - } - - @Test - public void givenStandardPidRegulatorWhenNoChangeInInputExpectOutputToGoTowardsMinimum() - throws Exception - { - UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - PidRegulator regulator = null; - try - { - regulator = createPidRegulator( uow ); - } - finally - { - if( regulator != null ) - { - uow.remove( regulator ); - } - // TODO: This problem is related to that uow.remove() has a bug. - // If the Entity is both created and removed in the same session, then the remove() should simply remove - // the entity from the internal UoW holding area, and not set the REMOVED status. - - // Probably that UnitOfWorkInstance.remove() should also call instanceCache.remove(), but the question is - // then what is an InstanceKey vs EntityReference - uow.complete(); - } - } - - public interface TestEntity - extends EntityComposite - { - @Optional - Property<String> test(); - } - - private PidRegulator createPidRegulator( UnitOfWork uow ) - throws UnitOfWorkCompletionException - { - EntityBuilder<PidRegulator> builder = uow.newEntityBuilder( PidRegulator.class ); - PidRegulator prototype = builder.instance(); - prototype.p().set( 1.0f ); - prototype.i().set( 10f ); - prototype.d().set( 0.1f ); - prototype.maxD().set( 10f ); - prototype.maximum().set( 100f ); - prototype.minimum().set( 0f ); - PidRegulator regulator = builder.newInstance(); - - return regulator; - } - - // @Mixins( { PidRegulatorAlgorithmMixin.class } ) - public interface PidRegulator - extends PidParameters, EntityComposite - { - } - - public interface PidParameters - { - Property<Float> p(); - - Property<Float> i(); - - Property<Float> d(); - - Property<Float> maxD(); - - Property<Float> minimum(); - - Property<Float> maximum(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplateTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplateTest.java b/core/api/src/test/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplateTest.java deleted file mode 100644 index 170132b..0000000 --- a/core/api/src/test/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplateTest.java +++ /dev/null @@ -1,74 +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.api.unitofwork; - -import org.junit.Test; -import org.apache.zest.api.entity.EntityBuilderTemplate; -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.property.Property; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.test.AbstractPolygeneTest; -import org.apache.zest.test.EntityTestAssembler; - -/** - * TODO - */ -public class UnitOfWorkTemplateTest - extends AbstractPolygeneTest -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - new EntityTestAssembler().assemble( module ); - module.entities( TestEntity.class ); - } - - @Test - public void testTemplate() - throws UnitOfWorkCompletionException - { - new UnitOfWorkTemplate<Void, RuntimeException>() - { - @Override - protected Void withUnitOfWork( UnitOfWork uow ) - throws RuntimeException - { - new EntityBuilderTemplate<TestEntity>( TestEntity.class ) - { - @Override - protected void build( TestEntity prototype ) - { - prototype.name().set( "Rickard" ); - } - }.newInstance( module.instance() ); - - return null; - } - }.withModule( module.instance() ); - } - - interface TestEntity - extends EntityComposite - { - Property<String> name(); - } -}
