You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2006/12/11 23:52:14 UTC

svn commit: r485928 - in /incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core: ./ src/test/java/org/apache/openejb/test/ src/test/java/org/apache/openejb/test/interop/ src/test/java/org/apache/openejb/test/security/

Author: dblevins
Date: Mon Dec 11 14:52:13 2006
New Revision: 485928

URL: http://svn.apache.org/viewvc?view=rev&rev=485928
Log:
Move over a copy of UsernamePasswordCallback so there is no geronimo-security dep

Added:
    incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/UsernamePasswordCallback.java
Modified:
    incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/pom.xml
    incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java
    incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/interop/BaseInteropTestClient.java
    incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/security/BaseSecurityTestClient.java

Modified: incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/pom.xml?view=diff&rev=485928&r1=485927&r2=485928
==============================================================================
--- incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/pom.xml (original)
+++ incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/pom.xml Mon Dec 11 14:52:13 2006
@@ -72,11 +72,7 @@
     <dependency>
       <groupId>org.apache.openejb</groupId>
       <artifactId>openejb-core</artifactId>
-      <version>2.2-incubating-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.geronimo.modules</groupId>
-      <artifactId>geronimo-security</artifactId>
+      <version>${pom.version}</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>

Modified: incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java
URL: http://svn.apache.org/viewvc/incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java?view=diff&rev=485928&r1=485927&r2=485928
==============================================================================
--- incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java (original)
+++ incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/NumberedTestCase.java Mon Dec 11 14:52:13 2006
@@ -93,7 +93,7 @@
         try {
             setUp();
         } catch (Exception e) {
-            result.addError(new DummyTest(".setUp()", 0), e);
+            result.addError(new DummyTest(createTestName("setUp"), 0), e);
             return;
         }
         for (int i = 0; i < testMethods.length; i++) {
@@ -102,7 +102,7 @@
         try {
             tearDown();
         } catch (Exception e) {
-            result.addError(new DummyTest(".tearDown()", 0), e);
+            result.addError(new DummyTest(createTestName("tearDown"), 0), e);
             return;
         }
     }
@@ -150,7 +150,11 @@
     }
 
     protected String createTestName(Method testMethod) {
-        return name() + removePrefix(testMethod.getName());
+        return createTestName(testMethod.getName());
+    }
+
+    private String createTestName(String methodName) {
+        return name() + removePrefix(methodName);
     }
 
     protected static String removePrefix(String name) {

Added: incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/UsernamePasswordCallback.java
URL: http://svn.apache.org/viewvc/incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/UsernamePasswordCallback.java?view=auto&rev=485928
==============================================================================
--- incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/UsernamePasswordCallback.java (added)
+++ incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/UsernamePasswordCallback.java Mon Dec 11 14:52:13 2006
@@ -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.openejb.test;
+
+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;
+
+
+/**
+ * Convenience callback handler.
+ *
+ * @version $Revision$ $Date$
+ */
+public class UsernamePasswordCallback implements CallbackHandler {
+    private final String username;
+    private final char[] password;
+
+    public UsernamePasswordCallback(String username, char[] password) {
+        this.username = username;
+        this.password = password;
+    }
+
+    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+        for (int i = 0; i < callbacks.length; i++) {
+            if (callbacks[i] instanceof PasswordCallback) {
+                ((PasswordCallback) callbacks[i]).setPassword(password);
+            } else if (callbacks[i] instanceof NameCallback) {
+                ((NameCallback) callbacks[i]).setName(username);
+            }
+        }
+    }
+}

Modified: incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/interop/BaseInteropTestClient.java
URL: http://svn.apache.org/viewvc/incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/interop/BaseInteropTestClient.java?view=diff&rev=485928&r1=485927&r2=485928
==============================================================================
--- incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/interop/BaseInteropTestClient.java (original)
+++ incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/interop/BaseInteropTestClient.java Mon Dec 11 14:52:13 2006
@@ -21,7 +21,7 @@
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginContext;
 
-import org.apache.geronimo.security.jaas.UsernamePasswordCallback;
+import org.apache.openejb.test.UsernamePasswordCallback;
 
 import org.apache.openejb.test.NamedTestCase;
 import org.apache.openejb.test.TestManager;

Modified: incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/security/BaseSecurityTestClient.java
URL: http://svn.apache.org/viewvc/incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/security/BaseSecurityTestClient.java?view=diff&rev=485928&r1=485927&r2=485928
==============================================================================
--- incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/security/BaseSecurityTestClient.java (original)
+++ incubator/openejb/branches/v2_2/openejb2/itests/openejb-itests-core/src/test/java/org/apache/openejb/test/security/BaseSecurityTestClient.java Mon Dec 11 14:52:13 2006
@@ -21,7 +21,7 @@
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginContext;
 
-import org.apache.geronimo.security.jaas.UsernamePasswordCallback;
+import org.apache.openejb.test.UsernamePasswordCallback;
 
 import org.apache.openejb.test.NamedTestCase;
 import org.apache.openejb.test.TestManager;