You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/10/18 16:53:14 UTC

svn commit: r585993 [1/2] - in /incubator/tuscany/java/sca/itest/conversations-ws: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/sca/ src/main/java/org/a...

Author: slaws
Date: Thu Oct 18 07:53:09 2007
New Revision: 585993

URL: http://svn.apache.org/viewvc?rev=585993&view=rev
Log:
TUSCANY-1857
Start of a test to run conversations over the web services binding. This is a straight copy of the conversation itest as quite a few strange things fails a the moment. Ultimately this can be merged back into the conversations itest so that we don;t have lots of duplicate code. 

Added:
    incubator/tuscany/java/sca/itest/conversations-ws/   (with props)
    incubator/tuscany/java/sca/itest/conversations-ws/pom.xml
    incubator/tuscany/java/sca/itest/conversations-ws/src/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/resources/
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/resources/ConversationAge.composite
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/resources/conversationId.composite
    incubator/tuscany/java/sca/itest/conversations-ws/src/main/resources/conversational.composite
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java
    incubator/tuscany/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java

Propchange: incubator/tuscany/java/sca/itest/conversations-ws/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 18 07:53:09 2007
@@ -0,0 +1,13 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules

Added: incubator/tuscany/java/sca/itest/conversations-ws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/pom.xml?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/pom.xml (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/pom.xml Thu Oct 18 07:53:09 2007
@@ -0,0 +1,58 @@
+<?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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-itest</artifactId>
+        <version>1.1-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>itest-conversations-ws</artifactId>
+    <name>Apache Tuscany SCA Conversations Over binding.ws Integration Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>1.1-incubating-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-axis2</artifactId>
+            <version>1.1-incubating-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-tomcat</artifactId>
+            <version>1.1-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>         
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.1-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,29 @@
+/*
+ * 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.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+public interface ConversationIdService {
+
+    String getCIDField();
+    String getCIDSetter();
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+	
+    public void init();
+    
+    public void destroy();
+    
+    public void initializeCount(int count);
+    
+    public void incrementCount();
+    
+    public int retrieveCount();
+    
+    public void businessException() throws Exception;        
+    
+    @EndsConversation
+    public String endConversation();
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,51 @@
+/*
+ * 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.conversational;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient { 
+	
+	public int runConversationFromInjectedReference();
+	public int runConversationFromInjectedReference2();
+	public int runConversationFromServiceReference();
+	public int runConversationWithUserDefinedConversationId();
+	public String runConversationCheckUserDefinedConversationId();	
+	public int runConversationCheckingScope();
+	public int runConversationWithCallback(); 
+	public int runConversationHavingPassedReference();
+	public String runConversationBusinessException();
+	public String runConversationBusinessExceptionCallback();
+	public int runConversationCallingEndedConversation();
+	public int runConversationCallingEndedConversationCallback();
+        public String runConversationCallingEndedConversationCheckConversationId(); 
+	public String runConversationCallingEndedConversationCallbackCheckConversationId();
+	public int runConversationAgeTimeout();
+	public int runConversationIdleTimeout();
+	public int runConversationPrincipleError();	
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient { 
+	
+    public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+	
+    //public void init();
+    
+    //public void destroy();
+    
+    public void initializeCount(int count);
+    
+    public void incrementCount();
+    
+    public int retrieveCount();
+    
+    //public void businessException() throws Exception;        
+    
+    public void initializeCountCallback(int count);
+    
+    public void incrementCountCallback();
+    
+    public int retrieveCountCallback();
+    
+    //public void businessExceptionCallback() throws Exception;    
+    
+    @EndsConversation
+    public String endConversation();
+    
+    public String endConversationCallback();
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(NonConversationalCallback.class)
+public interface ConversationalServiceNonConversationalCallback {
+	
+    public void init();
+    
+    public void destroy();
+    
+    public void initializeCount(int count);
+    
+    public void incrementCount();
+    
+    public int retrieveCount();
+    
+    public void businessException() throws Exception;        
+    
+    public void initializeCountCallback(int count);
+    
+    public void incrementCountCallback();
+    
+    public int retrieveCountCallback();
+    
+    public void businessExceptionCallback() throws Exception;    
+    
+    @EndsConversation
+    public String endConversation();
+    
+    public String endConversationCallback();
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface NonConversationalCallback {
+	
+    public void init();
+    
+    public void destroy();
+    
+    public void initializeCount(int count);
+    
+    public void incrementCount();
+    
+    public int retrieveCount();
+    
+    public void businessException() throws Exception;        
+    
+    public String endConversation();
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds")
+public class ConversationAgeComponentImpl implements ConversationalService {
+
+    private int count;
+    
+    public void businessException() throws Exception {   
+    }
+    
+    public void businessExceptionCallback() throws Exception {   
+    }      
+
+    public void destroy() {
+    }
+
+    public String endConversation() {
+        return null;
+    }
+
+    public String endConversationCallback() {
+        return null;
+    }
+
+    public void incrementCount() {
+    }
+
+    public void incrementCountCallback() {
+    }
+
+    public void init() {
+    }
+
+    public void initializeCount(int count) {
+        this.count = count;
+    }
+
+    public void initializeCountCallback(int count) {
+    }
+
+    public int retrieveCount() {
+        return count;
+    }
+
+    public int retrieveCountCallback() {
+        return 0;
+    }
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationIdService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationIdService.class)
+@Scope("CONVERSATION")
+public class ConversationIdComponentImpl implements ConversationIdService {
+
+    @ConversationID
+    public String cid;
+
+    private String setterCid;
+    
+    public String getCIDField() {
+        return cid;
+    }
+    public String getCIDSetter() {
+        return setterCid;
+    }
+    
+
+    @ConversationID
+    public void setCID(String cid) {
+        this.setterCid = cid;
+    }
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class ConversationMaxIdleComponentImpl implements ConversationalService {
+
+    private int count;
+
+    public void businessException() throws Exception {   
+    }
+    
+    public void businessExceptionCallback() throws Exception {   
+    }    
+    
+    public void destroy() {
+    }
+
+    public String endConversation() {
+        return null;
+    }
+
+    public String endConversationCallback() {
+        return null;
+    }
+
+    public void incrementCount() {
+    }
+
+    public void incrementCountCallback() {
+    }
+
+    public void init() {
+    }
+
+    public void initializeCount(int count) {
+        this.count = count;
+    }
+
+    public void initializeCountCallback(int count) {
+    }
+
+    public int retrieveCount() {
+        return count;
+    }
+
+    public int retrieveCountCallback() {
+        return 0;
+    }
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,321 @@
+/*
+ * 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+                        maxIdleTime="5 minutes",
+                        singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+    
+    @Context
+    protected ComponentContext componentContext;
+    
+    @Reference 
+    protected ConversationalService conversationalService;
+    
+    @Reference 
+    protected ConversationalService conversationalService2;
+    
+    @Reference
+    protected ConversationalReferenceClient conversationalReferenceClient;
+      
+    private int clientCount = 0;
+    private int callbackCount = 0;  
+    
+    
+    // a static member variable that records the number of times this service is called
+    public static StringBuffer calls = new StringBuffer();        
+	
+    // From ConversationalClient
+	public int runConversationFromInjectedReference(){
+	    calls.append("runConversationFromInjectedReference,");	    
+	    conversationalService.initializeCount(1);
+	    conversationalService.incrementCount();
+	    clientCount = conversationalService.retrieveCount();
+	    conversationalService.endConversation();
+	    
+	    return clientCount;
+	}
+    public int runConversationFromInjectedReference2(){
+        calls.append("runConversationFromInjectedReference2,");
+               
+        conversationalService2.initializeCount(1);
+        conversationalService2.incrementCount();
+        
+        // stick in a call to the first reference to 
+        // make sure the two references don't clash
+        conversationalService.initializeCount(1);
+        
+        clientCount = conversationalService2.retrieveCount();
+        conversationalService2.endConversation();
+        
+        // end the conversation through the first reference
+        conversationalService.endConversation();
+        
+        return clientCount;
+    }	
+    public int runConversationFromServiceReference(){
+        calls.append("runConversationFromServiceReference,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        // serviceReference.getConversation().end();
+        
+        return clientCount;
+    }	
+    public int runConversationWithUserDefinedConversationId(){
+        calls.append("runConversationWithUserDefinedConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation1");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        // serviceReference.getConversation().end();
+        
+        return clientCount;
+    }    
+    public String runConversationCheckUserDefinedConversationId(){
+        calls.append("runConversationCheckUserDefinedConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation2");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        
+        String clientConversationId = serviceReference.getConversationID().toString();
+        String serverConversationId = callableReference.endConversation();
+        
+        if (clientConversationId.equals("MyConversation2") &&
+            serverConversationId.equals("MyConversation2") ) {
+            return clientConversationId;
+        } else {
+            return "client = " + clientConversationId +
+                   "server = " + serverConversationId;
+        }  
+              
+    }      
+    public int runConversationCheckingScope(){
+        calls.append("runConversationCheckingScope,");
+        // run a conversation
+        return runConversationFromInjectedReference();
+        
+        // test will then use a static method to find out how many times 
+        // init/destroy were called
+    }    
+	public int runConversationWithCallback(){
+	    calls.append("runConversationWithCallback,");
+	    callbackCount = 2;
+        conversationalService.initializeCountCallback(1);
+        conversationalService.incrementCountCallback();
+        clientCount = conversationalService.retrieveCountCallback();
+        conversationalService.endConversationCallback();
+        
+        return clientCount;
+    } 
+    public int runConversationHavingPassedReference(){
+        calls.append("runConversationHavingPassedReference,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");       
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        conversationalReferenceClient.incrementCount(serviceReference);
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        serviceReference.getConversation().end();
+        
+        return clientCount;
+    }
+    public String runConversationBusinessException(){
+        calls.append("runConversationbusinessException,");      
+        try {
+            conversationalService.initializeCount(1);
+//            conversationalService.businessException();
+            clientCount = conversationalService.retrieveCount();
+            conversationalService.endConversation();
+        } catch(Exception ex) {
+            return ex.getMessage();
+        }
+         
+        return "No Exception Returned";
+    }
+    
+    public String runConversationBusinessExceptionCallback(){
+        calls.append("runConversationbusinessExceptionCallback,");
+        try {
+            conversationalService.initializeCountCallback(1);
+//            conversationalService.businessExceptionCallback();
+            clientCount = conversationalService.retrieveCountCallback();
+            conversationalService.endConversationCallback();
+        } catch(Exception ex) {
+            return ex.getMessage();
+        }
+         
+        return "No Exception Returned";
+    }   
+    
+    public int runConversationCallingEndedConversation(){
+        calls.append("runConversationCallingEndedConversation,");
+        conversationalService.initializeCount(1);
+        conversationalService.endConversation();
+        return conversationalService.retrieveCount();
+    }       
+    
+    public int runConversationCallingEndedConversationCallback(){
+        calls.append("runConversationCallingEndedConversationCallback,");
+        conversationalService.initializeCountCallback(1);
+        conversationalService.endConversationCallback();
+        return conversationalService.retrieveCountCallback();
+    } 
+     
+    public String runConversationCallingEndedConversationCheckConversationId(){
+        calls.append("runConversationCallingEndedConversationCheckConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation3");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        if (serviceReference.getConversation() ==null ) {
+            return null;
+        } else {
+            return serviceReference.getConversation().getConversationID().toString();
+        }
+    }    
+    
+    public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+        calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation3");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversationCallback();
+        
+        if (serviceReference.getConversation() ==null ) {
+            return null;
+        } else {
+            return serviceReference.getConversation().getConversationID().toString();
+        }
+    }    
+    
+    public int runConversationAgeTimeout(){
+        calls.append("runConversationAgeTimeout,");
+        // done in other testing
+        return clientCount;
+    }
+    public int runConversationIdleTimeout(){
+        calls.append("runConversationIdleTimeout,");
+        // done in other testing
+        return clientCount;
+    }
+    public int runConversationPrincipleError(){
+        calls.append("runConversationPrincipleError,");
+        // TODO - when policy framework is done
+        return clientCount;
+    }
+    
+    
+    // From ConversationalCallback
+    @Init
+    public void init(){
+        calls.append("init,");
+    }
+    
+    @Destroy
+    public void destroy(){
+        calls.append("destroy,"); 
+    }
+    
+    public void initializeCount(int count){
+        calls.append("initializeCount,");
+        callbackCount += count;
+    }
+    
+    public void incrementCount(){
+        calls.append("incrementCount,");
+        callbackCount++;
+    }
+    
+    public int retrieveCount(){
+        calls.append("retrieveCount,");
+        return  callbackCount;
+    }
+    
+    public void businessException() throws Exception {
+        throw new Exception("Business Exception");
+    }     
+    
+    public String endConversation(){
+        calls.append("endConversation,");
+        callbackCount = 0;
+        return null;
+    }
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,310 @@
+/*
+ * 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+                        maxIdleTime="5 minutes",
+                        singlePrincipal=false)
+public class ConversationalClientStatefulNonConversationalCallbackImpl implements ConversationalClient, NonConversationalCallback {
+    
+    @Context
+    protected ComponentContext componentContext;
+    
+    @Reference 
+    protected ConversationalService conversationalService;
+    
+    @Reference 
+    protected ConversationalService conversationalService2;
+    
+    @Reference
+    protected ConversationalReferenceClient conversationalReferenceClient;
+      
+    private int clientCount = 0;
+    private int callbackCount = 0;  
+    
+    
+    // a static member variable that records the number of times this service is called
+    public static StringBuffer calls = new StringBuffer();        
+	
+    // From ConversationalClient
+	public int runConversationFromInjectedReference(){
+	    calls.append("runConversationFromInjectedReference,");	    
+	    conversationalService.initializeCount(1);
+	    conversationalService.incrementCount();
+	    clientCount = conversationalService.retrieveCount();
+	    conversationalService.endConversation();
+	    
+	    return clientCount;
+	}
+    public int runConversationFromInjectedReference2(){
+        calls.append("runConversationFromInjectedReference2,");
+               
+        conversationalService2.initializeCount(1);
+        conversationalService2.incrementCount();
+        
+        // stick in a call to the first reference to 
+        // make sure the two references don't clash
+        conversationalService.initializeCount(1);
+        
+        clientCount = conversationalService2.retrieveCount();
+        conversationalService2.endConversation();
+        
+        // end the conversation through the first reference
+        conversationalService.endConversation();
+        
+        return clientCount;
+    }	
+    public int runConversationFromServiceReference(){
+        calls.append("runConversationFromServiceReference,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        // serviceReference.getConversation().end();
+        
+        return clientCount;
+    }	
+    public int runConversationWithUserDefinedConversationId(){
+        calls.append("runConversationWithUserDefinedConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation1");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        // serviceReference.getConversation().end();
+        
+        return clientCount;
+    }    
+    public String runConversationCheckUserDefinedConversationId(){
+        calls.append("runConversationCheckUserDefinedConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation2");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        return callableReference.endConversation();
+              
+    }      
+    public int runConversationCheckingScope(){
+        calls.append("runConversationCheckingScope,");
+        // run a conversation
+        return runConversationFromInjectedReference();
+        
+        // test will then use a static method to find out how many times 
+        // init/destroy were called
+    }    
+	public int runConversationWithCallback(){
+	    calls.append("runConversationWithCallback,");
+	    callbackCount = 2;
+        conversationalService.initializeCountCallback(1);
+        conversationalService.incrementCountCallback();
+        clientCount = conversationalService.retrieveCountCallback();
+        conversationalService.endConversationCallback();
+        
+        return clientCount;
+    } 
+    public int runConversationHavingPassedReference(){
+        calls.append("runConversationHavingPassedReference,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");       
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        conversationalReferenceClient.incrementCount(serviceReference);
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        // serviceReference.getConversation().end();
+        
+        return clientCount;
+    }
+    public String runConversationBusinessException(){
+        calls.append("runConversationbusinessException,");      
+        try {
+            conversationalService.initializeCount(1);
+//            conversationalService.businessException();
+            clientCount = conversationalService.retrieveCount();
+            conversationalService.endConversation();
+        } catch(Exception ex) {
+            return ex.getMessage();
+        }
+         
+        return "No Exception Returned";
+    }
+    
+    public String runConversationBusinessExceptionCallback(){
+        calls.append("runConversationbusinessExceptionCallback,");
+        try {
+            conversationalService.initializeCountCallback(1);
+//            conversationalService.businessExceptionCallback();
+            clientCount = conversationalService.retrieveCountCallback();
+            conversationalService.endConversationCallback();
+        } catch(Exception ex) {
+            return ex.getMessage();
+        }
+         
+        return "No Exception Returned";
+    }   
+    
+    public String runConversationCallingEndedConversationCheckConversationId(){
+        calls.append("runConversationCallingEndedConversationCheckConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation3");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        if (serviceReference.getConversation() ==null ) {
+            return null;
+        } else {
+            return serviceReference.getConversation().getConversationID().toString();
+        }
+    }    
+    
+    public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+        calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation3");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversationCallback();
+        
+        if (serviceReference.getConversation() ==null ) {
+            return null;
+        } else {
+            return serviceReference.getConversation().getConversationID().toString();
+        }
+    }     
+    
+    public int runConversationCallingEndedConversation(){
+        calls.append("runConversationCallingEndedConversation,");
+        conversationalService.initializeCount(1);
+        conversationalService.endConversation();
+        return conversationalService.retrieveCount();
+    }   
+    
+    public int runConversationCallingEndedConversationCallback(){
+        calls.append("runConversationCallingEndedConversationCallback,");
+        conversationalService.initializeCountCallback(1);
+        conversationalService.endConversationCallback();
+        return conversationalService.retrieveCountCallback();
+    }  
+    
+    public int runConversationAgeTimeout(){
+        calls.append("runConversationAgeTimeout,");
+        // done in other testing
+        return clientCount;
+    }
+    public int runConversationIdleTimeout(){
+        calls.append("runConversationIdleTimeout,");
+        // done in other testing
+        return clientCount;
+    }
+    public int runConversationPrincipleError(){
+        calls.append("runConversationPrincipleError,");
+        // TODO - when policy framework is done
+        return clientCount;
+    }
+    
+    
+    // From ConversationalCallback
+    @Init
+    public void init(){
+        calls.append("init,");
+    }
+    
+    @Destroy
+    public void destroy(){
+        calls.append("destroy,"); 
+    }
+    
+    public void initializeCount(int count){
+        calls.append("initializeCount,");
+        callbackCount += count;
+    }
+    
+    public void incrementCount(){
+        calls.append("incrementCount,");
+        callbackCount++;
+    }
+    
+    public int retrieveCount(){
+        calls.append("retrieveCount,");
+        return  callbackCount;
+    }
+    
+    public void businessException() throws Exception {
+        throw new Exception("Business Exception");
+    }     
+    
+    public String endConversation(){
+        calls.append("endConversation,");
+        return null;
+    }
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,317 @@
+/*
+ * 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+   
+    @Context
+    protected ComponentContext componentContext;
+    
+    @Reference 
+    protected ConversationalService conversationalService;
+    
+    @Reference 
+    protected ConversationalService conversationalService2;
+    
+    @Reference
+    protected ConversationalReferenceClient conversationalReferenceClient;
+    
+    private int clientCount = 0;
+    private int callbackCount = 0;
+    
+    // a static member variable that records the number of times this service is called
+    public static StringBuffer calls = new StringBuffer();    
+	
+    // From ConversationalClient
+    public int runConversationFromInjectedReference(){
+        calls.append("runConversationFromInjectedReference,");
+        conversationalService.initializeCount(1);
+        conversationalService.incrementCount();
+        clientCount = conversationalService.retrieveCount();
+        conversationalService.endConversation();
+        
+        return clientCount;
+    }
+    public int runConversationFromInjectedReference2(){
+        calls.append("runConversationFromInjectedReference2,");   
+
+        // now test the second reference        
+        conversationalService2.initializeCount(1);
+        conversationalService2.incrementCount();
+        
+        // stick in a call to the first reference to 
+        // make sure the two references don't clash
+        conversationalService.initializeCount(1);
+        
+        clientCount = conversationalService2.retrieveCount();
+        conversationalService2.endConversation();
+        
+        // end the conversation through the first reference
+        conversationalService.endConversation();
+        
+        return clientCount;
+    }
+    public int runConversationFromServiceReference(){
+        calls.append("runConversationFromServiceReference,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");       
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        // serviceReference.getConversation().end();
+        
+        return clientCount;
+    }   
+    public int runConversationWithUserDefinedConversationId(){
+        calls.append("runConversationWithUserDefinedConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation1");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        // serviceReference.getConversation().end();
+        
+        return clientCount;
+    }    
+    public String runConversationCheckUserDefinedConversationId(){
+        calls.append("runConversationCheckUserDefinedConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation2");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        
+        String clientConversationId = serviceReference.getConversationID().toString();
+        String serverConfersationId = callableReference.endConversation();
+        
+        if (clientConversationId.equals("MyConversation2") &&
+            serverConfersationId.equals("MyConversation2") ) {
+            return clientConversationId;
+        } else {
+            return "client = " + clientConversationId +
+                   "server = " + serverConfersationId;
+        }     
+    }     
+    public int runConversationCheckingScope(){
+        calls.append("runConversationCheckingScope,");
+        // run a conversation
+        return runConversationFromInjectedReference();
+        
+        // test will then use a static method to find out how many times 
+        // init/destroy were called
+    }
+    public int runConversationWithCallback(){
+        calls.append("runConversationWithCallback,");
+        conversationalService.initializeCountCallback(1);
+        conversationalService.incrementCountCallback();
+        clientCount = conversationalService.retrieveCountCallback();
+        conversationalService.endConversationCallback();
+        
+        return clientCount;
+    } 
+    
+    public int runConversationHavingPassedReference(){
+        calls.append("runConversationHavingPassedReference,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");       
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        conversationalReferenceClient.incrementCount(serviceReference);
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        serviceReference.getConversation().end();
+        
+        return clientCount;
+    }	
+    
+    public String runConversationBusinessException(){
+	    calls.append("runConversationbusinessException,");	    
+	    try {
+            conversationalService.initializeCount(1);
+//            conversationalService.businessException();
+            clientCount = conversationalService.retrieveCount();
+            conversationalService.endConversation();
+	    } catch(Exception ex) {
+	        return ex.getMessage();
+	    }
+         
+        return "No Exception Returned";
+    }
+	
+    public String runConversationBusinessExceptionCallback(){
+        calls.append("runConversationbusinessExceptionCallback,");
+        try {
+            conversationalService.initializeCountCallback(1);
+//            conversationalService.businessExceptionCallback();
+            clientCount = conversationalService.retrieveCountCallback();
+            conversationalService.endConversationCallback();
+        } catch(Exception ex) {
+            return ex.getMessage();
+        }
+         
+        return "No Exception Returned";
+    }	
+	
+    public int runConversationCallingEndedConversation(){
+        calls.append("runConversationCallingEndedConversation,");
+        conversationalService.initializeCount(1);
+        conversationalService.endConversation();
+        return conversationalService.retrieveCount();
+    }   
+    
+    public int runConversationCallingEndedConversationCallback(){
+        calls.append("runConversationCallingEndedConversationCallback,");
+        conversationalService.initializeCountCallback(1);
+        conversationalService.endConversationCallback();
+        return conversationalService.retrieveCountCallback();
+    }   
+    
+    public String runConversationCallingEndedConversationCheckConversationId(){
+        calls.append("runConversationCallingEndedConversationCheckConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation3");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversation();
+        
+        if (serviceReference.getConversation() ==null ) {
+            return null;
+        } else {
+            return serviceReference.getConversation().getConversationID().toString();
+        }
+    }    
+    
+    public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+        calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+        ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class, 
+                                                                                                        "conversationalService");
+        serviceReference.setConversationID("MyConversation3");
+        
+        ConversationalService callableReference = serviceReference.getService();
+        
+        callableReference.initializeCount(1);
+        callableReference.incrementCount();
+        clientCount = callableReference.retrieveCount();
+        callableReference.endConversationCallback();
+        
+        if (serviceReference.getConversation() ==null ) {
+            return null;
+        } else {
+            return serviceReference.getConversation().getConversationID().toString();
+        } 
+    }    
+    
+    public int runConversationAgeTimeout(){
+        calls.append("runConversationAgeTimeout,");
+        // done in other testing
+        return clientCount;
+    }
+    public int runConversationIdleTimeout(){
+        calls.append("runConversationIdleTimeout,");
+        // done in other testing
+        return clientCount;
+    }
+    public int runConversationPrincipleError(){
+        calls.append("runConversationPrincipleError,");
+        // TODO - when policy framework is done
+        return clientCount;
+    }
+    
+    
+    // From ConversationalCallback
+    @Init
+    public void init(){
+        calls.append("init,");
+
+    }
+    
+    @Destroy
+    public void destroy(){
+        calls.append("destroy,");
+        
+    }
+    
+    public void initializeCount(int count){
+        calls.append("initializeCount,");
+        callbackCount = 0;
+    }
+    
+    public void incrementCount(){
+        calls.append("incrementCount,");
+        callbackCount++;
+    }
+    
+    public int retrieveCount(){
+        calls.append("retrieveCount,");
+        return  callbackCount;
+    }
+    
+    public void businessException() throws Exception {
+        throw new Exception("Business Exception");
+    }     
+    
+    public String endConversation(){
+        calls.append("endConversation,");
+        callbackCount = 0;
+        return null;
+    }
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+   
+    public void incrementCount(CallableReference<ConversationalService> conversationalService){
+        ConversationalService callableReference = conversationalService.getService();
+        
+        callableReference.incrementCount();        
+    }
+
+
+}

Added: incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java?rev=585993&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java (added)
+++ incubator/tuscany/java/sca/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java Thu Oct 18 07:53:09 2007
@@ -0,0 +1,123 @@
+/*
+ * 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.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("REQUEST")
+public class ConversationalServiceRequestImpl implements ConversationalService {
+    
+    @ConversationID
+    protected String conversationId;
+    
+    @Callback
+    protected ConversationalCallback conversationalCallback; 
+    
+    // static area in which to hold conversational data
+    private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+   
+    // a static member variable that records the number of times this service is called
+    public static StringBuffer calls = new StringBuffer();
+   
+    @Init
+    public void init(){
+        calls.append("init,");
+    }
+    
+    @Destroy
+    public void destroy(){
+        calls.append("destroy,");
+    }
+    
+    public void initializeCount(int count){
+        calls.append("initializeCount,");
+        Integer conversationalCount = new Integer(count); 
+        conversationalState.put(conversationId, conversationalCount);
+    }
+    
+    public void incrementCount(){
+        calls.append("incrementCount,");
+        Integer conversationalCount = conversationalState.get(conversationId);
+        conversationalCount++;
+        conversationalState.put(conversationId, conversationalCount);
+    }
+    
+    public int retrieveCount(){
+        calls.append("retrieveCount,");
+        Integer count = conversationalState.get(conversationId);
+        if (count != null){
+            return count.intValue();
+        } else {
+            return -999;
+        }
+    }
+    
+    public void businessException() throws Exception {
+        throw new Exception("Business Exception");
+    }    
+    
+    public void initializeCountCallback(int count){
+        calls.append("initializeCountCallback,");
+        initializeCount(count);
+        conversationalCallback.initializeCount(count);
+    }
+    
+    public void incrementCountCallback(){
+        calls.append("incrementCountCallback,");
+        incrementCount();
+        conversationalCallback.incrementCount();
+    }
+    
+    public int retrieveCountCallback(){
+        calls.append("retrieveCountCallback,");
+        return conversationalCallback.retrieveCount();
+    }
+    
+    public void businessExceptionCallback() throws Exception {
+        calls.append("businessExceptionCallback,");        
+        conversationalCallback.businessException();
+    }
+    
+    public String endConversation(){
+        calls.append("endConversation,");
+        conversationalState.remove(conversationId);
+        return conversationId;
+    }
+    
+    public String endConversationCallback(){
+        calls.append("endConversationCallback,");       
+        return conversationalCallback.endConversation();
+    }   
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org