From 07b7dfd1a70ba222b899d9813f8c449dbf3b785f Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:07:28 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835124 13f79535-47bb-0310-9956-ffa450edef68 --- .../branches/sca-java-1.1/itest/properties/pom.xml | 84 +++++++ .../java/mysca/test/myservice/impl/MyService.java | 26 ++ .../mysca/test/myservice/impl/MyServiceImpl.java | 73 ++++++ .../test/myservice/impl/MyTotalServiceImpl.java | 39 +++ .../apache/tuscany/sca/itest/ABCDComponent.java | 27 +++ .../tuscany/sca/itest/ABCDComponentImpl.java | 55 +++++ .../org/apache/tuscany/sca/itest/ABComponent.java | 35 +++ .../apache/tuscany/sca/itest/ABComponentImpl.java | 98 ++++++++ .../org/apache/tuscany/sca/itest/CDComponent.java | 33 +++ .../apache/tuscany/sca/itest/CDComponentImpl.java | 97 ++++++++ .../tuscany/sca/itest/ComplexPropertyBean.java | 113 +++++++++ .../apache/tuscany/sca/itest/OverrideService.java | 25 ++ .../tuscany/sca/itest/OverrideServiceImpl.java | 24 ++ .../tuscany/sca/itest/PropertyComponent.java | 62 +++++ .../tuscany/sca/itest/PropertyComponentImpl.java | 152 ++++++++++++ .../apache/tuscany/sca/itest/PropertyService.java | 24 ++ .../java/org/apache/tuscany/sca/itest/cdi/Bar.java | 23 ++ .../org/apache/tuscany/sca/itest/cdi/Foo1.java | 39 +++ .../org/apache/tuscany/sca/itest/cdi/Foo2.java | 39 +++ .../org/apache/tuscany/sca/itest/cdi/Foo3.java | 44 ++++ .../ConstructorPropertyInjection.composite | 41 ++++ .../properties/src/main/resources/Outer.composite | 43 ++++ .../src/main/resources/OuterPropertyTest.composite | 42 ++++ .../src/main/resources/PropertyTest.composite | 237 ++++++++++++++++++ .../properties/src/main/resources/customer.xsd | 30 +++ .../properties/src/main/resources/fileProperty.txt | 21 ++ .../src/main/resources/manyValuesFileProperty.txt | 23 ++ .../src/main/resources/mySimpleService.composite | 40 ++++ .../tuscany/sca/itest/MyTotalServiceTestCase.java | 69 ++++++ .../tuscany/sca/itest/OuterPropertyTestCase.java | 92 +++++++ .../apache/tuscany/sca/itest/PropertyTestCase.java | 266 +++++++++++++++++++++ .../cdi/ConstructorPropertyInjectionTestCase.java | 44 ++++ 32 files changed, 2060 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/ConstructorPropertyInjection.composite create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/Outer.composite create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/OuterPropertyTest.composite create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/PropertyTest.composite create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/customer.xsd create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/fileProperty.txt create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/manyValuesFileProperty.txt create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/mySimpleService.composite create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java (limited to 'sca-java-1.x/branches/sca-java-1.1/itest/properties') diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/properties/pom.xml new file mode 100644 index 0000000000..dc1e752b0a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/pom.xml @@ -0,0 +1,84 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.1-incubating-SNAPSHOT + ../pom.xml + + itest-properties + Apache Tuscany SCA Properties Integration Tests + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.1-incubating-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.1-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-core-databinding + 1.1-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-databinding-sdo + 1.1-incubating-SNAPSHOT + compile + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.0-incubating + + + generate-customer-sdo + generate-sources + + ${basedir}/src/main/resources/customer.xsd + com.example.customer.sdo + true + true + true + + + generate + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java b/sca-java-1.x/branches/sca-java-1.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.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.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-1.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.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.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java b/sca-java-1.x/branches/sca-java-1.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.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.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/sca-java-1.x/branches/sca-java-1.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.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.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/sca-java-1.x/branches/sca-java-1.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.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.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/sca-java-1.x/branches/sca-java-1.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.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 getManyStringValues(); + Collection getManyIntegers(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/sca-java-1.x/branches/sca-java-1.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.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 manyStringValues; + private Collection 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 value) { + this.manyStringValues = value; + } + + @Property(name="fooInts") + public void setManyIntegers(final Collection 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 getManyStringValues() { + return manyStringValues; + } + + public Collection getManyIntegers() { + return manyIntegerValues; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/sca-java-1.x/branches/sca-java-1.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.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 getManyValuesFileProperty(); + int getOverrideValue(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/sca-java-1.x/branches/sca-java-1.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.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 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 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 getManyValuesFileProperty() { + return this.manyValuesFileProperty; + } +} + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java new file mode 100644 index 0000000000..6335db8a75 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java @@ -0,0 +1,113 @@ +/* + * 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; + protected float floatNumber = 50; + protected double doubleNumber = 75; + protected int[] intArray = null; + protected double[] doubleArray = null; + protected String[] stringArray = null; + + ComplexPropertyBean numberSet; + protected 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; + } + + public int[] getIntArray() { + return intArray; + } + + public void setIntArray(int[] intArray) { + this.intArray = intArray; + } + + public double[] getDoubleArray() { + return doubleArray; + } + + public void setDoubleArray(double[] doubleArray) { + this.doubleArray = doubleArray; + } + + public ComplexPropertyBean[] getNumberSetArray() { + return numberSetArray; + } + + public void setNumberSetArray(ComplexPropertyBean[] numberSetArray) { + this.numberSetArray = numberSetArray; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/sca-java-1.x/branches/sca-java-1.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.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.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/sca-java-1.x/branches/sca-java-1.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.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.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/sca-java-1.x/branches/sca-java-1.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.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 getComplexPropertyFour(); + public DataObject getSdoProperty(); + public DataObject getCustomerSdo(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/sca-java-1.x/branches/sca-java-1.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.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 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 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.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/sca-java-1.x/branches/sca-java-1.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.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.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java new file mode 100644 index 0000000000..c147a2affe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java @@ -0,0 +1,23 @@ +/* + * 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.cdi; + +public interface Bar { + public String getBar(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java new file mode 100644 index 0000000000..0a84e93828 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.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 org.apache.tuscany.sca.itest.cdi; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(Bar.class) +public class Foo1 implements Bar { + + @Property + protected String bar; + + @Constructor( {"bar"}) + public Foo1(String b) { + this.bar = b; + } + + public String getBar() { + return this.bar; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java new file mode 100644 index 0000000000..6344a8aa83 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.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 org.apache.tuscany.sca.itest.cdi; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(Bar.class) +public class Foo2 implements Bar { + + protected String bar; + + @Constructor + public Foo2(@Property(name = "bar") String b) { + this.bar = b; + } + + public String getBar() { + return this.bar; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java new file mode 100644 index 0000000000..11a0a758cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java @@ -0,0 +1,44 @@ +/* + * 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.cdi; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(Bar.class) +public class Foo3 implements Bar { + + protected String bar; + + @Constructor + public Foo3() { + this.bar = "bar"; + } + + public String getBar() { + return this.bar; + } + + @Property(name = "bar") + public void setBar(String b) { + this.bar = b; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/ConstructorPropertyInjection.composite b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/ConstructorPropertyInjection.composite new file mode 100644 index 0000000000..70a251fa16 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/ConstructorPropertyInjection.composite @@ -0,0 +1,41 @@ + + + + + + + fubar + + + + + fubar + + + + + fubar + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/Outer.composite b/sca-java-1.x/branches/sca-java-1.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.1/itest/properties/src/main/resources/Outer.composite @@ -0,0 +1,43 @@ + + + + + Raleigh + 2008 + + + + + + + + + + + + + + + Durham + 2009 + + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/OuterPropertyTest.composite b/sca-java-1.x/branches/sca-java-1.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.1/itest/properties/src/main/resources/OuterPropertyTest.composite @@ -0,0 +1,42 @@ + + + + + + + 125 + + + Overriden A + Overriden B + Overriden C + Overriden D + + Overriden Y + Overriden Z + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/PropertyTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/PropertyTest.composite new file mode 100644 index 0000000000..172f014ad0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/PropertyTest.composite @@ -0,0 +1,237 @@ + + + + + + + + + + + + 1 + + + a + b + c + d + + y + z + + + + + + + + 1 + 11 + 111 + + + 2 + 22 + 222 + + TestString_1 + TestString_2 + 10 + 20 + 27 + 79.34 + 184.52 + 50.05 + 25.52 + + 54 + 158.68 + 369.04 + + + + + + + + + + + + + + + f + + + "Apache" "Tuscany" "Java SCA" + 123 456 789 + + + + + + + + aValue + + + + 25 + + + + + + + + TestString_1 + TestString_2 + 10 + 27 + 79.34 + 25.52 + 184.52 + 50.05 + 20 + + 1 + 11 + 111 + + + 2 + 22 + 222 + + + 54 + 158.68 + 369.04 + + + + + + TestElementString_1 + TestElementString_2 + 10 + 27 + 79.34 + 25.52 + 184.52 + 50.05 + 20 + + 1 + 11 + 111 + + + 2 + 22 + 222 + + + 54 + 158.68 + 369.04 + + + + + + 1 + 11.11 + 111.111 + + 11 + 1111.1111 + 11111.11111 + + + + 2 + 22.22 + 222.222 + + 22 + 2222.2222 + 22222.22222 + + + + 3 + 33.33 + 333.333 + + 33 + 3333.3333 + 33333.33333 + + + + + + Firstly Name + Middler Name + Lasting Name + + + + + Sdo Firstly Name + Sdo Middler Name + Sdo Lasting Name + + + RTP + 2006 + "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday" + 1 2 3 4 5 6 7 8 9 10 + 10 9 8 7 6 5 4 3 2 1 0 + + + Firstly Name 1 + Middler Name 1 + Lasting Name 1 + + + Firstly Name 2 + Middler Name 2 + Lasting Name 2 + + + Firstly Name 3 + Middler Name 3 + Lasting Name 3 + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/customer.xsd b/sca-java-1.x/branches/sca-java-1.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.1/itest/properties/src/main/resources/customer.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/fileProperty.txt b/sca-java-1.x/branches/sca-java-1.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.1/itest/properties/src/main/resources/fileProperty.txt @@ -0,0 +1,21 @@ + + + +fileValue diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/manyValuesFileProperty.txt b/sca-java-1.x/branches/sca-java-1.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.1/itest/properties/src/main/resources/manyValuesFileProperty.txt @@ -0,0 +1,23 @@ + + + + + "fileValueOne" "fileValueTwo" "fileValueThree" "fileValueFour" + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/mySimpleService.composite b/sca-java-1.x/branches/sca-java-1.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.1/itest/properties/src/main/resources/mySimpleService.composite @@ -0,0 +1,40 @@ + + + + + + + + + + Raleigh + 2008 + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java new file mode 100644 index 0000000000..5eb5e57f90 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java @@ -0,0 +1,69 @@ +/* + * 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.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java b/sca-java-1.x/branches/sca-java-1.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.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 iterator = outerABService.getManyStringValues().iterator(); + assertEquals("Apache", iterator.next()); + assertEquals("Tuscany", iterator.next()); + assertEquals("Java SCA", iterator.next()); + } + + @Test + public void testManySimpleIntegerValues() { + Iterator 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.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/sca-java-1.x/branches/sca-java-1.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.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 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 iterator = abService.getManyStringValues().iterator(); + assertEquals("Apache", iterator.next()); + assertEquals("Tuscany", iterator.next()); + assertEquals("Java SCA", iterator.next()); + } + + @Test + public void testManySimpleIntegerValues() { + Iterator 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(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java new file mode 100644 index 0000000000..8ee5dce91f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java @@ -0,0 +1,44 @@ +/* + * 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.cdi; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class ConstructorPropertyInjectionTestCase extends TestCase { + + public void testFoo1() throws Exception { + SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite"); + Bar foo = sca.getService(Bar.class, "Foo1Component"); + assertEquals("fubar", foo.getBar()); + } + + public void testFoo2() throws Exception { + SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite"); + Bar foo = sca.getService(Bar.class, "Foo2Component"); + assertEquals("fubar", foo.getBar()); + } + + public void testFoo3() throws Exception { + SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite"); + Bar foo = sca.getService(Bar.class, "Foo3Component"); + assertEquals("fubar", foo.getBar()); + } +} -- cgit v1.2.3