Stage 2 of the namespace change. Bulk of documentation fixed.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/fc41bb18 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/fc41bb18 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/fc41bb18 Branch: refs/heads/master Commit: fc41bb1838046512cc82356818a78311b55c0727 Parents: 8744a67 Author: Niclas Hedhman <[email protected]> Authored: Fri Jul 31 00:07:14 2015 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Fri Jul 31 00:07:14 2015 +0800 ---------------------------------------------------------------------- core/api/src/docs/application.txt | 8 +- core/api/src/docs/composition.txt | 4 +- core/api/src/docs/concern.txt | 6 +- core/api/src/docs/configuration.txt | 6 +- core/api/src/docs/decoratormixin.txt | 12 +- core/api/src/docs/metrics.txt | 14 +- core/api/src/docs/mixin.txt | 28 +- core/api/src/docs/servicecomposite.txt | 12 +- core/api/src/docs/valuecomposite.txt | 8 +- core/bootstrap/src/docs/bootstrap.txt | 28 +- core/functional/src/docs/functional.txt | 4 +- core/io/src/docs/io.txt | 40 +-- core/runtime/src/docs/runtime.txt | 6 +- .../constraints/PropertyConstraintTest.java | 77 +++++ .../zest/regression/qi230/Qi230IssueTest.java | 133 +++++++++ ...faceCollisionWithRelatedReturnTypesTest.java | 200 +++++++++++++ ...ceCollisionWithUnrelatedReturnTypesTest.java | 53 ++++ .../apache/zest/regression/qi377/IssueTest.java | 73 +++++ .../qi377/SetAssociationInSideEffectTest.java | 130 +++++++++ ...alueCollisionWithRelatedReturnTypesTest.java | 144 +++++++++ .../apache/zest/regression/qi382/Qi382Test.java | 109 +++++++ .../apache/zest/regression/qi383/Qi383Test.java | 59 ++++ .../apache/zest/regression/qi53/IssueTest.java | 103 +++++++ .../apache/zest/regression/qi55/IssueTest.java | 56 ++++ .../apache/zest/regression/qi59/IssueTest.java | 90 ++++++ .../apache/zest/regression/qi65/IssueTest.java | 65 +++++ .../apache/zest/regression/qi74/IssueTest.java | 59 ++++ .../apache/zest/regression/qi78/IssueTest.java | 94 ++++++ .../apache/zest/regression/qi94/IssueTest.java | 74 +++++ .../constraints/PropertyConstraintTest.java | 77 ----- .../qi4j/regression/qi230/Qi230IssueTest.java | 133 --------- ...faceCollisionWithRelatedReturnTypesTest.java | 200 ------------- ...ceCollisionWithUnrelatedReturnTypesTest.java | 53 ---- .../org/qi4j/regression/qi377/IssueTest.java | 73 ----- .../qi377/SetAssociationInSideEffectTest.java | 130 --------- ...alueCollisionWithRelatedReturnTypesTest.java | 144 --------- .../org/qi4j/regression/qi382/Qi382Test.java | 109 ------- .../org/qi4j/regression/qi383/Qi383Test.java | 59 ---- .../org/qi4j/regression/qi53/IssueTest.java | 103 ------- .../org/qi4j/regression/qi55/IssueTest.java | 56 ---- .../org/qi4j/regression/qi59/IssueTest.java | 90 ------ .../org/qi4j/regression/qi65/IssueTest.java | 65 ----- .../org/qi4j/regression/qi74/IssueTest.java | 59 ---- .../org/qi4j/regression/qi78/IssueTest.java | 94 ------ .../org/qi4j/regression/qi94/IssueTest.java | 74 ----- core/spi/src/docs/spi.txt | 4 +- core/testsupport/src/docs/testsupport.txt | 10 +- .../cache-ehcache/src/docs/cache-ehcache.txt | 4 +- .../cache-memcache/src/docs/cache-memcache.txt | 4 +- .../entitystore-file/src/docs/es-file.txt | 4 +- .../src/docs/es-hazelcast.txt | 4 +- .../entitystore-jclouds/src/docs/es-jclouds.txt | 4 +- .../entitystore-jdbm/src/docs/es-jdbm.txt | 4 +- .../entitystore-leveldb/src/docs/es-leveldb.txt | 4 +- .../entitystore-memory/src/docs/es-memory.txt | 2 +- .../entitystore-mongodb/src/docs/es-mongodb.txt | 4 +- .../src/docs/es-preferences.txt | 2 +- .../entitystore-redis/src/docs/es-redis.txt | 4 +- .../entitystore-riak/src/docs/es-riak.txt | 8 +- extensions/entitystore-sql/src/docs/es-sql.txt | 10 +- .../src/docs/index-elasticsearch.txt | 10 +- extensions/indexing-rdf/src/docs/index-rdf.txt | 10 +- .../indexing-solr/src/docs/index-solr.txt | 2 +- extensions/indexing-sql/src/docs/index-sql.txt | 2 +- .../src/docs/vs-jackson.txt | 2 +- .../src/docs/vs-orgjson.txt | 2 +- .../src/docs/vs-stax.txt | 2 +- libraries/alarm/src/docs/alarm.txt | 2 +- .../apache/zest/library/appbrowser/Browser.java | 109 +++++++ .../library/appbrowser/BrowserException.java | 29 ++ .../zest/library/appbrowser/Formatter.java | 34 +++ .../library/appbrowser/FormatterFactory.java | 25 ++ .../appbrowser/json/AbstractJsonFormatter.java | 85 ++++++ .../json/ApplicationModelFormatter.java | 56 ++++ .../library/appbrowser/json/ArrayFormatter.java | 56 ++++ .../json/CompositeMethodModelFormatter.java | 54 ++++ .../json/ConstructorModelFormatter.java | 53 ++++ .../appbrowser/json/EntityModelFormatter.java | 56 ++++ .../json/InjectedFieldModelFormatter.java | 60 ++++ .../appbrowser/json/JsonFormatterFactory.java | 107 +++++++ .../appbrowser/json/LayerModelFormatter.java | 62 ++++ .../appbrowser/json/MixinModelFormatter.java | 53 ++++ .../appbrowser/json/ModuleModelFormatter.java | 54 ++++ .../library/appbrowser/json/NullFormatter.java | 48 +++ .../appbrowser/json/ObjectModelFormatter.java | 53 ++++ .../appbrowser/json/ServiceModelFormatter.java | 61 ++++ .../appbrowser/json/ValueModelFormatter.java | 55 ++++ .../org/qi4j/library/appbrowser/Browser.java | 109 ------- .../library/appbrowser/BrowserException.java | 29 -- .../org/qi4j/library/appbrowser/Formatter.java | 34 --- .../library/appbrowser/FormatterFactory.java | 25 -- .../appbrowser/json/AbstractJsonFormatter.java | 85 ------ .../json/ApplicationModelFormatter.java | 56 ---- .../library/appbrowser/json/ArrayFormatter.java | 56 ---- .../json/CompositeMethodModelFormatter.java | 54 ---- .../json/ConstructorModelFormatter.java | 53 ---- .../appbrowser/json/EntityModelFormatter.java | 56 ---- .../json/InjectedFieldModelFormatter.java | 60 ---- .../appbrowser/json/JsonFormatterFactory.java | 107 ------- .../appbrowser/json/LayerModelFormatter.java | 62 ---- .../appbrowser/json/MixinModelFormatter.java | 53 ---- .../appbrowser/json/ModuleModelFormatter.java | 54 ---- .../library/appbrowser/json/NullFormatter.java | 48 --- .../appbrowser/json/ObjectModelFormatter.java | 53 ---- .../appbrowser/json/ServiceModelFormatter.java | 61 ---- .../appbrowser/json/ValueModelFormatter.java | 55 ---- .../zest/library/appbrowser/AppBrowserTest.java | 168 +++++++++++ .../qi4j/library/appbrowser/AppBrowserTest.java | 168 ----------- .../circuitbreaker/src/docs/circuitbreaker.txt | 6 +- libraries/constraints/src/docs/constraints.txt | 2 +- libraries/conversion/src/docs/conversion.txt | 18 +- .../eventsourcing/src/docs/eventsourcing.txt | 16 +- libraries/fileconfig/src/docs/fileconfig.txt | 8 +- libraries/http/src/docs/http.txt | 18 +- .../src/docs/invocation-cache.txt | 4 +- libraries/jmx/src/docs/jmx.txt | 2 +- libraries/lang-groovy/src/docs/lang-groovy.txt | 14 +- .../library/groovy/HelloSpeakerMixin.groovy | 2 +- .../zest/library/groovy/HelloSpeakerTest.java | 12 +- .../zest/library/groovy/HelloSpeaker.groovy | 26 -- .../apache/zest/library/groovy/Mixin1.groovy | 23 -- .../library/groovy/support/HelloSpeaker.groovy | 26 ++ .../zest/library/groovy/support/Mixin1.groovy | 23 ++ .../src/docs/lang-javascript.txt | 4 +- libraries/lang-jruby/README.txt | 2 +- libraries/lang-scala/src/docs/lang-scala.txt | 18 +- .../scala/ExclamationGenericConcern.scala | 36 +++ .../zest/library/scala/HelloThereConcern.scala | 22 ++ .../library/scala/HelloWorldComposite.scala | 21 ++ .../library/scala/HelloWorldComposite2.scala | 15 + .../library/scala/HelloWorldCompositeTest.java | 122 ++++++++ .../zest/library/scala/HelloWorldMixin.scala | 20 ++ .../zest/library/scala/HelloWorldMixin2.scala | 21 ++ .../zest/library/scala/HelloWorldMixin3.scala | 22 ++ .../apache/zest/library/scala/TestEntity.scala | 62 ++++ .../apache/zest/library/scala/TestService.scala | 25 ++ .../scala/scala/ExclamationGenericConcern.scala | 36 --- .../library/scala/scala/HelloThereConcern.scala | 22 -- .../scala/scala/HelloWorldComposite.scala | 21 -- .../scala/scala/HelloWorldComposite2.scala | 15 - .../scala/scala/HelloWorldCompositeTest.java | 123 -------- .../library/scala/scala/HelloWorldMixin.scala | 20 -- .../library/scala/scala/HelloWorldMixin2.scala | 21 -- .../library/scala/scala/HelloWorldMixin3.scala | 22 -- .../zest/library/scala/scala/TestEntity.scala | 62 ---- .../zest/library/scala/scala/TestService.scala | 25 -- libraries/locking/src/docs/locking.txt | 2 +- libraries/logging/src/docs/logging.txt | 8 +- libraries/metrics/src/docs/metrics.txt | 4 +- libraries/osgi/src/docs/osgi.txt | 4 +- libraries/rest-client/src/docs/primer.txt | 4 +- libraries/rest-client/src/docs/rest-client.txt | 14 +- libraries/scheduler/src/docs/scheduler.txt | 16 +- libraries/servlet/src/docs/servlet.txt | 6 +- libraries/shiro-core/src/docs/shiro.txt | 26 +- libraries/shiro-web/src/docs/shiro-web.txt | 2 +- libraries/spring/src/docs/spring.txt | 12 +- libraries/sql/src/docs/sql.txt | 22 +- libraries/uid/src/docs/uid.txt | 12 +- libraries/uowfile/src/docs/uowfile.txt | 26 +- .../tutorials/howto-assembly-application.txt | 12 +- .../src/docs/tutorials/howto-build-system.txt | 2 +- .../docs/tutorials/howto-configure-service.txt | 24 +- .../tutorials/howto-contextual-fragments.txt | 2 +- .../src/docs/tutorials/howto-create-concern.txt | 14 +- .../docs/tutorials/howto-create-constraint.txt | 14 +- .../src/docs/tutorials/howto-create-entity.txt | 34 +-- .../docs/tutorials/howto-create-sideeffect.txt | 14 +- .../src/docs/tutorials/howto-depend-on-zest.txt | 36 +-- .../tutorials/howto-invocation-annotation.txt | 6 +- .../tutorials/howto-leverage-properties.txt | 12 +- .../docs/tutorials/howto-releasing-apache.txt | 2 +- manual/src/docs/tutorials/howto-use-io.txt | 10 +- .../src/docs/tutorials/howto-writing-docs.txt | 12 +- manual/src/docs/userguide/glossary.txt | 2 +- manual/src/docs/website/intro.txt | 2 +- .../README-for-regression-reporting.txt | 4 +- tools/envisage/src/docs/envisage.txt | 2 +- .../plugin/idea/Qi4jApplicationComponent.java | 131 +++++++++ .../common/Qi4jAppliesToConstants.java | 31 ++ .../appliesTo/common/Qi4jAppliesToUtil.java | 136 +++++++++ ...ToAnnotationDeclaredCorrectlyInspection.java | 292 +++++++++++++++++++ .../AbstractCreateElementActionBase.java | 151 ++++++++++ .../common/actions/Qi4jCreateActionGroup.java | 80 +++++ .../ide/plugin/idea/common/facet/Qi4jFacet.java | 47 +++ .../common/facet/Qi4jFacetConfiguration.java | 54 ++++ .../plugin/idea/common/facet/Qi4jFacetType.java | 120 ++++++++ .../common/facet/ui/Qi4jFacetEditorTab.java | 70 +++++ .../idea/common/inspections/AbstractFix.java | 49 ++++ .../common/inspections/AbstractInspection.java | 60 ++++ .../common/intentions/AbstractIntention.java | 130 +++++++++ .../idea/common/psi/PsiAnnotationUtil.java | 95 ++++++ .../plugin/idea/common/psi/PsiClassUtil.java | 132 +++++++++ .../psi/search/GlobalSearchScopeUtil.java | 65 +++++ .../common/resource/Qi4jResourceBundle.java | 66 +++++ .../plugin/idea/common/vfs/VirtualFileUtil.java | 71 +++++ ...teConcernFromMixinTypeOrCompositeAction.java | 62 ++++ .../CreateConcernOfInPackageAction.java | 119 ++++++++ .../concerns/common/Qi4jConcernConstants.java | 38 +++ .../idea/concerns/common/Qi4jConcernUtil.java | 226 ++++++++++++++ ...nsAnnotationDeclaredCorrectlyInspection.java | 173 +++++++++++ .../intentions/add/AddConcernOnType.java | 138 +++++++++ ...larationOnFieldAndConstructorInspection.java | 90 ++++++ ...nAnnotationDeclarationOnFieldInspection.java | 138 +++++++++ .../Qi4jInvocationAnnotationConstants.java | 30 ++ .../common/Qi4jInvocationAnnotationUtil.java | 127 ++++++++ ...onAnnotationDeclaredCorrectlyInspection.java | 119 ++++++++ .../common/Qi4jServiceAnnotationConstants.java | 30 ++ .../common/Qi4jServiceAnnotationUtil.java | 97 ++++++ ...ceAnnotationDeclaredCorrectlyInspection.java | 110 +++++++ .../Qi4jStructureAnnotationConstants.java | 51 ++++ .../common/Qi4jStructureAnnotationUtil.java | 122 ++++++++ .../common/ReplaceWithStructureAnnotation.java | 47 +++ ...reAnnotationDeclaredCorrectlyInspection.java | 90 ++++++ .../idea/mixins/common/Qi4jMixinConstants.java | 30 ++ .../idea/mixins/common/Qi4jMixinUtil.java | 194 ++++++++++++ .../inspections/MixinImplementsMixinType.java | 188 ++++++++++++ .../MixinsAnnotationDeclaredOnMixinType.java | 90 ++++++ .../common/Qi4jSideEffectConstants.java | 33 +++ .../sideEffects/common/Qi4jSideEffectUtil.java | 186 ++++++++++++ ...tsAnnotationDeclaredCorrectlyInspection.java | 175 +++++++++++ .../plugin/idea/Qi4jApplicationComponent.java | 131 --------- .../common/Qi4jAppliesToConstants.java | 31 -- .../appliesTo/common/Qi4jAppliesToUtil.java | 136 --------- ...ToAnnotationDeclaredCorrectlyInspection.java | 292 ------------------- .../AbstractCreateElementActionBase.java | 151 ---------- .../common/actions/Qi4jCreateActionGroup.java | 80 ----- .../ide/plugin/idea/common/facet/Qi4jFacet.java | 47 --- .../common/facet/Qi4jFacetConfiguration.java | 54 ---- .../plugin/idea/common/facet/Qi4jFacetType.java | 120 -------- .../common/facet/ui/Qi4jFacetEditorTab.java | 70 ----- .../idea/common/inspections/AbstractFix.java | 49 ---- .../common/inspections/AbstractInspection.java | 60 ---- .../common/intentions/AbstractIntention.java | 130 --------- .../idea/common/psi/PsiAnnotationUtil.java | 95 ------ .../plugin/idea/common/psi/PsiClassUtil.java | 132 --------- .../psi/search/GlobalSearchScopeUtil.java | 65 ----- .../common/resource/Qi4jResourceBundle.java | 66 ----- .../plugin/idea/common/vfs/VirtualFileUtil.java | 71 ----- ...teConcernFromMixinTypeOrCompositeAction.java | 62 ---- .../CreateConcernOfInPackageAction.java | 119 -------- .../concerns/common/Qi4jConcernConstants.java | 38 --- .../idea/concerns/common/Qi4jConcernUtil.java | 226 -------------- ...nsAnnotationDeclaredCorrectlyInspection.java | 173 ----------- .../intentions/add/AddConcernOnType.java | 138 --------- ...larationOnFieldAndConstructorInspection.java | 90 ------ ...nAnnotationDeclarationOnFieldInspection.java | 138 --------- .../Qi4jInvocationAnnotationConstants.java | 30 -- .../common/Qi4jInvocationAnnotationUtil.java | 127 -------- ...onAnnotationDeclaredCorrectlyInspection.java | 119 -------- .../common/Qi4jServiceAnnotationConstants.java | 30 -- .../common/Qi4jServiceAnnotationUtil.java | 97 ------ ...ceAnnotationDeclaredCorrectlyInspection.java | 110 ------- .../Qi4jStructureAnnotationConstants.java | 51 ---- .../common/Qi4jStructureAnnotationUtil.java | 122 -------- .../common/ReplaceWithStructureAnnotation.java | 47 --- ...reAnnotationDeclaredCorrectlyInspection.java | 90 ------ .../idea/mixins/common/Qi4jMixinConstants.java | 30 -- .../idea/mixins/common/Qi4jMixinUtil.java | 194 ------------ .../inspections/MixinImplementsMixinType.java | 188 ------------ .../MixinsAnnotationDeclaredOnMixinType.java | 90 ------ .../common/Qi4jSideEffectConstants.java | 33 --- .../sideEffects/common/Qi4jSideEffectUtil.java | 186 ------------ ...tsAnnotationDeclaredCorrectlyInspection.java | 175 ----------- .../src/main/resources/META-INF/plugin.xml | 8 +- .../resource/Qi4jResourceBundle.properties | 159 ++++++++++ .../resource/Qi4jResourceBundle.properties | 159 ---------- tutorials/composites/src/docs/step1.txt | 10 +- tutorials/composites/src/docs/step2.txt | 6 +- tutorials/composites/src/docs/step3.txt | 10 +- tutorials/composites/src/docs/step4.txt | 4 +- tutorials/composites/src/docs/step5.txt | 8 +- tutorials/composites/src/docs/step6.txt | 8 +- tutorials/composites/src/docs/step7.txt | 8 +- tutorials/composites/src/docs/step8.txt | 6 +- tutorials/composites/src/docs/step9.txt | 6 +- tutorials/introduction/src/docs/qi4j-cop.txt | 22 -- .../introduction/src/docs/state-modeling.txt | 10 +- .../introduction/src/docs/whats-an-object.txt | 12 +- tutorials/introduction/src/docs/zest-cop.txt | 22 ++ .../tenminutes/src/docs/ten-minutes.txt | 8 +- .../thirtyminutes/src/docs/thirty-minutes.txt | 16 +- .../twominutes/src/docs/two-minutes.txt | 6 +- tutorials/services/src/docs/step3.txt | 2 +- 284 files changed, 8324 insertions(+), 8325 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/application.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/application.txt b/core/api/src/docs/application.txt index bf97b53..2deb3b2 100644 --- a/core/api/src/docs/application.txt +++ b/core/api/src/docs/application.txt @@ -65,7 +65,7 @@ The full code looks like this; [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/docsupport/ApplicationDocs.java +source=core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java tag=application1 ----------- @@ -76,7 +76,7 @@ shows what is the actual required sequence to start up Zest. [snippet,java] ----------- -source=core/bootstrap/src/main/java/org/qi4j/bootstrap/SingletonAssembler.java +source=core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java tag=actual ----------- @@ -94,7 +94,7 @@ Module in the second index and any number of Assembler instances in the last ind [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/docsupport/ApplicationDocs.java +source=core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java tag=application2 ----------- @@ -109,7 +109,7 @@ free structure, as long as the rules for no cyclic reference of the Layers are k [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/docsupport/ApplicationDocs.java +source=core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java tag=application3 ----------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/composition.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/composition.txt b/core/api/src/docs/composition.txt index 467fd7a..68779fe 100644 --- a/core/api/src/docs/composition.txt +++ b/core/api/src/docs/composition.txt @@ -58,7 +58,7 @@ We can therefor get rid of a lot of additional types, and use Zest-free interfac [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/docsupport/CompositionDocs.java +source=core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java tag=comp1 ----------- @@ -66,7 +66,7 @@ and declare it with; [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/docsupport/CompositionDocs.java +source=core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java tag=comp2 ----------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/concern.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/concern.txt b/core/api/src/docs/concern.txt index 3d6e36f..47e0ac7 100644 --- a/core/api/src/docs/concern.txt +++ b/core/api/src/docs/concern.txt @@ -60,21 +60,21 @@ of the JDBC Connection class; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/concern/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java tag=class -------------- We can also use an AppliesToFilter to define which methods should be wrapped with the concern, like this; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/concern/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java tag=filter -------------- And finally an example of how to use annotations to mark indvidual methods for being wrapped by the concern. [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/concern/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java tag=annotation -------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/configuration.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/configuration.txt b/core/api/src/docs/configuration.txt index 75ce54d..dd4f84f 100644 --- a/core/api/src/docs/configuration.txt +++ b/core/api/src/docs/configuration.txt @@ -34,7 +34,7 @@ Example; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/configuration/MailServiceConfiguration.java +source=core/api/src/test/java/org/apache/zest/api/configuration/MailServiceConfiguration.java tag=configuration -------------- @@ -49,7 +49,7 @@ changes take effect. Example; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/configuration/MailService.java +source=core/api/src/test/java/org/apache/zest/api/configuration/MailService.java tag=read -------------- @@ -59,7 +59,7 @@ must be called. Example; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/configuration/MailService.java +source=core/api/src/test/java/org/apache/zest/api/configuration/MailService.java tag=write -------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/decoratormixin.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/decoratormixin.txt b/core/api/src/docs/decoratormixin.txt index 548ae24..77ed241 100644 --- a/core/api/src/docs/decoratormixin.txt +++ b/core/api/src/docs/decoratormixin.txt @@ -32,7 +32,7 @@ the same model instance, so any changes to the model will notify the views. We start with the FooModel interface; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/mixin/decoratorMixin/FooModel.java +source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java tag=plain -------------- @@ -41,7 +41,7 @@ and its implementation is not really relevant for this discussion. Each of the views looks like this; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/mixin/decoratorMixin/View1.java +source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java tag=decorator -------------- @@ -53,7 +53,7 @@ FooModel with the DecoratorMixin. [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/mixin/decoratorMixin/FooModel.java +source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java tag=decorator -------------- @@ -62,7 +62,7 @@ do; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/mixin/decoratorMixin/DecoratorMixinTest.java +source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java tag=create -------------- @@ -70,7 +70,7 @@ And there is nothing special in the assembly of this simple example; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/mixin/decoratorMixin/DecoratorMixinTest.java +source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java tag=assembly -------------- @@ -78,6 +78,6 @@ This can now be validated in a small test; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/mixin/decoratorMixin/DecoratorMixinTest.java +source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java tag=test -------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/metrics.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/metrics.txt b/core/api/src/docs/metrics.txt index 65f80a7..3f81ea1 100644 --- a/core/api/src/docs/metrics.txt +++ b/core/api/src/docs/metrics.txt @@ -30,7 +30,7 @@ constructor argument. [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/metrics/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java tag=common -------------- @@ -48,7 +48,7 @@ To create a Gauge, you do something like; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/metrics/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java tag=gauge -------------- @@ -56,14 +56,14 @@ tag=gauge [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/metrics/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java tag=counter -------------- == Histogram == [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/metrics/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java tag=histogram -------------- @@ -71,7 +71,7 @@ tag=histogram [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/metrics/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java tag=meter -------------- @@ -81,7 +81,7 @@ critical sections, or even HTTP requests duration and similar. [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/metrics/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java tag=timer -------------- @@ -89,6 +89,6 @@ tag=timer [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/metrics/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java tag=healthcheck -------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/mixin.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/mixin.txt b/core/api/src/docs/mixin.txt index 625f894..989b7cd 100644 --- a/core/api/src/docs/mixin.txt +++ b/core/api/src/docs/mixin.txt @@ -25,7 +25,7 @@ the @Mixins annotation of a Composite declaration) implements one or more method Mixin Type can be very simple, like; [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/BankAccount.java +source=core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java tag=mixinType ----------- @@ -68,12 +68,12 @@ Mixins are declared as annotations on the composite interface. [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/Something.java +source=core/api/src/test/java/org/apache/zest/api/mixin/Something.java tag=something ----------- [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/SomethingMixin.java +source=core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java tag=something ----------- In the above sample, the SomethingMixin will be made part of the Something composite. @@ -83,17 +83,17 @@ the mixins required. [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/Car.java +source=core/api/src/test/java/org/apache/zest/api/mixin/Car.java tag=mixin ----------- [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/Startable.java +source=core/api/src/test/java/org/apache/zest/api/mixin/Startable.java tag=mixin ----------- [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/Vehicle.java +source=core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java tag=mixin ----------- @@ -103,22 +103,22 @@ which are ordinary mixins but are lacking some methods. This is simply done by d [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/partial/Car.java +source=core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java tag=partial ----------- [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/partial/Vehicle.java +source=core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java tag=partial ----------- [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/partial/SpeedLocation.java +source=core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java tag=partial ----------- [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/partial/SpeedMixin.java +source=core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java tag=partial ----------- @@ -142,7 +142,7 @@ the Cargo interface like; [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/privateMixin/Cargo.java +source=core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java tag=private ----------- @@ -152,12 +152,12 @@ probably do something like; [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/privateMixin/CargoMixin.java +source=core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java tag=private ----------- [snippet,java] ----------- -source=core/api/src/test/java/org/qi4j/api/mixin/privateMixin/CargoState.java +source=core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java tag=private ----------- @@ -179,7 +179,7 @@ interfaces and automatically included if needed. They also serve as excellent ex [snippet,java] ----------- -source=core/api/src/main/java/org/qi4j/api/property/PropertyMixin.java +source=core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java tag=actual ----------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/servicecomposite.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/servicecomposite.txt b/core/api/src/docs/servicecomposite.txt index 0736d90..4016195 100644 --- a/core/api/src/docs/servicecomposite.txt +++ b/core/api/src/docs/servicecomposite.txt @@ -54,7 +54,7 @@ by calling instantiateOnStartup(), this way; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/service/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java tag=instantiateOnStartup -------------- @@ -69,7 +69,7 @@ The easiest way is to implement the ServiceActivation interface directly in the [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/service/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java tag=activation1 -------------- @@ -77,7 +77,7 @@ The activation code can also be moved outside the composite by using the Service [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/service/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java tag=activation2 -------------- @@ -85,7 +85,7 @@ Activators can be registered on Service assembly too, this way; [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/service/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java tag=activation3 -------------- @@ -102,7 +102,7 @@ instance. Services can also be arbitrarily tagged, via the ServiceDescriptor. Ex [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/service/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java tag=tag -------------- @@ -110,6 +110,6 @@ Tags are useful inside the application code to locate a particular service insta [snippet,java] -------------- -source=core/api/src/test/java/org/qi4j/api/service/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java tag=UseTag -------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/api/src/docs/valuecomposite.txt ---------------------------------------------------------------------- diff --git a/core/api/src/docs/valuecomposite.txt b/core/api/src/docs/valuecomposite.txt index 7f06ec7..7aad0c4 100644 --- a/core/api/src/docs/valuecomposite.txt +++ b/core/api/src/docs/valuecomposite.txt @@ -86,7 +86,7 @@ Let's see how it works in practice. [snippet,java] ---- -source=core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java tag=default ---- @@ -110,7 +110,7 @@ Let's see how to use the ValueSerialization Services. [snippet,java] ---- -source=core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java tag=service ---- @@ -130,7 +130,7 @@ The first one use classic streams. [snippet,java] ---- -source=core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java tag=stream ---- @@ -143,7 +143,7 @@ The second one use the <<core-io>>: [snippet,java] ---- -source=core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java +source=core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java tag=io ---- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/bootstrap/src/docs/bootstrap.txt ---------------------------------------------------------------------- diff --git a/core/bootstrap/src/docs/bootstrap.txt b/core/bootstrap/src/docs/bootstrap.txt index 56be2d0..6f4af65 100644 --- a/core/bootstrap/src/docs/bootstrap.txt +++ b/core/bootstrap/src/docs/bootstrap.txt @@ -27,7 +27,7 @@ is defined programmatically. Once all the layers, modules and all the composite the model is instantiated into an application. This enables the entire _structure_ system in Zest, where types "belongs" to a module and visibility rules define default behaviors, enforcement of architectural integrity and much more. -The _assembly_ is preceeded by the creation of the _Qi4j Runtime_. The _assembly_ can be declared fully by defining +The _assembly_ is preceeded by the creation of the _Zest Runtime_. The _assembly_ can be declared fully by defining all modules and layers, and how the layers are sitting on top of each other, OR one can utilize one of the two convenience assemblies, one for a _pancake_ pattern, where all layers are top on each other, or one with a single module in a single layer, useful for small applications, spikes and tests. The +bootstrap+ system has several ways to acheive @@ -53,7 +53,7 @@ include::../../build/docs/buildinfo/artifact.txt[] [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=objects -------------- @@ -62,7 +62,7 @@ tag=objects [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=transients -------------- @@ -71,7 +71,7 @@ tag=transients [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=values -------------- @@ -80,7 +80,7 @@ tag=values [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=entities -------------- @@ -89,7 +89,7 @@ tag=entities [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=services -------------- @@ -97,7 +97,7 @@ tag=services [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=tagged-services -------------- @@ -105,7 +105,7 @@ tag=tagged-services [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=imported-services -------------- @@ -113,7 +113,7 @@ tag=imported-services [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=properties-defaults -------------- @@ -136,7 +136,7 @@ such as; [snippet,java] -------------- -source=libraries/rest-server/src/test/java/org/qi4j/library/rest/server/DocumentationSupport.java +source=libraries/rest-server/src/test/java/org/apache/zest/library/rest/server/DocumentationSupport.java tag=UsingAssembler -------------- @@ -160,7 +160,7 @@ used like; [snippet,java] -------------- -source=extensions/entitystore-jdbm/src/test/java/org/qi4j/entitystore/jdbm/DocumentationSupport.java +source=extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/DocumentationSupport.java tag=UsingAssembler -------------- @@ -214,7 +214,7 @@ Let's take a closer look at how it is put together. [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=singleton -------------- @@ -268,7 +268,7 @@ Let's look at an example; [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=pancake -------------- @@ -283,7 +283,7 @@ ApplicationAssemblyFactory, which is used to create an ApplicationAssembly descr [snippet,java] -------------- -source=core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java +source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java tag=full -------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/functional/src/docs/functional.txt ---------------------------------------------------------------------- diff --git a/core/functional/src/docs/functional.txt b/core/functional/src/docs/functional.txt index 461e091..153dcc5 100644 --- a/core/functional/src/docs/functional.txt +++ b/core/functional/src/docs/functional.txt @@ -34,7 +34,7 @@ sum it all up in something like this; [snippet,java] ----------- -source=core/functional/src/test/java/org/qi4j/functional/docsupport/FunctionalDocs.java +source=core/functional/src/test/java/org/apache/zest/functional/docsupport/FunctionalDocs.java tag=func1 ----------- @@ -42,7 +42,7 @@ With the Zest⢠Core Functional API, you go about it in a different way. The co [snippet,java] ----------- -source=core/functional/src/test/java/org/qi4j/functional/docsupport/FunctionalDocs.java +source=core/functional/src/test/java/org/apache/zest/functional/docsupport/FunctionalDocs.java tag=func2 ----------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/io/src/docs/io.txt ---------------------------------------------------------------------- diff --git a/core/io/src/docs/io.txt b/core/io/src/docs/io.txt index d8ffef8..3abd508 100644 --- a/core/io/src/docs/io.txt +++ b/core/io/src/docs/io.txt @@ -48,14 +48,14 @@ not have this simple feature and in the Zest⢠Core API, we need to work around make the abstraction a little bit more encompassing than "just" files. So how does that look like then? == First Examples == -The most common inputs and outputs are collected in the org.qi4j.io.Inputs and org.qi4j.io.Outputs classes as static +The most common inputs and outputs are collected in the org.apache.zest.io.Inputs and org.apache.zest.io.Outputs classes as static factory methods, but you can create your (more about that later). So, we want to read a text file and write the content into another text file, right? This is how it is done; [snippet,java] ----------- -source=core/io/src/test/java/org/qi4j/io/docsupport/IoDocs.java +source=core/io/src/test/java/org/apache/zest/io/docsupport/IoDocs.java tag=io1 ----------- @@ -66,7 +66,7 @@ Another simple example, where we want to count the number of lines in the text; [snippet,java] ----------- -source=core/io/src/test/java/org/qi4j/io/docsupport/IoDocs.java +source=core/io/src/test/java/org/apache/zest/io/docsupport/IoDocs.java tag=io2 ----------- @@ -80,12 +80,12 @@ be a File or a String, the transformation could be a filter, conversion or a fun destination could be a File, String or an OutputStream. It is important to note that there is a strong separation of concern between them. Let's look at the on at a time. -== org.qi4j.io.Input == +== org.apache.zest.io.Input == This interface simply has a transferTo() method, which takes an Output. The formal definition is; [snippet,java] -------------- -source=core/io/src/main/java/org/qi4j/io/Input.java +source=core/io/src/main/java/org/apache/zest/io/Input.java tag=input -------------- @@ -102,16 +102,16 @@ So, then, the method transferTo() contains the declaration of the downstream rec (ReceiverThrowable) which the transferTo() method may also throw as the data may not be accepted and such exception will bubble up to the transferTo() method (the client's view of the transfer). -== org.qi4j.io.Output == +== org.apache.zest.io.Output == The output interface is likewise fairly simple; [snippet,java] -------------- -source=core/io/src/main/java/org/qi4j/io/Output.java +source=core/io/src/main/java/org/apache/zest/io/Output.java tag=output -------------- -It can simply receive data from a org.qi4j.io.Sender. +It can simply receive data from a org.apache.zest.io.Sender. Hey, hold on! Why is it not receiving from an Input? Because the Input is the client's entry point and of no use to the Output as such. Instead, the Output will tell the Sender (which is handed to from the Input or an transformation) @@ -126,16 +126,16 @@ which is represented by the Sender. Likewise the destination is an Output, but i interface. For O/S resources, they are handled purely inside the Input and Output implementations, where are the Sender/Receiver are effectively dealing with the data itself. -== org.qi4j.io.Transforms == +== org.apache.zest.io.Transforms == The 3 component in the Zest⢠Core I/O API is the transformations that are possible. Interestingly enough, with the above separation of concerns, we don't need an InputOutput type that can both receive and send data. Instead, we -simply need to prepare easy to use static factory methods, which are found in the org.qi4j.io.Transforms class. Again, +simply need to prepare easy to use static factory methods, which are found in the org.apache.zest.io.Transforms class. Again, it is fairly straight forward to create your own Transforms if you need something not provided here. The current transformations available are; * filter - takes a Specification and only forwards data items conforming to the Specification. - * map - takes a org.qi4j.functional.Function to convert an item from one type to (potentially) another, and any + * map - takes a org.apache.zest.functional.Function to convert an item from one type to (potentially) another, and any possible change along the way. * filteredMap - is a combination of a filter and a map. If the Specification is satisfied, the map function is applied, otherwise the item is passed through unaffected. @@ -159,7 +159,7 @@ The implementation is very straight forward. [snippet,java] -------------- -source=core/io/src/main/java/org/qi4j/io/Transforms.java +source=core/io/src/main/java/org/apache/zest/io/Transforms.java tag=counter -------------- @@ -170,7 +170,7 @@ Speaking of "progress", so how is the ProgressLog implemented? Glad you asked; [snippet,java] -------------- -source=core/io/src/main/java/org/qi4j/io/Transforms.java +source=core/io/src/main/java/org/apache/zest/io/Transforms.java tag=progress -------------- @@ -184,7 +184,7 @@ about that in <<core-functional>>. [snippet,java] -------------- -source=core/functional/src/main/java/org/qi4j/functional/Specification.java +source=core/functional/src/main/java/org/apache/zest/functional/Specification.java tag=specification -------------- @@ -194,30 +194,30 @@ as [snippet,java] -------------- -source=core/functional/src/test/java/org/qi4j/functional/IntegerRangeSpecificationTest.java +source=core/functional/src/test/java/org/apache/zest/functional/IntegerRangeSpecificationTest.java tag=specification -------------- == Ready-to-use components == Input and Output implementations at first glance look quite scary. Taking a closer look and it can be followed. But to -simplify for users, the org.qi4j.io.Inputs and org.qi4h.io.Outputs contains static factory methods for many useful +simplify for users, the org.apache.zest.io.Inputs and org.apache.zest.io.Outputs contains static factory methods for many useful sources and destinations. -== org.qi4j.io.Inputs == +== org.apache.zest.io.Inputs == The current set of ready-to-use Input implementations are; [snippet,java] -------------- -source=core/io/src/main/java/org/qi4j/io/Inputs.java +source=core/io/src/main/java/org/apache/zest/io/Inputs.java tag=method -------------- -== org.qi4j.io.Outputs == +== org.apache.zest.io.Outputs == The current set of ready-to-use Input implementations are; [snippet,java] -------------- -source=core/io/src/main/java/org/qi4j/io/Outputs.java +source=core/io/src/main/java/org/apache/zest/io/Outputs.java tag=method -------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/docs/runtime.txt ---------------------------------------------------------------------- diff --git a/core/runtime/src/docs/runtime.txt b/core/runtime/src/docs/runtime.txt index ec2c9f3..24eb301 100644 --- a/core/runtime/src/docs/runtime.txt +++ b/core/runtime/src/docs/runtime.txt @@ -22,10 +22,10 @@ source=core/runtime/dev-status.xml -------------- First of all, your code should never, ever, have a dependency on Core Runtime. If you think you need this, you should -probably contact qi4j-dev forum at Google Groups and see if your usecase can either be solved in a existing way or perhaps -that a new Core SPI Extension is needed. +probably contact [email protected] mailing list and see if your usecase can either be solved in a existing way or +perhaps that a new Core SPI Extension is needed. include::../../build/docs/buildinfo/artifact.txt[] Let's repeat that; *Never, never, ever depend on Core Runtime*. Make sure that the compile dependency does NOT include -the `org.qi4j.core.runtime` jar. \ No newline at end of file +the `org.apache.zest.core.runtime` jar. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/constraints/PropertyConstraintTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/constraints/PropertyConstraintTest.java b/core/runtime/src/test/java/org/apache/zest/constraints/PropertyConstraintTest.java new file mode 100644 index 0000000..8307140 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/constraints/PropertyConstraintTest.java @@ -0,0 +1,77 @@ +/* + * Copyright 2008 Niclas Hedhman. All rights Reserved. + * + * 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.constraints; + +import java.util.Collection; +import org.apache.zest.api.composite.TransientBuilder; +import org.apache.zest.api.composite.TransientComposite; +import org.apache.zest.api.constraint.ConstraintViolation; +import org.apache.zest.api.constraint.ConstraintViolationException; +import org.apache.zest.api.constraint.Constraints; +import org.apache.zest.api.property.Property; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.library.constraints.MinLengthConstraint; +import org.apache.zest.library.constraints.annotation.Matches; +import org.apache.zest.library.constraints.annotation.MinLength; +import org.apache.zest.test.AbstractQi4jTest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class PropertyConstraintTest + extends AbstractQi4jTest +{ + @org.junit.Test + public void givenConstraintOnPropertyWhenInvalidValueThenThrowException() + throws Throwable + { + TransientBuilder<Test> builder = module.newTransientBuilder( Test.class ); + builder.prototype().test().set( "XXXXXX" ); + Test test = builder.newInstance(); + try + { + test.test().set( "YY" ); + fail( "Should have thrown a ConstraintViolationException." ); + } + catch( ConstraintViolationException e ) + { + Collection<ConstraintViolation> violations = e.constraintViolations(); + assertEquals( 2, violations.size() ); + } + } + + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.transients( TestComposite.class ); + } + + @Constraints( { MinLengthConstraint.class } ) + public interface TestComposite + extends Test, TransientComposite + { + } + + public interface Test + { + @MinLength( 3 ) + @Matches( "X*" ) + Property<String> test(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi230/Qi230IssueTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi230/Qi230IssueTest.java b/core/runtime/src/test/java/org/apache/zest/regression/qi230/Qi230IssueTest.java new file mode 100644 index 0000000..02eff2e --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi230/Qi230IssueTest.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2010, Rickard Ãberg. All Rights Reserved. + * + * 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.regression.qi230; + +import org.junit.Test; +import org.apache.zest.api.Qi4j; +import org.apache.zest.api.composite.Composite; +import org.apache.zest.api.concern.ConcernOf; +import org.apache.zest.api.concern.Concerns; +import org.apache.zest.api.injection.scope.Service; +import org.apache.zest.api.injection.scope.Structure; +import org.apache.zest.api.injection.scope.This; +import org.apache.zest.api.mixin.Mixins; +import org.apache.zest.api.mixin.NoopMixin; +import org.apache.zest.api.service.ServiceComposite; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.test.AbstractQi4jTest; + +import static org.junit.Assert.assertEquals; + +/** + * JAVADOC + */ +public class Qi230IssueTest + extends AbstractQi4jTest +{ + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( Some.class ).withMixins( NoopMixin.class ).withConcerns( OtherConcern.class ); +// module.services( Some.class ); + module.services( Result.class ); + } + + @Test + public void whenDerefencingInsideConcernThisExpectItToWork() + throws Exception + { + Result result = module.findService( Result.class ).get(); + Some some = module.findService( Some.class ).get(); + assertEquals( "method()", some.method() ); + assertEquals( some.identity(), result.some().identity() ); + assertEquals( some.identity().get(), result.some().identity().get() ); + } + + @Mixins( ResultMixin.class ) + public interface Result + extends ServiceComposite + { + void execute( Some value ); + + Some some(); + } + + public static abstract class ResultMixin + implements Result + { + + private Some value; + + public void execute( Some value ) + { + this.value = value; + } + + public Some some() + { + return value; + } + } + + @Concerns( OtherConcern.class ) + @Mixins( NoopMixin.class ) + public interface Other + { + void other(); + } + + @Mixins( SomeMixin.class ) + public interface Some + extends ServiceComposite +// extends ServiceComposite, Other + { + String method(); + } + + public abstract static class SomeMixin + implements Some + { + @This + private Other other; + + public String method() + { + other.other(); + return "method()"; + } + } + + public static class OtherConcern + extends ConcernOf<Other> + implements Other + { + @Structure + private Qi4j api; + + @This + private Composite me; + + @Service + private Result result; + + public void other() + { + Composite value = api.dereference( me ); + result.execute( (Some) value ); + next.other(); + } + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java b/core/runtime/src/test/java/org/apache/zest/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java new file mode 100644 index 0000000..8cafbe6 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2013, Chris Chapman. All Rights Reserved. + * Copyright (c) 2014, Paul Merlin. All Rights Reserved. + * + * 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.regression.qi377; + +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.entity.Identity; +import org.apache.zest.api.property.Property; +import org.apache.zest.api.unitofwork.UnitOfWork; +import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.EntityTestAssembler; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsNull.notNullValue; +import static org.junit.Assert.assertThat; + +public class InterfaceCollisionWithRelatedReturnTypesTest + extends AbstractQi4jTest +{ + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + new EntityTestAssembler().assemble( module ); + module.entities( Employee.class, Company.class ); + } + + @Test + public void shouldBeAbleToSetNameToTheCompany() + throws UnitOfWorkCompletionException + { + String identity; + try( UnitOfWork uow = module.newUnitOfWork() ) + { + Company startUp = uow.newEntity( Company.class ); + startUp.name().set( "Acme" ); + identity = ( (Identity) startUp ).identity().get(); + uow.complete(); + } + try( UnitOfWork uow = module.newUnitOfWork() ) + { + Company startUp = uow.get( Company.class, identity ); + assertThat( startUp.name().get(), equalTo( "Acme" ) ); + + SalesTeam sales = uow.get( SalesTeam.class, identity ); + assertThat( sales.name().get(), equalTo( "Acme" ) ); + + ResearchTeam research = uow.get( ResearchTeam.class, identity ); + assertThat( research.name().get(), equalTo( "Acme" ) ); + } + } + + @Test + public void shouldBeAbleToSetLeadToTheCompany() + throws UnitOfWorkCompletionException + { + String identity; + try( UnitOfWork uow = module.newUnitOfWork() ) + { + Company startUp = uow.newEntity( Company.class ); + Employee niclas = uow.newEntity( Employee.class ); + + startUp.lead().set( niclas ); + identity = ( (Identity) startUp ).identity().get(); + + uow.complete(); + } + try( UnitOfWork uow = module.newUnitOfWork() ) + { + Company startUp = uow.get( Company.class, identity ); + Employee niclas = startUp.lead().get(); + assertThat( niclas, notNullValue() ); + + SalesTeam sales = uow.get( SalesTeam.class, identity ); + assertThat( sales.lead().get(), equalTo( niclas ) ); + + ResearchTeam research = uow.get( ResearchTeam.class, identity ); + assertThat( research.lead().get(), equalTo( niclas ) ); + } + } + + @Test + public void shouldBeAbleToSetLeadToTheSalesTeam() + { + try( UnitOfWork uow = module.newUnitOfWork() ) + { + SalesTeam startUp = uow.newEntity( SalesTeam.class ); + Employee niclas = uow.newEntity( Employee.class ); + + startUp.lead().set( niclas ); + } + } + + @Test + public void shouldBeAbleToSetLeadToTheResearchTeam() + { + try( UnitOfWork uow = module.newUnitOfWork() ) + { + ResearchTeam startUp = uow.newEntity( ResearchTeam.class ); + Employee niclas = uow.newEntity( Employee.class ); + + startUp.lead().set( niclas ); + } + } + + @Test + public void shouldBeAbleToAddEmployeesToTheCompany() + { + try( UnitOfWork uow = module.newUnitOfWork() ) + { + Company startUp = uow.newEntity( Company.class ); + Employee niclas = uow.newEntity( Employee.class ); + + // To which team is Niclas added? Seems to be the interface listed first in the interface declaration? + // This contrived example is probably just bad design... + startUp.employees().add( niclas ); + } + } + + @Test + public void shouldBeAbleToAddEmployeesToTheSalesTeam() + { + try( UnitOfWork uow = module.newUnitOfWork() ) + { + SalesTeam startUp = uow.newEntity( SalesTeam.class ); + Employee niclas = uow.newEntity( Employee.class ); + + startUp.employees().add( niclas ); + } + } + + @Test + public void shouldBeAbleToAddEmployeesToTheResearchTeam() + { + try( UnitOfWork uow = module.newUnitOfWork() ) + { + ResearchTeam startUp = uow.newEntity( ResearchTeam.class ); + Employee niclas = uow.newEntity( Employee.class ); + + startUp.employees().add( niclas ); + } + } + + public interface Employee + { + } + + public interface SalesTeam + { + @Optional + Property<String> name(); + + @Optional + Association<Employee> lead(); + + ManyAssociation<Employee> employees(); + } + + public interface ResearchTeam + { + @Optional + Property<String> name(); + + @Optional + Association<Employee> lead(); + + ManyAssociation<Employee> employees(); + } + + /** + * This compiles, unlike the example in {@link InterfaceCollisionWithUnrelatedReturnTypesTest}. + */ + public interface Company + extends SalesTeam, ResearchTeam + { + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi377/InterfaceCollisionWithUnrelatedReturnTypesTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi377/InterfaceCollisionWithUnrelatedReturnTypesTest.java b/core/runtime/src/test/java/org/apache/zest/regression/qi377/InterfaceCollisionWithUnrelatedReturnTypesTest.java new file mode 100644 index 0000000..cef8c94 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi377/InterfaceCollisionWithUnrelatedReturnTypesTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013, Chris Chapman. All Rights Reserved. + * + * 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.regression.qi377; + +import org.apache.zest.api.common.UseDefaults; +import org.apache.zest.api.property.Property; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.test.AbstractQi4jTest; + +public class InterfaceCollisionWithUnrelatedReturnTypesTest + extends AbstractQi4jTest +{ + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + } + + public interface Person + { + @UseDefaults + Property<String> name(); + } + + public interface Robot + { + @UseDefaults + Property<Integer> name(); + } + + /** + * DOESN'T COMPILE!!! + * java: types org.qi4j.regression.qi377.InterfaceCollisionWithUnrelatedReturnTypesTest.Robot and org.qi4j.regression.qi377.InterfaceCollisionWithUnrelatedReturnTypesTest.Person are incompatible; both define name(), but with unrelated return types + */ +// public interface TeamMember extends Person, Robot {} +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi377/IssueTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi377/IssueTest.java b/core/runtime/src/test/java/org/apache/zest/regression/qi377/IssueTest.java new file mode 100644 index 0000000..959d29d --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi377/IssueTest.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2013, Chris Chapman. All Rights Reserved. + * + * 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.regression.qi377; + +import org.junit.Test; +import org.apache.zest.api.common.UseDefaults; +import org.apache.zest.api.property.Property; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.test.AbstractQi4jTest; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +public class IssueTest + extends AbstractQi4jTest +{ + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.transients( TeamMember.class ); + } + + @Test + public void propertyNameCollisionsShouldWork() + { + TeamMember m = module.newTransient( TeamMember.class ); + m.name().set( "Niclas" ); + Person p = m; + p.name().set( "Chris" ); + Employee e = m; + e.name().set( "Paul" ); + + assertThat( m.name().get(), equalTo( "Paul" ) ); + assertThat( e.name().get(), equalTo( "Paul" ) ); + assertThat( p.name().get(), equalTo( "Paul" ) ); + } + + public interface Person + { + @UseDefaults + Property<String> name(); + } + + public interface Employee + { + @UseDefaults + Property<String> name(); + } + + public interface TeamMember + extends Person, Employee + { + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi377/SetAssociationInSideEffectTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi377/SetAssociationInSideEffectTest.java b/core/runtime/src/test/java/org/apache/zest/regression/qi377/SetAssociationInSideEffectTest.java new file mode 100644 index 0000000..b057c4e --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi377/SetAssociationInSideEffectTest.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2013, Chris Chapman. All Rights Reserved. + * + * 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.regression.qi377; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.Method; +import org.junit.Test; +import org.apache.zest.api.association.Association; +import org.apache.zest.api.common.AppliesTo; +import org.apache.zest.api.common.Optional; +import org.apache.zest.api.entity.EntityComposite; +import org.apache.zest.api.injection.scope.This; +import org.apache.zest.api.mixin.Mixins; +import org.apache.zest.api.sideeffect.GenericSideEffect; +import org.apache.zest.api.sideeffect.SideEffects; +import org.apache.zest.api.unitofwork.UnitOfWork; +import org.apache.zest.api.usecase.UsecaseBuilder; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.EntityTestAssembler; + +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.nullValue; +import static org.hamcrest.core.IsSame.theInstance; +import static org.junit.Assert.assertThat; + +public class SetAssociationInSideEffectTest + extends AbstractQi4jTest +{ + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + new EntityTestAssembler().assemble( module ); + + module.entities( Pianist.class, Steinway.class ); + } + + @Test + public void whenSettingAnAssociationInASideEffectExpectItToWork() + { + try( UnitOfWork uow = module.newUnitOfWork( UsecaseBuilder.newUsecase( "Purchase Steinway" ) ) ) + { + Pianist chris = uow.newEntity( Pianist.class, "Chris" ); + Steinway modelD = uow.newEntity( Steinway.class, "ModelD-274" ); + + assertThat( modelD.owner().get(), is( nullValue() ) ); + + chris.purchase( modelD ); + + assertThat( modelD.owner().get(), is( theInstance( (Owner) chris ) ) ); + } + } + + @Mixins( PianistMixin.class ) + @SideEffects( ChangeOwnerSideEffect.class ) + public interface Pianist + extends Owner, EntityComposite + { + @Optional + Association<Steinway> steinway(); + + @ChangesOwner + void purchase( Steinway piano ); + } + + public static abstract class PianistMixin + implements Pianist + { + @Override + public void purchase( Steinway piano ) + { + steinway().set( piano ); + } + } + + public interface Steinway + extends Ownable, EntityComposite + { + } + + public interface Owner + { + } + + public interface Ownable + { + @Optional + Association<Owner> owner(); + } + + @AppliesTo( ChangesOwner.class ) + public static class ChangeOwnerSideEffect + extends GenericSideEffect + { + @This + Owner owner; + + @Override + protected void invoke( Method method, Object[] args ) + throws Throwable + { + Ownable ownable = (Ownable) args[ 0]; + ownable.owner().set( owner ); + } + } + + @Retention( RetentionPolicy.RUNTIME ) + public @interface ChangesOwner + { + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java b/core/runtime/src/test/java/org/apache/zest/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java new file mode 100644 index 0000000..276d393 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi377/ValueCollisionWithRelatedReturnTypesTest.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2013, Chris Chapman. All Rights Reserved. + * Copyright (c) 2014, Paul Merlin. All Rights Reserved. + * + * 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.regression.qi377; + +import org.junit.Test; +import org.apache.zest.api.entity.Identity; +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.property.Property; +import org.apache.zest.api.value.ValueBuilder; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.test.AbstractQi4jTest; + +public class ValueCollisionWithRelatedReturnTypesTest + extends AbstractQi4jTest +{ + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.values( Employee.class, Company.class ); + } + + @Test + public void shouldBeAbleToSetNameToTheCompany() + { + ValueBuilder<Company> builder = module.newValueBuilder( Company.class ); + builder.prototype().name().set( "Acme" ); + Company startUp = builder.newInstance(); + } + + @Test + public void shouldBeAbleToSetLeadToTheCompany() + { + Company startUp = module.newValue( Company.class ); + ValueBuilder<Employee> builder = module.newValueBuilder( Employee.class ); + builder.prototype().identity().set( "niclas" ); + Employee niclas = builder.newInstance(); + startUp.lead().set( niclas ); + } + + @Test + public void shouldBeAbleToSetLeadToTheSalesTeam() + { + SalesTeam startUp = module.newValue( SalesTeam.class ); + ValueBuilder<Employee> builder = module.newValueBuilder( Employee.class ); + builder.prototype().identity().set( "niclas" ); + Employee niclas = builder.newInstance(); + startUp.lead().set( niclas ); + } + + @Test + public void shouldBeAbleToSetLeadToTheResearchTeam() + { + ResearchTeam startUp = module.newValue( ResearchTeam.class ); + ValueBuilder<Employee> builder = module.newValueBuilder( Employee.class ); + builder.prototype().identity().set( "niclas" ); + Employee niclas = builder.newInstance(); + startUp.lead().set( niclas ); + } + + @Test + public void shouldBeAbleToAddEmployeesToTheCompany() + { + Company startUp = module.newValue( Company.class ); + ValueBuilder<Employee> builder = module.newValueBuilder( Employee.class ); + builder.prototype().identity().set( "niclas" ); + Employee niclas = builder.newInstance(); + startUp.employees().add( niclas ); + } + + @Test + public void shouldBeAbleToAddEmployeesToTheSalesTeam() + { + SalesTeam startUp = module.newValue( SalesTeam.class ); + ValueBuilder<Employee> builder = module.newValueBuilder( Employee.class ); + builder.prototype().identity().set( "niclas" ); + Employee niclas = builder.newInstance(); + startUp.employees().add( niclas ); + } + + @Test + public void shouldBeAbleToAddEmployeesToTheResearchTeam() + { + ResearchTeam startUp = module.newValue( ResearchTeam.class ); + ValueBuilder<Employee> builder = module.newValueBuilder( Employee.class ); + builder.prototype().identity().set( "niclas" ); + Employee niclas = builder.newInstance(); + startUp.employees().add( niclas ); + } + + public interface Employee + extends Identity + { + } + + public interface SalesTeam + { + @Optional + Property<String> name(); + + @Optional + Association<Employee> lead(); + + ManyAssociation<Employee> employees(); + } + + public interface ResearchTeam + { + @Optional + Property<String> name(); + + @Optional + Association<Employee> lead(); + + ManyAssociation<Employee> employees(); + } + + /** + * This compiles, unlike the example in {@link InterfaceCollisionWithUnrelatedReturnTypesTest}. + */ + public interface Company + extends SalesTeam, ResearchTeam + { + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi382/Qi382Test.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi382/Qi382Test.java b/core/runtime/src/test/java/org/apache/zest/regression/qi382/Qi382Test.java new file mode 100644 index 0000000..36831b2 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi382/Qi382Test.java @@ -0,0 +1,109 @@ +/* + * Copyright 2013 Niclas Hedhman. + * + * 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.regression.qi382; + +import org.junit.Test; +import org.apache.zest.api.association.Association; +import org.apache.zest.api.entity.EntityBuilder; +import org.apache.zest.api.entity.EntityComposite; +import org.apache.zest.api.entity.Lifecycle; +import org.apache.zest.api.entity.LifecycleException; +import org.apache.zest.api.injection.scope.Structure; +import org.apache.zest.api.injection.scope.This; +import org.apache.zest.api.mixin.Mixins; +import org.apache.zest.api.structure.Module; +import org.apache.zest.api.unitofwork.UnitOfWork; +import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException; +import org.apache.zest.api.value.ValueSerialization; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.entitystore.memory.MemoryEntityStoreService; +import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.hamcrest.core.IsNull.notNullValue; +import static org.junit.Assert.assertThat; + +public class Qi382Test extends AbstractQi4jTest +{ + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.addServices( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON ); + module.addServices( MemoryEntityStoreService.class ); + module.entities( Car.class, Person.class ); + } + + @Test + public void givenCreationOfTwoEntitiesWhenAssigningOneToOtherExpectCompletionToSucceed() + throws UnitOfWorkCompletionException + { + try( UnitOfWork unitOfWork = module.newUnitOfWork() ) + { + Car car = unitOfWork.newEntity( Car.class, "Ferrari" ); + unitOfWork.complete(); + } + try( UnitOfWork unitOfWork = module.newUnitOfWork() ) + { + Car car = unitOfWork.get( Car.class, "Ferrari" ); + assertThat( car, notNullValue() ); + Person p = unitOfWork.get( Person.class, "Niclas" ); + assertThat( p, notNullValue() ); + assertThat( p.car().get(), equalTo( car ) ); + } + } + + @Mixins( Car.CarMixin.class ) + public interface Car extends EntityComposite, Lifecycle + { + + static class CarMixin implements Lifecycle + { + @This + private Car me; + + @Structure + private Module module; + + @Override + public void create() + throws LifecycleException + { + UnitOfWork unitOfWork = module.currentUnitOfWork(); + EntityBuilder<Person> builder = unitOfWork.newEntityBuilder( Person.class, "Niclas" ); + builder.instance().car().set( me ); + builder.newInstance(); + } + + @Override + public void remove() + throws LifecycleException + { + + } + } + } + + public interface Person extends EntityComposite + { + Association<Car> car(); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi383/Qi383Test.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi383/Qi383Test.java b/core/runtime/src/test/java/org/apache/zest/regression/qi383/Qi383Test.java new file mode 100644 index 0000000..8a50f61 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi383/Qi383Test.java @@ -0,0 +1,59 @@ +/* + * Copyright 2013 Niclas Hedhman. + * + * 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.regression.qi383; + +import org.junit.Test; +import org.apache.zest.api.entity.EntityComposite; +import org.apache.zest.api.unitofwork.EntityCompositeAlreadyExistsException; +import org.apache.zest.api.unitofwork.UnitOfWork; +import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException; +import org.apache.zest.api.value.ValueSerialization; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.entitystore.memory.MemoryEntityStoreService; +import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService; + +public class Qi383Test extends AbstractQi4jTest +{ + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.addServices( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON ); + module.addServices( MemoryEntityStoreService.class ); + module.entities( Car.class ); + } + + @Test( expected = EntityCompositeAlreadyExistsException.class ) + public void givenUnitOfWorkInProgressWhenAddingSameEntityTwiceExpectException() + throws UnitOfWorkCompletionException + { + try( UnitOfWork unitOfWork = module.newUnitOfWork() ) + { + unitOfWork.newEntity( Car.class, "Ferrari" ); + unitOfWork.newEntity( Car.class, "Ford" ); + unitOfWork.newEntity( Car.class, "Ferrari" ); + unitOfWork.complete(); + } + } + + public interface Car extends EntityComposite + { + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/fc41bb18/core/runtime/src/test/java/org/apache/zest/regression/qi53/IssueTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/zest/regression/qi53/IssueTest.java b/core/runtime/src/test/java/org/apache/zest/regression/qi53/IssueTest.java new file mode 100644 index 0000000..d13e846 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/zest/regression/qi53/IssueTest.java @@ -0,0 +1,103 @@ +/* + * 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.regression.qi53; + +import org.junit.Test; +import org.apache.zest.api.composite.TransientBuilder; +import org.apache.zest.api.composite.TransientBuilderFactory; +import org.apache.zest.api.composite.TransientComposite; +import org.apache.zest.api.injection.scope.Structure; +import org.apache.zest.api.injection.scope.This; +import org.apache.zest.api.mixin.Mixins; +import org.apache.zest.api.property.Immutable; +import org.apache.zest.api.property.Property; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.test.AbstractQi4jTest; + +import static org.junit.Assert.assertEquals; + +public class IssueTest + extends AbstractQi4jTest +{ + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.transients( CostPerUnitComposite.class ); + } + + @Test + public void genericPropertiesAndParameters() + throws SecurityException, NoSuchMethodException + { + TransientBuilder<CostPerUnitComposite> builder = module.newTransientBuilder( CostPerUnitComposite.class ); + builder.prototype().unit().set( new Unit<Integer>( 10 ) ); + CostPerUnitComposite test = builder.newInstance(); + assertEquals( 10, test.unit().get().value ); + assertEquals( 50, test.toCostPer( new Unit<Integer>( 50 ) ).unit().get().value ); + } + + public interface CostPerUnit + { + @Immutable + Property<Unit<?>> unit(); + + CostPerUnit toCostPer( Unit<?> unit ); + } + + public static class Unit<T> + { + private T value; + + public Unit( T value ) + { + this.value = value; + } + + T get() + { + return value; + } + } + + public static abstract class CostPerUnitMixin + implements CostPerUnit + { + + @This + CostPerUnit costPerUnit; + @Structure + TransientBuilderFactory builderFactory; + + public CostPerUnit toCostPer( Unit<?> unit ) + { + TransientBuilder<CostPerUnitComposite> builder = + builderFactory.newTransientBuilder( CostPerUnitComposite.class ); + + builder.prototype().unit().set( unit ); + return builder.newInstance(); + } + } + + @Mixins( { CostPerUnitMixin.class } ) + public interface CostPerUnitComposite + extends CostPerUnit, TransientComposite + { + } +} \ No newline at end of file
