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 2008/12/05 01:48:35 UTC
svn commit: r723537 [4/4] - in /tuscany/java/sca/itest: ./ callback-api/
callback-api/src/main/java/org/apache/tuscany/sca/test/
callback-api/src/test/java/org/apache/tuscany/sca/test/ callback-basic/
callback-basic/src/main/java/org/apache/tuscany/sca...
Modified: tuscany/java/sca/itest/properties/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/pom.xml?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/pom.xml (original)
+++ tuscany/java/sca/itest/properties/pom.xml Thu Dec 4 16:48:31 2008
@@ -31,15 +31,30 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
+ <artifactId>tuscany-node-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
- <scope>runtime</scope>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- XPathFactory -->
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.1</version>
+ <scope>test</scope>
</dependency>
<dependency>
Modified: tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java (original)
+++ tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java Thu Dec 4 16:48:31 2008
@@ -97,7 +97,7 @@
/**
* It is a method which implements toString() function
*/
- @Override
+
public String toString() {
return Double.toString(integerNumber) + " - "
+ Double.toString(floatNumber)
Modified: tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java (original)
+++ tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java Thu Dec 4 16:48:31 2008
@@ -21,9 +21,10 @@
import java.util.Collection;
+import test.jaxb.props.ReturnCodeProperties;
+
import commonj.sdo.DataObject;
-import test.jaxb.props.ReturnCodeProperties;
/**
* It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
* interface. Implementation for these methods is provided in PropertyComponentImpl Class
@@ -113,7 +114,7 @@
* PropertyComponentImpl
*/
public DataObject getCustomerSdo();
-
+
/**
* This is a method to get a property value from the SCA runtime environment. It is implemented in the class
* PropertyComponentImpl
Modified: tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java (original)
+++ tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java Thu Dec 4 16:48:31 2008
@@ -25,11 +25,11 @@
import org.osoa.sca.annotations.Context;
import org.osoa.sca.annotations.Property;
+import test.jaxb.props.ReturnCodeProperties;
+
import com.example.customer.sdo.impl.CustomerImpl;
import commonj.sdo.DataObject;
-import test.jaxb.props.ReturnCodeProperties;
-
/**
* This class Implements the interface PropertyComponent and gives implementation for all methods which are declared in
* that interface.
@@ -37,7 +37,7 @@
public class PropertyComponentImpl implements PropertyComponent {
@Context
protected ComponentContext context;
-
+
@Property
protected CustomerImpl customerSdo;
@@ -173,7 +173,7 @@
public DataObject[] getSdoArrayProperty() {
return sdoArray;
}
-
+
public String getLocationFromComponentContext() {
return context.getProperty(String.class, "location");
}
Modified: tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java (original)
+++ tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java Thu Dec 4 16:48:31 2008
@@ -22,8 +22,6 @@
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2008.06.07 at 03:30:47 PM EDT
//
-
-
package test.jaxb.props;
import javax.xml.bind.JAXBElement;
@@ -31,7 +29,6 @@
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
-
/**
* This object contains factory methods for each
* Java content interface and Java element interface
Modified: tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java (original)
+++ tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java Thu Dec 4 16:48:31 2008
@@ -22,8 +22,6 @@
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2008.06.07 at 03:30:47 PM EDT
//
-
-
package test.jaxb.props;
import java.math.BigInteger;
@@ -33,7 +31,6 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-
/**
* <p>Java class for ReturnCodeProperties complex type.
*
@@ -55,10 +52,7 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ReturnCodeProperties", namespace = "http://test.sca.jaxb/rcprops", propOrder = {
- "a",
- "b"
-})
+@XmlType(name = "ReturnCodeProperties", namespace = "http://test.sca.jaxb/rcprops", propOrder = {"a", "b"})
public class ReturnCodeProperties {
@XmlElement(name = "AInt")
Modified: tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java (original)
+++ tuscany/java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java Thu Dec 4 16:48:31 2008
@@ -22,6 +22,6 @@
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2008.06.07 at 03:30:47 PM EDT
//
-
@javax.xml.bind.annotation.XmlSchema(namespace = "http://test.sca.jaxb/rcprops", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package test.jaxb.props;
+
Modified: tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java (original)
+++ tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java Thu Dec 4 16:48:31 2008
@@ -18,10 +18,13 @@
*/
package org.apache.tuscany.sca.itest;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
import mysca.test.myservice.impl.MyService;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -31,7 +34,7 @@
private static MyService service2;
private static MyService service3;
- private static SCADomain domain;
+ private static Node node;
/**
* Method annotated with
@@ -75,25 +78,27 @@
* Method annotated with
*
* @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
- * Embedded SCA Domain, to start the SCA Domain and to get a reference to the 'outerABService' service
+ * Embedded SCA node, to start the SCA node and to get a reference to the 'outerABService' service
*/
@BeforeClass
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");
+ String location = ContributionLocationHelper.getContributionLocation("Outer.composite");
+ node = NodeFactory.newInstance().createNode("Outer.composite", new Contribution("c1", location));
+ node.start();
+ service1 = node.getService(MyService.class, "MyServiceComponent/MyService");
+ service2 = node.getService(MyService.class, "MyServiceComponentNew/MyService");
+ service3 = node.getService(MyService.class, "MySimpleServiceInRecursiveAnother");
}
/**
* Method annotated with
*
* @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
- * domain, close any previously opened connections etc
+ * node, close any previously opened connections etc
*/
@AfterClass
public static void tearDown() {
- domain.close();
+ node.stop();
}
}
Modified: tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java (original)
+++ tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java Thu Dec 4 16:48:31 2008
@@ -19,11 +19,14 @@
package org.apache.tuscany.sca.itest;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
import java.util.Iterator;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -36,30 +39,32 @@
*/
public class OuterPropertyTestCase {
- private static SCADomain domain;
+ private static Node node;
private static ABComponent outerABService;
/**
* Method annotated with
*
* @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
- * Embedded SCA Domain, to start the SCA Domain and to get a reference to the 'outerABService' service
+ * Embedded SCA node, to start the SCA node and to get a reference to the 'outerABService' service
*/
@BeforeClass
public static void init() throws Exception {
- domain = SCADomain.newInstance("OuterPropertyTest.composite");
- outerABService = domain.getService(ABComponent.class, "OuterComponent");
+ String location = ContributionLocationHelper.getContributionLocation("OuterPropertyTest.composite");
+ node = NodeFactory.newInstance().createNode("OuterPropertyTest.composite", new Contribution("c1", location));
+ node.start();
+ outerABService = node.getService(ABComponent.class, "OuterComponent");
}
/**
* Method annotated with
*
* @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
- * domain, close any previously opened connections etc
+ * node, close any previously opened connections etc
*/
@AfterClass
public static void destroy() throws Exception {
- domain.close();
+ node.stop();
}
/**
Modified: tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java (original)
+++ tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java Thu Dec 4 16:48:31 2008
@@ -19,22 +19,24 @@
package org.apache.tuscany.sca.itest;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.math.BigInteger;
import java.util.Arrays;
import java.util.Iterator;
-import java.math.BigInteger;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import test.jaxb.props.ReturnCodeProperties;
+
import commonj.sdo.DataObject;
/**
@@ -43,14 +45,12 @@
* 'PropertyTest.composite'. It basically tests all types of property values returned from SCA runtime environment.
*/
public class PropertyTestCase {
- private static SCADomain domain;
+ private static Node node;
private static ABComponent abService;
private static CDComponent cdService;
private static ABCDComponent abcdService;
private static PropertyComponent propertyService;
-
-
/**
* Method annotated with
*
@@ -368,7 +368,6 @@
assertEquals("Sdo Middler Name", dataObject.getString("middleName"));
assertEquals("Sdo Lasting Name", dataObject.getString("lastName"));
}
-
@Test
public void testGetLocationFromComponentContext() {
@@ -439,30 +438,32 @@
* Method annotated with
*
* @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
- * Embedded SCA Domain, to start the SCA Domain and to get a reference to 4 services namely 'abService'
+ * Embedded SCA node, to start the SCA node and to get a reference to 4 services namely 'abService'
* service, 'cdService' service, 'abcdService' service and 'propertyService' service
*/
@BeforeClass
public static void init() throws Exception {
try {
- domain = SCADomain.newInstance("PropertyTest.composite");
+ String location = ContributionLocationHelper.getContributionLocation("PropertyTest.composite");
+ node = NodeFactory.newInstance().createNode("PropertyTest.composite", new Contribution("c1", location));
+ node.start();
} 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");
+ abService = node.getService(ABComponent.class, "ABComponent");
+ cdService = node.getService(CDComponent.class, "CDComponent");
+ abcdService = node.getService(ABCDComponent.class, "ABCDComponent");
+ propertyService = node.getService(PropertyComponent.class, "PropertyComponent");
}
/**
* Method annotated with
*
* @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
- * domain, close any previously opened connections etc
+ * node, close any previously opened connections etc
*/
@AfterClass
public static void destroy() throws Exception {
- domain.close();
+ node.stop();
}
}
Modified: tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java (original)
+++ tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java Thu Dec 4 16:48:31 2008
@@ -18,27 +18,55 @@
*/
package org.apache.tuscany.sca.itest.cdi;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ConstructorPropertyInjectionTestCase {
+ private static org.apache.tuscany.sca.node.Node node;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ String location = ContributionLocationHelper.getContributionLocation("ConstructorPropertyInjection.composite");
+ node = NodeFactory.newInstance().createNode("ConstructorPropertyInjection.composite", new Contribution("c1", location));
+ node.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
-public class ConstructorPropertyInjectionTestCase extends TestCase {
+ /**
+ * Method annotated with
+ *
+ * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
+ * node, close any previously opened connections etc
+ */
+ @AfterClass
+ public static void destroy() throws Exception {
+ node.stop();
+ }
+ @Test
public void testFoo1() throws Exception {
- SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
- Bar foo = sca.getService(Bar.class, "Foo1Component");
+ Bar foo = node.getService(Bar.class, "Foo1Component");
assertEquals("fubar", foo.getBar());
}
+ @Test
public void testFoo2() throws Exception {
- SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
- Bar foo = sca.getService(Bar.class, "Foo2Component");
+ Bar foo = node.getService(Bar.class, "Foo2Component");
assertEquals("fubar", foo.getBar());
}
+ @Test
public void testFoo3() throws Exception {
- SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
- Bar foo = sca.getService(Bar.class, "Foo3Component");
+ Bar foo = node.getService(Bar.class, "Foo3Component");
assertEquals("fubar", foo.getBar());
}
}
Modified: tuscany/java/sca/itest/recursive-multi-level/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/recursive-multi-level/pom.xml?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/recursive-multi-level/pom.xml (original)
+++ tuscany/java/sca/itest/recursive-multi-level/pom.xml Thu Dec 4 16:48:31 2008
@@ -31,15 +31,31 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
+ <artifactId>tuscany-node-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- XPathFactory -->
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.1</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
Modified: tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java (original)
+++ tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java Thu Dec 4 16:48:31 2008
@@ -19,8 +19,8 @@
package mysca.test.myservice;
-
public interface MyService {
String getLocation();
+
String getYear();
}
Modified: tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java (original)
+++ tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java Thu Dec 4 16:48:31 2008
@@ -22,27 +22,21 @@
import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Service;
-import mysca.test.myservice.MyService;
-
@Service(MyService.class)
public class MyServiceImpl implements MyService {
-
- @Property(name="location")
- protected String location = "ABC";
- @Property(name="year")
+ @Property(name = "location")
+ protected String location = "ABC";
+
+ @Property(name = "year")
protected String year = "2006";
-
- public String getLocation()
- {
- return location;
+ public String getLocation() {
+ return location;
}
- public String getYear()
- {
+ public String getYear() {
return year;
}
-
}
Modified: tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java (original)
+++ tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java Thu Dec 4 16:48:31 2008
@@ -21,5 +21,6 @@
public interface MySimpleTotalService {
String getLocation();
+
String getYear();
}
Modified: tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java (original)
+++ tuscany/java/sca/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java Thu Dec 4 16:48:31 2008
@@ -22,24 +22,17 @@
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
-import mysca.test.myservice.MyService;
-import mysca.test.myservice.MySimpleTotalService;
-
@Service(MySimpleTotalService.class)
-public class MySimpleTotalServiceImpl implements MySimpleTotalService
-{
+public class MySimpleTotalServiceImpl implements MySimpleTotalService {
// default required==true so it is 1:1
@Reference
public MyService myService;
-
- public String getLocation()
- {
+ public String getLocation() {
return myService.getLocation();
}
- public String getYear()
- {
+ public String getYear() {
return myService.getYear();
}
Modified: tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java (original)
+++ tuscany/java/sca/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java Thu Dec 4 16:48:31 2008
@@ -18,51 +18,72 @@
*/
package test.sca.tests;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
+import static org.junit.Assert.assertEquals;
import mysca.test.myservice.MySimpleTotalService;
-import junit.framework.TestCase;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
/**
* Tests to make sure that autowiring and recusive composite work together
*
*/
-public class MultiLevelTestCase extends TestCase
-{
- private SCADomain domain1;
- private SCADomain domain2;
- private SCADomain domain3;
- private MySimpleTotalService myService1;
- private MySimpleTotalService myService2;
- private MySimpleTotalService myService3;
-
- protected void setUp() throws Exception {
- super.setUp();
- domain1 = SCADomain.newInstance("TotalService1Auto.composite");
- domain2 = SCADomain.newInstance("TotalService2Auto.composite");
- domain3 = SCADomain.newInstance("TotalService3Auto.composite");
-
- myService1 = domain1.getService(MySimpleTotalService.class, "TotalServiceComponentLevel1Auto");
- myService2 = domain2.getService(MySimpleTotalService.class, "TotalServiceInRecursive2Auto/MyServiceLevel1Auto");
- myService3 = domain3.getService(MySimpleTotalService.class, "TotalServiceInRecursive3Auto/MyServiceLevel2Auto");
+public class MultiLevelTestCase {
+ private static Node node1;
+ private static Node node2;
+ private static Node node3;
+ private static MySimpleTotalService myService1;
+ private static MySimpleTotalService myService2;
+ private static MySimpleTotalService myService3;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ String location = ContributionLocationHelper.getContributionLocation("TotalService1Auto.composite");
+ Contribution contribution = new Contribution("c1", location);
+ try {
+ node1 = NodeFactory.newInstance().createNode("TotalService1Auto.composite", contribution);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ node2 = NodeFactory.newInstance().createNode("TotalService2Auto.composite", contribution);
+ node3 = NodeFactory.newInstance().createNode("TotalService3Auto.composite", contribution);
+
+ node1.start();
+ node2.start();
+ node3.start();
+
+ myService1 = node1.getService(MySimpleTotalService.class, "TotalServiceComponentLevel1Auto");
+ myService2 = node2.getService(MySimpleTotalService.class, "TotalServiceInRecursive2Auto/MyServiceLevel1Auto");
+ myService3 = node3.getService(MySimpleTotalService.class, "TotalServiceInRecursive3Auto/MyServiceLevel2Auto");
}
-
- public void testLevel1()
- {
- assertEquals("Level 1",myService1.getLocation());
- assertEquals("2001",myService1.getYear());
+
+ @Test
+ public void testLevel1() {
+ assertEquals("Level 1", myService1.getLocation());
+ assertEquals("2001", myService1.getYear());
}
-
- public void testLevel2()
- {
- assertEquals("Default 2",myService2.getLocation());
- assertEquals("1992",myService2.getYear());
+
+ @Test
+ public void testLevel2() {
+ assertEquals("Default 2", myService2.getLocation());
+ assertEquals("1992", myService2.getYear());
}
- public void testLevel3()
- {
- assertEquals("Default 3",myService3.getLocation());
- assertEquals("1993",myService3.getYear());
+ @Test
+ public void testLevel3() {
+ assertEquals("Default 3", myService3.getLocation());
+ assertEquals("1993", myService3.getYear());
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ node1.stop();
+ node2.stop();
+ node3.stop();
}
}
Modified: tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java (original)
+++ tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java Thu Dec 4 16:48:31 2008
@@ -37,11 +37,10 @@
@Reference(name = "dReferences")
public Collection<DComponent> dReferences;
-
+
@Reference(name = "dReferenceArray")
public DComponent[] dReferenceArray;
-
@Reference(name = "dServiceReferences")
public List<ServiceReference<DComponent>> dServiceReferences;
@@ -93,8 +92,8 @@
str.deleteCharAt(str.length() - 1);
}
return str.toString();
- }
-
+ }
+
public String fooMultipleD() {
StringBuffer str = new StringBuffer();
for (DComponent d : dReferences) {
@@ -106,7 +105,7 @@
}
return str.toString();
}
-
+
public String fooMultipleDServiceRef() {
StringBuffer str = new StringBuffer();
for (ServiceReference<DComponent> d : dServiceReferences) {
Modified: tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java (original)
+++ tuscany/java/sca/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java Thu Dec 4 16:48:31 2008
@@ -18,10 +18,9 @@
*/
package org.apache.tuscany.sca.itest.references;
-import org.osoa.sca.annotations.Remotable;
-
public interface DComponent {
String dFoo();
+
String getComponentName();
}
Modified: tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java (original)
+++ tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java Thu Dec 4 16:48:31 2008
@@ -18,29 +18,40 @@
*/
package org.apache.tuscany.sca.itest.references;
-import static junit.framework.Assert.assertEquals;
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
public class AutoWiredReferenceTestCase {
- private static SCADomain domain;
+ private static Node node;
private static AComponent acomponent;
private static AComponent acomponentAutowire;
@BeforeClass
public static void init() throws Exception {
- domain = SCADomain.newInstance("AutoWiredReferencesTest.composite");
- acomponent = domain.getService(AComponent.class, "AComponent");
- acomponentAutowire = domain.getService(AComponent.class, "AComponentAutowire");
+ try {
+ String location = ContributionLocationHelper.getContributionLocation("AutoWiredReferencesTest.composite");
+ node =
+ NodeFactory.newInstance().createNode("AutoWiredReferencesTest.composite",
+ new Contribution("c1", location));
+ node.start();
+ acomponent = node.getService(AComponent.class, "AComponent");
+ acomponentAutowire = node.getService(AComponent.class, "AComponentAutowire");
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
}
@AfterClass
public static void destroy() throws Exception {
- domain.close();
+ node.stop();
}
@Test
@@ -67,19 +78,19 @@
public void testD2Reference() {
assertEquals("DComponent", acomponent.fooD2());
}
-
+
@Test
public void testMultiDReferenceArray() {
String components = acomponent.fooMultipleDArray();
Assert.assertTrue(components.contains("DComponent1"));
- }
-
+ }
+
@Test
public void testMultiDServiceReference() {
String components = acomponent.fooMultipleDServiceRef();
Assert.assertTrue(components.contains("DComponent"));
Assert.assertTrue(components.contains("DComponent1"));
- }
+ }
@Test
public void testRequiredFalseReference() {
@@ -89,7 +100,7 @@
Assert.assertTrue(true);
}
}
-
+
@Test
public void testTargetPrecendence() {
try {
Modified: tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java (original)
+++ tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java Thu Dec 4 16:48:31 2008
@@ -18,27 +18,32 @@
*/
package org.apache.tuscany.sca.itest.references;
-import static junit.framework.Assert.assertEquals;
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
public class InnerReferenceTestCase {
- private static SCADomain domain;
+ private static Node node;
private static AComponent acomponent;
@BeforeClass
public static void init() throws Exception {
- domain = SCADomain.newInstance("InnerReferencesTest.composite");
- acomponent = domain.getService(AComponent.class, "AComponent");
+ String location = ContributionLocationHelper.getContributionLocation("InnerReferencesTest.composite");
+ node = NodeFactory.newInstance().createNode("InnerReferencesTest.composite", new Contribution("c1", location));
+ node.start();
+ acomponent = node.getService(AComponent.class, "AComponent");
}
@AfterClass
public static void destroy() throws Exception {
- domain.close();
+ node.stop();
}
@Test
@@ -65,26 +70,26 @@
public void testD2Reference() {
assertEquals("DComponent", acomponent.fooD2());
}
-
+
@Test
public void testMultiDReference() {
String components = acomponent.fooMultipleD();
Assert.assertTrue(components.contains("DComponent"));
Assert.assertTrue(components.contains("DComponent1"));
}
-
+
@Test
public void testMultiDReferenceArray() {
String components = acomponent.fooMultipleDArray();
Assert.assertTrue(components.equals("DComponent1"));
- }
-
+ }
+
@Test
public void testMultiDServiceReference() {
String components = acomponent.fooMultipleDServiceRef();
Assert.assertTrue(components.contains("DComponent"));
Assert.assertTrue(components.contains("DComponent1"));
- }
+ }
@Test(expected = NullPointerException.class)
public void testRequiredFalseReference() {
Modified: tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java (original)
+++ tuscany/java/sca/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java Thu Dec 4 16:48:31 2008
@@ -18,28 +18,33 @@
*/
package org.apache.tuscany.sca.itest.references;
-import static junit.framework.Assert.assertEquals;
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
public class ManualWiredReferenceTestCase {
- private static SCADomain domain;
+ private static Node node;
private static AComponent acomponent;
@BeforeClass
public static void init() throws Exception {
- domain = SCADomain.newInstance("ManualWiredReferencesTest.composite");
- acomponent = domain.getService(AComponent.class, "AComponent");
+ String location = ContributionLocationHelper.getContributionLocation("ManualWiredReferencesTest.composite");
+ node = NodeFactory.newInstance().createNode("ManualWiredReferencesTest.composite", new Contribution("c1", location));
+ node.start();
+ acomponent = node.getService(AComponent.class, "AComponent");
}
@AfterClass
public static void destroy() throws Exception {
- domain.close();
+ node.stop();
}
@Test
@@ -67,19 +72,19 @@
public void testD2Reference() {
assertEquals("DComponent", acomponent.fooD2());
}
-
+
@Test
public void testMultiDReferenceArray() {
String components = acomponent.fooMultipleDArray();
Assert.assertTrue(components.contains("DComponent1"));
- }
-
+ }
+
@Test
public void testMultiDServiceReference() {
String components = acomponent.fooMultipleDServiceRef();
Assert.assertTrue(components.contains("DComponent"));
Assert.assertTrue(components.contains("DComponent1"));
- }
+ }
@Test
public void testRequiredFalseReference() {
Modified: tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java (original)
+++ tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java Thu Dec 4 16:48:31 2008
@@ -32,15 +32,15 @@
ThreadLocal<Integer> moduleState;
public CompositeScopeStateVerifierImpl() {
- moduleState = new ThreadLocal<Integer>();
+ moduleState = new ThreadLocal<Integer>();
}
public void setState(int i) {
- moduleState.set(i);
+ moduleState.set(i);
}
public boolean checkState(int i) {
- return (moduleState.get() == i);
+ return (moduleState.get() == i);
}
}
Modified: tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java (original)
+++ tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java Thu Dec 4 16:48:31 2008
@@ -17,6 +17,7 @@
* under the License.
*/
package org.apache.tuscany.sca.itest.scopes;
+
import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Scope;
@@ -30,21 +31,21 @@
int requestState;
public void setState(int i) {
- requestState = i;
+ requestState = i;
}
public boolean checkState(int i) {
- return (requestState == i);
+ return (requestState == i);
}
-
+
@Init
public void init() {
requestState = 0;
}
-
+
@Destroy
public void destroy() {
- requestState = -1;
+ requestState = -1;
}
-}
\ No newline at end of file
+}
Modified: tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java (original)
+++ tuscany/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java Thu Dec 4 16:48:31 2008
@@ -20,6 +20,6 @@
public interface StateVerifier {
void setState(int i);
+
boolean checkState(int i);
}
-
Modified: tuscany/java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java (original)
+++ tuscany/java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java Thu Dec 4 16:48:31 2008
@@ -18,76 +18,81 @@
*/
package org.apache.tuscany.sca.test;
-import junit.framework.TestCase;
+import static org.junit.Assert.fail;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
import org.apache.tuscany.sca.itest.scopes.StateVerifier;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-public class ScopeTestCase extends TestCase {
+public class ScopeTestCase {
final static int numThreads = 4; // number of threads to drive each scope container
final static int iterations = 200; // number of iterations per thread
- private SCADomain domain;
+ private Node node;
// Test scope containers.
// The request scope container isn't hooked up for some reason so the code below
// that tests request scope is commented out.
// Code could be added to test session scope once it is supported in a standalone environment.
-
+ @Test
public void testScopes() throws InterruptedException {
- Thread[] moduleScopeThreadTable = new Thread[numThreads];
- Thread[] requestScopeThreadTable = new Thread[numThreads];
+ Thread[] moduleScopeThreadTable = new Thread[numThreads];
+ Thread[] requestScopeThreadTable = new Thread[numThreads];
- for(int i=0; i<numThreads; i++)
- {
- moduleScopeThreadTable[i] = new ModuleScopeTestThread();
- requestScopeThreadTable[i] = new RequestScopeTestThread();
- }
- for(int j=0; j<numThreads; j++)
- {
- moduleScopeThreadTable[j].start();
- requestScopeThreadTable[j].start();
- }
- for(int k=0; k<numThreads; k++)
- {
- moduleScopeThreadTable[k].join();
- requestScopeThreadTable[k].join();
- }
+ for (int i = 0; i < numThreads; i++) {
+ moduleScopeThreadTable[i] = new ModuleScopeTestThread();
+ requestScopeThreadTable[i] = new RequestScopeTestThread();
+ }
+ for (int j = 0; j < numThreads; j++) {
+ moduleScopeThreadTable[j].start();
+ requestScopeThreadTable[j].start();
+ }
+ for (int k = 0; k < numThreads; k++) {
+ moduleScopeThreadTable[k].join();
+ requestScopeThreadTable[k].join();
+ }
}
- private class ModuleScopeTestThread extends Thread {
- @Override
- public void run() {
- StateVerifier moduleScopeService = domain.getService(StateVerifier.class, "ModuleScopeComponent");
- for(int i=1; i<=iterations; i++) {
- moduleScopeService.setState(i);
- if (!moduleScopeService.checkState(i))
- fail("The module scope service lost its state on iteration " + i);
+ private class ModuleScopeTestThread extends Thread {
+
+ public void run() {
+ StateVerifier moduleScopeService = node.getService(StateVerifier.class, "ModuleScopeComponent");
+ for (int i = 1; i <= iterations; i++) {
+ moduleScopeService.setState(i);
+ if (!moduleScopeService.checkState(i))
+ fail("The module scope service lost its state on iteration " + i);
+ }
}
- }
}
private class RequestScopeTestThread extends Thread {
- @Override
- public void run() {
- StateVerifier requestScopeService = domain.getService(StateVerifier.class, "RequestScopeComponent");
- for(int i=1; i<=iterations; i++) {
- requestScopeService.setState(i);
- if (!requestScopeService.checkState(i))
- fail("The request scope service lost its state on iteration " + i);
+
+ public void run() {
+ StateVerifier requestScopeService = node.getService(StateVerifier.class, "RequestScopeComponent");
+ for (int i = 1; i <= iterations; i++) {
+ requestScopeService.setState(i);
+ if (!requestScopeService.checkState(i))
+ fail("The request scope service lost its state on iteration " + i);
+ }
}
- }
}
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("scopes.composite");
+ @Before
+ public void setUp() throws Exception {
+ String location = ContributionLocationHelper.getContributionLocation("scopes.composite");
+ node = NodeFactory.newInstance().createNode("scopes.composite", new Contribution("c1", location));
+ node.start();
}
- @Override
- protected void tearDown() throws Exception {
- domain.close();
+ @After
+ public void tearDown() throws Exception {
+ node.stop();
}
-
+
}
Modified: tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java (original)
+++ tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java Thu Dec 4 16:48:31 2008
@@ -23,5 +23,5 @@
@Remotable
public interface AComponent {
- String foo();
+ String foo();
}
Modified: tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java (original)
+++ tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java Thu Dec 4 16:48:31 2008
@@ -21,8 +21,8 @@
public class AComponentImpl implements AComponent {
- public String foo() {
- return "AComponent";
- }
+ public String foo() {
+ return "AComponent";
+ }
}
Modified: tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java (original)
+++ tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java Thu Dec 4 16:48:31 2008
@@ -21,5 +21,5 @@
public interface BComponent {
- String foo();
+ String foo();
}
Modified: tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java (original)
+++ tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java Thu Dec 4 16:48:31 2008
@@ -24,8 +24,8 @@
@Service(BComponent.class)
public class BComponentImpl implements BComponent {
- public String foo() {
- return "BComponent";
- }
+ public String foo() {
+ return "BComponent";
+ }
}
Modified: tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java (original)
+++ tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java Thu Dec 4 16:48:31 2008
@@ -19,7 +19,6 @@
package org.apache.tuscany.sca.itest.services;
-
public interface D1Component {
- String foo1();
+ String foo1();
}
Modified: tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java (original)
+++ tuscany/java/sca/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java Thu Dec 4 16:48:31 2008
@@ -19,7 +19,6 @@
package org.apache.tuscany.sca.itest.services;
-
public interface DComponent {
- String foo();
+ String foo();
}
Modified: tuscany/java/sca/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java (original)
+++ tuscany/java/sca/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java Thu Dec 4 16:48:31 2008
@@ -19,14 +19,14 @@
package org.apache.tuscany.sca.itest.services;
-import static junit.framework.Assert.assertEquals;
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.osoa.sca.ServiceRuntimeException;
@@ -38,7 +38,7 @@
public static void init() throws Exception {
String location = ContributionLocationHelper.getContributionLocation("ServicesTest.composite");
node = NodeFactory.newInstance().createNode("ServicesTest.composite", new Contribution("c1", location));
- node.start();
+ node.start();
}
@AfterClass
Modified: tuscany/java/sca/itest/wires/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/wires/pom.xml?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/wires/pom.xml (original)
+++ tuscany/java/sca/itest/wires/pom.xml Thu Dec 4 16:48:31 2008
@@ -31,15 +31,23 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
+ <artifactId>tuscany-node-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
- <scope>runtime</scope>
+ <scope>test</scope>
</dependency>
+
</dependencies>
</project>
Modified: tuscany/java/sca/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java (original)
+++ tuscany/java/sca/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java Thu Dec 4 16:48:31 2008
@@ -19,8 +19,7 @@
package org.apache.tuscany.sca.itest;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
@@ -41,10 +40,10 @@
public void runTests() {
// Make sure the wire has injected a reference
Assert.assertNotNull(aWireService);
-
+
// Test the injected reference
String msg = aWireService.sayHello("MCC");
-
+
// Validate the response
Assert.assertNotNull(msg);
Assert.assertEquals("Hello MCC", msg);
Modified: tuscany/java/sca/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java?rev=723537&r1=723536&r2=723537&view=diff
==============================================================================
--- tuscany/java/sca/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java (original)
+++ tuscany/java/sca/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java Thu Dec 4 16:48:31 2008
@@ -19,10 +19,16 @@
package org.apache.tuscany.sca.itest;
-import junit.framework.Assert;
import junit.framework.TestCase;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* This test case will attempt to use a wire
@@ -30,10 +36,10 @@
public class WireTestCase extends TestCase {
/**
- * The SCADomain we are using
+ * The Node we are using
*/
- private SCADomain domain;
-
+ private Node node;
+
/**
* The client the tests should use
*/
@@ -42,28 +48,33 @@
/**
* Run the wire tests
*/
+ @Test
public void testWire() {
- aWireClient.runTests();
+ aWireClient.runTests();
}
/**
* Load the Wire composite and look up the client.
*/
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("WireTest.composite");
- aWireClient = domain.getService(WireClient.class, "WireClient");
+
+ @Before
+ public void setUp() throws Exception {
+ String location = ContributionLocationHelper.getContributionLocation("WireTest.composite");
+ node = NodeFactory.newInstance().createNode("WireTest.composite", new Contribution("c1", location));
+ node.start();
+ aWireClient = node.getService(WireClient.class, "WireClient");
Assert.assertNotNull(aWireClient);
-
- aWireClient = domain.getService(WireClient.class, "AnotherWireClient");
+
+ aWireClient = node.getService(WireClient.class, "AnotherWireClient");
Assert.assertNotNull(aWireClient);
}
/**
- * Shutdown the SCA domain
+ * Shutdown the SCA node
*/
- @Override
- protected void tearDown() throws Exception {
- domain.close();
+
+ @After
+ public void tearDown() throws Exception {
+ node.stop();
}
}