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/16 21:50:00 UTC

svn commit: r648819 - in /incubator/tuscany/java/sca/vtest/java-api/apis: ./ requestcontext/ requestcontext/src/ requestcontext/src/main/ requestcontext/src/main/java/ requestcontext/src/main/java/org/ requestcontext/src/main/java/org/apache/ requestco...

Author: kwilliams
Date: Wed Apr 16 12:49:47 2008
New Revision: 648819

URL: http://svn.apache.org/viewvc?rev=648819&view=rev
Log:
Adding YK's contribution for TUSCANY-2230 - RequestContext

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

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=648819&r1=648818&r2=648819&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/pom.xml (original)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/pom.xml Wed Apr 16 12:49:47 2008
@@ -53,7 +53,8 @@
             </activation>
             <modules>
                 <module>componentcontext</module>
-           </modules>
+                <module>requestcontext</module>
+          </modules>
         </profile>
     </profiles>
 </project>

Added: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/pom.xml?rev=648819&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/pom.xml (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/pom.xml Wed Apr 16 12:49:47 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-requestcontext</artifactId>
+    <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - RequestContext</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/requestcontext/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java?rev=648819&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/AComponent.java Wed Apr 16 12:49:47 2008
@@ -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.requestcontext;
+
+/**
+ * Simple Service A.
+ */
+public interface AComponent {
+
+    public String getName();
+
+    public boolean isJAASSubject();
+    public String getServiceName();
+    public String getCallbackResult();
+
+}

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java?rev=648819&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BCallback.java Wed Apr 16 12:49:47 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.requestcontext;
+
+public interface BCallback {
+
+    public void processResults(String result);        
+
+}

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java?rev=648819&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/BComponent.java Wed Apr 16 12:49:47 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.requestcontext;
+
+import org.osoa.sca.annotations.Callback;
+
+/**
+ * Simple Service B.
+ */
+@Callback(BCallback.class)
+public interface BComponent {
+
+    public String getName();
+    
+    public void testCallback();
+
+}

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java?rev=648819&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/AComponentImpl.java Wed Apr 16 12:49:47 2008
@@ -0,0 +1,86 @@
+/*
+ * 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.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+public class AComponentImpl implements AComponent, BCallback {
+
+    private static Object monitor = new Object();
+    private static String returnMessage = null;
+
+    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;
+    }
+
+}

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java?rev=648819&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/impl/BComponentImpl.java Wed Apr 16 12:49:47 2008
@@ -0,0 +1,60 @@
+/*
+ * 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.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 testCallbackServiceReference() {
+        // ServiceReference bSR = componentContext.getRequestContext().getServiceReference();
+    }
+
+}

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite?rev=648819&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/main/resources/requestcontext.composite Wed Apr 16 12:49:47 2008
@@ -0,0 +1,34 @@
+<?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>

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

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java?rev=648819&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java Wed Apr 16 12:49:47 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.requestcontext;
+
+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 RequestContext interface described in 1.7.2 of the SCA Java Annotations & APIs Specification 1.0.
+ */
+public class RequestContextTestCase {
+
+    protected static SCADomain domain;
+    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");
+            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();
+        }
+    }
+
+    /**
+     * L858 <br>
+     * getSecuritySubject() – Returns the JAAS Subject of the current request.
+     * 
+     * @throws Exception
+     */
+    @Ignore
+    public void testGetSecuritySubject() throws Exception {
+        Assert.assertTrue(a.isJAASSubject());
+    }
+
+    /**
+     * L860 <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());
+    }
+
+    /**
+     * L861, L862 <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());
+    }
+
+    /**
+     * L863 <br>
+     * getServiceReference() – Returns the callable reference that represents the service or callback reference that the request was invoked on.
+     * It is illegal for the service implementation to try to call the setCallback() on a returned service reference.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testGetServiceReference() throws Exception {
+        
+    }
+
+}

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

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



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