diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /branches/pre-spec-changes/test |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/pre-spec-changes/test')
24 files changed, 1797 insertions, 0 deletions
diff --git a/branches/pre-spec-changes/test/.ruleset b/branches/pre-spec-changes/test/.ruleset new file mode 100644 index 0000000000..3886f07f2d --- /dev/null +++ b/branches/pre-spec-changes/test/.ruleset @@ -0,0 +1,190 @@ +<?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. +--> +<ruleset name="pmd-eclipse"> + <description>PMD Plugin preferences rule set</description> + + + <rule ref="rulesets/basic.xml/BooleanInstantiation"/> + <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/> + <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/> +<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>--> +<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>--> +<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>--> + <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/> +<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>--> +<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>--> +<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>--> +<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>--> +<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>--> + <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/> + <rule ref="rulesets/basic.xml/JumbledIncrementer"/> +<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>--> + <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/> + <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/> + <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/> + <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/> + <rule ref="rulesets/basic.xml/UnnecessaryReturn"/> +<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>--> + +<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>--> +<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>--> +<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>--> +<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>--> + +<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>--> +<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>--> +<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>--> + +<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>--> +<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>--> +<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>--> +<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>--> +<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>--> +<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>--> + +<rule ref="rulesets/controversial.xml/AssignmentInOperand"/> +<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>--> +<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>--> +<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>--> +<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>--> +<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>--> +<!--<rule ref="rulesets/controversial.xml/SingularField"/>--> +<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>--> +<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>--> +<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/> +<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>--> + +<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>--> +<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>--> +<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>--> + +<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>--> +<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>--> +<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>--> +<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>--> +<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>--> +<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/> +<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>--> +<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>--> +<!--<rule ref="rulesets/design.xml/BadComparison"/>--> +<!--<rule ref="rulesets/design.xml/CloseConnection"/>--> +<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>--> +<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>--> +<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/> +<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>--> +<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>--> +<rule ref="rulesets/design.xml/IdempotentOperations"/> +<!--<rule ref="rulesets/design.xml/ImmutableField"/>--> +<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>--> +<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>--> +<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>--> +<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>--> +<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>--> +<rule ref="rulesets/design.xml/OptimizableToArrayCall"/> +<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/> +<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/> +<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/> +<rule ref="rulesets/design.xml/SimplifyConditional"/> +<!--<rule ref="rulesets/design.xml/SwitchDensity"/>--> +<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>--> +<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/> +<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>--> +<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>--> +<!--<rule ref="rulesets/design.xml/UseSingleton"/>--> + +<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>--> +<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>--> +<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>--> +<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>--> +<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>--> +<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>--> + +<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>--> +<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>--> +<!--<rule ref="rulesets/imports.xml/UnusedImports"/>--> +<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>--> + +<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>--> +<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>--> + +<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>--> +<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>--> +<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>--> +<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>--> +<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>--> +<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>--> +<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>--> +<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>--> + + <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>--> + <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>--> + <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>--> + <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>--> + <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>--> + <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>--> + <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>--> + <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>--> + + <!--<rule ref="rulesets/naming.xml/ShortVariable"/>--> + <!--<rule ref="rulesets/naming.xml/LongVariable"/>--> + <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>--> + <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>--> + <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>--> + <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>--> + <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>--> + <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>--> + <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>--> + <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>--> + <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>--> + <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>--> + <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>--> + <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>--> + <!--<rule ref="rulesets/naming.xml/NoPackage"/>--> + <!--<rule ref="rulesets/naming.xml/PackageCase"/>--> + + <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>--> + <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>--> + <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>--> + <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>--> + <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>--> + <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>--> + + <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>--> + <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>--> + <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>--> + <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>--> + <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>--> + <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>--> + + <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>--> + <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>--> + <!--<rule ref="rulesets/strings.xml/StringToString"/>--> + <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>--> + <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>--> + + <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>--> + <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>--> + + <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/> + <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/> + <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/> + <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>--> + +</ruleset> diff --git a/branches/pre-spec-changes/test/LICENSE.txt b/branches/pre-spec-changes/test/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/branches/pre-spec-changes/test/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/branches/pre-spec-changes/test/NOTICE.txt b/branches/pre-spec-changes/test/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/branches/pre-spec-changes/test/NOTICE.txt @@ -0,0 +1,14 @@ +${pom.name} +Copyright (c) 2005 - 2006 The Apache Software Foundation + +Apache Tuscany is an effort undergoing incubation at The Apache Software +Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is +required of all newly accepted projects until a further review indicates that +the infrastructure, communications, and decision making process have stabilized +in a manner consistent with other successful ASF projects. While incubation +status is not necessarily a reflection of the completeness or stability of the +code, it does indicate that the project has yet to be fully endorsed by the ASF. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/branches/pre-spec-changes/test/pom.xml b/branches/pre-spec-changes/test/pom.xml new file mode 100644 index 0000000000..70ec793727 --- /dev/null +++ b/branches/pre-spec-changes/test/pom.xml @@ -0,0 +1,46 @@ +<?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. +--> +<project> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>parent</artifactId> + <version>0.1-pre-spec-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>test</artifactId> + <name>Apache Tuscany Test Framework</name> + <description>Tuscany Testcase Framework</description> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca.kernel</groupId> + <artifactId>core</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymock</artifactId> + </dependency> + </dependencies> +</project> diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java new file mode 100644 index 0000000000..a7dbe0f90f --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java @@ -0,0 +1,154 @@ +/* + * 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.tuscany.test; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.tuscany.spi.builder.Connector; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.Service; +import org.apache.tuscany.spi.idl.InvalidServiceContractException; +import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.InboundInvocationChain; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.OutboundWire; +import org.apache.tuscany.spi.wire.WireService; + +import org.apache.tuscany.core.builder.ConnectorImpl; +import org.apache.tuscany.core.component.WorkContextImpl; +import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl; +import org.apache.tuscany.core.implementation.composite.ServiceImpl; +import org.apache.tuscany.core.wire.InboundInvocationChainImpl; +import org.apache.tuscany.core.wire.InboundWireImpl; +import org.apache.tuscany.core.wire.InvokerInterceptor; +import org.apache.tuscany.core.wire.OutboundInvocationChainImpl; +import org.apache.tuscany.core.wire.OutboundWireImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireService; + +/** + * A factory for creating runtime artifacts to facilitate testing without directly instantiating core implementation + * classes + * + * @version $$Rev$$ $$Date$$ + */ +public final class ArtifactFactory { + + private ArtifactFactory() { + } + + public static Connector createConnector() { + return new ConnectorImpl(createWireService(), null, null, null); + } + + public static WireService createWireService() { + return new JDKWireService(new WorkContextImpl(), null); + } + + public static Service createService(String name, CompositeComponent parent, ServiceContract<?> contract) { + return new ServiceImpl(name, parent, contract); + } + + /** + * Creates an inbound wire. After a wire is returned, client code must call {@link + * #terminateWire(org.apache.tuscany.spi.wire.InboundWire)}. These two methods have been separated to allow wires to + * be decorated with interceptors or handlers prior to their completion + * + * @param serviceName the service name associated with the wire + * @param interfaze the interface associated with the wire + */ + public static <T> InboundWire createLocalInboundWire(String serviceName, Class<T> interfaze) + throws InvalidServiceContractException { + InboundWire wire = new InboundWireImpl(); + JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl(); + ServiceContract<?> contract = registry.introspect(interfaze); + wire.setServiceContract(contract); + wire.setServiceName(serviceName); + wire.addInvocationChains(createInboundChains(interfaze)); + return wire; + } + + /** + * Creates an outbound wire. After a wire is returned, client code must call {@link + * #terminateWire(org.apache.tuscany.spi.wire.OutboundWire)}. These two methods have been separated to allow wires + * to be decorated with interceptors or handlers prior to their completion + * + * @param refName the reference name the wire is associated with on the client + * @param interfaze the interface associated with the wire + */ + public static <T> OutboundWire createLocalOutboundWire(String refName, Class<T> interfaze) + throws InvalidServiceContractException { + OutboundWire wire = new OutboundWireImpl(); + wire.setReferenceName(refName); + wire.addInvocationChains(createOutboundChains(interfaze)); + JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl(); + ServiceContract<?> contract = registry.introspect(interfaze); + wire.setServiceContract(contract); + return wire; + } + + + /** + * Finalizes the target wire + */ + public static void terminateWire(InboundWire wire) { + for (InboundInvocationChain chain : wire.getInvocationChains().values()) { + // add tail interceptor + chain.addInterceptor(new InvokerInterceptor()); + } + } + + public static void terminateWire(OutboundWire wire) { + for (OutboundInvocationChain chain : wire.getInvocationChains().values()) { + // add tail interceptor + chain.addInterceptor(new InvokerInterceptor()); + } + } + + private static Map<Operation<?>, OutboundInvocationChain> createOutboundChains(Class<?> interfaze) + throws InvalidServiceContractException { + Map<Operation<?>, OutboundInvocationChain> invocations = new HashMap<Operation<?>, OutboundInvocationChain>(); + JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl(); + ServiceContract<?> contract = registry.introspect(interfaze); + for (Operation operation : contract.getOperations().values()) { + OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation); + invocations.put(operation, chain); + } + return invocations; + } + + private static Map<Operation<?>, InboundInvocationChain> createInboundChains(Class<?> interfaze) + throws InvalidServiceContractException { + Map<Operation<?>, InboundInvocationChain> invocations = new HashMap<Operation<?>, InboundInvocationChain>(); + JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl(); + ServiceContract<?> contract = registry.introspect(interfaze); + for (Operation<?> operation : contract.getOperations().values()) { + InboundInvocationChain chain = new InboundInvocationChainImpl(operation); + // add tail interceptor + //chain.addInterceptor(new InvokerInterceptor()); + invocations.put(operation, chain); + } + return invocations; + } + + +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/SCATestCase.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/SCATestCase.java new file mode 100644 index 0000000000..829f99b6f9 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/SCATestCase.java @@ -0,0 +1,183 @@ +/* + * 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.tuscany.test; + +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.HashMap; +import java.util.Map; + +import org.apache.tuscany.spi.bootstrap.ComponentNames; +import org.apache.tuscany.spi.builder.BuilderException; +import org.apache.tuscany.spi.component.AtomicComponent; +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.component.ComponentException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.SCAObject; +import org.apache.tuscany.spi.deployer.Deployer; +import org.apache.tuscany.spi.deployer.DeploymentMonitor; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.model.ComponentDefinition; +import org.apache.tuscany.spi.wire.WireService; + +import junit.framework.TestCase; +import org.apache.tuscany.api.TuscanyException; +import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation; +import org.apache.tuscany.core.launcher.CompositeContextImpl; +import org.apache.tuscany.core.launcher.LauncherImpl; +import org.apache.tuscany.core.monitor.JavaLoggingMonitorFactory; +import org.apache.tuscany.host.MonitorFactory; +import org.apache.tuscany.host.runtime.InitializationException; + +import org.osoa.sca.CurrentCompositeContext; + +/** + * Base class for JUnit tests that want to run in an SCA client environment. + * + * @version $Rev$ $Date$ + */ +public abstract class SCATestCase extends TestCase { + protected CompositeComponent component; + private CompositeContextImpl context; + private Map<String, URL> extensions = new HashMap<String, URL>(); + private URL applicationSCDL; + private LauncherImpl launcher; + private MonitorFactory monitorFactory; + + protected void setUp() throws Exception { + super.setUp(); + if (monitorFactory == null) { + monitorFactory = new JavaLoggingMonitorFactory(); + } + ClassLoader cl = getClass().getClassLoader(); + launcher = new LauncherImpl(); + launcher.setApplicationLoader(cl); + URL scdl = cl.getResource(LauncherImpl.METAINF_SYSTEM_SCDL_PATH); + + try { + CompositeComponent composite = launcher.bootRuntime(scdl, monitorFactory); + for (String extensionName : extensions.keySet()) { + deployExtension(composite, extensionName, extensions.get(extensionName)); + } + + SCAObject wireServiceComponent = composite.getSystemChild(ComponentNames.TUSCANY_WIRE_SERVICE); + if (!(wireServiceComponent instanceof AtomicComponent)) { + throw new InitializationException("WireService must be an atomic component"); + } + + WireService wireService = (WireService) ((AtomicComponent) wireServiceComponent).getTargetInstance(); + + if (applicationSCDL == null) { + throw new RuntimeException("application SCDL not found: " + applicationSCDL); + } + component = launcher.bootApplication("application", applicationSCDL); + component.start(); + context = new CompositeContextImpl(component, wireService); + CurrentCompositeContext.setContext(context); + } catch (TuscanyException e) { + DeploymentMonitor monitor = monitorFactory.getMonitor(DeploymentMonitor.class); + monitor.deploymentError(e); + throw e; + } + + } + + /** + * A TestCase can use this to overide the default SCDL location of "META-INF/sca/default.scdl" + */ + protected void setApplicationSCDL(URL applicationSCDL) { + this.applicationSCDL = applicationSCDL; + } + + /** + * Set the application scdl based on the classpath entry for a class. Normally this will be a class in the + * production code associated with this test case. + * + * @param aClass a Class from which to determine the resource base url + * @param path location of the application SCDL relative to the base class + * @throws MalformedURLException if the path is malformed + */ + protected void setApplicationSCDL(Class<?> aClass, String path) throws MalformedURLException { + URL root = getRoot(aClass); + setApplicationSCDL(new URL(root, path)); + } + + /** + * A TestCase can use this to add the SCDL location of an extention to be deployed to the runtime + */ + protected void addExtension(String extensionName, URL extentionSCDL) { + extensions.put(extensionName, extentionSCDL); + } + + + /** + * Sets the monitor factory to use + * + * @param monitorFactory the monitor factory to use + */ + protected void setMonitorFactory(MonitorFactory monitorFactory) { + this.monitorFactory = monitorFactory; + } + + protected void deployExtension(CompositeComponent composite, String extensionName, URL scdlURL) + throws LoaderException, BuilderException, ComponentException, InitializationException { + SystemCompositeImplementation implementation = new SystemCompositeImplementation(); + implementation.setScdlLocation(scdlURL); + implementation.setClassLoader(new URLClassLoader(new URL[]{scdlURL}, getClass().getClassLoader())); + + ComponentDefinition<SystemCompositeImplementation> definition = + new ComponentDefinition<SystemCompositeImplementation>(extensionName, implementation); + + + SCAObject child = composite.getSystemChild(ComponentNames.TUSCANY_DEPLOYER); + if (!(child instanceof AtomicComponent)) { + throw new InitializationException("Deployer must be an atomic component"); + } + Deployer deployer = (Deployer) ((AtomicComponent) child).getTargetInstance(); + Component component = deployer.deploy(composite, definition); + component.start(); + } + + + protected static URL getRoot(Class<?> aClass) { + String name = aClass.getName(); + String classPath = "/" + name.replace('.', '/') + ".class"; + URL classURL = aClass.getResource(classPath); + assert classURL != null; + StringBuilder prefix = new StringBuilder(); + for (int i = 0; i < name.length(); i++) { + if (name.charAt(i) == '.') { + prefix.append("../"); + } + } + try { + return new URL(classURL, prefix.toString()); + } catch (MalformedURLException e) { + throw new AssertionError(); + } + } + + protected void tearDown() throws Exception { + CurrentCompositeContext.setContext(null); + component.stop(); + launcher.shutdownRuntime(); + super.tearDown(); + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/TestLauncher.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/TestLauncher.java new file mode 100644 index 0000000000..b66716bac0 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/TestLauncher.java @@ -0,0 +1,34 @@ +/* + * 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.tuscany.test; + +import java.io.File; + +import org.apache.tuscany.core.launcher.LauncherImpl; + +/** + * @version $Rev$ $Date$ + */ +public class TestLauncher extends LauncherImpl { + + public File getInstallDirectory() { + return new File("."); + } + +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingBuilder.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingBuilder.java new file mode 100644 index 0000000000..8354b0710a --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingBuilder.java @@ -0,0 +1,53 @@ +/* + * 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.tuscany.test.binding; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.model.BoundReferenceDefinition; +import org.apache.tuscany.spi.model.BoundServiceDefinition; + +/** + * @version $Rev$ $Date$ + */ +public class TestBindingBuilder extends BindingBuilderExtension<TestBindingDefinition> { + + @SuppressWarnings("unchecked") + public ServiceBinding build(CompositeComponent parent, + BoundServiceDefinition definition, + TestBindingDefinition bindingDefinition, + DeploymentContext ctx) { + return new TestBindingServiceBinding(definition.getName(), parent); + } + + public ReferenceBinding build(CompositeComponent parent, + BoundReferenceDefinition definition, + TestBindingDefinition bindingDefinition, + DeploymentContext ctx) { + String name = definition.getName(); + return new TestReferenceBinding(name, parent); + } + + protected Class<TestBindingDefinition> getBindingType() { + return TestBindingDefinition.class; + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingDefinition.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingDefinition.java new file mode 100644 index 0000000000..19228fd86a --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingDefinition.java @@ -0,0 +1,32 @@ +/* + * 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.tuscany.test.binding; + +import org.apache.tuscany.spi.model.BindingDefinition; + + +/** + * A simple binding for test purposes. + * + * @version $$Rev$$ $$Date$$ + */ +public class TestBindingDefinition extends BindingDefinition { + + +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingLoader.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingLoader.java new file mode 100644 index 0000000000..ef7a0ebb6f --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingLoader.java @@ -0,0 +1,57 @@ +/* + * 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.tuscany.test.binding; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.osoa.sca.Version; +import org.osoa.sca.annotations.Constructor; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; + +/** + * @version $Rev$ $Date$ + */ +public class TestBindingLoader extends LoaderExtension<TestBindingDefinition> { + + public static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.test"); + + @Constructor + public TestBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return BINDING_TEST; + } + + public TestBindingDefinition load(CompositeComponent parent, + ModelObject object, XMLStreamReader reader, + DeploymentContext context) throws XMLStreamException, LoaderException { + return new TestBindingDefinition(); + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingRuntimeException.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingRuntimeException.java new file mode 100644 index 0000000000..88c62d1420 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingRuntimeException.java @@ -0,0 +1,24 @@ +package org.apache.tuscany.test.binding; + +import org.apache.tuscany.api.TuscanyRuntimeException; + +/** + * @version $Rev$ $Date$ + */ +public class TestBindingRuntimeException extends TuscanyRuntimeException { + + public TestBindingRuntimeException() { + } + + public TestBindingRuntimeException(String message) { + super(message); + } + + public TestBindingRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public TestBindingRuntimeException(Throwable cause) { + super(cause); + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingServiceBinding.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingServiceBinding.java new file mode 100644 index 0000000000..341be523a3 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestBindingServiceBinding.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.test.binding; + +import javax.xml.namespace.QName; + +import org.osoa.sca.Version; + +import org.apache.tuscany.spi.CoreRuntimeException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; + +/** + * @version $Rev$ $Date$ + */ +public class TestBindingServiceBinding extends ServiceBindingExtension { + private static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket"); + + public TestBindingServiceBinding(String name, CompositeComponent parent) throws CoreRuntimeException { + super(name, parent); + // do nothing, but this could register with the host environment + } + + public QName getBindingType() { + return BINDING_TEST; + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestInvoker.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestInvoker.java new file mode 100644 index 0000000000..c3b02024af --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestInvoker.java @@ -0,0 +1,49 @@ +package org.apache.tuscany.test.binding; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * @version $Rev$ $Date$ + */ +public class TestInvoker implements TargetInvoker { + + private boolean cacheable; + + public boolean isCacheable() { + return cacheable; + } + + public void setCacheable(boolean cacheable) { + this.cacheable = cacheable; + } + + public boolean isOptimizable() { + return isCacheable(); + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + // echo back the result, a real binding would invoke some API for flowing the request + return ((Object[]) payload)[0]; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBodyWithFault(e.getCause()); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestReferenceBinding.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestReferenceBinding.java new file mode 100644 index 0000000000..025cfb1e1e --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestReferenceBinding.java @@ -0,0 +1,30 @@ +package org.apache.tuscany.test.binding; + +import javax.xml.namespace.QName; + +import org.osoa.sca.Version; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ReferenceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * @version $Rev$ $Date$ + */ +public class TestReferenceBinding extends ReferenceBindingExtension { + private static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket"); + + public TestReferenceBinding(String name, CompositeComponent parent) { + super(name, parent); + } + + public QName getBindingType() { + return BINDING_TEST; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) { + return new TestInvoker(); + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingBuilder.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingBuilder.java new file mode 100644 index 0000000000..020bdd3ef9 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingBuilder.java @@ -0,0 +1,37 @@ +package org.apache.tuscany.test.binding; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.model.BoundReferenceDefinition; +import org.apache.tuscany.spi.model.BoundServiceDefinition; + +/** + * @version $Rev$ $Date$ + */ +public class TestSocketBindingBuilder extends BindingBuilderExtension<TestSocketBindingDefinition> { + + public ServiceBinding build(CompositeComponent parent, + BoundServiceDefinition definition, + TestSocketBindingDefinition bindingDefinition, + DeploymentContext ctx) { + int port = bindingDefinition.getPort(); + return new TestSocketBindingServiceBinding(definition.getName(), port, parent); + } + + public ReferenceBinding build(CompositeComponent parent, + BoundReferenceDefinition definition, + TestSocketBindingDefinition bindingDefinition, + DeploymentContext ctx) { + String name = definition.getName(); + int port = bindingDefinition.getPort(); + String host = bindingDefinition.getHost(); + return new TestSocketReferenceBinding(name, host, port, parent); + } + + protected Class<TestSocketBindingDefinition> getBindingType() { + return TestSocketBindingDefinition.class; + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingDefinition.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingDefinition.java new file mode 100644 index 0000000000..fa5f7b2c57 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingDefinition.java @@ -0,0 +1,27 @@ +package org.apache.tuscany.test.binding; + +import org.apache.tuscany.spi.model.BindingDefinition; + +/** + * A simple socket-based binding. Service operations may onyl take one parameter that is <code>Serializable</code> + * + * @version $$Rev$$ $$Date$$ + */ +public class TestSocketBindingDefinition extends BindingDefinition { + private String host; + private int port; + + public TestSocketBindingDefinition(String host, int port) { + this.host = host; + this.port = port; + } + + public String getHost() { + return host; + } + + public int getPort() { + return port; + } + +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingLoader.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingLoader.java new file mode 100644 index 0000000000..cdec616c35 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingLoader.java @@ -0,0 +1,46 @@ +package org.apache.tuscany.test.binding; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.osoa.sca.Version; +import org.osoa.sca.annotations.Constructor; + +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; + +/** + * @version $Rev$ $Date$ + */ +public class TestSocketBindingLoader extends LoaderExtension<TestSocketBindingDefinition> { + + public static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket"); + + @Constructor + public TestSocketBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + } + + public QName getXMLType() { + return TestSocketBindingLoader.BINDING_TEST; + } + + public TestSocketBindingDefinition load(CompositeComponent parent, + ModelObject object, XMLStreamReader reader, + DeploymentContext context) throws XMLStreamException, LoaderException { + String host = reader.getAttributeValue(null, "host"); + int port; + try { + port = Integer.parseInt(reader.getAttributeValue(null, "port")); + } catch (NumberFormatException e) { + throw new LoaderException("Invalid port specified", e); + } + return new TestSocketBindingDefinition(host, port); + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingServiceBinding.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingServiceBinding.java new file mode 100644 index 0000000000..a1531b6f5f --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingServiceBinding.java @@ -0,0 +1,129 @@ +package org.apache.tuscany.test.binding; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import javax.xml.namespace.QName; + +import org.osoa.sca.Version; + +import org.apache.tuscany.spi.CoreRuntimeException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundInvocationChain; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; + +/** + * Implements a very simple remote, socket-based binding for test purposes. This binding exposes serviceBindings using a socket + * on a given port. Service operations must take only one paramter that is <code>Serializable</code>. + * + * @version $Rev$ $Date$ + */ +public class TestSocketBindingServiceBinding extends ServiceBindingExtension { + private static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket"); + private int port; + private ServerSocket socket; + private ExecutorService executor; + private TestSocketBindingServiceBinding.ServerRunnable runnable; + + public TestSocketBindingServiceBinding(String name, int port, CompositeComponent parent) throws CoreRuntimeException { + super(name, parent); + this.port = port; + } + + public QName getBindingType() { + return BINDING_TEST; + } + + public void start() { + executor = Executors.newSingleThreadExecutor(); + // create a listener, note that a work scheduler should normally be used to spawn work in different threads + runnable = new ServerRunnable(); + executor.execute(runnable); + } + + public void stop() { + try { + runnable.setEnd(true); + socket.close(); + executor.shutdownNow(); + } catch (IOException e) { + throw new TestBindingRuntimeException(e); + } + } + + /** + * Creates a socket listener in another thread which handles one client at a time. For a real binding, a work + * scheduler should be used + */ + private class ServerRunnable implements Runnable { + + private boolean end; + + public void setEnd(boolean end) { + this.end = end; + } + + public void run() { + Socket clientSocket; + ObjectInputStream is = null; + ObjectOutputStream os = null; + try { + socket = new ServerSocket(port); + } catch (IOException e) { + throw new TestBindingRuntimeException(e); + } + while (!end) { + try { + clientSocket = socket.accept(); + is = new ObjectInputStream(clientSocket.getInputStream()); + String operation = is.readUTF(); + int argn = is.readInt(); + Object[] args = new Object[argn]; + for (int i = 0; i < argn; i++) { + args[i] = is.readObject(); + } + Map<Operation<?>, InboundInvocationChain> chains = getInboundWire().getInvocationChains(); + for (InboundInvocationChain chain : chains.values()) { + if (chain.getOperation().getName().equals(operation)) { + Message message = new MessageImpl(); + message.setTargetInvoker(chain.getTargetInvoker()); + message.setBody(args); + message = chain.getHeadInterceptor().invoke(message); + os = new ObjectOutputStream(clientSocket.getOutputStream()); + os.writeObject(message.getBody()); + os.flush(); + } + } + } catch (IOException e) { + throw new TestBindingRuntimeException(e); + } catch (ClassNotFoundException e) { + throw new TestBindingRuntimeException(e); + } finally { + if (os != null) { + try { + os.close(); + } catch (IOException e) { + // ingore + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + // ignore + } + } + } + } + } + } +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketInvoker.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketInvoker.java new file mode 100644 index 0000000000..15ebd672df --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketInvoker.java @@ -0,0 +1,123 @@ +package org.apache.tuscany.test.binding; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.lang.reflect.InvocationTargetException; +import java.net.Socket; +import java.net.UnknownHostException; + +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * Responsible for serializing an operation parameter flowing the invocation through the socket + * + * @version $Rev$ $Date$ + */ +public class TestSocketInvoker implements TargetInvoker { + private String host; + private int port; + private String operation; + + private boolean cacheable; + + public TestSocketInvoker(String host, int port, String operation) { + this.host = host; + this.port = port; + this.operation = operation; + } + + public boolean isCacheable() { + return cacheable; + } + + public void setCacheable(boolean cacheable) { + this.cacheable = cacheable; + } + + public boolean isOptimizable() { + return isCacheable(); + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBodyWithFault(e.getCause()); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + /** + * Sends the payload over a socket + */ + public Object invokeTarget(final Object object, final short sequence) throws InvocationTargetException { + int argn; + if (object == null) { + argn = 0; + } else if (!object.getClass().isArray()) { + argn = 1; + } else { + argn = ((Object[])object).length; + } + + Socket socket = null; + ObjectOutputStream os = null; + ObjectInputStream is = null; + try { + socket = new Socket(host, port); + os = new ObjectOutputStream(socket.getOutputStream()); + os.writeUTF(operation); + os.writeInt(argn); + for (int i=0; i<argn; i++) { + if (!object.getClass().isArray()) { + os.writeObject(object); + } + else { + os.writeObject(((Object[])object)[i]); + } + } + os.flush(); + is = new ObjectInputStream(socket.getInputStream()); + return is.readObject(); + } catch (ClassNotFoundException e) { + throw new InvocationTargetException(e); + } catch (UnknownHostException e) { + throw new InvocationTargetException(e); + } catch (IOException e) { + throw new InvocationTargetException(e); + } finally { + if (os != null) { + try { + os.close(); + } catch (IOException e) { + // ignore + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + // ignore + } + } + if (socket != null) { + try { + socket.close(); + } catch (IOException e) { + // ignore + } + } + } + } + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + +} diff --git a/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketReferenceBinding.java b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketReferenceBinding.java new file mode 100644 index 0000000000..ac9cb9c479 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/java/org/apache/tuscany/test/binding/TestSocketReferenceBinding.java @@ -0,0 +1,38 @@ +package org.apache.tuscany.test.binding; + +import javax.xml.namespace.QName; + +import org.osoa.sca.Version; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ReferenceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; + +/** + * @version $Rev$ $Date$ + */ +public class TestSocketReferenceBinding extends ReferenceBindingExtension { + private static final QName BINDING_TEST = new QName(Version.XML_NAMESPACE_1_0, "binding.socket"); + + private String host; + private int port; + + public TestSocketReferenceBinding(String name, + String host, + int port, + CompositeComponent parent) { + super(name, parent); + this.port = port; + this.host = host; + } + + public QName getBindingType() { + return BINDING_TEST; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) { + return new TestSocketInvoker(host, port, operation.getName()); + } +} diff --git a/branches/pre-spec-changes/test/src/main/resources/META-INF/sca/test.default.scdl b/branches/pre-spec-changes/test/src/main/resources/META-INF/sca/test.default.scdl new file mode 100644 index 0000000000..e6ffb7300b --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/resources/META-INF/sca/test.default.scdl @@ -0,0 +1,44 @@ +<?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. +--> +<!-- + JavaScript configuration for the launcher environment. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" + + name="org.apache.tuscany.test.TestBindingImplementation"> + + <component name="BindingLoader"> + <system:implementation.system class="org.apache.tuscany.test.binding.TestBindingLoader"/> + </component> + + <component name="BindingBuilder"> + <system:implementation.system class="org.apache.tuscany.test.binding.TestBindingBuilder"/> + </component> + + <component name="SocketBindingLoader"> + <system:implementation.system class="org.apache.tuscany.test.binding.TestSocketBindingLoader"/> + </component> + + <component name="SocketBindingBuilder"> + <system:implementation.system class="org.apache.tuscany.test.binding.TestSocketBindingBuilder"/> + </component> + +</composite> diff --git a/branches/pre-spec-changes/test/src/main/resources/META-INF/tuscany/system.scdl b/branches/pre-spec-changes/test/src/main/resources/META-INF/tuscany/system.scdl new file mode 100644 index 0000000000..da82b3b0b4 --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/resources/META-INF/tuscany/system.scdl @@ -0,0 +1,163 @@ +<?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. +--> +<!-- + Default system configuration for the launcher environment. + + $Rev$ $Date$ +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" + name="org.apache.tuscany.launcher.System"> + + <!-- Component that provides the Deployer service --> + <component name="deployer"> + <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/> + </component> + + <!-- Work management --> + <component name="workContext"> + <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/> + </component> + + <!-- Wire service --> + <component name="wireService"> + <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKWireService"/> + </component> + + <!-- Scope infrastructure --> + <component name="scopeRegistry"> + <system:implementation.system class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl"/> + </component> + + <!-- Store infrastructure --> + <component name="store"> + <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/> + </component> + + <!-- Builder and BuilderRegistry --> + <component name="builder"> + <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/> + </component> + + <!-- Loader and LoaderRegistry --> + <component name="loader"> + <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/> + </component> + + <!-- Introspector and IntrospectionRegistry --> + <component name="interfaceProcessorRegistry"> + <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/> + </component> + + <!-- Resource host registry --> + <component name="resourceHostRegistry"> + <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/> + </component> + + <!-- Connector infrastructure --> + <component name="connector"> + <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/> + </component> + + <component name="wirePostProcessorRegistry"> + <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/> + </component> + + <!-- Default scopes --> + <component name="scope.module"> + <system:implementation.system class="org.apache.tuscany.core.component.scope.CompositeScopeObjectFactory"/> + </component> + <component name="scope.stateless"> + <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeObjectFactory"/> + </component> + <component name="scope.request"> + <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeObjectFactory"/> + </component> + + <component name="scope.conversational"> + <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeObjectFactory"/> + </component> + + <!-- service for resolving artifacts against the user's local Maven repository --> + <component name="artifactRepository"> + <system:implementation.system class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/> + <property name="repository">.m2/repository</property> + </component> + + <!-- WorkScheduler service --> + <component name="workManager"> + <system:implementation.system + class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/> + <property name="poolSize">10</property> + </component> + + <component name="workScheduler"> + <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/> + </component> + + <component name="policyBuilderRegistry"> + <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/> + </component> + + <component name="propertyFactory"> + <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/> + </component> + + <component name="wireLoader"> + <system:implementation.system class="org.apache.tuscany.core.loader.WireLoader"/> + </component> + + <!-- include loader configuration --> + <include name="org.apache.tuscany.launcher.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/> + + <!-- include implementation processor configuration --> + <include name="org.apache.tuscany.launcher.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/> + + <!-- Java interface definition language --> + <include name="org.apache.tuscany.launcher.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/> + + <!-- include omposite implementation type --> + <include name="org.apache.tuscany.launcher.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/> + + <!-- System implementation type --> + <include name="org.apache.tuscany.launcher.SystemImplementation" scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/> + + <!-- Java implementation type --> + <include name="org.apache.tuscany.launcher.JavaImplementation" scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/> + + <!-- Data Binding --> + <include name="org.apache.tuscany.launcher.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/> + + <!-- System implementation type --> + <include name="org.apache.tuscany.test.TestBindingImplementation" scdlLocation="test.binding.system.scdl"/> + + <!-- Logging formatters --> + <include name="org.apache.tuscany.launcher.Formatters" scdlResource="org/apache/tuscany/core/formatters.scdl"/> + + <!-- the local binding --> + <component name="localBindingLoader"> + <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingLoader"/> + </component> + + <component name="localBindingBuilder"> + <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingBuilder"/> + </component> + +</composite> diff --git a/branches/pre-spec-changes/test/src/main/resources/META-INF/tuscany/test.binding.system.scdl b/branches/pre-spec-changes/test/src/main/resources/META-INF/tuscany/test.binding.system.scdl new file mode 100644 index 0000000000..e6ffb7300b --- /dev/null +++ b/branches/pre-spec-changes/test/src/main/resources/META-INF/tuscany/test.binding.system.scdl @@ -0,0 +1,44 @@ +<?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. +--> +<!-- + JavaScript configuration for the launcher environment. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" + + name="org.apache.tuscany.test.TestBindingImplementation"> + + <component name="BindingLoader"> + <system:implementation.system class="org.apache.tuscany.test.binding.TestBindingLoader"/> + </component> + + <component name="BindingBuilder"> + <system:implementation.system class="org.apache.tuscany.test.binding.TestBindingBuilder"/> + </component> + + <component name="SocketBindingLoader"> + <system:implementation.system class="org.apache.tuscany.test.binding.TestSocketBindingLoader"/> + </component> + + <component name="SocketBindingBuilder"> + <system:implementation.system class="org.apache.tuscany.test.binding.TestSocketBindingBuilder"/> + </component> + +</composite> diff --git a/branches/pre-spec-changes/test/src/test/java/org/apache/tuscany/test/SCATestCaseTestCase.java b/branches/pre-spec-changes/test/src/test/java/org/apache/tuscany/test/SCATestCaseTestCase.java new file mode 100644 index 0000000000..fac190b02e --- /dev/null +++ b/branches/pre-spec-changes/test/src/test/java/org/apache/tuscany/test/SCATestCaseTestCase.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.test; + +import java.net.URL; +import java.net.MalformedURLException; + +import junit.framework.TestCase; + +/** + * @version $Rev$ $Date$ + */ +public class SCATestCaseTestCase extends TestCase { + public void testGetRoot() throws MalformedURLException { + URL classUrl = getClass().getResource("SCATestCaseTestCase.class"); + URL root = SCATestCase.getRoot(getClass()); + assertEquals(classUrl, new URL(root, "org/apache/tuscany/test/SCATestCaseTestCase.class")); + } +} |