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/24 22:49:50 UTC

svn commit: r651414 - in /incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes: ./ src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ src/main/resources/ src/test/java/org/apache/tusc...

Author: kwilliams
Date: Thu Apr 24 13:49:42 2008
New Revision: 651414

URL: http://svn.apache.org/viewvc?rev=651414&view=rev
Log:
First pass at test for SinglePrincipal - not enabled

Added:
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java   (with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml   (with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.composite   (with props)
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java   (with props)
Modified:
    incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/pom.xml

Modified: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/pom.xml?rev=651414&r1=651413&r2=651414&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/pom.xml (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/pom.xml Thu Apr 24 13:49:42 2008
@@ -42,5 +42,12 @@
             <scope>runtime</scope>
         </dependency>
         
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-policy-security</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        
     </dependencies>
 </project>

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java?rev=651414&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java Thu Apr 24 13:49:42 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.annotations.conversationattributes.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ACallbackHandler implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+            if (callbacks[i] instanceof NameCallback) {
+                NameCallback nc = (NameCallback)callbacks[i];
+                nc.setName("AUser");
+            } else if (callbacks[i] instanceof PasswordCallback) {
+                PasswordCallback pc = (PasswordCallback)callbacks[i];
+                pc.setPassword("AUserPasswd".toCharArray());
+            } else {
+                throw new UnsupportedCallbackException
+                 (callbacks[i], "Unsupported Callback!");
+            }
+          }
+    }
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/ACallbackHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java?rev=651414&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java Thu Apr 24 13:49:42 2008
@@ -0,0 +1,179 @@
+/*
+ * 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.annotations.conversationattributes.security;
+
+import java.security.Principal;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JaasLoginModule implements LoginModule {
+
+    private CallbackHandler callbackHandler;
+    private Subject subject;
+    private Principal userPrincipal;
+    private String userId;
+    private String password;
+    private boolean succeeded;
+    private boolean commitSucceeded;
+
+    public void initialize(Subject subject,
+                           CallbackHandler callbackHandler,
+                           Map<String, ?> sharedState,
+                           Map<String, ?> options) {
+        this.callbackHandler = callbackHandler;
+        this.subject = subject;
+    }
+
+    public boolean login() throws LoginException {
+        Callback[] callbacks = new Callback[2];
+        callbacks[0] = new NameCallback("UserId:");
+        callbacks[1] = new PasswordCallback("Password:", false);
+
+        try {
+            callbackHandler.handle(callbacks);
+            userId = ((NameCallback)callbacks[0]).getName();
+            password = new String(((PasswordCallback)callbacks[1]).getPassword());
+
+            if (userId.equals("CalculatorUser") && password.equals("CalculatorUserPasswd")) {
+                System.out.println("Successfully AUTHENTICATED!!");
+                succeeded = true;
+                return true;
+            } else {
+                System.out.println("Incorrect userId / password! AUTHENTICATION FAILED!!");
+                return false;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * <p> This method is called if the LoginContext's
+     * overall authentication succeeded
+     * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
+     * succeeded).
+     *
+     * <p> If this LoginModule's own authentication attempt
+     * succeeded (checked by retrieving the private state saved by the
+     * <code>login</code> method), then this method associates a
+     * <code>UserPrincipal</code>
+     * with the <code>Subject</code> located in the
+     * <code>LoginModule</code>.  If this LoginModule's own
+     * authentication attempted failed, then this method removes
+     * any state that was originally saved.
+     *
+     * <p>
+     *
+     * @exception LoginException if the commit fails.
+     *
+     * @return true if this LoginModule's own login and commit
+     *          attempts succeeded, or false otherwise.
+     */
+    public boolean commit() throws LoginException {
+        if (succeeded == false) {
+            return false;
+        } else {
+            // add a Principal (authenticated identity) to the Subject
+
+            // assume the user we authenticated is the UserPrincipal
+            userPrincipal = new UserPrincipal(userId);
+            if (!subject.getPrincipals().contains(userPrincipal))
+                subject.getPrincipals().add(userPrincipal);
+
+            // in any case, clean out state
+            userId = null;
+            password = null;
+            commitSucceeded = true;
+            return true;
+        }
+    }
+
+    /**
+     * <p> This method is called if the LoginContext's
+     * overall authentication failed.
+     * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
+     * did not succeed).
+     *
+     * <p> If this LoginModule's own authentication attempt
+     * succeeded (checked by retrieving the private state saved by the
+     * <code>login</code> and <code>commit</code> methods),
+     * then this method cleans up any state that was originally saved.
+     *
+     * <p>
+     *
+     * @exception LoginException if the abort fails.
+     *
+     * @return false if this LoginModule's own login and/or commit attempts
+     *          failed, and true otherwise.
+     */
+    public boolean abort() throws LoginException {
+        if (succeeded == false) {
+            return false;
+        } else if (succeeded == true && commitSucceeded == false) {
+            // login succeeded but overall authentication failed
+            succeeded = false;
+            userId = null;
+            password = null;
+            userPrincipal = null;
+        } else {
+            // overall authentication succeeded and commit succeeded,
+            // but someone else's commit failed
+            logout();
+        }
+        return true;
+    }
+
+    /**
+     * Logout the user.
+     *
+     * <p> This method removes the <code>SimplePrincipal</code>
+     * that was added by the <code>commit</code> method.
+     *
+     * <p>
+     *
+     * @exception LoginException if the logout fails.
+     *
+     * @return true in all cases since this <code>LoginModule</code>
+     *          should not be ignored.
+     */
+    public boolean logout() throws LoginException {
+        subject.getPrincipals().remove(userPrincipal);
+        succeeded = false;
+        succeeded = commitSucceeded;
+        userId = null;
+        if (password != null)
+            password = null;
+        userPrincipal = null;
+        return true;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/JaasLoginModule.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java?rev=651414&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java Thu Apr 24 13:49:42 2008
@@ -0,0 +1,66 @@
+/**
+ * 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.annotations.conversationattributes.security;
+
+import java.security.Principal;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class UserPrincipal implements Principal {
+
+    private final String name;
+
+    public UserPrincipal(String name) {
+        if (name == null)
+            throw new IllegalArgumentException("name cannot be null");
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String toString() {
+        return name;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final UserPrincipal other = (UserPrincipal)obj;
+        if (name == null) {
+            if (other.name != null)
+                return false;
+        } else if (!name.equals(other.name))
+            return false;
+        return true;
+    }
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/security/UserPrincipal.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config?rev=651414&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/AJass.config Thu Apr 24 13:49:42 2008
@@ -0,0 +1,3 @@
+AService {
+  org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.security.JaasLoginModule required debug=true;
+};

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml?rev=651414&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml Thu Apr 24 13:49:42 2008
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+    * 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.    
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+    xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" 
+    xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+    xmlns:convatt="http://convatt">
+
+    <!-- PolicySets -->
+    <policySet name="JaasPolicy" provides="tuscany:jaasAuthentication" appliesTo="sca:implementation.java"
+        xmlns="http://www.osoa.org/xmlns/sca/1.0">
+        <tuscany:jaasAuthentication>
+            <tuscany:configurationName>AService</tuscany:configurationName>
+            <tuscany:callbackHandler>org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.security.ACallbackHandler</tuscany:callbackHandler>
+        </tuscany:jaasAuthentication>
+    </policySet>
+
+</definitions>
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.composite?rev=651414&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.composite (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/main/resources/singleprincipal.composite Thu Apr 24 13:49:42 2008
@@ -0,0 +1,38 @@
+<?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"
+	targetNamespace="http://java-api-tests" 
+	xmlns:sample="http://java-api-tests" 
+	name="SinglePrincipal"
+	xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+	<component name="AComponent">
+		<implementation.java
+			class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.impl.AServiceImpl"
+			requires = "tuscany:jaasAuthentication" />
+		<reference name="c" target="CComponent" />
+	</component>
+
+	<component name="CComponent">
+		<implementation.java
+			class="org.apache.tuscany.sca.vtest.javaapi.annotations.conversationattributes.impl.CServiceImpl" />
+	</component>
+
+</composite>

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

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

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

Added: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java?rev=651414&view=auto
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java (added)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java Thu Apr 24 13:49:42 2008
@@ -0,0 +1,73 @@
+/*
+ * 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.annotations.conversationattributes;
+
+import javax.security.auth.login.Configuration;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class SinglePricipalTestCase {
+
+    protected static SCADomain domain;
+    protected static String compositeName = "singleprincipal.composite";
+    protected static AService aService = null;
+
+    @Before
+    public void init() throws Exception {
+        try {
+            Configuration.getConfiguration();
+        } catch (java.lang.SecurityException e) {
+            System.out.println("Caught SecurityException");
+            System.setProperty("java.security.auth.login.config", this.getClass().getClassLoader()
+                .getResource("AJass.config").toString());
+        }
+        System.out.println("Setting up");
+        domain = SCADomain.newInstance(compositeName);
+        aService = domain.getService(AService.class, "AComponent");
+    }
+
+    @After
+    public void destroy() throws Exception {
+
+        System.out.println("Cleaning up");
+        if (domain != null)
+            domain.close();
+
+    }
+
+
+    /**
+     * Line 1669, 1670
+     * <p>
+     * singlePrincipal (optional) – If true, only the principal (the user) that
+     * started the conversation has authority to continue the conversation. The
+     * default value is false.
+     */
+    @Test(expected = Exception.class)
+    public void singlePrincipal() throws Exception {
+        aService.testSinglePrincipal();
+    }
+}

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/vtest/java-api/annotations/conversationattributes/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/conversationattributes/SinglePricipalTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date