summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src')
-rw-r--r--tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java35
-rw-r--r--tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java27
-rw-r--r--tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java35
-rw-r--r--tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java102
-rw-r--r--tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java61
-rw-r--r--tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite34
-rw-r--r--tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java109
7 files changed, 0 insertions, 403 deletions
diff --git a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java b/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java
deleted file mode 100644
index 6fec5cada3..0000000000
--- a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext;
-
-/**
- * Simple Service A.
- */
-public interface AComponent {
-
- public String getName();
-
- public boolean isJAASSubject();
- public String getServiceName();
- public String getCallbackResult();
- public String getServiceReferenceName();
- public String getCallbackServiceReferenceName();
-
-}
diff --git a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java b/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java
deleted file mode 100644
index 4dd2088f90..0000000000
--- a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext;
-
-public interface BCallback {
-
- public String getCallbackName();
- public void processResults(String result);
-
-}
diff --git a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java b/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java
deleted file mode 100644
index d913e95a53..0000000000
--- a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext;
-
-import org.oasisopen.sca.annotation.Callback;
-
-/**
- * Simple Service B.
- */
-@Callback(BCallback.class)
-public interface BComponent {
-
- public String getName();
-
- public void testCallback();
- public String getServiceReferenceName();
-
-}
diff --git a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java b/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java
deleted file mode 100644
index 5d3cbf6e3d..0000000000
--- a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.impl;
-
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.AComponent;
-import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.BCallback;
-import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.BComponent;
-import org.oasisopen.sca.CallableReference;
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.ServiceReference;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Service;
-
-@Service(AComponent.class)
-public class AComponentImpl implements AComponent, BCallback {
-
- private static Object monitor = new Object();
- private static String returnMessage = null;
- private static CallableReference<BCallback> cbCR;
-
- protected ComponentContext componentContext;
-
- @Reference
- protected BComponent bReference;
-
- public String getName() {
- return "ComponentA";
- }
-
- @Context
- public void setComponentContext(ComponentContext context) {
- this.componentContext = context;
- }
-
- public boolean isJAASSubject() {
- return componentContext.getRequestContext().getSecuritySubject() instanceof Subject;
- }
-
- public String getServiceName() {
- return componentContext.getRequestContext().getServiceName();
- }
-
- public String getCallbackResult() {
- ServiceReference<BComponent> bSR = componentContext.getServiceReference(BComponent.class, "bReference");
- String cbID = "ComponentACallBack";
- bSR.setCallbackID(cbID);
- bSR.getService().testCallback();
-
- // Wait for 30s max.
- int count = 0;
- synchronized(monitor) {
- while (returnMessage == null && count++ < 30) {
- try {
- monitor.wait(1000L);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- return returnMessage;
- }
-
- public void processResults(String result) {
- returnMessage = result;
- cbCR = componentContext.getRequestContext().getServiceReference();
- }
-
- public String getServiceReferenceName() {
- CallableReference<AComponent> aCR = componentContext.getRequestContext().getServiceReference();
- return aCR.getService().getName();
- }
-
- public String getCallbackServiceReferenceName() {
- return cbCR.getService().getCallbackName();
- }
-
- public String getCallbackName() {
- return "CallBackB";
- }
-
-}
diff --git a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java b/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java
deleted file mode 100644
index d358736daa..0000000000
--- a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.impl;
-
-import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.BCallback;
-import org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.BComponent;
-import org.junit.Assert;
-import org.oasisopen.sca.CallableReference;
-import org.oasisopen.sca.ComponentContext;
-import org.oasisopen.sca.annotation.Callback;
-import org.oasisopen.sca.annotation.Context;
-import org.oasisopen.sca.annotation.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 String getServiceReferenceName() {
- CallableReference<BComponent> bCR = componentContext.getRequestContext().getServiceReference();
- return bCR.getService().getName();
- }
-
-}
diff --git a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite b/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite
deleted file mode 100644
index 4aa5eeb25a..0000000000
--- a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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="RequestContext-Composite">
-
- <component name="AComponent">
- <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.impl.AComponentImpl"/>
- <reference name="bReference" target="BComponent"/>
- </component>
-
- <component name="BComponent">
- <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext.impl.BComponentImpl"/>
- </component>
-
-</composite>
diff --git a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java b/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java
deleted file mode 100644
index e3b761bd37..0000000000
--- a/tags/java/sca/2.0-M1/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext;
-
-import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
-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 RequestContext interface described in 1.7.2 of the
- * SCA Java Annotations & APIs Specification 1.0.
- */
-public class RequestContextTestCase {
-
- protected static String compositeName = "requestcontext.composite";
- protected static AComponent a;
- protected static BComponent b;
-
- @BeforeClass
- public static void init() throws Exception {
- try {
- System.out.println("Setting up");
- ServiceFinder.init(compositeName);
- a = ServiceFinder.getService(AComponent.class, "AComponent");
- b = ServiceFinder.getService(BComponent.class, "BComponent");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- System.out.println("Cleaning up");
- ServiceFinder.cleanup();
- }
-
- /**
- * Lines 858 <br>
- * getSecuritySubject() – Returns the JAAS Subject of the current request.
- *
- * @throws Exception
- */
- @Ignore("TUSCANY-2608")
- public void testGetSecuritySubject() throws Exception {
- Assert.assertTrue(a.isJAASSubject());
- }
-
- /**
- * Lines 860 <br>
- * getServiceName() – Returns the name of the service on the Java
- * implementation the request came in on.
- *
- * @throws Exception
- */
- @Test
- public void testGetServiceName() throws Exception {
- Assert.assertEquals("AComponent", a.getServiceName());
- }
-
- /**
- * Lines 861, 862 <br>
- * getCallbackReference() – Returns a callable reference to the callback as
- * specified by the caller. getCallback() – Returns a proxy for the callback
- * as specified by the caller.
- *
- * @throws Exception
- */
- @Test
- public void testGetCallback() throws Exception {
- Assert.assertEquals("CallBackFromB", a.getCallbackResult());
- }
-
- /**
- * Lines 863 <br>
- * getServiceReference() – When invoked during the execution of a service
- * operation, this API MUST return a CallableReference that represents the
- * service. When invoked during the execution of a callback operation, this
- * API MUST return a CallableReference that represents the callback service.
- *
- * @throws Exception
- */
- @Test
- public void testGetServiceReference() throws Exception {
- Assert.assertEquals("ComponentA", a.getServiceReferenceName());
- Assert.assertEquals("ComponentB", b.getServiceReferenceName());
- Assert.assertEquals("CallBackB", a.getCallbackServiceReferenceName());
- }
-
-}