You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by kw...@apache.org on 2008/04/17 19:06:30 UTC

svn commit: r649188 - in /incubator/tuscany/java/sca/vtest/java-api/apis: ./ exception/ exception/src/ exception/src/main/ exception/src/main/java/ exception/src/main/java/org/ exception/src/main/java/org/apache/ exception/src/main/java/org/apache/tusc...

Author: kwilliams
Date: Thu Apr 17 10:06:16 2008
New Revision: 649188

URL: http://svn.apache.org/viewvc?rev=649188&view=rev
Log:
Adding YKs contribution for TUSCANY-2238, exception APIs

Added:
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/pom.xml   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/exception.composite   (with props)
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/
    incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java   (with props)
Modified:
    incubator/tuscany/java/sca/vtest/java-api/apis/pom.xml

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 17 10:06:16 2008
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/pom.xml?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/pom.xml (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/pom.xml Thu Apr 17 10:06:16 2008
@@ -0,0 +1,45 @@
+<?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>java-api-apis</artifactId>
+        <version>2.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <artifactId>vtest-java-api-apis-exception</artifactId>
+    <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - Exception</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,38 @@
+/*
+ * 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.apis.exception;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service A.
+ */
+@Conversational
+public interface AComponent {
+
+    public String getName();
+
+    public void testConversation();
+    public void testCallBack();
+
+    public boolean testServiceRuntimeException();
+    public boolean testServiceUnavailableException();
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,26 @@
+/*
+ * 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.apis.exception;
+
+public interface BCallback {
+
+    public void processResults(String result);        
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.apis.exception;
+
+import org.osoa.sca.annotations.Callback;
+
+/**
+ * Simple Service B.
+ */
+@Callback(BCallback.class)
+public interface BComponent {
+
+    public String getName();
+    
+    public void testCallback();
+    public void testRedirectedCallback();
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.apis.exception;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple Service C.
+ */
+@Conversational
+public interface CComponent {
+
+    public String getName();
+
+    public void testConversation();
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.apis.exception;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Simple Remote Service D.
+ */
+@Remotable
+public interface DComponent {
+
+    public String getName();
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,116 @@
+/*
+ * 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.apis.exception.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.BComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.CComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.DComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ConversationEndedException;
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.ServiceUnavailableException;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+@Scope("CONVERSATION")
+public class AComponentImpl implements AComponent {
+
+    protected ComponentContext componentContext;
+    
+    @Reference
+    protected CallableReference<BComponent> bReference;
+
+    @Reference
+    protected ServiceReference<CComponent> cReference;
+
+    @Reference
+    protected ServiceReference<DComponent> dReference;
+
+    @ConversationID
+    protected String cid;
+
+    public String getName() {
+        return "ComponentA";
+    }
+
+    @Context
+    public void setComponentContext(ComponentContext context) {
+        this.componentContext = context;
+    }
+
+    public void testConversation() {
+        ServiceReference<CComponent> cSR = componentContext.getServiceReference(CComponent.class, "cReference");
+        cSR.setConversationID("AConversationID");
+        Assert.assertEquals("ComponentC", cSR.getService().getName());
+
+        try {
+            Thread.sleep(1100);
+            cSR.getService().testConversation();
+
+            Assert.fail();
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        } catch (ConversationEndedException cee) {
+            // Expected
+        }
+    }
+
+    public void testCallBack() {
+        ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
+        bSR.setCallbackID("ComponentACallBack");
+
+        try {
+            bSR.getService().testCallback();
+            Assert.fail();
+        } catch (NoRegisteredCallbackException e) {
+            // Expected
+        }
+    }
+
+    public boolean testServiceRuntimeException() {
+        try {
+            componentContext.getServiceReference(BComponent.class, "dummyBReference").getService().getName();
+        } catch (ServiceRuntimeException sre) {
+            return true;
+        }
+
+        return false;
+    }
+
+    public boolean testServiceUnavailableException() {
+        try {
+            componentContext.getServiceReference(DComponent.class, "dReference").getService().getName();
+        } catch (ServiceUnavailableException sue) {
+            return true;
+        }
+
+        return false;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,64 @@
+/*
+ * 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.apis.exception.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.BCallback;
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.BComponent;
+import org.junit.Assert;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+public class BComponentImpl implements BComponent {
+
+    protected ComponentContext componentContext;
+    
+    @Callback
+    protected BCallback callback;
+
+    @Context
+    public void setComponentContext(ComponentContext context) {
+        this.componentContext = context;
+    }
+
+    public String getName() {
+        return "ComponentB";
+    }
+
+    public void testCallback() {
+        callback = componentContext.getRequestContext().getCallback();
+        callback.processResults("CallBackFromB");
+
+        CallableReference<BCallback> bCR = componentContext.getRequestContext().getCallbackReference();
+        Assert.assertEquals("ComponentACallBack", bCR.getCallbackID());
+    }
+
+    public void testRedirectedCallback() {
+        callback = componentContext.getRequestContext().getCallback();
+        callback.processResults("RedirectedCallBackFromB");
+
+        CallableReference<BCallback> bCR = componentContext.getRequestContext().getCallbackReference();
+        Assert.assertEquals("RedirectedCallBack", bCR.getCallbackID());
+    }
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java Thu Apr 17 10:06:16 2008
@@ -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.vtest.javaapi.apis.exception.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.CComponent;
+import org.junit.Assert;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CComponent.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class CComponentImpl implements CComponent {
+
+    @Context
+    protected RequestContext requestContext;
+
+    @ConversationID
+    protected String cid;
+
+    public String getName() {
+        return "ComponentC";
+    }
+
+    public void testConversation() {
+        Assert.assertEquals("AConversationID", cid);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.vtest.javaapi.apis.exception.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.exception.DComponent;
+import org.osoa.sca.annotations.Service;
+
+@Service(DComponent.class)
+public class DComponentImpl implements DComponent {
+
+    public String getName() {
+        return "ComponentD";
+    }
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/exception.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/exception.composite?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/exception.composite (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/exception.composite Thu Apr 17 10:06:16 2008
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://java-api-tests"
+    name="Exception-Composite">
+
+    <component name="AComponent">
+        <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.exception.impl.AComponentImpl"/>
+        <reference name="bReference" target="BComponent"/>
+        <reference name="cReference" target="CComponent"/>
+        <reference name="dReference" target="DComponent"/>
+    </component>
+
+    <component name="BComponent">
+        <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.exception.impl.BComponentImpl"/>
+    </component>
+
+    <component name="CComponent">
+        <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.exception.impl.CComponentImpl"/>
+    </component>
+
+</composite>

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/exception.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/exception.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/main/resources/exception.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java?rev=649188&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java Thu Apr 17 10:06:16 2008
@@ -0,0 +1,105 @@
+/*
+ * 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.apis.exception;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test class tests the Exceptions described in 1.7.6, 1.7.7, 1.7.8, and 1.7.9 of the SCA Java Annotations & APIs Specification 1.0.
+ */
+public class ExceptionTestCase {
+
+    protected static SCADomain domain;
+    protected static String compositeName = "exception.composite";
+    protected static AComponent a;
+    protected static BComponent b;
+
+    @BeforeClass
+    public static void init() throws Exception {
+        try {
+            System.out.println("Setting up");
+            domain = SCADomain.newInstance(compositeName);
+            a = domain.getService(AComponent.class, "AComponent");
+            b = domain.getService(BComponent.class, "BComponent");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @AfterClass
+    public static void destroy() throws Exception {
+        System.out.println("Cleaning up");
+        if (domain != null) {
+            domain.close();
+        }
+    }
+
+    /**
+     * L951 <br>
+     * NoRegisteredCallbackException.
+     *  
+     * @throws Exception
+     */
+    @Test
+    public void testNoRegisteredCallbackException() throws Exception {
+        a.testCallBack();
+    }
+
+    /**
+     * L960 <br>
+     * ServiceRuntimeException - This exception signals problems in the management of SCA component execution.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testServiceRuntimeException() throws Exception {
+        Assert.assertTrue(a.testServiceRuntimeException());        
+    }
+
+    /**
+     * L970 <br>
+     * ServiceUnavailableException – This exception signals problems in the interaction with remote services.
+     * 
+     * @throws Exception
+     */
+    @Ignore
+    public void testServiceUnavailableException() throws Exception {
+        // TODO: Need a way to "stop" service to simulate service unavailability ..
+        // Simulate from Non-SCA Client to SCA Service? 
+        // Assert.assertTrue(a.testServiceUnavailableException());
+    }
+
+    /**
+     * L983 <br>
+     * ConversationEndedException.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testConversationEndedException() throws Exception {
+        a.testConversation();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/apis/exception/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/ExceptionTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/vtest/java-api/apis/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/pom.xml?rev=649188&r1=649187&r2=649188&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/pom.xml (original)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/pom.xml Thu Apr 17 10:06:16 2008
@@ -57,6 +57,7 @@
                 <module>callablereference</module>
                 <module>servicereference</module>
                 <module>conversation</module>
+                <module>exception</module>
           </modules>
         </profile>
     </profiles>



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