You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2010/07/21 06:22:42 UTC
svn commit: r966082 - in /incubator/river/jtsk/trunk/qa/jtreg:
com/sun/jini/config/KeyStores/TestGetKeyStore.java
net/jini/security/GrantPermission/implies/Test.java
Author: peter_firmstone
Date: Wed Jul 21 04:22:41 2010
New Revision: 966082
URL: http://svn.apache.org/viewvc?rev=966082&view=rev
Log:
Minor fix to jtreg tests due to jsk-policy.jar no longer being loaded from jre/lib/ext an assumption about class visibility in Test.java and TestGetKeyStore failling due to IOException being recieved, which is still an acceptable form of failure, although not the expected Exception.
Modified:
incubator/river/jtsk/trunk/qa/jtreg/com/sun/jini/config/KeyStores/TestGetKeyStore.java
incubator/river/jtsk/trunk/qa/jtreg/net/jini/security/GrantPermission/implies/Test.java
Modified: incubator/river/jtsk/trunk/qa/jtreg/com/sun/jini/config/KeyStores/TestGetKeyStore.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/qa/jtreg/com/sun/jini/config/KeyStores/TestGetKeyStore.java?rev=966082&r1=966081&r2=966082&view=diff
==============================================================================
--- incubator/river/jtsk/trunk/qa/jtreg/com/sun/jini/config/KeyStores/TestGetKeyStore.java (original)
+++ incubator/river/jtsk/trunk/qa/jtreg/com/sun/jini/config/KeyStores/TestGetKeyStore.java Wed Jul 21 04:22:41 2010
@@ -44,7 +44,11 @@ public class TestGetKeyStore extends Bas
System.setSecurityManager(new SecurityManager());
}
}
-
+ /* "http://unknwnxx/foo" used to be UnknownHostException, however IOException
+ * was also found to be a valid Exception and is the direct parent class that
+ * UnknownHostException inherits from. Inspection of various methods involved
+ * indicate that IOException is also a valid response.
+ */
static Test[] tests = {
new TestGetKeyStore(null, null, NullPointerException.class),
new TestGetKeyStore("not-found", null, FileNotFoundException.class),
@@ -54,7 +58,7 @@ public class TestGetKeyStore extends Bas
new TestGetKeyStore(
"badprot://foo", null, FileNotFoundException.class),
new TestGetKeyStore(
- "http://unknwnxx/foo", null, UnknownHostException.class),
+ "http://unknwnxx/foo", null, IOException.class),
testWithHttpServer("unknown-file", null, FileNotFoundException.class),
testWithHttpServer("keystore", null, KeyStore.class),
testWithHttpServer("policy", null, IOException.class),
Modified: incubator/river/jtsk/trunk/qa/jtreg/net/jini/security/GrantPermission/implies/Test.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/qa/jtreg/net/jini/security/GrantPermission/implies/Test.java?rev=966082&r1=966081&r2=966082&view=diff
==============================================================================
--- incubator/river/jtsk/trunk/qa/jtreg/net/jini/security/GrantPermission/implies/Test.java (original)
+++ incubator/river/jtsk/trunk/qa/jtreg/net/jini/security/GrantPermission/implies/Test.java Wed Jul 21 04:22:41 2010
@@ -20,15 +20,31 @@
*/
import java.security.Permission;
+import java.security.UnresolvedPermission;
import net.jini.security.GrantPermission;
public class Test {
public static void main(String[] args) throws Exception {
- Permission gp1 = new GrantPermission("FooPermission"),
- gp2 = new GrantPermission("FooPermission; FooPermission"),
+ /* 21st July 2010 - Peter Firmstone commented: I changed the constructors
+ * from using string representations that relied on class visibility
+ * to generate UnresolvedPermission's, this test failled due to
+ * the Permission's classes being successfully resolved by GrantPermission
+ * due to that fact that jsk-policy.jar was no longer loaded by the
+ * jre/lib/ext Extension ClassLoader.
+ *
+ * I figure this is ok as the tests states that it is testing implies()
+ * and equals(), not the proper parsing of string's in constructors.
+ */
+ UnresolvedPermission foo = new UnresolvedPermission("FooPermission", null, null, null),
+ foo2 = new UnresolvedPermission("FooPermission", null, null, null),
+ bar = new UnresolvedPermission("BarPermission", null, null, null);
+ Permission [] foos = {foo, foo2};
+ Permission [] fooBar = {foo, bar};
+ Permission gp1 = new GrantPermission(foo),
+ gp2 = new GrantPermission(foos),
gp3 = new GrantPermission(new FooPermission()),
- gp4 = new GrantPermission("FooPermission; BarPermission"),
- gp5 = new GrantPermission("BarPermission");
+ gp4 = new GrantPermission(fooBar),
+ gp5 = new GrantPermission(bar);
// sanity check
if (!(gp1.equals(gp2) && gp1.implies(gp2) &&
@@ -38,7 +54,9 @@ public class Test {
}
// unresolved FooPerm should imply resolved FooPerm
if (!gp1.implies(gp3)) {
- throw new Error();
+ throw new Error("GrantPermission, containing UnresolvedPermission" +
+ "identical to a resolved instance of that permission" +
+ "does not imply as expected");
}
// resolved FooPerm should not imply or equal unresolved FooPerm
if (gp1.equals(gp3) || gp3.implies(gp1)) {