summaryrefslogtreecommitdiffstats
path: root/java/sca/itest/properties
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/itest/properties')
-rw-r--r--java/sca/itest/properties/pom.xml19
-rw-r--r--java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java2
-rw-r--r--java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java5
-rw-r--r--java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java8
-rw-r--r--java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java3
-rw-r--r--java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java8
-rw-r--r--java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java2
-rw-r--r--java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java25
-rw-r--r--java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java21
-rw-r--r--java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java39
-rw-r--r--java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java46
11 files changed, 112 insertions, 66 deletions
diff --git a/java/sca/itest/properties/pom.xml b/java/sca/itest/properties/pom.xml
index 8ab9eccb6d..edd4c8c6a1 100644
--- a/java/sca/itest/properties/pom.xml
+++ b/java/sca/itest/properties/pom.xml
@@ -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>
diff --git a/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
index c0c068d12e..87f87d6c22 100644
--- a/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
+++ b/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
@@ -97,7 +97,7 @@ public class ComplexPropertyBean {
/**
* It is a method which implements toString() function
*/
- @Override
+
public String toString() {
return Double.toString(integerNumber) + " - "
+ Double.toString(floatNumber)
diff --git a/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
index 17b4e582d6..5217ede572 100644
--- a/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
+++ b/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
@@ -21,9 +21,10 @@ package org.apache.tuscany.sca.itest;
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 @@ public interface PropertyComponent {
* 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
diff --git a/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
index eb642b6637..16029a6584 100644
--- a/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
+++ b/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
@@ -25,11 +25,11 @@ import org.osoa.sca.ComponentContext;
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 @@ import test.jaxb.props.ReturnCodeProperties;
public class PropertyComponentImpl implements PropertyComponent {
@Context
protected ComponentContext context;
-
+
@Property
protected CustomerImpl customerSdo;
@@ -173,7 +173,7 @@ public class PropertyComponentImpl implements PropertyComponent {
public DataObject[] getSdoArrayProperty() {
return sdoArray;
}
-
+
public String getLocationFromComponentContext() {
return context.getProperty(String.class, "location");
}
diff --git a/java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java b/java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java
index 76bcd06fca..15fb49ea4e 100644
--- a/java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java
+++ b/java/sca/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java
@@ -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.XmlElementDecl;
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
diff --git a/java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java b/java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java
index 7a809ebf1e..0a1d4a34a3 100644
--- a/java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java
+++ b/java/sca/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java
@@ -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.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
-
/**
* <p>Java class for ReturnCodeProperties complex type.
*
@@ -55,10 +52,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@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")
diff --git a/java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java b/java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java
index f726552a62..6a6fdd00cc 100644
--- a/java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java
+++ b/java/sca/itest/properties/src/main/java/test/jaxb/props/package-info.java
@@ -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;
+
diff --git a/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java b/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java
index 8cf182e24a..efc635c72b 100644
--- a/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java
+++ b/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java
@@ -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 @@ public class MyTotalServiceTestCase {
private static MyService service2;
private static MyService service3;
- private static SCADomain domain;
+ private static Node node;
/**
* Method annotated with
@@ -75,25 +78,27 @@ public class MyTotalServiceTestCase {
* 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();
}
}
diff --git a/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java b/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
index 28357c5bbe..da1ec5186f 100644
--- a/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
+++ b/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
@@ -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 @@ import org.junit.Test;
*/
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();
}
/**
diff --git a/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
index 6979659ece..caf5a5e052 100644
--- a/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
+++ b/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
@@ -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 @@ import commonj.sdo.DataObject;
* '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 @@ public class PropertyTestCase {
assertEquals("Sdo Middler Name", dataObject.getString("middleName"));
assertEquals("Sdo Lasting Name", dataObject.getString("lastName"));
}
-
@Test
public void testGetLocationFromComponentContext() {
@@ -439,30 +438,32 @@ public class PropertyTestCase {
* 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();
}
}
diff --git a/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java b/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java
index 8ee5dce91f..a0213ced46 100644
--- a/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java
+++ b/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java
@@ -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 extends TestCase {
+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();
+ }
+ }
+
+ /**
+ * 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());
}
}