summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/tags/1.1/itest/oneway/src
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:26:33 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:26:33 +0000
commita40e527938d76ba71f211da7e327adb50384ba69 (patch)
treecb8f99f1727122b040a3f0fbb6649292b6a74302 /sca-java-1.x/tags/1.1/itest/oneway/src
parent968721109881107520d7aefa91d7fcc0519d7739 (diff)
Moving 1.x tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835157 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/tags/1.1/itest/oneway/src')
-rw-r--r--sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java32
-rw-r--r--sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java37
-rw-r--r--sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java53
-rw-r--r--sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java46
-rw-r--r--sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java45
-rw-r--r--sca-java-1.x/tags/1.1/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite39
-rw-r--r--sca-java-1.x/tags/1.1/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java82
7 files changed, 334 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java
new file mode 100644
index 0000000000..afa008bd3e
--- /dev/null
+++ b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.sca.itest.oneway;
+
+
+/**
+ * The client for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public interface OneWayClient {
+
+ public int doSomething(int count);
+}
diff --git a/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java
new file mode 100644
index 0000000000..b389927403
--- /dev/null
+++ b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.sca.itest.oneway;
+
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing oneway interactions
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface OneWayService {
+
+ @OneWay
+ public void doSomething(int count);
+
+}
diff --git a/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java
new file mode 100644
index 0000000000..c1d77dbbb1
--- /dev/null
+++ b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.sca.itest.oneway.impl;
+
+import org.apache.tuscany.sca.itest.oneway.OneWayClient;
+import org.apache.tuscany.sca.itest.oneway.OneWayService;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * The client for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public class OneWayClientImpl implements OneWayClient {
+
+ @Reference
+ protected OneWayService oneWayService;
+
+ public static int callCount = 0;
+
+
+ public int doSomething(int count){
+
+ callCount = callCount + count;
+
+ for (int loopCount = 0; loopCount < count; loopCount++){
+ //System.out.println("Client: doSomething " + loopCount);
+ //System.out.flush();
+ oneWayService.doSomething(loopCount);
+ }
+
+ return count;
+ }
+}
diff --git a/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java
new file mode 100644
index 0000000000..405fa5c3fd
--- /dev/null
+++ b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.sca.itest.oneway.impl;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the oneway Web service endpoint.
+ */
+public class OneWayServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("oneWay.composite");
+
+ try {
+ System.out.println("OneWay server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("OneWay server stopped");
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java
new file mode 100644
index 0000000000..6e57e83ad8
--- /dev/null
+++ b/sca-java-1.x/tags/1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.sca.itest.oneway.impl;
+
+import org.apache.tuscany.sca.itest.oneway.OneWayService;
+
+/**
+ * The service for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public class OneWayServiceImpl implements OneWayService {
+
+ public static int callCount = 0;
+
+ public void doSomething(int count){
+
+ synchronized(this){
+ callCount++;
+ }
+
+ // System.out.println("Service: doSomething " + count + " callCount = " + callCount);
+ // System.out.flush();
+
+
+ }
+}
diff --git a/sca-java-1.x/tags/1.1/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite b/sca-java-1.x/tags/1.1/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite
new file mode 100644
index 0000000000..f827327301
--- /dev/null
+++ b/sca-java-1.x/tags/1.1/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite
@@ -0,0 +1,39 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="OneWayITest">
+
+ <component name="OneWayClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl"/>
+ <reference name="oneWayService" target="OneWayServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="OneWayServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ <binding.ws/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/tags/1.1/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java b/sca-java-1.x/tags/1.1/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java
new file mode 100644
index 0000000000..86f10abcf6
--- /dev/null
+++ b/sca-java-1.x/tags/1.1/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+package org.apache.tuscany.sca.itest.oneway;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl;
+import org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl;
+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;
+
+public class OneWayTestCaseFIXME {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ SCANode node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ OneWayTestCaseFIXME.class.getResource("/OneWayContribution/."));
+ node.start();
+ domain = node.getDomain();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.destroy();
+ }
+ }
+
+ @Test
+ public void testOneWay() {
+ OneWayClient client =
+ domain.getService(OneWayClient.class, "OneWayClientComponent");
+ try {
+
+ int count = 100;
+
+ for (int i = 0; i < 10; i++){
+ // System.out.println("Test: doSomething " + count);
+ // System.out.flush();
+ client.doSomething(count);
+
+ Thread.sleep(2000);
+
+ System.out.println("Finished callCount = " + OneWayServiceImpl.callCount);
+
+ Assert.assertEquals(OneWayClientImpl.callCount, OneWayServiceImpl.callCount);
+ }
+ } catch (Exception ex) {
+ System.err.println("Exception: " + ex.toString());
+ }
+
+
+
+ }
+
+}