From c4a6a944e93fa338c196ad5c16d5c844d4b2d09c Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 17 Mar 2009 12:05:24 +0000 Subject: Copy sca trunk to sandbox area so i can get the release plugin configuration correct without messing up the live trunk git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@755209 13f79535-47bb-0310-9956-ffa450edef68 --- .../conversation/lifetime/LifetimeTestCase.java | 216 +++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 sandbox/ant/sca/trunk/vtest/java-api/conversation/lifetime/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/LifetimeTestCase.java (limited to 'sandbox/ant/sca/trunk/vtest/java-api/conversation/lifetime/src/test') diff --git a/sandbox/ant/sca/trunk/vtest/java-api/conversation/lifetime/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/LifetimeTestCase.java b/sandbox/ant/sca/trunk/vtest/java-api/conversation/lifetime/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/LifetimeTestCase.java new file mode 100644 index 0000000000..52c11b881c --- /dev/null +++ b/sandbox/ant/sca/trunk/vtest/java-api/conversation/lifetime/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/lifetime/LifetimeTestCase.java @@ -0,0 +1,216 @@ +/* + * 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.vtest.javaapi.conversation.lifetime; + +import org.apache.tuscany.sca.vtest.utilities.ServiceFinder; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.oasisopen.sca.ConversationEndedException; + +/** + * + */ +public class LifetimeTestCase { + + protected static String compositeName = "lifetime.composite"; + protected static AService aService = null; + + @BeforeClass + public static void init() throws Exception { + try { + System.out.println("Setting up"); + ServiceFinder.init(compositeName); + aService = ServiceFinder.getService(AService.class, "AComponent"); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @AfterClass + public static void destroy() throws Exception { + + System.out.println("Cleaning up"); + ServiceFinder.cleanup(); + + } + + /** + * Lines 475, 476 + *

+ * Conversations start on the client side when one of the following occur: A + * "@Reference" to a conversational service is injected, ... and then a + * method of the service is called + */ + @Test + public void lifetime1() throws Exception { + aService.testConversationStarted(); + } + + /** + * Lines 477, 478, 479 + *

+ * Conversations start on the client side when one of the following occur + * ... A call is made to CompositeContext.getServiceReference and then a + * method of the service is called. + */ + @Test + //@Ignore("TUSCANY-2243") + public void lifetime2() throws Exception { + aService.testConversationStarted2(); + } + + /** + * Line 481, 482 + *

+ * The client can continue an existing conversation, by: Holding the service + * reference that was created when the conversation started + */ + @Test + public void lifetime3() throws Exception { + aService.testConversationContinue(); + } + + /** + * Line 481, 483 + *

+ * The client can continue an existing conversation, by: ... • Getting the + * service reference object passed as a parameter from another service, even + * remotely + */ + @Test + public void lifetime4() throws Exception { + // aService.testConversationContinue2(); + } + + /** + * Line 481, 484 + *

+ * The client can continue an existing conversation, by:
• Loading a + * service reference that had been written to some form of persistent + * storage + */ + @Test + public void lifetime6() throws Exception { + aService.testConversationContinue3(); + } + + /** + * Line 487, 488 + *

+ * A conversation ends, and any state associated with the conversation is + * freed up, when:
+ * ...A server operation that has been annotated "@EndConveration" has been + * called + */ + @Test + public void lifetime7() throws Exception { + aService.testConversationEnd(); + } + + /** + * Line 487, 489 + *

+ * A conversation ends, and any state associated with the conversation is + * freed up, when:
+ * ...The server calls an "@EndsConversation" method on the "@Callback" + * reference
+ */ + @Test + public void lifetime8() throws Exception { + aService.testConversationEnd2(); + } + + /** + * Line 487, 490 + *

+ * 487 A conversation ends, and any state associated with the conversation + * is freed up, when:
+ * ... The server's conversation lifetime timeout occurs + */ + @Test + public void lifetime9() throws Exception { + aService.testConversationEnd3(); + } + + /** + * Line 487, 491 + *

+ * A conversation ends, and any state associated with the conversation is + * freed up, when:
+ * ...The client calls Conversation.end() + */ + @Test + public void lifetime10() throws Exception { + aService.testConversationEnd4(); + } + + /** + * Line 487, 492 + *

+ * A conversation ends, and any state associated with the conversation is + * freed up, when:
+ * ...Any non-business exception is thrown by a conversational operation + */ + @Test + //@Ignore("TUSCANY-2283") + public void lifetime11() throws Exception { + aService.testConversationEnd5(); + aService.testConversationEnd9(); + } + + /** + * Line 494, 495 + *

+ * If a method is invoked on a service reference after an + * "@EndsConversation" method has been called then a new conversation will + * automatically be started. + */ + @Test + public void lifetime12() throws Exception { + aService.testConversationEnd6(); + } + + /** + * Line 495, 496, 497 + *

+ * If ServiceReference.getConversationID() is called after the + * "@EndsConversation" method: is called, but before the next conversation + * has been started, it will return null. + */ + @Test + public void lifetime13() throws Exception { + aService.testConversationEnd7(); + } + + /** + * Line 498, 499 + *

+ * If a service reference is used after the service provider's conversation + * timeout has caused the conversation to be ended, then + * ConversationEndedException will be thrown. + */ + @Test(expected = ConversationEndedException.class) + public void lifetime14() throws Exception { + aService.testConversationEnd8(); + } + +} -- cgit v1.2.3