ZEST-195 ; Fix file names.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/b45402f2 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/b45402f2 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/b45402f2 Branch: refs/heads/develop Commit: b45402f28b6560cf1453d2dbd2d218b3dc5f7b4c Parents: b02063b Author: Niclas Hedhman <[email protected]> Authored: Wed Dec 14 10:24:43 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Wed Dec 14 10:24:43 2016 +0800 ---------------------------------------------------------------------- .../reference/AbstractPolygeneScenarioTest.txt | 18 + .../src/docs/reference/AbstractPolygeneTest.txt | 18 + .../docs/reference/AbstractZestScenarioTest.txt | 18 - .../src/docs/reference/AbstractZestTest.txt | 18 - etc/polygene-api-checkstyle.xml | 212 +++++ etc/polygene-runtime-checkstyle.xml | 208 +++++ etc/polygene-tests-checkstyle.xml | 196 +++++ etc/zest-api-checkstyle.xml | 212 ----- etc/zest-runtime-checkstyle.xml | 208 ----- etc/zest-tests-checkstyle.xml | 196 ----- .../metrics/AbstractPolygeneMetricsTest.java | 338 ++++++++ .../test/metrics/AbstractZestMetricsTest.java | 338 -------- .../http/polygene-lib-http-unittests-ca.jceks | Bin 0 -> 1075 bytes ...olygene-lib-http-unittests-client-cert.jceks | Bin 0 -> 3395 bytes ...olygene-lib-http-unittests-server-cert.jceks | Bin 0 -> 3380 bytes .../http/zest-lib-http-unittests-ca.jceks | Bin 1075 -> 0 bytes .../zest-lib-http-unittests-client-cert.jceks | Bin 3395 -> 0 bytes .../zest-lib-http-unittests-server-cert.jceks | Bin 3380 -> 0 bytes .../AbstractPolygeneServletBootstrap.java | 143 ++++ .../lifecycle/AbstractZestServletBootstrap.java | 143 ---- .../PolygeneExportServiceTest-context.xml | 36 + .../bootstrap/ZestExportServiceTest-context.xml | 36 - .../PolygeneImportServiceTest-context.xml | 28 + .../importer/ZestImportServiceTest-context.xml | 28 - .../docs/tutorials/howto-depend-on-polygene.txt | 193 +++++ .../src/docs/tutorials/howto-depend-on-zest.txt | 193 ----- .../src/docs/website/resources/css/polygene.css | 825 +++++++++++++++++++ manual/src/docs/website/resources/css/zest.css | 825 ------------------- manual/src/resources/images/polygene-blue.png | Bin 0 -> 853 bytes manual/src/resources/images/zest-blue.png | Bin 853 -> 0 bytes .../common/PolygeneAppliesToConstants.java | 33 + .../appliesTo/common/PolygeneAppliesToUtil.java | 138 ++++ .../common/ZestAppliesToConstants.java | 33 - .../appliesTo/common/ZestAppliesToUtil.java | 138 ---- .../actions/PolygeneCreateActionGroup.java | 82 ++ .../common/actions/ZestCreateActionGroup.java | 82 -- .../plugin/idea/common/facet/PolygeneFacet.java | 50 ++ .../facet/PolygeneFacetConfiguration.java | 56 ++ .../idea/common/facet/PolygeneFacetType.java | 122 +++ .../ide/plugin/idea/common/facet/ZestFacet.java | 50 -- .../common/facet/ZestFacetConfiguration.java | 56 -- .../plugin/idea/common/facet/ZestFacetType.java | 122 --- .../common/facet/ui/PolygeneFacetEditorTab.java | 72 ++ .../common/facet/ui/ZestFacetEditorTab.java | 72 -- .../common/resource/PolygeneResourceBundle.java | 68 ++ .../common/resource/ZestResourceBundle.java | 68 -- .../common/PolygeneConcernConstants.java | 40 + .../concerns/common/PolygeneConcernUtil.java | 228 +++++ .../concerns/common/ZestConcernConstants.java | 40 - .../idea/concerns/common/ZestConcernUtil.java | 228 ----- .../PolygeneInvocationAnnotationConstants.java | 32 + .../PolygeneInvocationAnnotationUtil.java | 129 +++ .../ZestInvocationAnnotationConstants.java | 32 - .../common/ZestInvocationAnnotationUtil.java | 129 --- .../PolygeneServiceAnnotationConstants.java | 32 + .../common/PolygeneServiceAnnotationUtil.java | 99 +++ .../common/ZestServiceAnnotationConstants.java | 32 - .../common/ZestServiceAnnotationUtil.java | 99 --- .../PolygeneStructureAnnotationConstants.java | 53 ++ .../common/PolygeneStructureAnnotationUtil.java | 124 +++ .../ZestStructureAnnotationConstants.java | 53 -- .../common/ZestStructureAnnotationUtil.java | 124 --- .../mixins/common/PolygeneMixinConstants.java | 32 + .../idea/mixins/common/PolygeneMixinUtil.java | 196 +++++ .../idea/mixins/common/ZestMixinConstants.java | 32 - .../idea/mixins/common/ZestMixinUtil.java | 196 ----- .../common/PolygeneSideEffectConstants.java | 35 + .../common/PolygeneSideEffectUtil.java | 188 +++++ .../common/ZestSideEffectConstants.java | 35 - .../sideEffects/common/ZestSideEffectUtil.java | 188 ----- .../resource/PolygeneResourceBundle.properties | 164 ++++ .../resource/ZestResourceBundle.properties | 164 ---- tools/shell/src/dist/bin/polygene-boot | 79 ++ tools/shell/src/dist/bin/zest-boot | 79 -- .../introduction/src/docs/polygene-cop.txt | 22 + tutorials/introduction/src/docs/zest-cop.txt | 22 - 76 files changed, 4289 insertions(+), 4289 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/core/testsupport/src/docs/reference/AbstractPolygeneScenarioTest.txt ---------------------------------------------------------------------- diff --git a/core/testsupport/src/docs/reference/AbstractPolygeneScenarioTest.txt b/core/testsupport/src/docs/reference/AbstractPolygeneScenarioTest.txt new file mode 100644 index 0000000..fc7aac6 --- /dev/null +++ b/core/testsupport/src/docs/reference/AbstractPolygeneScenarioTest.txt @@ -0,0 +1,18 @@ +/////////////////////////////////////////////////////////////// + * 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. +/////////////////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/core/testsupport/src/docs/reference/AbstractPolygeneTest.txt ---------------------------------------------------------------------- diff --git a/core/testsupport/src/docs/reference/AbstractPolygeneTest.txt b/core/testsupport/src/docs/reference/AbstractPolygeneTest.txt new file mode 100644 index 0000000..fc7aac6 --- /dev/null +++ b/core/testsupport/src/docs/reference/AbstractPolygeneTest.txt @@ -0,0 +1,18 @@ +/////////////////////////////////////////////////////////////// + * 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. +/////////////////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/core/testsupport/src/docs/reference/AbstractZestScenarioTest.txt ---------------------------------------------------------------------- diff --git a/core/testsupport/src/docs/reference/AbstractZestScenarioTest.txt b/core/testsupport/src/docs/reference/AbstractZestScenarioTest.txt deleted file mode 100644 index fc7aac6..0000000 --- a/core/testsupport/src/docs/reference/AbstractZestScenarioTest.txt +++ /dev/null @@ -1,18 +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. -/////////////////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/core/testsupport/src/docs/reference/AbstractZestTest.txt ---------------------------------------------------------------------- diff --git a/core/testsupport/src/docs/reference/AbstractZestTest.txt b/core/testsupport/src/docs/reference/AbstractZestTest.txt deleted file mode 100644 index fc7aac6..0000000 --- a/core/testsupport/src/docs/reference/AbstractZestTest.txt +++ /dev/null @@ -1,18 +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. -/////////////////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/polygene-api-checkstyle.xml ---------------------------------------------------------------------- diff --git a/etc/polygene-api-checkstyle.xml b/etc/polygene-api-checkstyle.xml new file mode 100644 index 0000000..4db3ae8 --- /dev/null +++ b/etc/polygene-api-checkstyle.xml @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + ~ + ~ + --> + +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" + "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> + +<!-- Documentation is availableService at + http://checkstyle.sourceforge.net/availablechecks.html +--> +<module name="Checker"> + <property name="severity" value="warning"/> + <module name="NewlineAtEndOfFile"/> + <module name="Translation"/> + <module name="JavadocPackage"/> + <module name="TreeWalker"> + <module name="MutableException"/> + + <module name="CyclomaticComplexity"> + <property name="max" value="7"/> + </module> + <module name="Indentation"/> + <module name="CovariantEquals"/> + <module name="FileContentsHolder"/> + <module name="ArrayTypeStyle"/> + <!-- 2005-Oct-05 + final in method arguments is just ugly in my opinion, + communicates very little, and is not preventing much + problem. Remove it for now. + <module name="FinalParameters"> + <property name="severity" value="ignore"/> + <property name="tokens" value="METHOD_DEF, CTOR_DEF"/> + </module> + --> + + <!-- + <module name="GenericIllegalRegexp"> + <property name="severity" value="ignore"/> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + --> + + <module name="ModifierOrder"/> + <module name="RedundantModifier"> + <property name="severity" value="ignore"/> + <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/> + </module> + + <module name="TodoComment"/> + <module name="UpperEll"/> + <module name="AvoidNestedBlocks"/> + <module name="EmptyBlock"> + <property name="tokens" + value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/> + </module> + <module name="LeftCurly"> + <property name="option" value="nl"/> + <property name="tokens" + value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/> + + </module> + <module name="NeedBraces"/> + <module name="RightCurly"> + <property name="option" value="alone"/> + <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/> + </module> + <module name="AvoidInlineConditionals"/> + <module name="DoubleCheckedLocking"/> + <module name="EmptyStatement"/> + + <module name="EqualsHashCode"/> + <!--<module name="HiddenField"/>--> + <module name="IllegalInstantiation"/> + <module name="InnerAssignment"/> + <module name="MagicNumber"> + <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/> + <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/> + </module> + <module name="MissingSwitchDefault"/> + + <!-- + Niclas 2005-09-16: + This check seems somewhat broken, since + a = b == false; + is more readable in my view than + a = !b + but the former will trigger this rule. Therefor I disable it. + <module name="SimplifyBooleanExpression"> + </module> + --> + <module name="SimplifyBooleanReturn"/> + <module name="StringLiteralEquality"/> + <module name="NestedIfDepth"> + <property name="max" value="3"/> + </module> + <module name="NestedTryDepth"> + <property name="max" value="2"/> + </module> + + <module name="SuperClone"/> + <module name="SuperFinalize"/> + <module name="IllegalCatch"> + <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/> + </module> + <module name="IllegalThrows"> + <property name="illegalClassNames" + value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/> + </module> + <module name="PackageDeclaration"/> + + <module name="JUnitTestCase"/> + <module name="DeclarationOrder"/> + <module name="ParameterAssignment"/> + <!--<module name="MissingCtor"/>--> + <module name="MultipleVariableDeclarations"/> + <module name="DesignForExtension"> + <property name="severity" value="ignore"/> + </module> + <module name="FinalClass"/> + + <module name="HideUtilityClassConstructor"/> + <module name="VisibilityModifier"/> + <module name="AvoidStarImport"/> + <module name="IllegalImport"/> + <module name="RedundantImport"/> + <module name="UnusedImports"/> + <module name="ImportOrder"> + <property name="groups" value=""/> + <property name="ordered" value="true"/> + <property name="option" value="under"/> + <property name="separated" value="true"/> + <property name="caseSensitive" value="true"/> + </module> + + <!--TODO Removing this until Javadoc effort has picked up --> + <!--<module name="JavadocMethod"/>--> + <!--<module name="JavadocType"/>--> + <!--<module name="JavadocVariable">--> + <!--<property name="scope" value="package"/>--> + <!--</module>--> + <module name="ConstantName"> + <property name="format" value="^[A-Z0-9_$]*$"/> + </module> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + </module> + <module name="MethodName"/> + <module name="PackageName"/> + + <module name="ParameterName"/> + <module name="StaticVariableName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + </module> + <module name="TypeName"/> + <module name="LineLength"> + + <property name="max" value="120"/> + </module> + <module name="MethodLength"/> + <module name="AnonInnerLength"> + <property name="max" value="60"/> + </module> + <module name="ParameterNumber"> + <property name="max" value="12"/> + </module> + + <module name="EmptyForIteratorPad"/> + <module name="NoWhitespaceAfter"> + <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/> + </module> + <!--<module name="OperatorWrap"/>--> + <module name="ParenPad"> + <property name="option" value="space"/> + <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/> + </module> + + <!-- + <module name="TabCharacter"/> + --> + + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"> + <property name="tokens" + value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/> + </module> + </module> + + <module name="FileLength"> + <property name="max" value="1000"/> + </module> + +</module> http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/polygene-runtime-checkstyle.xml ---------------------------------------------------------------------- diff --git a/etc/polygene-runtime-checkstyle.xml b/etc/polygene-runtime-checkstyle.xml new file mode 100644 index 0000000..8d4b9f7 --- /dev/null +++ b/etc/polygene-runtime-checkstyle.xml @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + ~ + ~ + --> + +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" + "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> + +<!-- Documentation is availableService at + http://checkstyle.sourceforge.net/availablechecks.html +--> +<module name="Checker"> + <property name="severity" value="warning"/> + <module name="NewlineAtEndOfFile"/> + <module name="Translation"/> + <!--TODO Removing this until Javadoc effort has picked up --> + <!--<module name="JavadocPackage"/>--> + <module name="TreeWalker"> + <module name="MutableException"/> + + <module name="CyclomaticComplexity"> + <property name="max" value="7"/> + </module> + <module name="Indentation"/> + <module name="CovariantEquals"/> + <module name="FileContentsHolder"/> + <module name="ArrayTypeStyle"/> + <!-- 2005-Oct-05 + final in method arguments is just ugly in my opinion, + communicates very little, and is not preventing much + problem. Remove it for now. + <module name="FinalParameters"> + <property name="severity" value="ignore"/> + <property name="tokens" value="METHOD_DEF, CTOR_DEF"/> + </module> + --> + + <!-- + <module name="GenericIllegalRegexp"> + <property name="severity" value="ignore"/> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + --> + + <module name="ModifierOrder"/> + <module name="RedundantModifier"> + <property name="severity" value="ignore"/> + <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/> + </module> + + <module name="TodoComment"/> + <module name="UpperEll"/> + <module name="AvoidNestedBlocks"/> + <module name="EmptyBlock"> + <property name="tokens" + value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/> + </module> + <module name="LeftCurly"> + <property name="option" value="nl"/> + <property name="tokens" + value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/> + + </module> + <module name="NeedBraces"/> + <module name="RightCurly"> + <property name="option" value="alone"/> + <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/> + </module> + <module name="AvoidInlineConditionals"/> + <module name="DoubleCheckedLocking"/> + <module name="EmptyStatement"/> + + <module name="EqualsHashCode"/> + <!--<module name="HiddenField"/>--> + <module name="IllegalInstantiation"/> + <module name="InnerAssignment"/> + <module name="MagicNumber"> + <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/> + <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/> + </module> + <module name="MissingSwitchDefault"/> + + <!-- + Niclas 2005-09-16: + This check seems somewhat broken, since + a = b == false; + is more readable in my view than + a = !b + but the former will trigger this rule. Therefor I disable it. + <module name="SimplifyBooleanExpression"> + </module> + --> + <module name="SimplifyBooleanReturn"/> + <module name="StringLiteralEquality"/> + <module name="NestedIfDepth"> + <property name="max" value="3"/> + </module> + <module name="NestedTryDepth"> + <property name="max" value="2"/> + </module> + + <module name="SuperClone"/> + <module name="SuperFinalize"/> + <module name="IllegalCatch"> + <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/> + </module> + <module name="IllegalThrows"> + <property name="illegalClassNames" + value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/> + </module> + <module name="PackageDeclaration"/> + + <module name="JUnitTestCase"/> + <module name="DeclarationOrder"/> + <module name="ParameterAssignment"/> + <!--<module name="MissingCtor"/>--> + <module name="MultipleVariableDeclarations"/> + <module name="DesignForExtension"> + <property name="severity" value="ignore"/> + </module> + <module name="FinalClass"/> + + <module name="HideUtilityClassConstructor"/> + <module name="VisibilityModifier"/> + <module name="AvoidStarImport"/> + <module name="IllegalImport"/> + <module name="RedundantImport"/> + <module name="UnusedImports"/> + <module name="ImportOrder"> + <property name="groups" value=""/> + <property name="ordered" value="true"/> + <property name="option" value="under"/> + <property name="separated" value="true"/> + <property name="caseSensitive" value="true"/> + </module> + <!--TODO Removing this until Javadoc effort has picked up --> + <!--<module name="JavadocType"/>--> + <module name="ConstantName"> + <property name="format" value="^[A-Z0-9_$]*$"/> + </module> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + </module> + <module name="MethodName"/> + <module name="PackageName"/> + + <module name="ParameterName"/> + <module name="StaticVariableName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + </module> + <module name="TypeName"/> + <module name="LineLength"> + + <property name="max" value="120"/> + </module> + <module name="MethodLength"/> + <module name="AnonInnerLength"> + <property name="max" value="60"/> + </module> + <module name="ParameterNumber"> + <property name="max" value="12"/> + </module> + + <module name="EmptyForIteratorPad"/> + <module name="NoWhitespaceAfter"> + <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/> + </module> + <!--<module name="OperatorWrap"/>--> + <module name="ParenPad"> + <property name="option" value="space"/> + <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/> + </module> + + <!-- + <module name="TabCharacter"/> + --> + + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"> + <property name="tokens" + value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/> + </module> + </module> + + <module name="FileLength"> + <property name="max" value="1000"/> + </module> + +</module> http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/polygene-tests-checkstyle.xml ---------------------------------------------------------------------- diff --git a/etc/polygene-tests-checkstyle.xml b/etc/polygene-tests-checkstyle.xml new file mode 100644 index 0000000..fc741ac --- /dev/null +++ b/etc/polygene-tests-checkstyle.xml @@ -0,0 +1,196 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + ~ + ~ + --> + +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" + "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> + +<!-- Documentation is availableService at + http://checkstyle.sourceforge.net/availablechecks.html +--> +<module name="Checker"> + <property name="severity" value="warning"/> + <module name="NewlineAtEndOfFile"/> + <module name="Translation"/> + <module name="TreeWalker"> + <module name="MutableException"/> + + <module name="CyclomaticComplexity"> + <property name="max" value="7"/> + </module> + <module name="Indentation"/> + <module name="CovariantEquals"/> + <module name="FileContentsHolder"/> + <module name="ArrayTypeStyle"/> + <!-- + <module name="GenericIllegalRegexp"> + <property name="severity" value="ignore"/> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + --> + + <module name="ModifierOrder"/> + <module name="RedundantModifier"> + <property name="severity" value="ignore"/> + <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/> + </module> + + <module name="TodoComment"/> + <module name="UpperEll"/> + <module name="AvoidNestedBlocks"/> + <module name="EmptyBlock"> + <property name="tokens" + value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/> + </module> + <module name="LeftCurly"> + <property name="option" value="nl"/> + <property name="tokens" + value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/> + + </module> + <module name="NeedBraces"/> + <module name="RightCurly"> + <property name="option" value="alone"/> + <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/> + </module> + <module name="AvoidInlineConditionals"/> + <module name="DoubleCheckedLocking"/> + <module name="EmptyStatement"/> + + <module name="EqualsHashCode"/> + <!--<module name="HiddenField"/>--> + <module name="IllegalInstantiation"/> + <module name="InnerAssignment"/> + <module name="MagicNumber"> + <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/> + <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/> + </module> + <module name="MissingSwitchDefault"/> + + <!-- + Niclas 2005-09-16: + This check seems somewhat broken, since + a = b == false; + is more readable in my view than + a = !b + but the former will trigger this rule. Therefor I disable it. + <module name="SimplifyBooleanExpression"> + </module> + --> + <module name="SimplifyBooleanReturn"/> + <module name="StringLiteralEquality"/> + <module name="NestedIfDepth"> + <property name="max" value="3"/> + </module> + <module name="NestedTryDepth"> + <property name="max" value="2"/> + </module> + + <module name="SuperClone"/> + <module name="SuperFinalize"/> + <!-- Ok in tests... + <module name="IllegalCatch"> + <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/> + </module> + <module name="IllegalThrows"> + <property name="illegalClassNames" + value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/> + </module> + --> + <module name="PackageDeclaration"/> + + <module name="JUnitTestCase"/> + <module name="DeclarationOrder"/> + <module name="ParameterAssignment"/> + <!--<module name="MissingCtor"/>--> + <module name="MultipleVariableDeclarations"/> + <module name="DesignForExtension"> + <property name="severity" value="ignore"/> + </module> + <module name="FinalClass"/> + + <module name="HideUtilityClassConstructor"/> + <module name="VisibilityModifier"/> + <module name="AvoidStarImport"/> + <module name="IllegalImport"/> + <module name="RedundantImport"/> + <module name="UnusedImports"/> + <module name="ImportOrder"> + <property name="groups" value=""/> + <property name="ordered" value="true"/> + <property name="separated" value="false"/> + <property name="caseSensitive" value="true"/> + <property name="option" value="under"/> + </module> + <module name="ConstantName"> + <property name="format" value="^[A-Z0-9_$]*$"/> + </module> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + </module> + <module name="MethodName"/> + <module name="PackageName"/> + + <module name="ParameterName"/> + <module name="StaticVariableName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + </module> + <module name="TypeName"/> + <module name="LineLength"> + + <property name="max" value="120"/> + </module> + <module name="MethodLength"/> + <module name="AnonInnerLength"> + <property name="max" value="60"/> + </module> + <module name="ParameterNumber"> + <property name="max" value="12"/> + </module> + + <module name="EmptyForIteratorPad"/> + <module name="NoWhitespaceAfter"> + <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/> + </module> + <!--<module name="OperatorWrap"/>--> + <module name="ParenPad"> + <property name="option" value="space"/> + <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/> + </module> + + <!-- + <module name="TabCharacter"/> + --> + + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"> + <property name="tokens" + value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/> + </module> + </module> + + <module name="FileLength"> + <property name="max" value="1000"/> + </module> + +</module> http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/zest-api-checkstyle.xml ---------------------------------------------------------------------- diff --git a/etc/zest-api-checkstyle.xml b/etc/zest-api-checkstyle.xml deleted file mode 100644 index 4db3ae8..0000000 --- a/etc/zest-api-checkstyle.xml +++ /dev/null @@ -1,212 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - ~ - ~ - --> - -<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" - "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> - -<!-- Documentation is availableService at - http://checkstyle.sourceforge.net/availablechecks.html ---> -<module name="Checker"> - <property name="severity" value="warning"/> - <module name="NewlineAtEndOfFile"/> - <module name="Translation"/> - <module name="JavadocPackage"/> - <module name="TreeWalker"> - <module name="MutableException"/> - - <module name="CyclomaticComplexity"> - <property name="max" value="7"/> - </module> - <module name="Indentation"/> - <module name="CovariantEquals"/> - <module name="FileContentsHolder"/> - <module name="ArrayTypeStyle"/> - <!-- 2005-Oct-05 - final in method arguments is just ugly in my opinion, - communicates very little, and is not preventing much - problem. Remove it for now. - <module name="FinalParameters"> - <property name="severity" value="ignore"/> - <property name="tokens" value="METHOD_DEF, CTOR_DEF"/> - </module> - --> - - <!-- - <module name="GenericIllegalRegexp"> - <property name="severity" value="ignore"/> - <property name="format" value="\s+$"/> - <property name="message" value="Line has trailing spaces."/> - </module> - --> - - <module name="ModifierOrder"/> - <module name="RedundantModifier"> - <property name="severity" value="ignore"/> - <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/> - </module> - - <module name="TodoComment"/> - <module name="UpperEll"/> - <module name="AvoidNestedBlocks"/> - <module name="EmptyBlock"> - <property name="tokens" - value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/> - </module> - <module name="LeftCurly"> - <property name="option" value="nl"/> - <property name="tokens" - value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/> - - </module> - <module name="NeedBraces"/> - <module name="RightCurly"> - <property name="option" value="alone"/> - <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/> - </module> - <module name="AvoidInlineConditionals"/> - <module name="DoubleCheckedLocking"/> - <module name="EmptyStatement"/> - - <module name="EqualsHashCode"/> - <!--<module name="HiddenField"/>--> - <module name="IllegalInstantiation"/> - <module name="InnerAssignment"/> - <module name="MagicNumber"> - <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/> - <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/> - </module> - <module name="MissingSwitchDefault"/> - - <!-- - Niclas 2005-09-16: - This check seems somewhat broken, since - a = b == false; - is more readable in my view than - a = !b - but the former will trigger this rule. Therefor I disable it. - <module name="SimplifyBooleanExpression"> - </module> - --> - <module name="SimplifyBooleanReturn"/> - <module name="StringLiteralEquality"/> - <module name="NestedIfDepth"> - <property name="max" value="3"/> - </module> - <module name="NestedTryDepth"> - <property name="max" value="2"/> - </module> - - <module name="SuperClone"/> - <module name="SuperFinalize"/> - <module name="IllegalCatch"> - <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/> - </module> - <module name="IllegalThrows"> - <property name="illegalClassNames" - value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/> - </module> - <module name="PackageDeclaration"/> - - <module name="JUnitTestCase"/> - <module name="DeclarationOrder"/> - <module name="ParameterAssignment"/> - <!--<module name="MissingCtor"/>--> - <module name="MultipleVariableDeclarations"/> - <module name="DesignForExtension"> - <property name="severity" value="ignore"/> - </module> - <module name="FinalClass"/> - - <module name="HideUtilityClassConstructor"/> - <module name="VisibilityModifier"/> - <module name="AvoidStarImport"/> - <module name="IllegalImport"/> - <module name="RedundantImport"/> - <module name="UnusedImports"/> - <module name="ImportOrder"> - <property name="groups" value=""/> - <property name="ordered" value="true"/> - <property name="option" value="under"/> - <property name="separated" value="true"/> - <property name="caseSensitive" value="true"/> - </module> - - <!--TODO Removing this until Javadoc effort has picked up --> - <!--<module name="JavadocMethod"/>--> - <!--<module name="JavadocType"/>--> - <!--<module name="JavadocVariable">--> - <!--<property name="scope" value="package"/>--> - <!--</module>--> - <module name="ConstantName"> - <property name="format" value="^[A-Z0-9_$]*$"/> - </module> - <module name="LocalFinalVariableName"/> - <module name="LocalVariableName"/> - <module name="MemberName"> - <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> - </module> - <module name="MethodName"/> - <module name="PackageName"/> - - <module name="ParameterName"/> - <module name="StaticVariableName"> - <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> - </module> - <module name="TypeName"/> - <module name="LineLength"> - - <property name="max" value="120"/> - </module> - <module name="MethodLength"/> - <module name="AnonInnerLength"> - <property name="max" value="60"/> - </module> - <module name="ParameterNumber"> - <property name="max" value="12"/> - </module> - - <module name="EmptyForIteratorPad"/> - <module name="NoWhitespaceAfter"> - <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/> - </module> - <!--<module name="OperatorWrap"/>--> - <module name="ParenPad"> - <property name="option" value="space"/> - <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/> - </module> - - <!-- - <module name="TabCharacter"/> - --> - - <module name="WhitespaceAfter"/> - <module name="WhitespaceAround"> - <property name="tokens" - value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/> - </module> - </module> - - <module name="FileLength"> - <property name="max" value="1000"/> - </module> - -</module> http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/zest-runtime-checkstyle.xml ---------------------------------------------------------------------- diff --git a/etc/zest-runtime-checkstyle.xml b/etc/zest-runtime-checkstyle.xml deleted file mode 100644 index 8d4b9f7..0000000 --- a/etc/zest-runtime-checkstyle.xml +++ /dev/null @@ -1,208 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - ~ - ~ - --> - -<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" - "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> - -<!-- Documentation is availableService at - http://checkstyle.sourceforge.net/availablechecks.html ---> -<module name="Checker"> - <property name="severity" value="warning"/> - <module name="NewlineAtEndOfFile"/> - <module name="Translation"/> - <!--TODO Removing this until Javadoc effort has picked up --> - <!--<module name="JavadocPackage"/>--> - <module name="TreeWalker"> - <module name="MutableException"/> - - <module name="CyclomaticComplexity"> - <property name="max" value="7"/> - </module> - <module name="Indentation"/> - <module name="CovariantEquals"/> - <module name="FileContentsHolder"/> - <module name="ArrayTypeStyle"/> - <!-- 2005-Oct-05 - final in method arguments is just ugly in my opinion, - communicates very little, and is not preventing much - problem. Remove it for now. - <module name="FinalParameters"> - <property name="severity" value="ignore"/> - <property name="tokens" value="METHOD_DEF, CTOR_DEF"/> - </module> - --> - - <!-- - <module name="GenericIllegalRegexp"> - <property name="severity" value="ignore"/> - <property name="format" value="\s+$"/> - <property name="message" value="Line has trailing spaces."/> - </module> - --> - - <module name="ModifierOrder"/> - <module name="RedundantModifier"> - <property name="severity" value="ignore"/> - <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/> - </module> - - <module name="TodoComment"/> - <module name="UpperEll"/> - <module name="AvoidNestedBlocks"/> - <module name="EmptyBlock"> - <property name="tokens" - value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/> - </module> - <module name="LeftCurly"> - <property name="option" value="nl"/> - <property name="tokens" - value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/> - - </module> - <module name="NeedBraces"/> - <module name="RightCurly"> - <property name="option" value="alone"/> - <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/> - </module> - <module name="AvoidInlineConditionals"/> - <module name="DoubleCheckedLocking"/> - <module name="EmptyStatement"/> - - <module name="EqualsHashCode"/> - <!--<module name="HiddenField"/>--> - <module name="IllegalInstantiation"/> - <module name="InnerAssignment"/> - <module name="MagicNumber"> - <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/> - <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/> - </module> - <module name="MissingSwitchDefault"/> - - <!-- - Niclas 2005-09-16: - This check seems somewhat broken, since - a = b == false; - is more readable in my view than - a = !b - but the former will trigger this rule. Therefor I disable it. - <module name="SimplifyBooleanExpression"> - </module> - --> - <module name="SimplifyBooleanReturn"/> - <module name="StringLiteralEquality"/> - <module name="NestedIfDepth"> - <property name="max" value="3"/> - </module> - <module name="NestedTryDepth"> - <property name="max" value="2"/> - </module> - - <module name="SuperClone"/> - <module name="SuperFinalize"/> - <module name="IllegalCatch"> - <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/> - </module> - <module name="IllegalThrows"> - <property name="illegalClassNames" - value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/> - </module> - <module name="PackageDeclaration"/> - - <module name="JUnitTestCase"/> - <module name="DeclarationOrder"/> - <module name="ParameterAssignment"/> - <!--<module name="MissingCtor"/>--> - <module name="MultipleVariableDeclarations"/> - <module name="DesignForExtension"> - <property name="severity" value="ignore"/> - </module> - <module name="FinalClass"/> - - <module name="HideUtilityClassConstructor"/> - <module name="VisibilityModifier"/> - <module name="AvoidStarImport"/> - <module name="IllegalImport"/> - <module name="RedundantImport"/> - <module name="UnusedImports"/> - <module name="ImportOrder"> - <property name="groups" value=""/> - <property name="ordered" value="true"/> - <property name="option" value="under"/> - <property name="separated" value="true"/> - <property name="caseSensitive" value="true"/> - </module> - <!--TODO Removing this until Javadoc effort has picked up --> - <!--<module name="JavadocType"/>--> - <module name="ConstantName"> - <property name="format" value="^[A-Z0-9_$]*$"/> - </module> - <module name="LocalFinalVariableName"/> - <module name="LocalVariableName"/> - <module name="MemberName"> - <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> - </module> - <module name="MethodName"/> - <module name="PackageName"/> - - <module name="ParameterName"/> - <module name="StaticVariableName"> - <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> - </module> - <module name="TypeName"/> - <module name="LineLength"> - - <property name="max" value="120"/> - </module> - <module name="MethodLength"/> - <module name="AnonInnerLength"> - <property name="max" value="60"/> - </module> - <module name="ParameterNumber"> - <property name="max" value="12"/> - </module> - - <module name="EmptyForIteratorPad"/> - <module name="NoWhitespaceAfter"> - <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/> - </module> - <!--<module name="OperatorWrap"/>--> - <module name="ParenPad"> - <property name="option" value="space"/> - <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/> - </module> - - <!-- - <module name="TabCharacter"/> - --> - - <module name="WhitespaceAfter"/> - <module name="WhitespaceAround"> - <property name="tokens" - value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/> - </module> - </module> - - <module name="FileLength"> - <property name="max" value="1000"/> - </module> - -</module> http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/zest-tests-checkstyle.xml ---------------------------------------------------------------------- diff --git a/etc/zest-tests-checkstyle.xml b/etc/zest-tests-checkstyle.xml deleted file mode 100644 index fc741ac..0000000 --- a/etc/zest-tests-checkstyle.xml +++ /dev/null @@ -1,196 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - ~ - ~ - --> - -<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" - "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> - -<!-- Documentation is availableService at - http://checkstyle.sourceforge.net/availablechecks.html ---> -<module name="Checker"> - <property name="severity" value="warning"/> - <module name="NewlineAtEndOfFile"/> - <module name="Translation"/> - <module name="TreeWalker"> - <module name="MutableException"/> - - <module name="CyclomaticComplexity"> - <property name="max" value="7"/> - </module> - <module name="Indentation"/> - <module name="CovariantEquals"/> - <module name="FileContentsHolder"/> - <module name="ArrayTypeStyle"/> - <!-- - <module name="GenericIllegalRegexp"> - <property name="severity" value="ignore"/> - <property name="format" value="\s+$"/> - <property name="message" value="Line has trailing spaces."/> - </module> - --> - - <module name="ModifierOrder"/> - <module name="RedundantModifier"> - <property name="severity" value="ignore"/> - <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/> - </module> - - <module name="TodoComment"/> - <module name="UpperEll"/> - <module name="AvoidNestedBlocks"/> - <module name="EmptyBlock"> - <property name="tokens" - value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/> - </module> - <module name="LeftCurly"> - <property name="option" value="nl"/> - <property name="tokens" - value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/> - - </module> - <module name="NeedBraces"/> - <module name="RightCurly"> - <property name="option" value="alone"/> - <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/> - </module> - <module name="AvoidInlineConditionals"/> - <module name="DoubleCheckedLocking"/> - <module name="EmptyStatement"/> - - <module name="EqualsHashCode"/> - <!--<module name="HiddenField"/>--> - <module name="IllegalInstantiation"/> - <module name="InnerAssignment"/> - <module name="MagicNumber"> - <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/> - <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/> - </module> - <module name="MissingSwitchDefault"/> - - <!-- - Niclas 2005-09-16: - This check seems somewhat broken, since - a = b == false; - is more readable in my view than - a = !b - but the former will trigger this rule. Therefor I disable it. - <module name="SimplifyBooleanExpression"> - </module> - --> - <module name="SimplifyBooleanReturn"/> - <module name="StringLiteralEquality"/> - <module name="NestedIfDepth"> - <property name="max" value="3"/> - </module> - <module name="NestedTryDepth"> - <property name="max" value="2"/> - </module> - - <module name="SuperClone"/> - <module name="SuperFinalize"/> - <!-- Ok in tests... - <module name="IllegalCatch"> - <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/> - </module> - <module name="IllegalThrows"> - <property name="illegalClassNames" - value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/> - </module> - --> - <module name="PackageDeclaration"/> - - <module name="JUnitTestCase"/> - <module name="DeclarationOrder"/> - <module name="ParameterAssignment"/> - <!--<module name="MissingCtor"/>--> - <module name="MultipleVariableDeclarations"/> - <module name="DesignForExtension"> - <property name="severity" value="ignore"/> - </module> - <module name="FinalClass"/> - - <module name="HideUtilityClassConstructor"/> - <module name="VisibilityModifier"/> - <module name="AvoidStarImport"/> - <module name="IllegalImport"/> - <module name="RedundantImport"/> - <module name="UnusedImports"/> - <module name="ImportOrder"> - <property name="groups" value=""/> - <property name="ordered" value="true"/> - <property name="separated" value="false"/> - <property name="caseSensitive" value="true"/> - <property name="option" value="under"/> - </module> - <module name="ConstantName"> - <property name="format" value="^[A-Z0-9_$]*$"/> - </module> - <module name="LocalFinalVariableName"/> - <module name="LocalVariableName"/> - <module name="MemberName"> - <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> - </module> - <module name="MethodName"/> - <module name="PackageName"/> - - <module name="ParameterName"/> - <module name="StaticVariableName"> - <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> - </module> - <module name="TypeName"/> - <module name="LineLength"> - - <property name="max" value="120"/> - </module> - <module name="MethodLength"/> - <module name="AnonInnerLength"> - <property name="max" value="60"/> - </module> - <module name="ParameterNumber"> - <property name="max" value="12"/> - </module> - - <module name="EmptyForIteratorPad"/> - <module name="NoWhitespaceAfter"> - <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/> - </module> - <!--<module name="OperatorWrap"/>--> - <module name="ParenPad"> - <property name="option" value="space"/> - <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/> - </module> - - <!-- - <module name="TabCharacter"/> - --> - - <module name="WhitespaceAfter"/> - <module name="WhitespaceAround"> - <property name="tokens" - value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/> - </module> - </module> - - <module name="FileLength"> - <property name="max" value="1000"/> - </module> - -</module> http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java b/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java new file mode 100644 index 0000000..9616f91 --- /dev/null +++ b/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java @@ -0,0 +1,338 @@ +/* + * 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.polygene.test.metrics; + +import org.apache.polygene.api.activation.ActivationException; +import org.apache.polygene.api.activation.PassivationException; +import org.apache.polygene.api.association.ManyAssociation; +import org.apache.polygene.api.common.Visibility; +import org.apache.polygene.api.concern.Concerns; +import org.apache.polygene.api.entity.EntityBuilder; +import org.apache.polygene.api.identity.Identity; +import org.apache.polygene.api.identity.StringIdentity; +import org.apache.polygene.api.injection.scope.Structure; +import org.apache.polygene.api.mixin.Mixins; +import org.apache.polygene.api.property.Property; +import org.apache.polygene.api.service.ServiceActivation; +import org.apache.polygene.api.structure.Module; +import org.apache.polygene.api.unitofwork.NoSuchEntityException; +import org.apache.polygene.api.unitofwork.UnitOfWork; +import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern; +import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation; +import org.apache.polygene.bootstrap.ApplicationAssembly; +import org.apache.polygene.bootstrap.Assembler; +import org.apache.polygene.bootstrap.Assemblers; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.LayerAssembly; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.library.metrics.TimingCapture; +import org.apache.polygene.library.metrics.TimingCaptureAllConcern; +import org.apache.polygene.library.metrics.TimingCaptureConcern; +import org.apache.polygene.test.AbstractPolygeneBaseTest; +import org.apache.polygene.test.EntityTestAssembler; +import org.apache.polygene.test.util.JmxFixture; +import org.junit.Test; + +import java.util.Collection; + +import static java.util.stream.Collectors.toList; +import static org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation.Propagation.MANDATORY; +import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +// TODO Test errors +public abstract class AbstractPolygeneMetricsTest extends AbstractPolygeneBaseTest +{ + public interface Person + { + Property<String> name(); + } + + public interface PersonList + { + Identity LIST_ID = StringIdentity.fromString( "person-list" ); + + ManyAssociation<Person> all(); + } + + @Concerns( {TimingCaptureAllConcern.class, UnitOfWorkConcern.class} ) + @Mixins( CommandsMixin.class ) + public interface Commands extends ServiceActivation + { + @UnitOfWorkPropagation( MANDATORY ) + Person create( Identity id, String name ); + + @UnitOfWorkPropagation( MANDATORY ) + void rename( Identity id, String newName ); + + @UnitOfWorkPropagation( MANDATORY ) + void delete( Identity id ); + } + + public static class CommandsMixin implements Commands + { + @Structure + private Module module; + + @Override + public void activateService() throws Exception + { + try (UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( newUsecase( "Init Person List" ) ) ) + { + try + { + uow.get( PersonList.class, PersonList.LIST_ID ); + } + catch( NoSuchEntityException ex ) + { + uow.newEntity( PersonList.class, PersonList.LIST_ID ); + uow.complete(); + } + } + } + + @Override + public void passivateService() + { + } + + @Override + public Person create( Identity id, String name ) + { + UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork(); + PersonList list = uow.get( PersonList.class, PersonList.LIST_ID ); + EntityBuilder<Person> builder = uow.newEntityBuilder( Person.class, id ); + builder.instance().name().set( name ); + Person person = builder.newInstance(); + list.all().add( person ); + return person; + } + + @Override + public void rename( Identity id, String newName ) + { + module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ).name().set( newName ); + } + + @Override + public void delete( Identity id ) + { + UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork(); + PersonList list = uow.get( PersonList.class, PersonList.LIST_ID ); + Person person = uow.get( Person.class, id ); + list.all().remove( person ); + uow.remove( person ); + } + } + + @Concerns( {TimingCaptureConcern.class, UnitOfWorkConcern.class} ) + @Mixins( QueriesMixin.class ) + public interface Queries + { + @UnitOfWorkPropagation( MANDATORY ) + Person byId( Identity id ); + + @TimingCapture + @UnitOfWorkPropagation( MANDATORY ) + Iterable<Person> all(); + } + + public static class QueriesMixin implements Queries + { + @Structure + private Module module; + + @Override + public Person byId( Identity id ) + { + return module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ); + } + + @Override + public Iterable<Person> all() + { + return module.unitOfWorkFactory().currentUnitOfWork() + .get( PersonList.class, PersonList.LIST_ID ) + .all().toList(); + } + } + + @Override + protected final void defineApplication( ApplicationAssembly app ) throws AssemblyException + { + app.setName( "app" ); + + LayerAssembly domain = app.layer( "domain" ); + ModuleAssembly model = domain.module( "model" ); + model.entities( Person.class, PersonList.class ) + .visibleIn( Visibility.layer ); + ModuleAssembly services = domain.module( "services" ); + services.services( Commands.class, Queries.class ) + .instantiateOnStartup() + .visibleIn( Visibility.application ); + + LayerAssembly config = app.layer( "config" ); + ModuleAssembly configModule = config.module( "config" ); + new EntityTestAssembler() + .visibleIn( Visibility.module ) + .assemble( configModule ); + + LayerAssembly infra = app.layer( "infra" ); + ModuleAssembly storage = infra.module( "storage" ); + entityStoreAssembler( configModule, Visibility.application ) + .visibleIn( Visibility.application ) + .assemble( storage ); + metricsAssembler() + .visibleIn( Visibility.application ) + .assemble( infra.module( "metrics" ) ); + + domain.uses( infra ); + infra.uses( config ); + } + + protected Assemblers.Visible<? extends Assembler> entityStoreAssembler( ModuleAssembly configModule, Visibility configVisibility ) throws AssemblyException + { + return new EntityTestAssembler(); + } + + protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler(); + + protected Module metricsModule() + { + return application.findModule( "infra", "metrics" ); + } + + protected static final String UOW_TIMER_NAME = "app.domain.services.UnitOfWork.timer"; + protected static final String ALL_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Queries.all"; + protected static final String CREATE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.create"; + protected static final String RENAME_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.rename"; + protected static final String DELETE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.delete"; + + protected final void assertUowTimer( MetricValuesProvider metrics ) throws PassivationException, ActivationException + { + Long initialUowCount = metrics.timerCount( UOW_TIMER_NAME ); + runScenario1(); + assertThat( UOW_TIMER_NAME + " count incremented by 3", metrics.timerCount( UOW_TIMER_NAME ), is( initialUowCount + 3L ) ); + application.passivate(); + application.activate(); + assertThat( UOW_TIMER_NAME + " count reset on passivation", metrics.timerCount( UOW_TIMER_NAME ), equalTo( initialUowCount ) ); + } + + protected final void assertTimingCapture( MetricValuesProvider metrics ) throws PassivationException, ActivationException + { + // Initial state + assertThat( ALL_NAME + " count is 0 at start", metrics.timerCount( ALL_NAME ), is( 0L ) ); + assertThat( CREATE_NAME + " count is 0 at start", metrics.timerCount( CREATE_NAME ), is( 0L ) ); + assertThat( RENAME_NAME + " count is 0 at start", metrics.timerCount( RENAME_NAME ), is( 0L ) ); + assertThat( DELETE_NAME+ " count is 0 at start", metrics.timerCount( DELETE_NAME ), is( 0L ) ); + + // Run scenario + runScenario1(); + + // Queries.byId() timings are not captured + assertThat( "Queries.byId() has no timer", metrics.registeredMetricNames(), not( contains( containsString( "byId" ) ) ) ); + + // Captured timings + assertThat( ALL_NAME + " count is 4 after scenario", metrics.timerCount( ALL_NAME ), is( 4L ) ); + assertThat( CREATE_NAME + " count is 1 after scenario", metrics.timerCount( CREATE_NAME ), is( 1L ) ); + assertThat( RENAME_NAME + " count is 1 after scenario", metrics.timerCount( RENAME_NAME ), is( 1L ) ); + assertThat( DELETE_NAME + " count is 1 after scenario", metrics.timerCount( DELETE_NAME ), is( 1L ) ); + + // Reset on passivation + application.passivate(); + application.activate(); + assertThat( ALL_NAME + " count is 0 after restart", metrics.timerCount( ALL_NAME ), is( 0L ) ); + assertThat( CREATE_NAME + " count is 0 after restart", metrics.timerCount( CREATE_NAME ), is( 0L ) ); + assertThat( RENAME_NAME + " count is 0 after restart", metrics.timerCount( RENAME_NAME ), is( 0L ) ); + assertThat( DELETE_NAME + " count is 0 after restart", metrics.timerCount( DELETE_NAME ), is( 0L ) ); + } + + protected final void runScenario1() + { + Module services = application.findModule( "domain", "services" ); + Commands commands = services.findService( Commands.class ).get(); + Queries queries = services.findService( Queries.class ).get(); + + Identity identity = StringIdentity.fromString( "1" ); + + try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork( newUsecase( "Step 1" ) ) ) + { + assertThat( queries.all().iterator().hasNext(), is( false ) ); + assertThat( commands.create( identity, "Bob Geldof" ).name().get(), equalTo( "Bob Geldof" ) ); + assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) ); + uow.complete(); + } + + try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 2"))) + { + assertThat( queries.all().iterator().next().name().get(), equalTo( "Bob Geldof" ) ); + assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) ); + commands.rename( identity, "Nina Hagen" ); + assertThat( queries.all().iterator().next().name().get(), equalTo( "Nina Hagen" ) ); + uow.complete(); + } + + try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 3"))) + { + commands.delete( identity ); + assertThat( queries.all().iterator().hasNext(), is( false ) ); + uow.complete(); + } + } + + protected static class JmxMetricTestAdapter implements MetricValuesProvider + { + private final JmxFixture jmx = new JmxFixture( "metrics:name=" ); + + @Override + public long timerCount( String name ) + { + if( jmx.objectExists( name ) ) { + return jmx.attributeValue( name, "Count", Long.class ); + } + return 0L; + } + + @Override + public Collection<String> registeredMetricNames() + { + return jmx.allObjectNames().stream() + .filter( objName -> objName.startsWith( jmx.prefix() ) ) + .map( objName -> objName.substring( jmx.prefix().length() ) ) + .collect( toList() ); + } + } + + @Test + public void uowTimerJmx() throws PassivationException, ActivationException + { + assertUowTimer( new JmxMetricTestAdapter() ); + } + + @Test + public void timingCaptureJmx() throws PassivationException, ActivationException + { + assertTimingCapture( new JmxMetricTestAdapter() ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractZestMetricsTest.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractZestMetricsTest.java b/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractZestMetricsTest.java deleted file mode 100644 index 9616f91..0000000 --- a/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractZestMetricsTest.java +++ /dev/null @@ -1,338 +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.polygene.test.metrics; - -import org.apache.polygene.api.activation.ActivationException; -import org.apache.polygene.api.activation.PassivationException; -import org.apache.polygene.api.association.ManyAssociation; -import org.apache.polygene.api.common.Visibility; -import org.apache.polygene.api.concern.Concerns; -import org.apache.polygene.api.entity.EntityBuilder; -import org.apache.polygene.api.identity.Identity; -import org.apache.polygene.api.identity.StringIdentity; -import org.apache.polygene.api.injection.scope.Structure; -import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.api.property.Property; -import org.apache.polygene.api.service.ServiceActivation; -import org.apache.polygene.api.structure.Module; -import org.apache.polygene.api.unitofwork.NoSuchEntityException; -import org.apache.polygene.api.unitofwork.UnitOfWork; -import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern; -import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation; -import org.apache.polygene.bootstrap.ApplicationAssembly; -import org.apache.polygene.bootstrap.Assembler; -import org.apache.polygene.bootstrap.Assemblers; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.LayerAssembly; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.library.metrics.TimingCapture; -import org.apache.polygene.library.metrics.TimingCaptureAllConcern; -import org.apache.polygene.library.metrics.TimingCaptureConcern; -import org.apache.polygene.test.AbstractPolygeneBaseTest; -import org.apache.polygene.test.EntityTestAssembler; -import org.apache.polygene.test.util.JmxFixture; -import org.junit.Test; - -import java.util.Collection; - -import static java.util.stream.Collectors.toList; -import static org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation.Propagation.MANDATORY; -import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertThat; - -// TODO Test errors -public abstract class AbstractPolygeneMetricsTest extends AbstractPolygeneBaseTest -{ - public interface Person - { - Property<String> name(); - } - - public interface PersonList - { - Identity LIST_ID = StringIdentity.fromString( "person-list" ); - - ManyAssociation<Person> all(); - } - - @Concerns( {TimingCaptureAllConcern.class, UnitOfWorkConcern.class} ) - @Mixins( CommandsMixin.class ) - public interface Commands extends ServiceActivation - { - @UnitOfWorkPropagation( MANDATORY ) - Person create( Identity id, String name ); - - @UnitOfWorkPropagation( MANDATORY ) - void rename( Identity id, String newName ); - - @UnitOfWorkPropagation( MANDATORY ) - void delete( Identity id ); - } - - public static class CommandsMixin implements Commands - { - @Structure - private Module module; - - @Override - public void activateService() throws Exception - { - try (UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( newUsecase( "Init Person List" ) ) ) - { - try - { - uow.get( PersonList.class, PersonList.LIST_ID ); - } - catch( NoSuchEntityException ex ) - { - uow.newEntity( PersonList.class, PersonList.LIST_ID ); - uow.complete(); - } - } - } - - @Override - public void passivateService() - { - } - - @Override - public Person create( Identity id, String name ) - { - UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork(); - PersonList list = uow.get( PersonList.class, PersonList.LIST_ID ); - EntityBuilder<Person> builder = uow.newEntityBuilder( Person.class, id ); - builder.instance().name().set( name ); - Person person = builder.newInstance(); - list.all().add( person ); - return person; - } - - @Override - public void rename( Identity id, String newName ) - { - module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ).name().set( newName ); - } - - @Override - public void delete( Identity id ) - { - UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork(); - PersonList list = uow.get( PersonList.class, PersonList.LIST_ID ); - Person person = uow.get( Person.class, id ); - list.all().remove( person ); - uow.remove( person ); - } - } - - @Concerns( {TimingCaptureConcern.class, UnitOfWorkConcern.class} ) - @Mixins( QueriesMixin.class ) - public interface Queries - { - @UnitOfWorkPropagation( MANDATORY ) - Person byId( Identity id ); - - @TimingCapture - @UnitOfWorkPropagation( MANDATORY ) - Iterable<Person> all(); - } - - public static class QueriesMixin implements Queries - { - @Structure - private Module module; - - @Override - public Person byId( Identity id ) - { - return module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ); - } - - @Override - public Iterable<Person> all() - { - return module.unitOfWorkFactory().currentUnitOfWork() - .get( PersonList.class, PersonList.LIST_ID ) - .all().toList(); - } - } - - @Override - protected final void defineApplication( ApplicationAssembly app ) throws AssemblyException - { - app.setName( "app" ); - - LayerAssembly domain = app.layer( "domain" ); - ModuleAssembly model = domain.module( "model" ); - model.entities( Person.class, PersonList.class ) - .visibleIn( Visibility.layer ); - ModuleAssembly services = domain.module( "services" ); - services.services( Commands.class, Queries.class ) - .instantiateOnStartup() - .visibleIn( Visibility.application ); - - LayerAssembly config = app.layer( "config" ); - ModuleAssembly configModule = config.module( "config" ); - new EntityTestAssembler() - .visibleIn( Visibility.module ) - .assemble( configModule ); - - LayerAssembly infra = app.layer( "infra" ); - ModuleAssembly storage = infra.module( "storage" ); - entityStoreAssembler( configModule, Visibility.application ) - .visibleIn( Visibility.application ) - .assemble( storage ); - metricsAssembler() - .visibleIn( Visibility.application ) - .assemble( infra.module( "metrics" ) ); - - domain.uses( infra ); - infra.uses( config ); - } - - protected Assemblers.Visible<? extends Assembler> entityStoreAssembler( ModuleAssembly configModule, Visibility configVisibility ) throws AssemblyException - { - return new EntityTestAssembler(); - } - - protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler(); - - protected Module metricsModule() - { - return application.findModule( "infra", "metrics" ); - } - - protected static final String UOW_TIMER_NAME = "app.domain.services.UnitOfWork.timer"; - protected static final String ALL_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Queries.all"; - protected static final String CREATE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.create"; - protected static final String RENAME_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.rename"; - protected static final String DELETE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.delete"; - - protected final void assertUowTimer( MetricValuesProvider metrics ) throws PassivationException, ActivationException - { - Long initialUowCount = metrics.timerCount( UOW_TIMER_NAME ); - runScenario1(); - assertThat( UOW_TIMER_NAME + " count incremented by 3", metrics.timerCount( UOW_TIMER_NAME ), is( initialUowCount + 3L ) ); - application.passivate(); - application.activate(); - assertThat( UOW_TIMER_NAME + " count reset on passivation", metrics.timerCount( UOW_TIMER_NAME ), equalTo( initialUowCount ) ); - } - - protected final void assertTimingCapture( MetricValuesProvider metrics ) throws PassivationException, ActivationException - { - // Initial state - assertThat( ALL_NAME + " count is 0 at start", metrics.timerCount( ALL_NAME ), is( 0L ) ); - assertThat( CREATE_NAME + " count is 0 at start", metrics.timerCount( CREATE_NAME ), is( 0L ) ); - assertThat( RENAME_NAME + " count is 0 at start", metrics.timerCount( RENAME_NAME ), is( 0L ) ); - assertThat( DELETE_NAME+ " count is 0 at start", metrics.timerCount( DELETE_NAME ), is( 0L ) ); - - // Run scenario - runScenario1(); - - // Queries.byId() timings are not captured - assertThat( "Queries.byId() has no timer", metrics.registeredMetricNames(), not( contains( containsString( "byId" ) ) ) ); - - // Captured timings - assertThat( ALL_NAME + " count is 4 after scenario", metrics.timerCount( ALL_NAME ), is( 4L ) ); - assertThat( CREATE_NAME + " count is 1 after scenario", metrics.timerCount( CREATE_NAME ), is( 1L ) ); - assertThat( RENAME_NAME + " count is 1 after scenario", metrics.timerCount( RENAME_NAME ), is( 1L ) ); - assertThat( DELETE_NAME + " count is 1 after scenario", metrics.timerCount( DELETE_NAME ), is( 1L ) ); - - // Reset on passivation - application.passivate(); - application.activate(); - assertThat( ALL_NAME + " count is 0 after restart", metrics.timerCount( ALL_NAME ), is( 0L ) ); - assertThat( CREATE_NAME + " count is 0 after restart", metrics.timerCount( CREATE_NAME ), is( 0L ) ); - assertThat( RENAME_NAME + " count is 0 after restart", metrics.timerCount( RENAME_NAME ), is( 0L ) ); - assertThat( DELETE_NAME + " count is 0 after restart", metrics.timerCount( DELETE_NAME ), is( 0L ) ); - } - - protected final void runScenario1() - { - Module services = application.findModule( "domain", "services" ); - Commands commands = services.findService( Commands.class ).get(); - Queries queries = services.findService( Queries.class ).get(); - - Identity identity = StringIdentity.fromString( "1" ); - - try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork( newUsecase( "Step 1" ) ) ) - { - assertThat( queries.all().iterator().hasNext(), is( false ) ); - assertThat( commands.create( identity, "Bob Geldof" ).name().get(), equalTo( "Bob Geldof" ) ); - assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) ); - uow.complete(); - } - - try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 2"))) - { - assertThat( queries.all().iterator().next().name().get(), equalTo( "Bob Geldof" ) ); - assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) ); - commands.rename( identity, "Nina Hagen" ); - assertThat( queries.all().iterator().next().name().get(), equalTo( "Nina Hagen" ) ); - uow.complete(); - } - - try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 3"))) - { - commands.delete( identity ); - assertThat( queries.all().iterator().hasNext(), is( false ) ); - uow.complete(); - } - } - - protected static class JmxMetricTestAdapter implements MetricValuesProvider - { - private final JmxFixture jmx = new JmxFixture( "metrics:name=" ); - - @Override - public long timerCount( String name ) - { - if( jmx.objectExists( name ) ) { - return jmx.attributeValue( name, "Count", Long.class ); - } - return 0L; - } - - @Override - public Collection<String> registeredMetricNames() - { - return jmx.allObjectNames().stream() - .filter( objName -> objName.startsWith( jmx.prefix() ) ) - .map( objName -> objName.substring( jmx.prefix().length() ) ) - .collect( toList() ); - } - } - - @Test - public void uowTimerJmx() throws PassivationException, ActivationException - { - assertUowTimer( new JmxMetricTestAdapter() ); - } - - @Test - public void timingCaptureJmx() throws PassivationException, ActivationException - { - assertTimingCapture( new JmxMetricTestAdapter() ); - } -}
