You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ri...@apache.org on 2007/03/29 03:27:22 UTC
svn commit: r523527 - in
/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src:
main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java
Author: rineholt
Date: Wed Mar 28 18:27:21 2007
New Revision: 523527
URL: http://svn.apache.org/viewvc?view=rev&rev=523527
Log:
MySimpleServiceInRecursiveComponent does not have MyService Service use MySimpleService
Initialize runtime once for all tests ... otheriwse runs out of memory and very slow.
Modified:
incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java
Modified: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java?view=diff&rev=523527&r1=523526&r2=523527
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java (original)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java Wed Mar 28 18:27:21 2007
@@ -54,7 +54,7 @@
private CompositeContext context;
public MyServiceImpl() {
- System.out.println("creating service instance...");
+ // System.out.println("creating service instance...");
}
public Date nextHoliday() {
@@ -94,12 +94,12 @@
@Init
public void start() {
- System.out.println("Start service..");
+ // System.out.println("Start service..");
}
@Destroy
public void stop() {
- System.out.println("Stop service..");
+ // System.out.println("Stop service..");
}
Modified: incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java?view=diff&rev=523527&r1=523526&r2=523527
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java Wed Mar 28 18:27:21 2007
@@ -18,7 +18,10 @@
*/
package org.apache.tuscany.sca.test.spec;
+import junit.extensions.TestSetup;
+import junit.framework.Test;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.apache.tuscany.api.SCARuntime;
import org.osoa.sca.CompositeContext;
@@ -27,74 +30,143 @@
@SuppressWarnings("deprecation")
public class CompositeOneService2LevelTestCase extends TestCase {
- private MyService myService;
- private MyService myServiceDefault;
- private MyService myServiceNo;
- private MyService myServiceMay;
- private MyService myServiceMust;
+ private static MyService myService;
+ private static MyService myServiceDefault;
+ private static MyService myServiceNo;
+ private static MyService myServiceMay;
+ private static MyService myServiceMust;
- private CompositeContext context;
+ static private CompositeContext context;
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(CompositeOneService2LevelTestCase.class);
+ TestSetup wrapper = new TestSetup(suite) {
+ public void setUp() {
+ setupStatic();
+ }
+
+ public void tearDown() {
+ tearDownStatic();
+ }
+
+ };
+ return wrapper;
+ }
+
+ public static void setupStatic() {
+ if (null != context)
+ return;
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ myService = context.locateService(MyService.class, "MySimpleServiceInRecursiveComponent/MySimpleService");
+ myServiceDefault = context.locateService(MyService.class, "MySimpleServiceDefault");
+ myServiceNo = context.locateService(MyService.class, "MySimpleServiceNo");
+ myServiceMay = context.locateService(MyService.class, "MySimpleServiceMay");
+ myServiceMust = context.locateService(MyService.class, "MySimpleServiceMust");
+
+ }
+
+ public static void tearDownStatic() {
+ if (context != null) {
+
+ context = null;
+ SCARuntime.stop();
+ }
+ }
+
+ public void setUp() {
+ setupStatic();
+ }
+
+ static Object foo = new Object() {
+ public void finalize() throws Throwable {
+ foo = null;
+ tearDownStatic();
+ }
+
+ };
public void testPropertyFromComponent() {
+
+ assertNotNull(myService);
assertEquals("CARY", myService.getLocation());
assertEquals("2007", myService.getYear());
}
public void testPropertyFromServiceDefault() {
+
+ assertNotNull(myServiceDefault);
assertEquals("CARY", myServiceDefault.getLocation());
assertEquals("2007", myServiceDefault.getYear());
}
public void testServiceDefault() {
+
+ assertNotNull(myService);
assertEquals(myService.nextHoliday(), myServiceDefault.nextHoliday());
}
public void testPropertyFromServiceNo() {
+
+ assertNotNull(myServiceNo);
assertEquals("CARY", myServiceNo.getLocation());
assertEquals("2007", myServiceNo.getYear());
}
public void testServiceNo() {
+
+ assertNotNull(myService);
assertEquals(myService.nextHoliday(), myServiceNo.nextHoliday());
}
public void testPropertyFromServiceMay() {
+
+ assertNotNull(myServiceMay);
assertEquals("CARY", myServiceMay.getLocation());
assertEquals("2007", myServiceMay.getYear());
}
public void testServiceMay() {
+
+ assertNotNull(myService);
assertEquals(myService.nextHoliday(), myServiceMay.nextHoliday());
}
public void testPropertyFromServiceMust() {
+
+ assertNotNull(myServiceMust);
assertEquals("CARY", myServiceMust.getLocation());
assertEquals("2007", myServiceMust.getYear());
}
public void testServiceMust() {
+
+ assertNotNull(myService);
assertEquals(myService.nextHoliday(), myServiceMust.nextHoliday());
}
public void testContext() {
- //FIXME TUSCANY-1174 - Need support for @ComponentName
+ // FIXME TUSCANY-1174 - Need support for @ComponentName
/*
- assertNotNull("Service component name is null", myService.getComponentName());
- assertNotNull("service context is null", myService.getContext());
-
- System.out.println("Service component name :" + myService.getComponentName());
- System.out.println("service context :" + myService.getContext());
-
- test(context);
- */
+ * assertNotNull("Service component name is null",
+ * myService.getComponentName()); assertNotNull("service context is
+ * null", myService.getContext()); System.out.println("Service component
+ * name :" + myService.getComponentName()); System.out.println("service
+ * context :" + myService.getContext()); test(context);
+ */
}
private void test(CompositeContext context) {
+
assertNotNull("composite name is null", context.getName());
assertNotNull("composite URI is null", context.getURI());
@@ -110,21 +182,10 @@
private void display(RequestContext context) {
System.out.println("\tService name:" + context.getServiceName());
System.out.println("\tSecurity subject:" + context.getSecuritySubject());
- //System.out.println("\tService reference:" + (Object)context.getServiceReference());
+ // System.out.println("\tService reference:" +
+ // (Object)context.getServiceReference());
}
+
- protected void setUp() throws Exception {
- SCARuntime.start("CompositeTest.composite");
- context = CurrentCompositeContext.getContext();
- myService = context.locateService(MyService.class, "MySimpleServiceInRecursiveComponent");
- myServiceDefault = context.locateService(MyService.class, "MySimpleServiceDefault");
- myServiceNo = context.locateService(MyService.class, "MySimpleServiceNo");
- myServiceMay = context.locateService(MyService.class, "MySimpleServiceMay");
- myServiceMust = context.locateService(MyService.class, "MySimpleServiceMust");
- }
-
- protected void tearDown() 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