adc 2003/09/27 09:00:23
Modified: specs/j2ee-jacc/src/java/javax/security/jacc
EJBMethodPermission.java WebResourcePermission.java
WebUserDataPermission.java
specs/j2ee-jacc/src/test/javax/security/jacc
EJBMethodPermissionTest.java
Added: specs/j2ee-jacc/src/java/javax/security/jacc
EJBMethodPermissionCollection.java
WebResourcePermissionCollection.java
WebUserDataPermissionCollection.java
specs/j2ee-jacc/src/test/javax/security/jacc
EJBMethodPermissionCollectionTest.java
Log:
Fixed some bugs and added an EJBMethodPermissionCollection
Revision Changes Path
1.2 +18 -19
incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/EJBMethodPermission.java
Index: EJBMethodPermission.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/EJBMethodPermission.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EJBMethodPermission.java 30 Aug 2003 01:55:12 -0000 1.1
+++ EJBMethodPermission.java 27 Sep 2003 16:00:23 -0000 1.2
@@ -90,8 +90,8 @@
methodInterfaces = newMethodInterfaces.split(",", -1);
}
- private transient int cachedHashCode = 0;
- private transient MethodSpec methodSpec;
+ private transient int cachedHashCode;
+ protected transient MethodSpec methodSpec;
public EJBMethodPermission(String name, String spec) {
super(name);
@@ -138,9 +138,8 @@
return getName().equals(other.getName()) &&
methodSpec.implies(other.methodSpec);
}
- // TODO should return a real PermissionCollection
- public PermissionCollection newPermissionCollection() {
- return null;
+ public PermissionCollection newPermissionCollection() {
+ return new EJBMethodPermissionCollection();
}
private synchronized void readObject(ObjectInputStream in) throws
IOException {
@@ -151,11 +150,11 @@
out.writeUTF(methodSpec.getActions());
}
- private class MethodSpec {
- private String methodName;
- private String methodInterface;
- private String methodParams;
- private String actions;
+ protected class MethodSpec {
+ protected String methodName;
+ protected String methodInterface;
+ protected String methodParams;
+ protected String actions;
public MethodSpec(String actionString) {
if (actionString == null || actionString.length() == 0) {
@@ -193,18 +192,18 @@
methodName = emptyNullCheck(tokens[0]);
methodInterface = emptyNullCheck(tokens[1]);
- methodParams = emptyNullCheck(tokens[2]);
+ methodParams = tokens[2];
}
}
actions = actionString;
}
}
- public MethodSpec(String methodName, String methodInterface,
String[] methodParamsArray) {
- checkMethodInterface(methodInterface);
+ public MethodSpec(String mthdName, String mthdInterface, String[]
methodParamsArray) {
+ checkMethodInterface(mthdInterface);
- methodName = emptyNullCheck(methodName);
- methodInterface = emptyNullCheck(methodInterface);
+ methodName = emptyNullCheck(mthdName);
+ methodInterface = emptyNullCheck(mthdInterface);
if (methodParamsArray == null) {
methodParams = null;
@@ -226,11 +225,11 @@
initActions();
}
- public MethodSpec(String methodInterface, Method method) {
- checkMethodInterface(methodInterface);
+ public MethodSpec(String mthdInterface, Method method) {
+ checkMethodInterface(mthdInterface);
methodName = method.getName();
- methodInterface = emptyNullCheck(methodInterface);
+ methodInterface = emptyNullCheck(mthdInterface);
Class[] paramTypes = method.getParameterTypes();
if (paramTypes.length == 0) {
@@ -248,7 +247,7 @@
}
public boolean equals(MethodSpec spec) {
- return actions.equals(spec.actions);
+ return implies(spec) && spec.implies(this);
}
public String getActions() {
1.2 +2 -3
incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/WebResourcePermission.java
Index: WebResourcePermission.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/WebResourcePermission.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebResourcePermission.java 30 Aug 2003 01:55:13 -0000 1.1
+++ WebResourcePermission.java 27 Sep 2003 16:00:23 -0000 1.2
@@ -122,9 +122,8 @@
return urlPatternSpec.implies(other.urlPatternSpec) &&
httpMethodSpec.implies(other.httpMethodSpec);
}
- // TODO should return a real PermissionCollection
public PermissionCollection newPermissionCollection() {
- return null;
+ return new WebResourcePermissionCollection();
}
private synchronized void readObject(ObjectInputStream in) throws
IOException {
1.2 +2 -3
incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/WebUserDataPermission.java
Index: WebUserDataPermission.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/WebUserDataPermission.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebUserDataPermission.java 30 Aug 2003 01:55:13 -0000 1.1
+++ WebUserDataPermission.java 27 Sep 2003 16:00:23 -0000 1.2
@@ -123,9 +123,8 @@
return urlPatternSpec.implies(other.urlPatternSpec) &&
httpMethodSpec.implies(other.httpMethodSpec);
}
- // TODO should return a real PermissionCollection
public PermissionCollection newPermissionCollection() {
- return null;
+ return new WebUserDataPermissionCollection();
}
private synchronized void readObject(ObjectInputStream in) throws
IOException {
1.1
incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/EJBMethodPermissionCollection.java
Index: EJBMethodPermissionCollection.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package javax.security.jacc;
import java.security.PermissionCollection;
import java.security.Permission;
import java.util.LinkedList;
import java.util.HashMap;
import java.util.Enumeration;
import java.util.Collections;
/**
*
* @version $Revision: 1.1 $ $Date: 2003/09/27 16:00:23 $
*/
public final class EJBMethodPermissionCollection extends PermissionCollection
{
private LinkedList collection = new LinkedList();
private HashMap permissions = new HashMap();
private static final Object WILDCARD = new Object();
/**
* Adds a permission object to the current collection of permission
objects.
*
* @param permission the Permission object to add.
*
* @exception SecurityException - if this PermissionCollection object
* has been marked readonly
*/
public void add(Permission permission) {
if (isReadOnly()) throw new IllegalArgumentException("Read only
collection");
if (!(permission instanceof EJBMethodPermission)) throw new
IllegalArgumentException("Wrong permission type");
if (collection.contains(permission)) return;
else collection.add(permission);
EJBMethodPermission p = (EJBMethodPermission)permission;
EJBMethodPermission.MethodSpec spec = p.methodSpec;
Object test = permissions.get(p.getName());
if (test instanceof Boolean) return;
if (spec.methodName == null && spec.methodInterface == null &&
spec.methodParams == null) {
permissions.put(p.getName(), new Boolean(true));
return;
}
HashMap methods = (HashMap)test;
if (methods == null) {
methods = new HashMap();
permissions.put(p.getName(), methods);
}
Object methodKey = (spec.methodName == null ||
spec.methodName.length() == 0? WILDCARD:spec.methodName);
HashMap interfaces = (HashMap)methods.get(methodKey);
if (interfaces == null) {
interfaces = new HashMap();
methods.put(methodKey, interfaces);
}
Object interfaceKey = (spec.methodInterface == null ||
spec.methodInterface.length() == 0? WILDCARD:spec.methodInterface);
HashMap parameters = (HashMap)interfaces.get(interfaceKey);
if (parameters == null) {
parameters = new HashMap();
interfaces.put(interfaceKey, parameters);
}
// an empty string for a parameter spec indicates a method w/ no
parameters
Object parametersKey = (spec.methodParams == null?
WILDCARD:spec.methodParams);
Object parameter = parameters.get(parametersKey);
if (parameter == null) {
parameter = new Boolean(true);
parameters.put(parametersKey, parameter);
}
}
/**
* Checks to see if the specified permission is implied by
* the collection of Permission objects held in this PermissionCollection.
*
* @param permission the Permission object to compare.
*
* @return true if "permission" is implied by the permissions in
* the collection, false if not.
*/
public boolean implies(Permission permission) {
if (!(permission instanceof EJBMethodPermission)) return false;
EJBMethodPermission p = (EJBMethodPermission)permission;
EJBMethodPermission.MethodSpec spec = p.methodSpec;
Object test = permissions.get(p.getName());
if (test == null) return false;
if (test instanceof Boolean) return true;
HashMap methods = (HashMap)test;
Object methodKey = (spec.methodName == null ||
spec.methodName.length() == 0? WILDCARD:spec.methodName);
HashMap interfaces = (HashMap)methods.get(methodKey);
if (methodImplies(interfaces, spec)) return true;
if (methodKey != WILDCARD) {
return methodImplies((HashMap)methods.get(WILDCARD), spec);
}
return false;
}
protected boolean methodImplies(HashMap interfaces,
EJBMethodPermission.MethodSpec spec) {
if (interfaces == null) return false;
Object interfaceKey = (spec.methodInterface == null ||
spec.methodInterface.length() == 0? WILDCARD:spec.methodInterface);
HashMap parameters = (HashMap)interfaces.get(interfaceKey);
if (interfaceImplies(parameters, spec)) return true;
if (interfaceKey != WILDCARD) {
return interfaceImplies((HashMap)interfaces.get(WILDCARD), spec);
}
return false;
}
protected boolean interfaceImplies(HashMap parameters,
EJBMethodPermission.MethodSpec spec) {
if (parameters == null) return false;
// An empty string for a parameter spec indicates a method w/ no
parameters
// so we won't convert an empty string to a wildcard.
Object parametersKey = (spec.methodParams == null?
WILDCARD:spec.methodParams);
Object parameter = parameters.get(parametersKey);
if (parameter != null) return true;
if (parametersKey != WILDCARD) {
return parameters.containsKey(WILDCARD);
}
return false;
}
/**
* Returns an enumeration of all the Permission objects in the collection.
*
* @return an enumeration of all the Permissions.
*/
public Enumeration elements() {
return Collections.enumeration(collection);
}
}
1.1
incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/WebResourcePermissionCollection.java
Index: WebResourcePermissionCollection.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package javax.security.jacc;
import java.security.PermissionCollection;
import java.security.Permission;
import java.util.Enumeration;
import java.util.Hashtable;
/**
*
* @version $Revision: 1.1 $ $Date: 2003/09/27 16:00:23 $
*/
public final class WebResourcePermissionCollection extends
PermissionCollection {
private Hashtable permissions = new Hashtable();
/**
* Adds a permission object to the current collection of permission
objects.
*
* @param permission the Permission object to add.
*
* @exception SecurityException - if this PermissionCollection object
* has been marked readonly
*/
public void add(Permission permission) {
if (isReadOnly()) throw new IllegalArgumentException("Read only
collection");
if (!(permission instanceof WebResourcePermission)) throw new
IllegalArgumentException("Wrong permission type");
WebResourcePermission p = (WebResourcePermission)permission;
permissions.put(p, p);
}
/**
* Checks to see if the specified permission is implied by
* the collection of Permission objects held in this PermissionCollection.
*
* @param permission the Permission object to compare.
*
* @return true if "permission" is implied by the permissions in
* the collection, false if not.
*/
public boolean implies(Permission permission) {
if (!(permission instanceof WebResourcePermission)) return false;
WebResourcePermission p = (WebResourcePermission)permission;
Enumeration enum = permissions.elements();
while (enum.hasMoreElements()) {
if (((WebResourcePermission)enum.nextElement()).implies(p))
return true;
}
return false;
}
/**
* Returns an enumeration of all the Permission objects in the collection.
*
* @return an enumeration of all the Permissions.
*/
public Enumeration elements() {
return permissions.elements();
}
}
1.1
incubator-geronimo/specs/j2ee-jacc/src/java/javax/security/jacc/WebUserDataPermissionCollection.java
Index: WebUserDataPermissionCollection.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package javax.security.jacc;
import java.security.PermissionCollection;
import java.security.Permission;
import java.util.Enumeration;
import java.util.Hashtable;
/**
*
* @version $Revision: 1.1 $ $Date: 2003/09/27 16:00:23 $
*/
public final class WebUserDataPermissionCollection extends
PermissionCollection {
private Hashtable permissions = new Hashtable();
/**
* Adds a permission object to the current collection of permission
objects.
*
* @param permission the Permission object to add.
*
* @exception SecurityException - if this PermissionCollection object
* has been marked readonly
*/
public void add(Permission permission) {
if (isReadOnly()) throw new IllegalArgumentException("Read only
collection");
if (!(permission instanceof WebUserDataPermission)) throw new
IllegalArgumentException("Wrong permission type");
WebUserDataPermission p = (WebUserDataPermission)permission;
permissions.put(p, p);
}
/**
* Checks to see if the specified permission is implied by
* the collection of Permission objects held in this PermissionCollection.
*
* @param permission the Permission object to compare.
*
* @return true if "permission" is implied by the permissions in
* the collection, false if not.
*/
public boolean implies(Permission permission) {
if (!(permission instanceof WebUserDataPermission)) return false;
WebUserDataPermission p = (WebUserDataPermission)permission;
Enumeration enum = permissions.elements();
while (enum.hasMoreElements()) {
if (((WebUserDataPermission)enum.nextElement()).implies(p))
return true;
}
return false;
}
/**
* Returns an enumeration of all the Permission objects in the collection.
*
* @return an enumeration of all the Permissions.
*/
public Enumeration elements() {
return permissions.elements();
}
}
1.2 +113 -7
incubator-geronimo/specs/j2ee-jacc/src/test/javax/security/jacc/EJBMethodPermissionTest.java
Index: EJBMethodPermissionTest.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/specs/j2ee-jacc/src/test/javax/security/jacc/EJBMethodPermissionTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EJBMethodPermissionTest.java 30 Aug 2003 01:55:13 -0000 1.1
+++ EJBMethodPermissionTest.java 27 Sep 2003 16:00:23 -0000 1.2
@@ -57,11 +57,24 @@
import junit.framework.TestCase;
+import java.lang.reflect.Method;
+
/**
*
* @version $Revision$ $Date$
*/
public class EJBMethodPermissionTest extends TestCase {
+ protected Method method;
+
+ public void setUp() {
+ try {
+ method = TestClass.class.getDeclaredMethod("cat", new Class[] {
Integer.class, Float.class, Long.class, Double.class });
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace(); //To change body of catch statement use
Options | File Templates.
+ } catch (SecurityException e) {
+ e.printStackTrace(); //To change body of catch statement use
Options | File Templates.
+ }
+ }
/*
* Testing EJBMethodPermission(java.lang.String, java.lang.String)
@@ -138,9 +151,9 @@
}
public void testImpliesStringString() {
- EJBMethodPermission permissionFooEEE = new
EJBMethodPermission("foo", ",,");
+ EJBMethodPermission permissionFooEEE = new
EJBMethodPermission("foo", "");
EJBMethodPermission permissionFooMIP = new
EJBMethodPermission("foo", "cat,LocalHome,a,b,c,d");
- EJBMethodPermission permissionBarEEE = new
EJBMethodPermission("bar", ",,");
+ EJBMethodPermission permissionBarEEE = new
EJBMethodPermission("bar", "");
EJBMethodPermission permissionFooEIP = new
EJBMethodPermission("foo", ",LocalHome,a,b,c,d");
EJBMethodPermission permissionFooEIE = new
EJBMethodPermission("foo", ",LocalHome,");
EJBMethodPermission permissionFooEI = new
EJBMethodPermission("foo", ",LocalHome");
@@ -163,7 +176,7 @@
assertFalse(permissionBarEEE.equals(permissionFooEEE));
assertTrue(permissionFooEIP.implies(permissionFooMIP));
- assertTrue(permissionFooEIE.implies(permissionFooMIP));
+ assertFalse(permissionFooEIE.implies(permissionFooMIP));
assertTrue(permissionFooEI.implies(permissionFooMIP));
assertTrue(permissionFooEI.implies(permissionFooEIP));
assertTrue(permissionFooEI.implies(permissionFooEIE));
@@ -175,23 +188,116 @@
* Testing EJBMethodPermission(String, String, String, String[])
*/
public void testConstructorStringStringStringStringArray() {
+
+ // methodSpec ::= null
+ EJBMethodPermission permission = new EJBMethodPermission("foo",
null, null, null);
+
+ // methodSpec ::= methodNameSpec
+ permission = new EJBMethodPermission("foo", "", "", null);
+ permission = new EJBMethodPermission("foo", "cat", "", null);
+
+ // methodSpec ::= methodNameSpec comma methodInterface
+ permission = new EJBMethodPermission("foo", "", "ServiceEndpoint",
null);
+ permission = new EJBMethodPermission("foo", "cat",
"ServiceEndpoint", null);
+
+ // methodSpec ::= methodNameSpec comma methodInterfaceSpec comma
methodParamsSpec
+ permission = new EJBMethodPermission("foo", "", "", new String[]{});
+ permission = new EJBMethodPermission("foo", "cat", "", new
String[]{});
+ permission = new EJBMethodPermission("foo", "", "Home", new
String[]{});
+ permission = new EJBMethodPermission("foo", "cat", "Home", new
String[] {});
+ permission = new EJBMethodPermission("foo", "", "", new String[] {
"a", "b", "c", "d" });
+ permission = new EJBMethodPermission("foo", "cat", "", new String[]
{ "a", "b", "c", "d" });
+ permission = new EJBMethodPermission("foo", "", "Home", new String[]
{ "a", "b", "c", "d" });
+ permission = new EJBMethodPermission("foo", "cat", "Home", new
String[] { "a", "b", "c", "d" });
+
+
+ // methodInterface ::= "Home" | "LocalHome" | "Remote" | "Local" |
"ServiceEndpoint"
+ permission = new EJBMethodPermission("foo", "cat", "Home", new
String[] { "a", "b", "c", "d" });
+ permission = new EJBMethodPermission("foo", "cat", "LocalHome", new
String[] { "a", "b", "c", "d" });
+ permission = new EJBMethodPermission("foo", "cat", "Remote", new
String[] { "a", "b", "c", "d" });
+ permission = new EJBMethodPermission("foo", "cat", "Local", new
String[] { "a", "b", "c", "d" });
+ permission = new EJBMethodPermission("foo", "cat",
"ServiceEndpoint", new String[] { "a", "b", "c", "d" });
+
+ assertEquals(permission.getName(), "foo");
+ assertEquals(permission.getActions(), "cat,ServiceEndpoint,a,b,c,d");
+
+
+ // bad methodInterface
+ try {
+ permission = new EJBMethodPermission("foo", "cat", "Interface",
new String[] { "a", "b", "c", "d" });
+ fail("Bad method interface");
+ } catch(IllegalArgumentException iae) {
+ }
}
public void testImpliesStringStringStringStringArray() {
+ EJBMethodPermission permissionFooEEE = new
EJBMethodPermission("foo", "", "", null);
+ EJBMethodPermission permissionFooMIP = new
EJBMethodPermission("foo", "cat", "LocalHome", new String[] { "a", "b", "c",
"d" });
+ EJBMethodPermission permissionBarEEE = new
EJBMethodPermission("bar", "", "", new String[] {});
+ EJBMethodPermission permissionFooEIP = new
EJBMethodPermission("foo", "", "LocalHome", new String[] { "a", "b", "c", "d"
});
+ EJBMethodPermission permissionFooEIE = new
EJBMethodPermission("foo", "", "LocalHome", new String[] {});
+ EJBMethodPermission permissionFooEI = new
EJBMethodPermission("foo", "", "LocalHome", null);
+
+ assertTrue(permissionFooEEE.implies(permissionFooEEE));
+ assertTrue(permissionFooEEE.implies(permissionFooMIP));
+ assertTrue(permissionFooEEE.implies(permissionFooEIP));
+ assertTrue(permissionFooEEE.implies(permissionFooEIE));
+ assertTrue(permissionFooEEE.implies(permissionFooEI));
+ assertFalse(permissionFooMIP.implies(permissionFooEEE));
+
+ assertTrue(permissionFooEEE.equals(permissionFooEEE));
+ assertFalse(permissionFooEEE.equals(permissionFooMIP));
+ assertFalse(permissionFooMIP.equals(permissionFooEEE));
+
+ assertFalse(permissionFooEEE.implies(permissionBarEEE));
+ assertFalse(permissionBarEEE.implies(permissionFooEEE));
+
+ assertFalse(permissionFooEEE.equals(permissionBarEEE));
+ assertFalse(permissionBarEEE.equals(permissionFooEEE));
+
+ assertTrue(permissionFooEIP.implies(permissionFooMIP));
+ assertFalse(permissionFooEIE.implies(permissionFooMIP));
+ assertTrue(permissionFooEI.implies(permissionFooMIP));
+ assertTrue(permissionFooEI.implies(permissionFooEIP));
+ assertTrue(permissionFooEI.implies(permissionFooEIE));
+
+ assertFalse(permissionFooEEE.hashCode() ==
permissionBarEEE.hashCode());
}
/*
* Testing EJBMethodPermission(String, String, Method)
*/
public void testConstructorStringStringMethod() {
+
+ EJBMethodPermission permission = new EJBMethodPermission("foo",
"ServiceEndpoint", method);
+
+ permission = new EJBMethodPermission("foo", null, method);
+ permission = new EJBMethodPermission("foo", "", method);
+
+ permission = new EJBMethodPermission("foo", "Home", method);
+ permission = new EJBMethodPermission("foo", "LocalHome", method);
+ permission = new EJBMethodPermission("foo", "Remote", method);
+ permission = new EJBMethodPermission("foo", "Local", method);
+ permission = new EJBMethodPermission("foo", "ServiceEndpoint",
method);
+
+ assertEquals(permission.getName(), "foo");
+ assertEquals(permission.getActions(),
"cat,ServiceEndpoint,java.lang.Integer,java.lang.Float,java.lang.Long,java.lang.Double");
+
+ // Parameter method must not be null
+ try {
+ permission = new EJBMethodPermission("foo", "ServiceEndpoint",
null);
+ fail("Parameter method must not be null");
+ } catch(IllegalArgumentException iae) {
+ }
}
public void testImpliesStringStringMethod() {
}
- public static void main(String[] args) {
- EJBMethodPermissionTest test = new EJBMethodPermissionTest();
- test.testConstructorStringString();
- test.testImpliesStringString();
+
+ class TestClass {
+ public Object cat(Integer a, Float b, Long c, Double d) {
+ return null;
+ }
}
}
1.1
incubator-geronimo/specs/j2ee-jacc/src/test/javax/security/jacc/EJBMethodPermissionCollectionTest.java
Index: EJBMethodPermissionCollectionTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package javax.security.jacc;
import junit.framework.TestCase;
import java.security.PermissionCollection;
/**
*
* @version $Revision: 1.1 $ $Date: 2003/09/27 16:00:23 $
*/
public class EJBMethodPermissionCollectionTest extends TestCase {
public void testWildCards() {
PermissionCollection collection = new
EJBMethodPermission("HelloWorld", "").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", ""));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", "")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", ",,a,b,c"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", ",,a,b,c")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", ",,"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", ",,")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", ",Local"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", ",Local")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", ",Local,a,b,c"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", ",Local,a,b,c")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", ",Local,"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", ",Local,")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", "hello"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", "hello")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", "hello,,a,b,c"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", "hello,,a,b,c")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", "hello,,"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", "hello,,")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", "hello,Local"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", "hello,Local")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", "hello,Local,a,b,c")));
collection = new EJBMethodPermission("HelloWorld",
"").newPermissionCollection();
collection.add(new EJBMethodPermission("HelloWorld", "hello,Local,"));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
",Local,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,a,b,c")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,,")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local")));
assertFalse(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,a,b,c")));
assertTrue(collection.implies(new EJBMethodPermission("HelloWorld",
"hello,Local,")));
assertFalse(collection.implies(new
EJBMethodPermission("GoodbyeWorld", "hello,Local,")));
}
}