You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/03/07 18:00:48 UTC

svn commit: r515647 - in /incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src: main/java/org/apache/tuscany/sca/itest/ main/resources/ test/java/org/apache/tuscany/sca/itest/

Author: svkrish
Date: Wed Mar  7 09:00:46 2007
New Revision: 515647

URL: http://svn.apache.org/viewvc?view=rev&rev=515647
Log:
added tests for 'many simply values' for property values defined in scdl and property values defined in a file

Added:
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt
Modified:
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite
    incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java

Modified: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java?view=diff&rev=515647&r1=515646&r2=515647
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java (original)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java Wed Mar  7 09:00:46 2007
@@ -19,6 +19,8 @@
 
 package org.apache.tuscany.sca.itest;
 
+import java.util.Collection;
+
 public interface ABComponent {  
 
     String getA();
@@ -26,4 +28,6 @@
     String getZ();
     int getIntValue();
     String getF();
+    Collection<String> getManyStringValues();
+    Collection<Integer> getManyIntegers();
 }

Modified: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java?view=diff&rev=515647&r1=515646&r2=515647
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java Wed Mar  7 09:00:46 2007
@@ -19,6 +19,8 @@
 
 package org.apache.tuscany.sca.itest;
 
+import java.util.Collection;
+
 import org.osoa.sca.annotations.Property;
 
 public class ABComponentImpl implements ABComponent {
@@ -26,7 +28,8 @@
     private String aProperty;
     private String bProperty;
     private int intValue;
- //   private Collection manyProp;
+    private Collection<String> manyStringValues;
+    private Collection<Integer> manyIntegerValues;
     private String zProperty;
     private String fProperty;
 
@@ -35,10 +38,15 @@
         this.zProperty = value;
     }
     
-//    @Property(name="foobar")
-//    public void setCollectionProperty(final Collection value) {
-//        this.manyProp = value;
-//    }
+    @Property(name="foobar")
+    public void setManyStringValues(final Collection<String> value) {
+        this.manyStringValues = value;
+    }
+    
+    @Property(name="fooInts")
+    public void setManyIntegers(final Collection<Integer> value) {
+        this.manyIntegerValues = value;
+    }
     
     @Property
     public void setA(final String A) {
@@ -79,4 +87,12 @@
     public String getF() {
         return this.fProperty;
     }
+
+	public Collection<String> getManyStringValues() {
+		return manyStringValues;
+	}
+	
+	public Collection<Integer> getManyIntegers() {
+		return manyIntegerValues;
+	}
 }

Modified: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java?view=diff&rev=515647&r1=515646&r2=515647
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java (original)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java Wed Mar  7 09:00:46 2007
@@ -19,6 +19,8 @@
 
 package org.apache.tuscany.sca.itest;
 
+import java.util.Collection;
+
 public interface CDComponent {  
 
     String getC();
@@ -26,5 +28,6 @@
     String getD();
     String getNoSource();
     String getFileProperty();
+    Collection<String> getManyValuesFileProperty();
     int getOverrideValue();
 }

Modified: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java?view=diff&rev=515647&r1=515646&r2=515647
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java Wed Mar  7 09:00:46 2007
@@ -19,6 +19,8 @@
 
 package org.apache.tuscany.sca.itest;
 
+import java.util.Collection;
+
 import org.osoa.sca.annotations.Property;
 
 public class CDComponentImpl implements CDComponent {
@@ -27,6 +29,7 @@
     private String dProperty;
     private String nosource;
     private String fileProperty;
+    private Collection<String> manyValuesFileProperty;
     private int overrideNumber;
     private String cProperty2;
 
@@ -43,6 +46,12 @@
     public void setFileProp(final String value) {
         this.fileProperty = value;
     }
+    
+    @Property(name="manyValuesFileProperty")
+    public void setFileManyValueProp(final Collection<String> values) {
+        this.manyValuesFileProperty = values;
+    }
+    
     @Property
     public void setC(final String C) {
         this.cProperty = C;
@@ -81,5 +90,8 @@
     public int getOverrideValue() {
         return this.overrideNumber;
     }
+	public Collection<String> getManyValuesFileProperty() {
+		return this.manyValuesFileProperty;
+	}
 }
 

Modified: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite?view=diff&rev=515647&r1=515646&r2=515647
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite (original)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite Wed Mar  7 09:00:46 2007
@@ -76,7 +76,18 @@
         <property name="f" source="$complex/foo:MyComplexValue/foo:a">f</property>
         <property name="xpath" source="$complex/foo:MyComplexValue/foo:x/*[local-name()='z']"/>
         <property name="one" source="$number"/>
+        <property name="foobar">
+        	<value>Apache</value>
+        	<value>Tuscany</value>
+        	<value>Java SCA</value>
+        </property>
+        <property name="fooInts">
+        	<value>123</value>
+        	<value>456</value>
+        	<value>789</value>
+        </property>
     </component>
+    
 
     <component name="CDComponent">
         <implementation.java class="org.apache.tuscany.sca.itest.CDComponentImpl"/>
@@ -84,6 +95,7 @@
         <property name="d" source="$complex/foo:MyComplexValue/foo:d"/>
         <property name="nosource">aValue</property>
         <property name="fileProperty" file="fileProperty.txt"/>
+        <property name="manyValuesFileProperty" file="manyValuesFileProperty.txt"/>
         <property name="nonFileProperty" file="fileProperty.txt" source="$complex/foo:MyComplexValue/foo:c"/>
         <property name="two" source="$number">2</property>
     </component>

Added: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt?view=auto&rev=515647
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt (added)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt Wed Mar  7 09:00:46 2007
@@ -0,0 +1,6 @@
+<manyFilePropertyValues>
+	<value>fileValueOne</value>
+	<value>fileValueTwo</value>
+	<value>fileValueThree</value>
+	<value>fileValueFour</value>
+</manyFilePropertyValues>

Modified: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java?view=diff&rev=515647&r1=515646&r2=515647
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java Wed Mar  7 09:00:46 2007
@@ -19,6 +19,8 @@
 
 package org.apache.tuscany.sca.itest;
 
+import java.util.Iterator;
+
 import junit.framework.TestCase;
 
 import org.apache.tuscany.api.SCAContainer;
@@ -96,6 +98,16 @@
         assertEquals("fileValue", cdService.getFileProperty());
     }
     
+    
+    public void testManyValuesFileProperty() {
+    	Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator();
+    	iterator.next();
+    	String secondValue = iterator.next();
+        assertEquals(4, cdService.getManyValuesFileProperty().size());
+        assertEquals("fileValueTwo", secondValue);
+    }
+    
+    
     public void testABCD() {
         assertEquals("a", abcdService.getA());
         assertEquals("b", abcdService.getB());
@@ -109,6 +121,20 @@
         assertEquals("2006",propertyService.getYear());
         
     } 
+    
+    public void testManySimpleStringValues() {
+    	Iterator<String> iterator = abService.getManyStringValues().iterator();
+    	assertEquals("Apache", iterator.next());
+    	assertEquals("Tuscany", iterator.next());
+    	assertEquals("Java SCA", iterator.next());
+    }
+    
+    public void testManySimpleIntegerValues() {
+    	Iterator<Integer> iterator = abService.getManyIntegers().iterator();
+    	assertEquals(123, iterator.next().intValue());
+    	assertEquals(456, iterator.next().intValue());
+    	assertEquals(789, iterator.next().intValue());
+    }
     
     public void testComplexPropertyOne() {
         ComplexPropertyBean propBean = propertyService.getComplexPropertyOne();



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org