From ebb89430400c2cb1d1c74ca18927375ff41601cc Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 5 Feb 2009 07:55:03 +0000 Subject: Move the contrib folder out of the sca trunk build as discussed on the ML git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@741038 13f79535-47bb-0310-9956-ffa450edef68 --- java/sca/contrib/itest/serialization/pom.xml | 66 ---------- .../servicereference/ConversationalService.java | 81 ------------ .../ConversationalServiceCallback.java | 37 ------ .../ConversationalServiceImpl.java | 141 -------------------- .../itest/servicereference/SCAManagedClient.java | 51 -------- .../servicereference/SCAManagedClientImpl.java | 115 ---------------- .../SCAManagedConversationalClient.java | 55 -------- .../SCAManagedConversationalClientImpl.java | 132 ------------------- .../itest/servicereference/StatelessService.java | 46 ------- .../servicereference/StatelessServiceCallback.java | 34 ----- .../servicereference/StatelessServiceImpl.java | 82 ------------ .../utils/ServiceReferenceUtils.java | 127 ------------------ .../ServiceReferenceSerializationTest.composite | 45 ------- .../src/main/resources/nestedcomposite.composite | 33 ----- .../SerializeServiceReferenceTestCase.java | 145 --------------------- 15 files changed, 1190 deletions(-) delete mode 100644 java/sca/contrib/itest/serialization/pom.xml delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalService.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceCallback.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceImpl.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClient.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClientImpl.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClient.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClientImpl.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessService.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceCallback.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceImpl.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/utils/ServiceReferenceUtils.java delete mode 100644 java/sca/contrib/itest/serialization/src/main/resources/ServiceReferenceSerializationTest.composite delete mode 100644 java/sca/contrib/itest/serialization/src/main/resources/nestedcomposite.composite delete mode 100644 java/sca/contrib/itest/serialization/src/test/java/org/apache/tuscany/sca/itest/servicereference/SerializeServiceReferenceTestCase.java (limited to 'java/sca/contrib/itest/serialization') diff --git a/java/sca/contrib/itest/serialization/pom.xml b/java/sca/contrib/itest/serialization/pom.xml deleted file mode 100644 index 625bcf4154..0000000000 --- a/java/sca/contrib/itest/serialization/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-itest - 2.0-SNAPSHOT - ../pom.xml - - itest-serialization - Apache Tuscany SCA Serialization Integration Tests - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-binding-sca-axis2 - 2.0-SNAPSHOT - test - - - diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalService.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalService.java deleted file mode 100644 index 3c643436e9..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalService.java +++ /dev/null @@ -1,81 +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.itest.servicereference; - -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Conversational; - -/** - * A very simple Conversational Service - * - * @version $Date$ $Revision$ - */ -@Conversational -@Callback(ConversationalServiceCallback.class) -public interface ConversationalService { - - /** - * Default value for the user data - * - * @See {@link #getUserData()} - * @See {@link #setUserData(String)} - */ - String DEFAULT_USER_DATA = "NOT SET"; - - /** - * Retrieves the conversation ID for this Service - * - * @return The conversation ID for this Service - */ - Object getConversationID(); - - /** - * Creates a self reference to this Service - * - * @return A self reference to this Service - */ - ServiceReference createSelfRef(); - - /** - * Sets some user data on the instance - * - * @param a_Data Some data - * - * @See {@link #getUserData()} - */ - void setUserData(String a_Data); - - /** - * Gets some user data on the instance - * - * @return Some data - * - * @See {@link #setUserData(String)} - */ - String getUserData(); - - /** - * Method that triggers the callback. - * - * @param msg A message to pass with the callback - * @throws Exception Test failed - */ - void triggerCallback(String msg) throws Exception; -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceCallback.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceCallback.java deleted file mode 100644 index 4d75c68c2d..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceCallback.java +++ /dev/null @@ -1,37 +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.itest.servicereference; - -import org.oasisopen.sca.annotation.Conversational; - -/** - * This is the callback for the ConversationalService. - * - * @version $Rev$ $Date$ - */ -@Conversational -public interface ConversationalServiceCallback { - - /** - * Simple callback method. - * - * @param msg The message for the call back - */ - void callback(String msg); -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceImpl.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceImpl.java deleted file mode 100644 index b129cbc4b7..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/ConversationalServiceImpl.java +++ /dev/null @@ -1,141 +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.itest.servicereference; - -import org.apache.tuscany.sca.itest.servicereference.utils.ServiceReferenceUtils; -import org.junit.Assert; -import org.oasisopen.sca.CallableReference; -import org.oasisopen.sca.ComponentContext; -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Context; -import org.oasisopen.sca.annotation.ConversationID; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * Simple conversational Service implementation - * - * @version $Date$ $Revision$ - */ -@Service(ConversationalService.class) -@Scope("CONVERSATION") -public class ConversationalServiceImpl implements ConversationalService { - - /** - * The Conversation ID - */ - private Object m_ConversationID; - - /** - * Injected reference to the call back. - */ - @Callback - protected CallableReference theCallbackRef; - - /** - * Injected reference to the ComponentContext. - */ - @Context - protected ComponentContext m_Ctx; - - /** - * Some user data - */ - private String m_UserData = DEFAULT_USER_DATA; - - /** - * Constructor - */ - public ConversationalServiceImpl() { - } - - /** - * Used to inject the Conversation ID - * - * @param a_ConversationID the Conversation ID - */ - @ConversationID - public void setConversationID(Object a_ConversationID) { - m_ConversationID = a_ConversationID; - } - - /** - * Retrieves the conversation ID for this Service - * - * @return The conversation ID for this Service - */ - public Object getConversationID() { - return m_ConversationID; - } - - /** - * Creates a self reference to this Service - * - * @return A self reference to this Service - */ - public ServiceReference createSelfRef() { - return m_Ctx.createSelfReference(ConversationalService.class); - } - - /** - * Sets some user data on the instance - * - * @param a_Data Some data - * - * @See {@link #getUserData()} - */ - public void setUserData(String a_Data) { - m_UserData = a_Data; - } - - /** - * Gets some user data on the instance - * - * @return Some data - * - * @See {@link #setUserData(String)} - */ - public String getUserData() { - return m_UserData; - } - - /** - * Method that triggers the callback. - * - * @param msg A message to pass with the callback - * @throws Exception Test failed - */ - public void triggerCallback(String msg) throws Exception { - Assert.assertNotNull(theCallbackRef); - - // Serialize the CallableReference - byte[] serializedCR = ServiceReferenceUtils.serialize(theCallbackRef); - Assert.assertNotNull(serializedCR); - - // Deserlaize the CallableReference - CallableReference cr = ServiceReferenceUtils.deserializeCallableReference(serializedCR); - Assert.assertNotNull(cr); - CallableReference regotCallbackRef - = (CallableReference) cr; - - // Use the deseralized CallbackReference - regotCallbackRef.getService().callback(msg); - } -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClient.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClient.java deleted file mode 100644 index c268f9bda7..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClient.java +++ /dev/null @@ -1,51 +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.itest.servicereference; - - -/** - * This is a test client that is used to test Serializing and Deserializing - * ServiceReferences within a SCA Application - * - * @version $Date$ $Revision$ - */ -public interface SCAManagedClient { - - /** - * Tests Serializing a Stateless ServiceReference - * - * @throws Exception Test failed - */ - void testSerializeStatelessServiceReference() throws Exception; - - /** - * Tests Serializing a Nested Stateless ServiceReference. - * - * @throws Exception Test failed - */ - void testSerializeNestedStatelessServiceReference() throws Exception; - - /** - * Tests Serializing a Callback to a Stateless Service as managed - * SCA code - * - * @throws Exception Test failed - */ - void testSerializeCallbackToStatelessServiceInsideSCA() throws Exception; -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClientImpl.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClientImpl.java deleted file mode 100644 index 64c5e7e631..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedClientImpl.java +++ /dev/null @@ -1,115 +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.itest.servicereference; - -import org.apache.tuscany.sca.itest.servicereference.utils.ServiceReferenceUtils; -import org.junit.Assert; -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -/** - * This is a test client that is used to test Serializing and Deserializing - * ServiceReferences within a SCA Application - * - * @version $Date$ $Revision$ - */ -@Service(SCAManagedClient.class) -public class SCAManagedClientImpl implements SCAManagedClient, StatelessServiceCallback { - - /** - * Injected reference to the StatelessService - */ - @Reference(name = "statelessService") - protected ServiceReference statelessServiceRef; - - /** - * Injected reference to the Nested StatelessService. - */ - @Reference(name = "nestedStatelessService") - protected ServiceReference nestedStatelessServiceRef; - - /** - * Tests Serializing a Stateless ServiceReference - * - * @throws Exception Test failed - */ - public void testSerializeStatelessServiceReference() throws Exception { - doTestSerializeStatelessServiceReference(statelessServiceRef); - } - - /** - * Tests Serializing a Nested Stateless ServiceReference. - * - * @throws Exception Test failed - */ - public void testSerializeNestedStatelessServiceReference() throws Exception { - doTestSerializeStatelessServiceReference(nestedStatelessServiceRef); - } - - /** - * Tests Serializing a Stateless ServiceReference. - * - * @throws Exception Test failed - */ - private void doTestSerializeStatelessServiceReference( - ServiceReference aServiceRef) throws Exception { - Assert.assertNotNull(aServiceRef); - - StatelessService service = aServiceRef.getService(); - service.getCurrentTime(); - - // Serialize the ServiceReference - byte[] serializedSR = ServiceReferenceUtils.serialize(aServiceRef); - Assert.assertNotNull(serializedSR); - - // Deserialize the ServiceReference - ServiceReference deserializedSR = ServiceReferenceUtils.deserializeServiceReference(serializedSR); - Assert.assertNotNull(deserializedSR); - ServiceReference regotServiceRef = (ServiceReference) deserializedSR; - Assert.assertNotNull(regotServiceRef); - - // Use the ServiceReference to access the Service. - StatelessService regotService = regotServiceRef.getService(); - Assert.assertNotNull(regotService); - } - - /** - * Simple callback method - * - * @param msg The call back message - */ - public void callback(String msg) { - System.out.println("Stateless Callback with message " + msg); - } - - /** - * Tests Serializing a Callback to a Stateless Service as managed - * SCA code - * - * @throws Exception Test failed - */ - public void testSerializeCallbackToStatelessServiceInsideSCA() throws Exception { - Assert.assertNotNull(statelessServiceRef); - - StatelessService service = statelessServiceRef.getService(); - String msg = "A message for the callback " + System.currentTimeMillis(); - service.triggerCallback(msg); - } -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClient.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClient.java deleted file mode 100644 index b233241514..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClient.java +++ /dev/null @@ -1,55 +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.itest.servicereference; - -import org.oasisopen.sca.annotation.Conversational; - - -/** - * This is a test client that is used to test Serializing and Deserializing - * ServiceReferences within a SCA Application where the client that the Callback - * is referring is actually Conversational. - * - * @version $Rev$ $Date$ - */ -@Conversational -public interface SCAManagedConversationalClient { - - /** - * Tests Serializing a Conversational ServiceReference. - * - * @throws Exception Test failed - */ - void testSerializeConversationalServiceReference() throws Exception; - - /** - * Tests Serializing a Nested Conversational ServiceReference. - * - * @throws Exception Test failed - */ - void testSerializeNestedConversationalServiceReference() throws Exception; - - /** - * Tests Serializing a Callback to a Conversational Service as managed - * SCA code. - * - * @throws Exception Test failed - */ - void testSerializeCallbackToConversationalServiceInsideSCA() throws Exception; -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClientImpl.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClientImpl.java deleted file mode 100644 index 9e55eea7ee..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/SCAManagedConversationalClientImpl.java +++ /dev/null @@ -1,132 +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.itest.servicereference; - -import org.apache.tuscany.sca.itest.servicereference.utils.ServiceReferenceUtils; -import org.junit.Assert; -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * This is a test client that is used to test Serializing and Deserializing - * ServiceReferences within a SCA Application - * - * @version $Rev$ $Date$ - */ -@Service(SCAManagedConversationalClient.class) -@Scope("CONVERSATION") -public class SCAManagedConversationalClientImpl implements SCAManagedConversationalClient, ConversationalServiceCallback { - - /** - * Injected reference to the ConversationalService. - */ - @Reference(name = "conversationalService") - protected ServiceReference conversationalServiceRef; - - /** - * Injected reference to the ConversationalService. - */ - @Reference(name = "nestedConversationalService") - protected ServiceReference nestedConversationalServiceRef; - - /** - * This is the message that we sent to the callback. - */ - private String messageSentToCallback; - - /** - * Tests Serializing a Conversational ServiceReference. - * - * @throws Exception Test failed - */ - public void testSerializeConversationalServiceReference() throws Exception { - doTestSerializeConversationalServiceReference(conversationalServiceRef); - } - - /** - * Tests Serializing a Nested Conversational ServiceReference. - * - * @throws Exception Test failed - */ - public void testSerializeNestedConversationalServiceReference() throws Exception { - doTestSerializeConversationalServiceReference(nestedConversationalServiceRef); - } - - /** - * Test Serializing a Conversational ServiceReference. - * - * @param aServiceRef The Reference to Serialize - * @throws Exception Test failed. - */ - private void doTestSerializeConversationalServiceReference(ServiceReference aServiceRef) throws Exception { - Assert.assertNotNull(aServiceRef); - - ConversationalService service = aServiceRef.getService(); - Object origConvID = service.getConversationID(); - Assert.assertNotNull(origConvID); - - // Serialize the ServiceReference - byte[] serializedSR = ServiceReferenceUtils.serialize(aServiceRef); - Assert.assertNotNull(serializedSR); - - // Deserialize the ServiceReference - ServiceReference deserializedSR = ServiceReferenceUtils.deserializeServiceReference(serializedSR); - Assert.assertNotNull(deserializedSR); - ServiceReference regotServiceRef = (ServiceReference) deserializedSR; - Assert.assertNotNull(regotServiceRef); - - // Use the ServiceReference to access the Service. - ConversationalService regotService = regotServiceRef.getService(); - Assert.assertNotNull(regotService); - Object regotConvID = regotService.getConversationID(); - Assert.assertNotNull(regotConvID); - - // Make sure we have the same Conversation ID - Assert.assertEquals(origConvID, regotConvID); - } - - - /** - * Tests Serializing a Callback to a Conversational Service as managed - * SCA code. - * - * @throws Exception Test failed - */ - public void testSerializeCallbackToConversationalServiceInsideSCA() throws Exception { - Assert.assertNotNull(conversationalServiceRef); - - ConversationalService service = conversationalServiceRef.getService(); - messageSentToCallback = "A message for the callback " + System.currentTimeMillis(); - service.triggerCallback(messageSentToCallback); - } - - /** - * Simple callback method. - * - * @param msg The call back message - */ - public void callback(String msg) { - System.out.println("Stateless Callback with message " + msg); - - // Make sure we received the message we expected - Assert.assertEquals(messageSentToCallback, msg); - } -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessService.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessService.java deleted file mode 100644 index 804debf30c..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessService.java +++ /dev/null @@ -1,46 +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.itest.servicereference; - -import org.oasisopen.sca.annotation.Callback; - - -/** - * A very simple Stateless Service - * - * @version $Date$ $Revision$ - */ -@Callback(StatelessServiceCallback.class) -public interface StatelessService { - - /** - * Gets the current time - * - * @return The current time - */ - String getCurrentTime(); - - /** - * Method that triggers the callback - * - * @param msg A message to pass with the callback - * @throws Exception Test failed - */ - void triggerCallback(String msg) throws Exception; -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceCallback.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceCallback.java deleted file mode 100644 index ffe3a3b8ef..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceCallback.java +++ /dev/null @@ -1,34 +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.itest.servicereference; - -/** - * This is the callback for the StatelessService - * - * @version $Date$ $Revision$ - */ -public interface StatelessServiceCallback { - - /** - * Simple callback method - * - * @param msg The message for the call back - */ - void callback(String msg); -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceImpl.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceImpl.java deleted file mode 100644 index 795f2d9c46..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/StatelessServiceImpl.java +++ /dev/null @@ -1,82 +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.itest.servicereference; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.tuscany.sca.itest.servicereference.utils.ServiceReferenceUtils; -import org.junit.Assert; -import org.oasisopen.sca.CallableReference; -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Service; - -/** - * Simple Stateless Service implementation - * - * @version $Date$ $Revision$ - */ -@Service(StatelessService.class) -public class StatelessServiceImpl implements StatelessService { - - /** - * Injected reference to the call back - */ - @Callback - protected CallableReference theCallbackRef; - - /** - * Constructor - */ - public StatelessServiceImpl() { - } - - /** - * Gets the current time - * - * @return The current time - */ - public String getCurrentTime() { - SimpleDateFormat sdf = new SimpleDateFormat(); - return sdf.format(new Date()); - } - - /** - * Method that triggers the callback - * - * @param msg A message to pass with the callback - * @throws Exception Test failed - */ - public void triggerCallback(String msg) throws Exception { - Assert.assertNotNull(theCallbackRef); - - // Serialize the CallableReference - byte[] serializedCR = ServiceReferenceUtils.serialize(theCallbackRef); - Assert.assertNotNull(serializedCR); - - // Deserlaize the CallableReference - CallableReference cr = ServiceReferenceUtils.deserializeCallableReference(serializedCR); - Assert.assertNotNull(cr); - CallableReference regotCallbackRef - = (CallableReference) cr; - - // Use the deseralized CallbackReference - regotCallbackRef.getService().callback(msg); - } -} diff --git a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/utils/ServiceReferenceUtils.java b/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/utils/ServiceReferenceUtils.java deleted file mode 100644 index bb8d40e788..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/java/org/apache/tuscany/sca/itest/servicereference/utils/ServiceReferenceUtils.java +++ /dev/null @@ -1,127 +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.itest.servicereference.utils; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.oasisopen.sca.CallableReference; -import org.oasisopen.sca.ServiceReference; - -/** - * Utility methods that are used by the ServiceReference Serialization tests - * - * @version $Date $Revision$ - */ -public final class ServiceReferenceUtils { - - /** - * Constructor - */ - private ServiceReferenceUtils() { - } - - /** - * Serializes the specified Object to a byte[] - * - * @param obj The Object to Serialize - * @return The Serialized Object as a byte[] - * @throws IOException Failed to Serialize the Object - */ - public static byte[] serialize(Object obj) throws IOException { - ByteArrayOutputStream bos = null; - try { - ObjectOutputStream oos = null; - bos = new ByteArrayOutputStream(); - try { - oos = new ObjectOutputStream(bos); - oos.writeObject(obj); - oos.flush(); - } finally { - if (oos != null) { - oos.close(); - } - } - } finally { - if (bos != null) { - bos.close(); - } - } - - return bos.toByteArray(); - } - - /** - * Deserializes the specified byte[] into a ServiceReference - * - * @param serializedSR The Serialized ServiceReference to deserialize - * @return The deserialized ServiceReference - * @throws IOException Failed to deserialize the ServiceReference - * @throws ClassNotFoundException Failed to deserialize the ServiceReference - */ - public static ServiceReference deserializeServiceReference(byte[] serializedSR) - throws IOException, ClassNotFoundException { - return (ServiceReference) deserialize(serializedSR); - } - - /** - * Deserializes the specified byte[] into a CallableReference - * - * @param callableRef The Serialized CallableReference to deserialize - * @return The deserialized ServiceReference - * @throws IOException Failed to deserialize the CallableReference - * @throws ClassNotFoundException Failed to deserialize the CallableReference - */ - public static CallableReference deserializeCallableReference(byte[] callableRef) - throws IOException, ClassNotFoundException { - return (CallableReference) deserialize(callableRef); - } - - /** - * Deserializes the specified byte[] into an Object - * - * @param serializedObj The Serialized Object to deserialize - * @return The deserialized Object - * @throws IOException Failed to deserialize the Object - * @throws ClassNotFoundException Failed to deserialize the Object - */ - public static Object deserialize(byte[] serializedSR) throws IOException, ClassNotFoundException { - ByteArrayInputStream bis = null; - try { - ObjectInputStream ois = null; - bis = new ByteArrayInputStream(serializedSR); - try { - ois = new ObjectInputStream(bis); - Object obj = ois.readObject(); - return obj; - } finally { - if (ois != null) { - ois.close(); - } - } - } finally { - if (bis != null) { - bis.close(); - } - } - } -} diff --git a/java/sca/contrib/itest/serialization/src/main/resources/ServiceReferenceSerializationTest.composite b/java/sca/contrib/itest/serialization/src/main/resources/ServiceReferenceSerializationTest.composite deleted file mode 100644 index 28c32d6fa4..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/resources/ServiceReferenceSerializationTest.composite +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/contrib/itest/serialization/src/main/resources/nestedcomposite.composite b/java/sca/contrib/itest/serialization/src/main/resources/nestedcomposite.composite deleted file mode 100644 index 8e1a132b0a..0000000000 --- a/java/sca/contrib/itest/serialization/src/main/resources/nestedcomposite.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/java/sca/contrib/itest/serialization/src/test/java/org/apache/tuscany/sca/itest/servicereference/SerializeServiceReferenceTestCase.java b/java/sca/contrib/itest/serialization/src/test/java/org/apache/tuscany/sca/itest/servicereference/SerializeServiceReferenceTestCase.java deleted file mode 100644 index 76e77284fb..0000000000 --- a/java/sca/contrib/itest/serialization/src/test/java/org/apache/tuscany/sca/itest/servicereference/SerializeServiceReferenceTestCase.java +++ /dev/null @@ -1,145 +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.itest.servicereference; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * A test case that will attempt to Serialize and Deserialize Service References - * - * @version $Date$ $Revision$ - */ -public class SerializeServiceReferenceTestCase { - /** - * Reference to the SCA Domain - */ - private static SCADomain domain; - - /** - * Initialise the SCA Domain - * - * @throws Exception Failed to initialise the SCA Domain - */ - @BeforeClass - public static void init() throws Exception { - domain = SCADomain.newInstance("ServiceReferenceSerializationTest.composite"); - Assert.assertNotNull(domain); - } - - /** - * Shutdown the SCA Domain - * - * @throws Exception Failed to shutdown the SCA Domain - */ - @AfterClass - public static void destroy() throws Exception { - if (domain != null) { - domain.close(); - } - } - - /** - * Tests Serializing a Stateless ServiceReference as managed - * SCA code - * - * @throws Exception Test failed - */ - @Test - public void testSerializeStatelessServiceReferenceInsideSCA() throws Exception { - SCAManagedClient client = domain.getService( - SCAManagedClient.class, "SCAManagedClientComponent"); - - client.testSerializeStatelessServiceReference(); - } - - /** - * Tests Serializing a Nested Stateless ServiceReference as managed - * SCA code. - * - * @throws Exception Test failed - */ - @Test - public void testSerializeNestedStatelessServiceReferenceInsideSCA() throws Exception { - SCAManagedClient client = domain.getService( - SCAManagedClient.class, "SCAManagedClientComponent"); - - client.testSerializeNestedStatelessServiceReference(); - } - - /** - * Tests Serializing a Conversational ServiceReference as managed - * SCA code - * - * @throws Exception Test failed - */ - @Test - public void testSerializeConversationalServiceReferenceInsideSCA() throws Exception { - SCAManagedConversationalClient client = domain.getService( - SCAManagedConversationalClient.class, "SCAManagedConversationalClientComponent"); - - client.testSerializeConversationalServiceReference(); - } - - /** - * Tests Serializing a Nested Conversational ServiceReference as managed - * SCA code. - * - * @throws Exception Test failed - */ - @Test - public void testSerializeNestedConversationalServiceReferenceInsideSCA() throws Exception { - SCAManagedConversationalClient client = domain.getService( - SCAManagedConversationalClient.class, "SCAManagedConversationalClientComponent"); - - client.testSerializeNestedConversationalServiceReference(); - } - - /** - * Tests Serializing a Callback to a Stateless Service as managed - * SCA code - * - * @throws Exception Test failed - */ - @Test - public void testSerializeCallbackToStatelessServiceInsideSCA() throws Exception { - SCAManagedClient client = domain.getService( - SCAManagedClient.class, "SCAManagedClientComponent"); - - client.testSerializeCallbackToStatelessServiceInsideSCA(); - } - - /** - * Tests Serializing a Callback to a Conversational Service as managed - * SCA code. - * - * @throws Exception Test failed - */ - @Test - public void testSerializeCallbackToConversationalServiceInsideSCA() throws Exception { - SCAManagedConversationalClient client = domain.getService( - SCAManagedConversationalClient.class, "SCAManagedConversationalClientComponent"); - - client.testSerializeCallbackToConversationalServiceInsideSCA(); - } -} -- cgit v1.2.3