geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r591426 - in /geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security: TestMEJBSecurity.java TestMEJBSecurityBadRealm.java
Date Fri, 02 Nov 2007 19:05:55 GMT
Author: gawor
Date: Fri Nov  2 12:05:53 2007
New Revision: 591426

URL: http://svn.apache.org/viewvc?rev=591426&view=rev
Log:
run mejb tests with a bad realm name

Added:
    geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurityBadRealm.java
  (with props)
Modified:
    geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java

Modified: geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java?rev=591426&r1=591425&r2=591426&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java
(original)
+++ geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java
Fri Nov  2 12:05:53 2007
@@ -33,7 +33,7 @@
 import org.testng.annotations.Test;
 
 public class TestMEJBSecurity extends TestSupport {
-
+       
     @Test
     public void testLogin() throws Exception {   
         Hashtable env = getEnvironment();
@@ -75,7 +75,7 @@
         testFailure("", "");
     }
             
-    private void testFailure(String username, String password) throws Exception {
+    protected void testFailure(String username, String password) throws Exception {
         Hashtable env = getEnvironment();
         if (username != null) {
             env.put(Context.SECURITY_PRINCIPAL, username);
@@ -96,7 +96,7 @@
         }
     }
         
-    private Hashtable getEnvironment() {
+    protected Hashtable getEnvironment() {
         Hashtable p = new Hashtable();
         
         p.put("java.naming.factory.initial", 
@@ -105,12 +105,15 @@
               "127.0.0.1:4201");  
         
         // XXXX: this should not be necessary
-        p.put("openejb.authentication.realmName", "geronimo-admin");
+        String realmName = getRealmName();
+        if (realmName != null) {
+            p.put("openejb.authentication.realmName", realmName);
+        }
         
         return p;
     }
     
-    private Management getMEJB(Hashtable env) throws Exception { 
+    protected Management getMEJB(Hashtable env) throws Exception { 
         String jndiName = "ejb/mgmt/MEJBRemoteHome"; // should be "ejb/mgmt/MEJB"
         InitialContext ctx = new InitialContext(env);
         Object objref = ctx.lookup(jndiName);
@@ -118,6 +121,10 @@
             PortableRemoteObject.narrow(objref,ManagementHome.class);
         Management mejb = home.create();
         return mejb;
+    }
+    
+    protected String getRealmName() {
+        return "geronimo-admin";
     }
     
 }

Added: geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurityBadRealm.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurityBadRealm.java?rev=591426&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurityBadRealm.java
(added)
+++ geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurityBadRealm.java
Fri Nov  2 12:05:53 2007
@@ -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.geronimo.testsuite.security;
+
+import org.testng.annotations.Test;
+
+public class TestMEJBSecurityBadRealm extends TestMEJBSecurity {
+
+    @Test
+    public void testLogin() throws Exception {  
+        testFailure("system", "manager");        
+    }
+
+    protected String getRealmName() {
+        return "foobarrelam";
+    }
+    
+}

Propchange: geronimo/server/trunk/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurityBadRealm.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message