summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/contributions/calendar
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-13 08:01:57 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-13 08:01:57 +0000
commitae27417c3e0192eb1920bbbf61b300380d03810c (patch)
tree636f8412da49518385f5b0364c24cf8c97b57970 /sandbox/travelsample/contributions/calendar
parent93b2330ad23ba550ba6d50fdce2f79a34cca7477 (diff)
Convert contributions/calendar test case from host-embedded to Node API
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@814278 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/contributions/calendar')
-rw-r--r--sandbox/travelsample/contributions/calendar/pom.xml15
-rw-r--r--sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java37
-rw-r--r--sandbox/travelsample/contributions/calendar/src/test/resources/META-INF/sca-contribution.xml23
3 files changed, 56 insertions, 19 deletions
diff --git a/sandbox/travelsample/contributions/calendar/pom.xml b/sandbox/travelsample/contributions/calendar/pom.xml
index bb80429680..b1c0caa167 100644
--- a/sandbox/travelsample/contributions/calendar/pom.xml
+++ b/sandbox/travelsample/contributions/calendar/pom.xml
@@ -31,15 +31,23 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
<version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <artifactId>tuscany-node-api</artifactId>
<version>1.6-SNAPSHOT</version>
- <scope>runtime</scope>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>test</scope>
</dependency>
<dependency>
@@ -48,7 +56,6 @@
<version>4.5</version>
<scope>test</scope>
</dependency>
-
</dependencies>
<build>
diff --git a/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java b/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java
index 571e7b4b4a..72cb5baa3c 100644
--- a/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java
+++ b/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java
@@ -18,32 +18,39 @@
*/
package scatours.calendar;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import com.tuscanyscatours.calendar.Calendar;
/**
* This shows how to test the Calculator service component.
*/
-public class CalendarTestCase extends TestCase {
-
- private Calendar calendar;
- private SCADomain scaDomain;
+public class CalendarTestCase {
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("calendar.composite");
- calendar = scaDomain.getService(Calendar.class, "Calendar");
- }
+ private SCANode node;
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
+ @Before
+ public void startNode() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("calendar.composite",
+ new SCAContribution("calendar", "./target/classes"),
+ new SCAContribution("calendar-test", "./target/test-classes"));
+ node.start();
}
+ @Test
public void testCalendar() throws Exception {
+ Calendar calendar = ((SCAClient)node).getService(Calendar.class, "Calendar");
System.out.println(calendar.getEndDate("07/10/96 04:05", 3));
}
+
+ @After
+ public void stopNode() throws Exception {
+ node.stop();
+ }
}
diff --git a/sandbox/travelsample/contributions/calendar/src/test/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contributions/calendar/src/test/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..e57bf783fc
--- /dev/null
+++ b/sandbox/travelsample/contributions/calendar/src/test/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="com.tuscanyscatours.calendar" />
+ <import.java package="com.tuscanyscatours.calendar.impl" />
+</contribution>