You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/03/13 22:38:04 UTC
svn commit: r517884 -
/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
Author: rfeng
Date: Tue Mar 13 14:38:03 2007
New Revision: 517884
URL: http://svn.apache.org/viewvc?view=rev&rev=517884
Log:
[sca-integration-branch] Switch property itest to JUnit 4.2 to leverage BeforeClass/AfterClass
Modified:
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/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=517884&r1=517883&r2=517884
==============================================================================
--- 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 Tue Mar 13 14:38:03 2007
@@ -19,161 +19,171 @@
package org.apache.tuscany.sca.itest;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
import java.util.Iterator;
+import junit.framework.Assert;
import junit.framework.TestCase;
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 extends TestCase {
- private ABComponent abService;
- private CDComponent cdService;
- private ABCDComponent abcdService;
- private PropertyComponent propertyService;
- // private PropertyService propertyService;
-
- // FIXME: Workaround to TUSCANY-1145
- /**
- * Merge a few tests to work around JIRA issue:
- * http://issues.apache.org/jira/browse/TUSCANY-1145
- */
- /*
+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());
+ 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());
}
- */
- public void testA2Z() {
- assertEquals("a", abService.getA());
- assertEquals("b", abService.getB());
- assertEquals("c", cdService.getC());
- assertEquals("c", cdService.getC2());
- assertEquals("d", cdService.getD());
- assertEquals("a", abService.getF());
- assertEquals("z", abService.getZ());
- }
-
-
+ @Test
public void testIntValue() {
assertEquals(1, abService.getIntValue());
}
-
+
+ @Test
public void testDefaultValue() {
assertEquals(1, abService.getIntValue());
}
-
+
+ @Test
public void testDefaultValueOverride() {
assertEquals(1, cdService.getOverrideValue());
}
-
+
+ @Test
public void testNoSource() {
assertEquals("aValue", cdService.getNoSource());
}
-
+
+ @Test
public void testFileProperty() {
assertEquals("fileValue", cdService.getFileProperty());
}
-
-
+
+ @Test
public void testManyValuesFileProperty() {
- Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator();
- iterator.next();
- String secondValue = iterator.next();
+ Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator();
+ iterator.next();
+ String secondValue = iterator.next();
assertEquals(4, cdService.getManyValuesFileProperty().size());
assertEquals("fileValueTwo", secondValue);
}
-
-
+
+ @Test
public void testABCD() {
assertEquals("a", abcdService.getA());
assertEquals("b", abcdService.getB());
assertEquals("c", abcdService.getC());
assertEquals("d", abcdService.getD());
}
-
- public void testDefaultProperty()
- {
- assertEquals("RTP",propertyService.getLocation());
- assertEquals("2006",propertyService.getYear());
-
- }
-
+
+ @Test
+ public void testDefaultProperty() {
+ assertEquals("RTP", propertyService.getLocation());
+ assertEquals("2006", propertyService.getYear());
+
+ }
+
+ @Test
public void testManySimpleStringValues() {
- Iterator<String> iterator = abService.getManyStringValues().iterator();
- assertEquals("Apache", iterator.next());
- assertEquals("Tuscany", iterator.next());
- assertEquals("Java SCA", iterator.next());
+ Iterator<String> iterator = abService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
}
-
+
+ @Test
public void testManySimpleIntegerValues() {
- Iterator<Integer> iterator = abService.getManyIntegers().iterator();
- assertEquals(123, iterator.next().intValue());
- assertEquals(456, iterator.next().intValue());
- assertEquals(789, iterator.next().intValue());
+ Iterator<Integer> iterator = abService.getManyIntegers().iterator();
+ assertEquals(123, iterator.next().intValue());
+ assertEquals(456, iterator.next().intValue());
+ assertEquals(789, iterator.next().intValue());
}
-
+
+ @Test
public void testComplexPropertyOne() {
ComplexPropertyBean propBean = propertyService.getComplexPropertyOne();
assertNotNull(propBean);
assertEquals("TestString_1", propBean.getStringArray()[0]);
assertEquals(2, propBean.numberSetArray[1].integerNumber);
}
-
+
+ @Test
public void testComplexPropertyTwo() {
ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo();
assertNotNull(propBean);
assertEquals(10, propBean.intArray[0]);
assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
}
-
+
+ @Test
public void testComplexPropertyThree() {
ComplexPropertyBean propBean = propertyService.getComplexPropertyThree();
assertNotNull(propBean);
assertEquals("TestElementString_1", propBean.stringArray[0]);
assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
}
-
+
+ @Test
public void testComplexPropertyFour() {
Object[] propBeanCollection = propertyService.getComplexPropertyFour().toArray();
assertNotNull(propBeanCollection);
assertEquals(1, ((ComplexPropertyBean)propBeanCollection[0]).getIntegerNumber());
assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber());
assertEquals(33, ((ComplexPropertyBean)propBeanCollection[2]).getNumberSet().getIntegerNumber());
- }
-
- protected void setUp() throws Exception {
+ }
+
+ @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");
+ cdService = CurrentCompositeContext.getContext().locateService(CDComponent.class, "CDComponent");
abcdService = CurrentCompositeContext.getContext().locateService(ABCDComponent.class, "ABCDComponent");
- propertyService = CurrentCompositeContext.getContext().locateService(PropertyComponent.class, "PropertyComponent");
+ propertyService =
+ CurrentCompositeContext.getContext().locateService(PropertyComponent.class, "PropertyComponent");
}
-
- protected void tearDown() throws Exception {
- SCARuntime.stop();
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ SCARuntime.stop();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org