diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.0.1/itest/properties')
29 files changed, 2026 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/DISCLAIMER b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/DISCLAIMER new file mode 100644 index 0000000000..d68a410903 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/DISCLAIMER @@ -0,0 +1,8 @@ +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.
+
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/LICENSE b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/LICENSE new file mode 100644 index 0000000000..8aa906c321 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/LICENSE @@ -0,0 +1,205 @@ + + 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, service 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/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/NOTICE b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/NOTICE new file mode 100644 index 0000000000..94481d6cfa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2007 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/pom.xml b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/pom.xml new file mode 100644 index 0000000000..ad448f7836 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/pom.xml @@ -0,0 +1,84 @@ +<?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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-properties</artifactId>
+ <name>Apache Tuscany SCA Properties Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.0.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-customer-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/customer.xsd</schemaFile>
+ <javaPackage>com.example.customer.sdo</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java new file mode 100644 index 0000000000..1f2fd0e5bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java @@ -0,0 +1,26 @@ +/* + * 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 mysca.test.myservice.impl; + + +public interface MyService { + String getLocation(); + + String getYear(); +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java new file mode 100644 index 0000000000..158f4a0c12 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java @@ -0,0 +1,73 @@ +/* + * 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 mysca.test.myservice.impl; + +import java.util.logging.Logger; + +import org.osoa.sca.annotations.ComponentName; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(MyService.class) +public class MyServiceImpl implements MyService { + + @Property(name = "location") + protected String location = "RTP"; + + @Property(name = "year") + protected String year = "2006"; + + @ComponentName + protected String componentName; + + + private Logger logger; + + public MyServiceImpl() { + logger = Logger.getAnonymousLogger(); + logger.info("creating service instance..."); + } + + @Init + public void start() { + logger.info("Start service.."); + } + + @Destroy + public void stop() { + logger.info("Stop service.."); + + } + + public String getComponentName() { + return componentName; + } + + public String getLocation() { + return location; + } + + public String getYear() { + return year; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java new file mode 100644 index 0000000000..9328c9149d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java @@ -0,0 +1,39 @@ +/* + * 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 mysca.test.myservice.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(MyService.class) +public class MyTotalServiceImpl implements MyService { + + // default required==true so it is 1:1 + @Reference + public MyService myService; + + public String getLocation() { + return myService.getLocation(); + } + + public String getYear() { + return myService.getYear(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java new file mode 100644 index 0000000000..667b854c10 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java @@ -0,0 +1,27 @@ +/* + * 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.sca.itest; + +public interface ABCDComponent { + String getA(); + String getB(); + String getC(); + String getD(); +} + diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java new file mode 100644 index 0000000000..51d4d9b3cb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java @@ -0,0 +1,55 @@ +/* + * 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.sca.itest; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class ABCDComponentImpl implements ABCDComponent { + private ABComponent abComponent; + private CDComponent cdComponent; + + @Reference + public void setAb(ABComponent component) { + this.abComponent = component; + } + + @Reference + public void setCd(CDComponent component) { + this.cdComponent = component; + } + + public String getA() { + return this.abComponent.getA(); + } + + public String getB() { + return this.abComponent.getB(); + } + + public String getC() { + return this.cdComponent.getC(); + } + + public String getD() { + return this.cdComponent.getD(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java new file mode 100644 index 0000000000..c33c140aec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.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.sca.itest; + +import java.util.Collection; + +import org.osoa.sca.annotations.Remotable; +@Remotable +public interface ABComponent { + + String getA(); + String getB(); + String getZ(); + int getIntValue(); + String getF(); + Collection<String> getManyStringValues(); + Collection<Integer> getManyIntegers(); +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java new file mode 100644 index 0000000000..b78d6380ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java @@ -0,0 +1,98 @@ +/* + * 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.sca.itest; + +import java.util.Collection; + +import org.osoa.sca.annotations.Property; + +public class ABComponentImpl implements ABComponent { + + private String aProperty; + private String bProperty; + private int intValue; + private Collection<String> manyStringValues; + private Collection<Integer> manyIntegerValues; + private String zProperty; + private String fProperty; + + @Property(name="xpath") + public void setZProperty(final String value) { + this.zProperty = value; + } + + @Property(name="foobar") + public void setManyStringValues(final Collection<String> value) { + this.manyStringValues = value; + } + + @Property(name="fooInts") + public void setManyIntegers(final Collection<Integer> value) { + this.manyIntegerValues = value; + } + + @Property + public void setA(final String A) { + this.aProperty = A; + } + + @Property + public void setB(final String B) { + this.bProperty = B; + } + + @Property + public void setF(final String F) { + this.fProperty = F; + } + + @Property + public void setOne(final int value) { + this.intValue = value; + } + + public String getA() { + return this.aProperty; + } + + public String getB() { + return this.bProperty; + } + + public int getIntValue() { + return this.intValue; + } + + public String getZ() { + return this.zProperty; + } + + public String getF() { + return this.fProperty; + } + + public Collection<String> getManyStringValues() { + return manyStringValues; + } + + public Collection<Integer> getManyIntegers() { + return manyIntegerValues; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java new file mode 100644 index 0000000000..cd3046c62c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest; + +import java.util.Collection; + +public interface CDComponent { + + String getC(); + String getC2(); + String getD(); + String getNoSource(); + String getFileProperty(); + Collection<String> getManyValuesFileProperty(); + int getOverrideValue(); +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java new file mode 100644 index 0000000000..aec71d30f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java @@ -0,0 +1,97 @@ +/* + * 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.sca.itest; + +import java.util.Collection; + +import org.osoa.sca.annotations.Property; + +public class CDComponentImpl implements CDComponent { + + private String cProperty; + private String dProperty; + private String nosource; + private String fileProperty; + private Collection<String> manyValuesFileProperty; + private int overrideNumber; + private String cProperty2; + + @Property(name="nonFileProperty") + public void setC2(final String value) { + this.cProperty2 = value; + } + @Property(name="two") + public void setOverrideNumber(final int value) { + this.overrideNumber = value; + } + + @Property(name="fileProperty") + public void setFileProp(final String value) { + this.fileProperty = value; + } + + @Property(name="manyValuesFileProperty") + public void setFileManyValueProp(final Collection<String> values) { + this.manyValuesFileProperty = values; + } + + @Property + public void setC(final String C) { + this.cProperty = C; + } + + @Property + public void setD(final String D) { + this.dProperty = D; + } + + @Property + public void setNosource(final String value) { + this.nosource = value; + } + + public String getFileProperty() { + return this.fileProperty; + } + + public String getC() { + return this.cProperty; + } + + public String getC2() { + return this.cProperty2; + } + + public String getD() { + return this.dProperty; + } + + public String getNoSource() { + return this.nosource; + } + + public int getOverrideValue() { + return this.overrideNumber; + } + public Collection<String> getManyValuesFileProperty() { + return this.manyValuesFileProperty; + } +} + diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java new file mode 100644 index 0000000000..559b9ea327 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java @@ -0,0 +1,89 @@ +/*
+ * 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.sca.itest;
+
+public class ComplexPropertyBean {
+
+ protected int integerNumber = 25;
+ public float floatNumber = 50;
+ public double doubleNumber = 75;
+ public int[] intArray = null;
+ public double[] doubleArray = null;
+ protected String[] stringArray = null;
+
+ ComplexPropertyBean numberSet;
+ public ComplexPropertyBean[] numberSetArray = null;
+
+ public ComplexPropertyBean() {
+
+ }
+
+ public double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ public ComplexPropertyBean getNumberSet() {
+ return numberSet;
+ }
+
+ public void setNumberSet(ComplexPropertyBean numberSet) {
+ this.numberSet = numberSet;
+ }
+
+ @Override
+ public String toString() {
+ return Double.toString(integerNumber) + " - " +
+ Double.toString(floatNumber) + " - " +
+ Double.toString(doubleNumber) + " \n" +
+ ((intArray == null ) ? "" : intArray[0] + " - " + intArray[1] + " \n " ) +
+ ((doubleArray == null ) ? "" : doubleArray[0] + " - " + doubleArray[1] + " \n " ) +
+ ((stringArray == null ) ? "" : stringArray[0] + " - " + stringArray[1] + " \n " ) +
+ ((numberSetArray == null ) ? "" : numberSetArray[0] + " - " + numberSetArray[1] + " \n " ) +
+ ((numberSet == null ) ? "" : numberSet.toString());
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java new file mode 100644 index 0000000000..116cdef48f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java @@ -0,0 +1,25 @@ + +/* + * 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.sca.itest; + +public interface OverrideService { + +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java new file mode 100644 index 0000000000..a36bb5e419 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java @@ -0,0 +1,24 @@ +/* + * 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.sca.itest; + +public class OverrideServiceImpl implements OverrideService { + +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java new file mode 100644 index 0000000000..5b2948715d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java @@ -0,0 +1,62 @@ +/*
+ * 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.sca.itest;
+
+import java.util.Collection;
+
+import commonj.sdo.DataObject;
+
+
+public interface PropertyComponent {
+ public String getLocation();
+ public String getLocationFromComponentContext();
+ public String getYear();
+
+ /**
+ * This method is used to test injecting a primitive String Array
+ * @return The injected array
+ */
+ public String[] getDaysOfTheWeek();
+
+ /**
+ * This method is used to test injecting an Object Integer Array
+ * @return The injected array
+ */
+ public Integer[] getIntegerNumbers();
+
+ /**
+ * This method is used to test injecting an int Array
+ * @return The injected array
+ */
+ public int[] getIntNumbers();
+
+ /**
+ * This method is used to test injecting an Object Array
+ * @return The injected array
+ */
+ public DataObject[] getSdoArrayProperty();
+
+ public ComplexPropertyBean getComplexPropertyOne();
+ public ComplexPropertyBean getComplexPropertyTwo();
+ public ComplexPropertyBean getComplexPropertyThree();
+ public Collection<ComplexPropertyBean> getComplexPropertyFour();
+ public DataObject getSdoProperty();
+ public DataObject getCustomerSdo();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java new file mode 100644 index 0000000000..43c9935d7e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java @@ -0,0 +1,152 @@ +/*
+ * 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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Property;
+
+import com.example.customer.sdo.impl.CustomerImpl;
+import commonj.sdo.DataObject;
+
+public class PropertyComponentImpl implements PropertyComponent {
+
+ @Context
+ protected ComponentContext context;
+
+ @Property
+ protected CustomerImpl customerSdo;
+
+ @Property
+ protected DataObject sdoProperty;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyOne;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyTwo;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyThree;
+
+ @Property
+ protected Collection<ComplexPropertyBean> complexPropertyFour;
+
+ @Property(name = "location")
+ protected String location;
+
+ @Property(name = "year")
+ protected String year;
+
+ @Property(name = "daysOfTheWeek")
+ protected String[] daysOfTheWeek;
+
+ @Property(name = "integerNumbers")
+ protected Integer[] integerNumbers;
+
+ @Property(name = "intNumbers")
+ protected int[] intNumbers;
+
+ @Property(name = "sdoArray")
+ protected DataObject[] sdoArray;
+
+ public String getLocation(){
+ return location;
+ }
+
+ public String getLocationFromComponentContext() {
+ return context.getProperty(String.class, "location");
+ }
+
+ public String getYear(){
+ return year;
+ }
+
+ public ComplexPropertyBean getComplexPropertyOne() {
+ //System.out.println(complexPropertyOne);
+ return complexPropertyOne;
+ }
+
+ public ComplexPropertyBean getComplexPropertyTwo() {
+ //System.out.println(complexPropertyTwo);
+ return complexPropertyTwo;
+ }
+
+ public ComplexPropertyBean getComplexPropertyThree() {
+ //System.out.println(complexPropertyThree);
+ return complexPropertyThree;
+ }
+
+ public Collection<ComplexPropertyBean> getComplexPropertyFour() {
+ //System.out.println(complexPropertyThree);
+ return complexPropertyFour;
+ }
+
+ public DataObject getSdoProperty() {
+ return sdoProperty;
+ }
+
+ public void setSdoProperty(DataObject sdoProperty) {
+ System.out.println("Reached here da machi");
+ this.sdoProperty = sdoProperty;
+ }
+
+ public CustomerImpl getCustomerSdo() {
+ return customerSdo;
+ }
+
+ public void setCustomerSdo(CustomerImpl customerSdo) {
+ this.customerSdo = customerSdo;
+ }
+
+ /**
+ * This method is used to test injecting an Array
+ * @return The injected array
+ */
+ public String[] getDaysOfTheWeek() {
+ return daysOfTheWeek;
+ }
+
+ /**
+ * This method is used to test injecting an Object Integer Array
+ * @return The injected array
+ */
+ public Integer[] getIntegerNumbers() {
+ return integerNumbers;
+ }
+
+ /**
+ * This method is used to test injecting an int Array
+ * @return The injected array
+ */
+ public int[] getIntNumbers() {
+ return intNumbers;
+ }
+
+ /**
+ * This method is used to test injecting an Object Array
+ * @return The injected array
+ */
+ public DataObject[] getSdoArrayProperty() {
+ return sdoArray;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java new file mode 100644 index 0000000000..f20d295a06 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java @@ -0,0 +1,24 @@ +/* + * 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.sca.itest; + +public interface PropertyService { + +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/Outer.composite b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/Outer.composite new file mode 100644 index 0000000000..b3e529e8b5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/Outer.composite @@ -0,0 +1,43 @@ +<?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
+ * 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.
+-->
+<composite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" name="Iteration3Composite"
+ targetNamespace="http://foo" local="true" autowire="false">
+
+ <property name="newLocation" type="xsd:anyURI">Raleigh</property>
+ <property name="newYear" type="xsd:anyURI">2008</property>
+ <component name="MyServiceComponent">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ </component>
+ <component name="MyServiceComponentNew">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ <property name="location" source="$newLocation" />
+ <property name="year" source="$newYear" />
+ </component>
+ <component name="MyTotalServiceNewComponent">
+ <implementation.java class="mysca.test.myservice.impl.MyTotalServiceImpl" />
+ <reference name="myService" target="MyServiceComponentNew/MyService" />
+ </component>
+ <component name="MySimpleServiceInRecursiveAnother">
+ <implementation.composite name="foo:MySimpleService" />
+ <property name="newLocation">Durham</property>
+ <property name="newYear">2009</property>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/OuterPropertyTest.composite b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/OuterPropertyTest.composite new file mode 100644 index 0000000000..5237e964a3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/OuterPropertyTest.composite @@ -0,0 +1,42 @@ +<?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
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="OuterPropertyTest" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="OuterComponent">
+ <implementation.composite name="foo:PropertyTest"/>
+ <property name="number">125</property>
+ <property name="complex" type="foo:MyComplexType">
+ <foo:MyComplexValue xsi:type="foo:MyComplexType" >
+ <foo:a>Overriden A</foo:a>
+ <foo:b>Overriden B</foo:b>
+ <foo:c>Overriden C</foo:c>
+ <foo:d>Overriden D</foo:d>
+ <foo:x>
+ <foo:y>Overriden Y</foo:y>
+ <foo:z>Overriden Z</foo:z>
+ </foo:x>
+ </foo:MyComplexValue>
+ </property>
+ </component>
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/PropertyTest.composite b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/PropertyTest.composite new file mode 100644 index 0000000000..4588d3c16d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/PropertyTest.composite @@ -0,0 +1,237 @@ +<?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 + * 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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:foo="http://foo" + xmlns:cust="http://www.example.com/Customer" + xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://foo" + name="PropertyTest" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <service name="ProperterTestService" promote="ABComponent"> + <interface.java interface="org.apache.tuscany.sca.itest.ABComponent"/> + </service> + + <dbsdo:import.sdo location="customer.xsd" /> + <!-- dbsdo:import.sdo factory="com.example.customer.sdo.SdoFactory" / --> + + <property name="number" type="xsd:int">1</property> + <property name="complex" type="foo:MyComplexType" > + <foo:MyComplexValue xsi:type="foo:MyComplexType" > + <foo:a>a</foo:a> + <foo:b>b</foo:b> + <foo:c>c</foo:c> + <foo:d>d</foo:d> + <foo:x> + <foo:y>y</foo:y> + <foo:z>z</foo:z> + </foo:x> + </foo:MyComplexValue> + </property> + + <property name="moreComplex" type="foo:MyMoreComplexType"> + <foo:MyMoreComplexValue xsi:type="foo:MyMoreComplexType"> + <foo:numberSetArray> + <foo:integerNumber>1</foo:integerNumber> + <foo:floatNumber>11</foo:floatNumber> + <foo:doubleNumber>111</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSetArray> + <foo:integerNumber>2</foo:integerNumber> + <foo:floatNumber>22</foo:floatNumber> + <foo:doubleNumber>222</foo:doubleNumber> + </foo:numberSetArray> + <foo:stringArray>TestString_1</foo:stringArray> + <foo:intArray>10</foo:intArray> + <foo:stringArray>TestString_2</foo:stringArray> + <foo:intArray>20</foo:intArray> + <foo:integerNumber>27</foo:integerNumber> + <foo:floatNumber>79.34</foo:floatNumber> + <foo:doubleNumber>184.52</foo:doubleNumber> + <foo:doubleArray>50.05</foo:doubleArray> + <foo:doubleArray>25.52</foo:doubleArray> + <foo:numberSet> + <foo:integerNumber>54</foo:integerNumber> + <foo:floatNumber>158.68</foo:floatNumber> + <foo:doubleNumber>369.04</foo:doubleNumber> + </foo:numberSet> + </foo:MyMoreComplexValue> + </property> + + <component name="ABCDComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.ABCDComponentImpl"/> + <reference name="ab" target="ABComponent"/> + <reference name="cd" target="CDComponent"/> + </component> + + <component name="ABComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.ABComponentImpl"/> + <property name="a" source="$complex/foo:MyComplexValue/foo:a"/> + <property name="b" source="$complex/foo:MyComplexValue/foo:b"/> + <property name="f" source="$complex/foo:MyComplexValue/foo:a">f</property> + <property name="xpath" source="$complex/foo:MyComplexValue/foo:x/*[local-name()='z']"/> + <property name="one" source="$number"/> + <property name="foobar" many="true">"Apache" "Tuscany" "Java SCA"</property> + <property name="fooInts" many="true">123 456 789</property> + </component> + + + <component name="CDComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.CDComponentImpl"/> + <property name="c" source="$complex/foo:MyComplexValue/foo:c"/> + <property name="d" source="$complex/foo:MyComplexValue/foo:d"/> + <property name="nosource">aValue</property> + <property name="fileProperty" file="fileProperty.txt"/> + <property name="manyValuesFileProperty" many="true" file="manyValuesFileProperty.txt"/> + <property name="nonFileProperty" file="fileProperty.txt" source="$complex/foo:MyComplexValue/foo:c"/> + <property name="two" source="$number">25</property> + </component> + + <component name="PropertyComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.PropertyComponentImpl"/> + <property name="complexPropertyOne" source="$moreComplex"></property> + <property name="complexPropertyTwo"> + <foo:MyAnotherComplexValue> + <foo:stringArray>TestString_1</foo:stringArray> + <foo:stringArray>TestString_2</foo:stringArray> + <foo:intArray>10</foo:intArray> + <foo:integerNumber>27</foo:integerNumber> + <foo:floatNumber>79.34</foo:floatNumber> + <foo:doubleArray>25.52</foo:doubleArray> + <foo:doubleNumber>184.52</foo:doubleNumber> + <foo:doubleArray>50.05</foo:doubleArray> + <foo:intArray>20</foo:intArray> + <foo:numberSetArray> + <foo:integerNumber>1</foo:integerNumber> + <foo:floatNumber>11</foo:floatNumber> + <foo:doubleNumber>111</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSetArray> + <foo:integerNumber>2</foo:integerNumber> + <foo:floatNumber>22</foo:floatNumber> + <foo:doubleNumber>222</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSet> + <foo:integerNumber>54</foo:integerNumber> + <foo:floatNumber>158.68</foo:floatNumber> + <foo:doubleNumber>369.04</foo:doubleNumber> + </foo:numberSet> + </foo:MyAnotherComplexValue> + </property> + <property name="complexPropertyThree" element="foo:PropertyThreeElement"> + <foo:PropertyThreeElement> + <foo:stringArray>TestElementString_1</foo:stringArray> + <foo:stringArray>TestElementString_2</foo:stringArray> + <foo:intArray>10</foo:intArray> + <foo:integerNumber>27</foo:integerNumber> + <foo:floatNumber>79.34</foo:floatNumber> + <foo:doubleArray>25.52</foo:doubleArray> + <foo:doubleNumber>184.52</foo:doubleNumber> + <foo:doubleArray>50.05</foo:doubleArray> + <foo:intArray>20</foo:intArray> + <foo:numberSetArray> + <foo:integerNumber>1</foo:integerNumber> + <foo:floatNumber>11</foo:floatNumber> + <foo:doubleNumber>111</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSetArray> + <foo:integerNumber>2</foo:integerNumber> + <foo:floatNumber>22</foo:floatNumber> + <foo:doubleNumber>222</foo:doubleNumber> + </foo:numberSetArray> + <foo:numberSet> + <foo:integerNumber>54</foo:integerNumber> + <foo:floatNumber>158.68</foo:floatNumber> + <foo:doubleNumber>369.04</foo:doubleNumber> + </foo:numberSet> + </foo:PropertyThreeElement> + </property> + <property name="complexPropertyFour" element="foo:PropertyFourElement" many="true"> + <foo:PropertyFourElement> + <foo:integerNumber>1</foo:integerNumber> + <foo:floatNumber>11.11</foo:floatNumber> + <foo:doubleNumber>111.111</foo:doubleNumber> + <foo:numberSet> + <foo:integerNumber>11</foo:integerNumber> + <foo:floatNumber>1111.1111</foo:floatNumber> + <foo:doubleNumber>11111.11111</foo:doubleNumber> + </foo:numberSet> + </foo:PropertyFourElement> + <foo:PropertyFourElement> + <foo:integerNumber>2</foo:integerNumber> + <foo:floatNumber>22.22</foo:floatNumber> + <foo:doubleNumber>222.222</foo:doubleNumber> + <foo:numberSet> + <foo:integerNumber>22</foo:integerNumber> + <foo:floatNumber>2222.2222</foo:floatNumber> + <foo:doubleNumber>22222.22222</foo:doubleNumber> + </foo:numberSet> + </foo:PropertyFourElement> + <foo:PropertyFourElement> + <foo:integerNumber>3</foo:integerNumber> + <foo:floatNumber>33.33</foo:floatNumber> + <foo:doubleNumber>333.333</foo:doubleNumber> + <foo:numberSet> + <foo:integerNumber>33</foo:integerNumber> + <foo:floatNumber>3333.3333</foo:floatNumber> + <foo:doubleNumber>33333.33333</foo:doubleNumber> + </foo:numberSet> + </foo:PropertyFourElement> + </property> + <property name="sdoProperty" type="cust:Customer"> + <cust:customer> + <cust:firstName>Firstly Name</cust:firstName> + <cust:middleName>Middler Name</cust:middleName> + <cust:lastName>Lasting Name</cust:lastName> + </cust:customer> + </property> + <property name="customerSdo" type="cust:Customer"> + <cust:customer> + <cust:firstName>Sdo Firstly Name</cust:firstName> + <cust:middleName>Sdo Middler Name</cust:middleName> + <cust:lastName>Sdo Lasting Name</cust:lastName> + </cust:customer> + </property> + <property name="location" type="xsd:string">RTP</property> + <property name="year" type="xsd:string">2006</property> + <property name="daysOfTheWeek" many="true" type="xsd:string">"Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"</property> + <property name="integerNumbers" many="true" type="xsd:int">1 2 3 4 5 6 7 8 9 10</property> + <property name="intNumbers" many="true" type="xsd:int">10 9 8 7 6 5 4 3 2 1 0</property> + <property name="sdoArray" many="true" type="cust:Customer"> + <cust:customer> + <cust:firstName>Firstly Name 1</cust:firstName> + <cust:middleName>Middler Name 1</cust:middleName> + <cust:lastName>Lasting Name 1</cust:lastName> + </cust:customer> + <cust:customer> + <cust:firstName>Firstly Name 2</cust:firstName> + <cust:middleName>Middler Name 2</cust:middleName> + <cust:lastName>Lasting Name 2</cust:lastName> + </cust:customer> + <cust:customer> + <cust:firstName>Firstly Name 3</cust:firstName> + <cust:middleName>Middler Name 3</cust:middleName> + <cust:lastName>Lasting Name 3</cust:lastName> + </cust:customer> + </property> + </component> +</composite> + + diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/customer.xsd b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/customer.xsd new file mode 100644 index 0000000000..8861d7e7b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/customer.xsd @@ -0,0 +1,30 @@ +<!--
+ * 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.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://www.example.com/Customer" targetNamespace="http://www.example.com/Customer">
+
+ <xsd:element name="customer" type="Customer"/>
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string"/>
+ <xsd:element name="middleName" type="xsd:string"/>
+ <xsd:element name="lastName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/fileProperty.txt b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/fileProperty.txt new file mode 100644 index 0000000000..0d3d9ead83 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/fileProperty.txt @@ -0,0 +1,21 @@ +<?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. +--> + +<filePropertyTest>fileValue</filePropertyTest> diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/manyValuesFileProperty.txt b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/manyValuesFileProperty.txt new file mode 100644 index 0000000000..450f397b30 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/manyValuesFileProperty.txt @@ -0,0 +1,23 @@ +<?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.
+-->
+
+<manyFilePropertyValues>
+ "fileValueOne" "fileValueTwo" "fileValueThree" "fileValueFour"
+</manyFilePropertyValues>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/mySimpleService.composite b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/mySimpleService.composite new file mode 100644 index 0000000000..75fdd24add --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/main/resources/mySimpleService.composite @@ -0,0 +1,40 @@ +<?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.
+-->
+<composite autowire="false" local="true" name="MySimpleService"
+ targetNamespace="http://foo" xmlns:foo="http://foo" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 ">
+
+
+ <service name="MyServiceNew1" promote="MyServiceComponentNew/MyService">
+ <interface.java interface="mysca.test.myservice.impl.MyService" />
+ </service>
+
+ <property name="newLocation" type="xsd:anyURI">Raleigh</property>
+ <property name="newYear" type="xsd:anyURI">2008</property>
+
+
+ <component name="MyServiceComponentNew">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ <property name="location" source="$newLocation" />
+ <property name="year" source="$newYear" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java new file mode 100644 index 0000000000..fa3b9c5404 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java @@ -0,0 +1,70 @@ +/* + * 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.sca.itest; +import static junit.framework.Assert.assertEquals; +import mysca.test.myservice.impl.MyService; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class MyTotalServiceTestCase { + private static MyService service1; + private static MyService service2; + private static MyService service3; + + private static SCADomain domain; + + @Test + public void testPropertyDefault() { + assertEquals("RTP", service1.getLocation()); + assertEquals("2006", service1.getYear()); + } + + @Test + public void testPropertyOverride() { + assertEquals("Raleigh", service2.getLocation()); + assertEquals("2008", service2.getYear()); + } + + @Test + public void testPropertyNestedOverride() { + assertEquals("Durham", service3.getLocation()); + assertEquals("2009", service3.getYear()); + } + + @BeforeClass + /** + * Sets up for the test case execution such as locating services. + */ + public static void setUp() throws Exception { + + domain = SCADomain.newInstance("Outer.composite"); + service1 = domain.getService(MyService.class, "MyServiceComponent/MyService"); + service2 = domain.getService(MyService.class, "MyServiceComponentNew/MyService"); + service3 = domain.getService(MyService.class, "MySimpleServiceInRecursiveAnother"); + } + + @AfterClass + public static void tearDown() { + domain.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java new file mode 100644 index 0000000000..b2ac537dec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java @@ -0,0 +1,92 @@ +/*
+ * 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.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class OuterPropertyTestCase {
+
+ private static SCADomain domain;
+ private static ABComponent outerABService;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("OuterPropertyTest.composite");
+ outerABService = domain.getService(ABComponent.class, "OuterComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testOverridenA() {
+ assertEquals("Overriden A", outerABService.getA());
+ }
+
+ @Test
+ public void testOverridenB() {
+ assertEquals("Overriden B", outerABService.getB());
+ }
+
+ @Test
+ public void testOverridenF() {
+ assertEquals("Overriden A", outerABService.getF());
+ }
+
+ @Test
+ public void testOverridenZ() {
+ assertEquals("Overriden Z", outerABService.getZ());
+ }
+
+ @Test
+ public void testOverridenIntValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ @Test
+ public void testDefaultValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = outerABService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ @Test
+ public void testManySimpleIntegerValues() {
+ Iterator<Integer> iterator = outerABService.getManyIntegers().iterator();
+ assertEquals(123, iterator.next().intValue());
+ assertEquals(456, iterator.next().intValue());
+ assertEquals(789, iterator.next().intValue());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java new file mode 100644 index 0000000000..39cc0759f8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.0.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java @@ -0,0 +1,266 @@ +/* + * 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.sca.itest; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.util.Arrays; +import java.util.Iterator; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import commonj.sdo.DataObject; + +public class PropertyTestCase { + private static SCADomain domain; + private static ABComponent abService; + private static CDComponent cdService; + private static ABCDComponent abcdService; + private static PropertyComponent propertyService; + + @Test + public void testA() { + assertEquals("a", abService.getA()); + } + + @Test + public void testB() { + assertEquals("b", abService.getB()); + } + + @Test + public void testC() { + assertEquals("c", cdService.getC()); + } + + @Test + public void testC2() { + assertEquals("c", cdService.getC2()); + } + + @Test + public void testD() { + assertEquals("d", cdService.getD()); + } + + @Test + public void testF() { + assertEquals("a", abService.getF()); + } + + @Test + public void testZ() { + assertEquals("z", abService.getZ()); + } + + @Test + public void testIntValue() { + assertEquals(1, abService.getIntValue()); + } + + @Test + public void testDefaultValue() { + assertEquals(1, abService.getIntValue()); + } + + @Test + public void testDefaultValueOverride() { + assertEquals(1, cdService.getOverrideValue()); + } + + @Test + public void testNoSource() { + assertEquals("aValue", cdService.getNoSource()); + } + + @Test + public void testFileProperty() { + assertEquals("fileValue", cdService.getFileProperty()); + } + + @Test + public void testManyValuesFileProperty() { + Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator(); + iterator.next(); + String secondValue = iterator.next(); + assertEquals(4, cdService.getManyValuesFileProperty().size()); + assertEquals("fileValueTwo", secondValue); + } + + @Test + public void testABCD() { + assertEquals("a", abcdService.getA()); + assertEquals("b", abcdService.getB()); + assertEquals("c", abcdService.getC()); + assertEquals("d", abcdService.getD()); + } + + @Test + public void testDefaultProperty() { + assertEquals("RTP", propertyService.getLocation()); + assertEquals("2006", propertyService.getYear()); + + } + + @Test + public void testManySimpleStringValues() { + Iterator<String> iterator = abService.getManyStringValues().iterator(); + assertEquals("Apache", iterator.next()); + assertEquals("Tuscany", iterator.next()); + assertEquals("Java SCA", iterator.next()); + } + + @Test + public void testManySimpleIntegerValues() { + Iterator<Integer> iterator = abService.getManyIntegers().iterator(); + assertEquals(123, iterator.next().intValue()); + assertEquals(456, iterator.next().intValue()); + assertEquals(789, iterator.next().intValue()); + } + + @Test + public void testComplexPropertyOne() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyOne(); + assertNotNull(propBean); + assertEquals("TestString_1", propBean.getStringArray()[0]); + assertEquals(2, propBean.numberSetArray[1].integerNumber); + } + + @Test + public void testComplexPropertyTwo() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo(); + assertNotNull(propBean); + assertEquals(10, propBean.intArray[0]); + assertEquals((float)22, propBean.numberSetArray[1].floatNumber); + } + + @Test + public void testComplexPropertyThree() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyThree(); + assertNotNull(propBean); + assertEquals("TestElementString_1", propBean.stringArray[0]); + assertEquals((float)22, propBean.numberSetArray[1].floatNumber); + } + + @Test + public void testComplexPropertyFour() { + Object[] propBeanCollection = propertyService.getComplexPropertyFour().toArray(); + assertNotNull(propBeanCollection); + assertEquals(1, ((ComplexPropertyBean)propBeanCollection[0]).getIntegerNumber()); + assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber()); + assertEquals(33, ((ComplexPropertyBean)propBeanCollection[2]).getNumberSet().getIntegerNumber()); + } + + @Test + public void testSDOProperty1() { + DataObject dataObject = propertyService.getSdoProperty(); + assertNotNull(dataObject); + assertEquals("Firstly Name", dataObject.get("firstName")); + assertEquals("Middler Name", dataObject.getString("middleName")); + assertEquals("Lasting Name", dataObject.getString("lastName")); + } + + @Test + public void testSDOProperty2() { + DataObject dataObject = propertyService.getCustomerSdo(); + assertNotNull(dataObject); + assertEquals("Sdo Firstly Name", dataObject.get("firstName")); + assertEquals("Sdo Middler Name", dataObject.getString("middleName")); + assertEquals("Sdo Lasting Name", dataObject.getString("lastName")); + } + + @Test + public void testGetLocationFromComponentContext() { + String location = propertyService.getLocation(); + assertNotNull(location); + String locationFromCC = propertyService.getLocationFromComponentContext(); + assertNotNull(locationFromCC); + assertEquals(location, locationFromCC); + } + + @Test + public void testGetInjectedStringArrayProperty() + { + String[] daysOfWeek = propertyService.getDaysOfTheWeek(); + assertNotNull(daysOfWeek); + + String[] expected = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; + Assert.assertTrue(Arrays.equals(expected, daysOfWeek)); + } + + @Test + public void testGetInjectedIntegerArrayProperty() + { + Integer[] numbers = propertyService.getIntegerNumbers(); + assertNotNull(numbers); + + Integer[] expected = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + Assert.assertTrue(Arrays.equals(expected, numbers)); + } + + @Test + public void testGetInjectedIntArrayProperty() + { + int[] numbers = propertyService.getIntNumbers(); + assertNotNull(numbers); + + int[] expected = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; + Assert.assertTrue(Arrays.equals(expected, numbers)); + } + + + @Test + public void testGetInjectedSdoArrayProperty() + { + DataObject[] sdos = propertyService.getSdoArrayProperty(); + assertNotNull(sdos); + + for (int i = 1; i <= 3; i++) { + DataObject dataObject = sdos[i - 1]; + assertEquals("Firstly Name " + i, dataObject.get("firstName")); + assertEquals("Middler Name " + i, dataObject.getString("middleName")); + assertEquals("Lasting Name " + i, dataObject.getString("lastName")); + } + } + + + @BeforeClass + public static void init() throws Exception { + try { + domain = SCADomain.newInstance("PropertyTest.composite"); + } catch ( Exception e ) { e.printStackTrace(); } + abService = domain.getService(ABComponent.class, "ABComponent"); + cdService = domain.getService(CDComponent.class, "CDComponent"); + abcdService = domain.getService(ABCDComponent.class, "ABCDComponent"); + propertyService = + domain.getService(PropertyComponent.class, "PropertyComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } +} |