summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:07:45 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:07:45 +0000
commit6a3ca6736c808c1647854e405ef379b609f276db (patch)
tree67670193d3511b227100419589d0f2ec0bb02cc0 /branches/sca-java-1.2.1/itest/callback-api/src/main/java/org
parent9f395ebf3ec27f89c8dc63137bc99c8d6b0cff6d (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835126 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.2.1/itest/callback-api/src/main/java/org')
-rw-r--r--branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java38
-rw-r--r--branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java30
-rw-r--r--branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java206
-rw-r--r--branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java50
-rw-r--r--branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java123
5 files changed, 0 insertions, 447 deletions
diff --git a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java b/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java
deleted file mode 100644
index de17ba2f0d..0000000000
--- a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.test;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-/**
- *
- */
-public interface CallBackApiCallBack {
- /**
- * This function is defined in CallBackApiClientImpl
- */
- public void callBackMessage(String aString);
-
- /**
- * This function is defined in CallBackApiClientImpl
- */
- public void callBackIncrement(String aString);
-
-}
diff --git a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java b/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java
deleted file mode 100644
index 5fd4a71466..0000000000
--- a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.test;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface CallBackApiClient {
- /**
- * This function is defined in CallBackApiClientImpl
- */
- public void run();
-
-}
diff --git a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java b/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java
deleted file mode 100644
index 5accbe801d..0000000000
--- a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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.test;
-
-import junit.framework.Assert;
-
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Service;
-
-@Service(CallBackApiClient.class)
-public class CallBackApiClientImpl implements CallBackApiClient, CallBackApiCallBack {
-
- @Reference
- protected CallBackApiService aCallBackService;
-
- private static String returnMessage = null;
- private static int callBackCount = 0;
- private static Object monitor = new Object();
-
- /**
- * This test calls function test 3a,3a1,3b,3c
- */
- public void run() {
-
- // This tests basic callback patterns.
-
- // Test3a is the basic callback where the target calls back prior to
- // returning to the client.
- test3a();
-
- test3a1();
-
- // Test3b is where the target does not call back to the client.
- test3b();
-
- // Test3c is where the target calls back multiple times to the client.
- test3c();
-
- return;
- }
-
- /**
- * This test is the basic callback where the target calls back prior to returning to the client.
- */
-
- private void test3a() {
- aCallBackService.knockKnock("Knock Knock");
- int count = 0;
-
- //
- // If we cant get a response in 30 seconds consider this a failure
- //
-
- synchronized (monitor) {
- while (returnMessage == null && count++ < 30) {
- try {
- monitor.wait(1000L);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage());
-
- }
-
- /**
- * This test is the basic callback where the target calls back prior to returning to the client.
- */
- private void test3a1() {
- aCallBackService.knockKnockByRef("Knock Knock");
- int count = 0;
-
- //
- // If we cant get a response in 30 seconds consider this a failure
- //
-
- synchronized (monitor) {
- while (returnMessage == null && count++ < 30) {
- try {
- monitor.wait(1000L);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage());
-
- }
-
- /**
- * This test is the basic callback where the target does not call back to the client
- */
- private void test3b() {
- aCallBackService.noCallBack("No Reply Desired");
- Assert.assertEquals("CallBackApiITest - test3b", 1, 1);
- return;
- }
-
- /**
- * This test is the basic callback where the target calls back multiple times to the client
- */
-
- private void test3c() {
- aCallBackService.multiCallBack("Call me back 3 times");
- int count = 0;
-
- //
- // If we cant get a response in 30 seconds consider this a failure
- //
-
- synchronized (monitor) {
- while (this.getCallBackCount() < 3 && count++ < 30) {
- try {
- monitor.wait(1000L);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- Assert.assertEquals("CallBackApiITest - test3c", 3, this.getCallBackCount());
- return;
- }
-
- /**
- * This function returns a string
- *
- * @param void
- * @return String result string
- */
-
- public String getReturnMessage() {
- return returnMessage;
- }
-
- /**
- * This function set the returnMessage string
- *
- * @param String
- */
- public void setReturnMessage(String aReturnMessage) {
- returnMessage = aReturnMessage;
- }
-
- /**
- * This function returns the callBackCount variable
- *
- * @return Integer callBackCount variable
- */
- public int getCallBackCount() {
- return callBackCount;
- }
-
- /**
- * This function increments callBackCount variable by 1
- */
- public void incrementCallBackCount() {
- callBackCount++;
- }
-
- /**
- * This function prints a message synched with setReturnMessage function
- *
- * @param String
- */
- public void callBackMessage(String aString) {
- System.out.println("Entering callback callBackMessage: " + aString);
- synchronized (monitor) {
- this.setReturnMessage(aString);
- monitor.notify();
- }
- }
-
- /**
- * This function prints a message synched with incrementCallBackCount function
- *
- * @param String
- */
- public void callBackIncrement(String aString) {
- System.out.println("Entering callback increment: " + aString);
- synchronized (monitor) {
- this.incrementCallBackCount();
- monitor.notify();
- }
- }
-
-}
diff --git a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java b/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java
deleted file mode 100644
index 33de1e7739..0000000000
--- a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.test;
-
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-@Callback(CallBackApiCallBack.class)
-/**
- *
- */
-public interface CallBackApiService {
- /**
- * This function is defined in CallBackApiServiceImpl
- */
- public void knockKnock(String aString);
-
- /**
- * This function is defined in CallBackApiServiceImpl
- */
- public void knockKnockByRef(String aString);
-
- /**
- * This function is defined in CallBackApiServiceImpl
- */
- public void noCallBack(String aString);
-
- /**
- * This function is defined in CallBackApiServiceImpl
- */
- public void multiCallBack(String aString);
-
-}
diff --git a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java b/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java
deleted file mode 100644
index 202d346b47..0000000000
--- a/branches/sca-java-1.2.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.test;
-
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.RequestContext;
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Context;
-import org.osoa.sca.annotations.Service;
-
-@Service(CallBackApiService.class)
-public class CallBackApiServiceImpl implements CallBackApiService {
-
- @Context
- protected ComponentContext componentContext;
- /**
- * Object of CallBackApiCallBack class
- */
- private CallBackApiCallBack callback;
-
- @Callback
- protected CallableReference<CallBackApiCallBack> callbackRef;
-
- /**
- * This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function and calls the
- * callBackMessage function.
- *
- * @param aString String passed by a function call
- */
-
- public void knockKnock(String aString) {
-
- System.out.println("CallBackApiServiceImpl message received: " + aString);
- callback = this.getCallBackInterface();
- callback.callBackMessage("Who's There");
- System.out.println("CallBackApiServiceImpl response sent");
- return;
-
- }
-
- /**
- * This function calls the callBackMessage function. <br>
- * The reference to this function is recieved from Call back reference to the class CallBackApiService.
- *
- * @param aString String passed by a function call
- */
- public void knockKnockByRef(String aString) {
-
- System.out.println("CallBackApiServiceImpl message received: " + aString);
- callbackRef.getService().callBackMessage("Who's There");
- System.out.println("CallBackApiServiceImpl response sent");
- return;
-
- }
-
- /**
- * This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function. <br>
- * This function then places multiple callBack using the callbackIncrement function defined in
- * callBack.ApiServiceImpl
- *
- * @param aString String passed by a function call
- */
- public void multiCallBack(String aString) {
-
- callback = this.getCallBackInterface();
-
- System.out.println("CallBackApiServiceImpl message received: " + aString);
- callback.callBackIncrement("Who's There 1");
- System.out.println("CallBackApiServiceImpl response sent");
- callback.callBackIncrement("Who's There 2");
- System.out.println("CallBackApiServiceImpl response sent");
- callback.callBackIncrement("Who's There 3");
- System.out.println("CallBackApiServiceImpl response sent");
- return;
-
- }
-
- /**
- * This function does not callBack any function.
- *
- * @param aString String passed by a function call
- */
- public void noCallBack(String aString) {
-
- System.out.println("CallBackApiServiceImpl message received: " + aString);
-
- return;
-
- }
-
- /**
- * This function get an object of CallBackApiServiceImpl from the present componentContext
- *
- * @param void
- */
- private CallBackApiCallBack getCallBackInterface() {
- System.out.println("CallBackApiServiceImpl getting request context");
- RequestContext rc = componentContext.getRequestContext();
- System.out.println("CallBackApiServiceImpl getting callback from request context");
- callback = rc.getCallback();
- System.out.println("CallBackApiServiceImpl returning callback");
- return callback;
-
- }
-
-}