summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java')
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java40
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java26
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java35
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java34
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java33
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DException.java30
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java128
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java64
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java50
-rw-r--r--tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java37
10 files changed, 477 insertions, 0 deletions
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java
new file mode 100644
index 0000000000..5c3755b19f
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/AComponent.java
@@ -0,0 +1,40 @@
+/*
+ * 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();
+
+ public boolean testCheckedException();
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java
new file mode 100644
index 0000000000..c1c1c6544c
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BCallback.java
@@ -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);
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java
new file mode 100644
index 0000000000..6893a3b4b8
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/BComponent.java
@@ -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();
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java
new file mode 100644
index 0000000000..519e66f1ce
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/CComponent.java
@@ -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();
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java
new file mode 100644
index 0000000000..d0ef71a926
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DComponent.java
@@ -0,0 +1,33 @@
+/*
+ * 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();
+ public void testException() throws DException;
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DException.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DException.java
new file mode 100644
index 0000000000..82873ed96d
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/DException.java
@@ -0,0 +1,30 @@
+/*
+ * 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 class DException extends Exception {
+
+ private static final long serialVersionUID = -3819913841563109423L;
+
+ public DException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java
new file mode 100644
index 0000000000..b4d6e929c5
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/AComponentImpl.java
@@ -0,0 +1,128 @@
+/*
+ * 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.apache.tuscany.sca.vtest.javaapi.apis.exception.DException;
+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.annotations.Context;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+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() {
+ return false;
+ }
+
+ public boolean testCheckedException() {
+ try {
+ dReference.getService().testException();
+ } catch (DException e) {
+ if (e.getMessage().equals("ADException")) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Destroy
+ public void destroy() {
+ System.out.println("This is a Destroy of AComponent ..");
+ }
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java
new file mode 100644
index 0000000000..245401e8aa
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/BComponentImpl.java
@@ -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());
+ }
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java
new file mode 100644
index 0000000000..2546548e1c
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/CComponentImpl.java
@@ -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);
+ }
+
+}
diff --git a/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java
new file mode 100644
index 0000000000..1cbda7e10b
--- /dev/null
+++ b/tags/java/sca/1.5.1/vtest/java-api/apis/exception/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/exception/impl/DComponentImpl.java
@@ -0,0 +1,37 @@
+/*
+ * 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.apache.tuscany.sca.vtest.javaapi.apis.exception.DException;
+import org.osoa.sca.annotations.Service;
+
+@Service(DComponent.class)
+public class DComponentImpl implements DComponent {
+
+ public String getName() {
+ return "ComponentD";
+ }
+
+ public void testException() throws DException {
+ throw new DException("ADException");
+ }
+
+}