From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../testing/sca/itest/property/pom.xml | 34 ++++ .../apache/tuscany/sca/itest/ABCDComponent.java | 27 +++ .../tuscany/sca/itest/ABCDComponentImpl.java | 55 ++++++ .../org/apache/tuscany/sca/itest/ABComponent.java | 33 ++++ .../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 | 69 ++++++++ .../apache/tuscany/sca/itest/OverrideService.java | 25 +++ .../tuscany/sca/itest/OverrideServiceImpl.java | 24 +++ .../tuscany/sca/itest/PropertyComponent.java | 32 ++++ .../tuscany/sca/itest/PropertyComponentImpl.java | 72 ++++++++ .../apache/tuscany/sca/itest/PropertyService.java | 24 +++ .../src/main/resources/PropertyTest.composite | 197 +++++++++++++++++++++ .../property/src/main/resources/fileProperty.txt | 1 + .../src/main/resources/manyValuesFileProperty.txt | 6 + .../apache/tuscany/sca/itest/PropertyTestCase.java | 186 +++++++++++++++++++ 17 files changed, 1013 insertions(+) create mode 100644 branches/sca-java-integration/testing/sca/itest/property/pom.xml create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt create mode 100644 branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java (limited to 'branches/sca-java-integration/testing/sca/itest/property') diff --git a/branches/sca-java-integration/testing/sca/itest/property/pom.xml b/branches/sca-java-integration/testing/sca/itest/property/pom.xml new file mode 100644 index 0000000000..40391d6c07 --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/pom.xml @@ -0,0 +1,34 @@ + + + + + org.apache.tuscany.testing + sca-itest + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + iTest-propertyTest + ${testing.version} + jar + Test Suite for SCA properties + + diff --git a/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java new file mode 100644 index 0000000000..667b854c10 --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/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/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java new file mode 100644 index 0000000000..51d4d9b3cb --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/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/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java new file mode 100644 index 0000000000..4058ce92bd --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.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 ABComponent { + + String getA(); + String getB(); + String getZ(); + int getIntValue(); + String getF(); + Collection getManyStringValues(); + Collection getManyIntegers(); +} diff --git a/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java new file mode 100644 index 0000000000..b78d6380ef --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/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/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java new file mode 100644 index 0000000000..cd3046c62c --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/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/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java new file mode 100644 index 0000000000..aec71d30f9 --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/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/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java new file mode 100644 index 0000000000..1f3e4a0a41 --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java @@ -0,0 +1,69 @@ +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; + } + + public String toString() { + return Double.toString(integerNumber) + " - " + + Double.toString(floatNumber) + " - " + + Double.toString(doubleNumber) + " \n" + + ((intArray == null ) ? "no int array" : intArray[0] + " - " + intArray[1] + " \n " ) + + ((doubleArray == null ) ? "no double array" : doubleArray[0] + " - " + doubleArray[1] + " \n " ) + + ((stringArray == null ) ? "no string array" : stringArray[0] + " - " + stringArray[1] + " \n " ) + + ((numberSetArray == null ) ? "no numberset array" : 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/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java new file mode 100644 index 0000000000..116cdef48f --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/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/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java new file mode 100644 index 0000000000..a36bb5e419 --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/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/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java new file mode 100644 index 0000000000..a76f17bcad --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest; + +import java.util.Collection; + + +public interface PropertyComponent { + public String getLocation(); + public String getYear(); + public ComplexPropertyBean getComplexPropertyOne(); + public ComplexPropertyBean getComplexPropertyTwo(); + public ComplexPropertyBean getComplexPropertyThree(); + public Collection getComplexPropertyFour(); +} diff --git a/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java new file mode 100644 index 0000000000..be99611dfa --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java @@ -0,0 +1,72 @@ +/* + * 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 PropertyComponentImpl implements PropertyComponent { + @Property + protected ComplexPropertyBean complexPropertyOne; + + @Property + protected ComplexPropertyBean complexPropertyTwo; + + @Property + protected ComplexPropertyBean complexPropertyThree; + + @Property + protected Collection complexPropertyFour; + + @Property(name = "location") + protected String location = "RTP"; + + @Property(name = "year") + protected String year = "2006"; + + public String getLocation(){ + return 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; + } +} diff --git a/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java new file mode 100644 index 0000000000..f20d295a06 --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/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/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite b/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite new file mode 100644 index 0000000000..e48a8cc606 --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite @@ -0,0 +1,197 @@ + + + + + 1 + + + a + b + c + d + + y + z + + + + + + + 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 + + + + + + + + + + + + + + + f + + + + Apache + Tuscany + Java SCA + + + 123 + 456 + 789 + + + + + + + + + aValue + + + + 2 + + + + + + + + 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 + + + + + + diff --git a/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt b/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt new file mode 100644 index 0000000000..c530ae892d --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt @@ -0,0 +1 @@ +fileValue diff --git a/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt b/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt new file mode 100644 index 0000000000..328b9b3767 --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt @@ -0,0 +1,6 @@ + + fileValueOne + fileValueTwo + fileValueThree + fileValueFour + diff --git a/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java new file mode 100644 index 0000000000..e72cdd24bf --- /dev/null +++ b/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java @@ -0,0 +1,186 @@ +/* + * 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.Iterator; + +import org.apache.tuscany.api.SCARuntime; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.osoa.sca.CurrentCompositeContext; + +public class PropertyTestCase { + 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()); + } + + @BeforeClass + public static void init() throws Exception { + SCARuntime.start("PropertyTest.composite"); + abService = CurrentCompositeContext.getContext().locateService(ABComponent.class, "ABComponent"); + cdService = CurrentCompositeContext.getContext().locateService(CDComponent.class, "CDComponent"); + abcdService = CurrentCompositeContext.getContext().locateService(ABCDComponent.class, "ABCDComponent"); + propertyService = + CurrentCompositeContext.getContext().locateService(PropertyComponent.class, "PropertyComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + SCARuntime.stop(); + } +} -- cgit v1.2.3