niclas 2004/01/19 16:59:23
Modified:
merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant
CodeSecurityDisabledTestCase.java
CodeSecurityEnabledTestCase.java
merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components
TestComponent.java TestService.java
Log:
Added a few more testcases.
Revision Changes Path
1.3 +11 -0
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityDisabledTestCase.java
Index: CodeSecurityDisabledTestCase.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityDisabledTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CodeSecurityDisabledTestCase.java 20 Jan 2004 00:10:29 -0000 1.2
+++ CodeSecurityDisabledTestCase.java 20 Jan 2004 00:59:23 -0000 1.3
@@ -136,6 +136,17 @@
throw new Exception( message );
}
+ try
+ {
+ test.setJavaVersion( "1.0.2" );
+ }
+ catch( Throwable e )
+ {
+ final String error = "CodeSecurityTest primary failure.";
+ final String message = ExceptionHelper.packException( error, e, true );
+ getLogger().error( message );
+ throw new Exception( message );
+ }
}
private TestService setupTestService() throws Exception
1.3 +17 -0
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityEnabledTestCase.java
Index: CodeSecurityEnabledTestCase.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityEnabledTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CodeSecurityEnabledTestCase.java 20 Jan 2004 00:10:29 -0000 1.2
+++ CodeSecurityEnabledTestCase.java 20 Jan 2004 00:59:23 -0000 1.3
@@ -146,6 +146,23 @@
getLogger().error( message );
throw new Exception( message );
}
+
+ try
+ {
+ test.setJavaVersion( "1.0.2" );
+ fail( "CodeSecurityTest failure: This operation should not be allowed."
);
+ }
+ catch( SecurityException e )
+ {
+ // ignore, expected
+ }
+ catch( Throwable e )
+ {
+ final String error = "CodeSecurityTest primary failure.";
+ final String message = ExceptionHelper.packException( error, e, true );
+ getLogger().error( message );
+ throw new Exception( message );
+ }
}
private TestService setupTestService() throws Exception
1.3 +5 -0
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/TestComponent.java
Index: TestComponent.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/TestComponent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestComponent.java 20 Jan 2004 00:10:29 -0000 1.2
+++ TestComponent.java 20 Jan 2004 00:59:23 -0000 1.3
@@ -115,4 +115,9 @@
{
return System.getProperty( "java.version" );
}
+
+ public void setJavaVersion( String newVer )
+ {
+ System.setProperty( "java.version", newVer );
+ }
}
1.3 +5 -0
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/TestService.java
Index: TestService.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/TestService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestService.java 20 Jan 2004 00:10:29 -0000 1.2
+++ TestService.java 20 Jan 2004 00:59:23 -0000 1.3
@@ -85,4 +85,9 @@
* Returns the version of the Java Virtual Machine.
**/
String getJavaVersion();
+
+ /**
+ * Sets the version of the Java Virtual Machine.
+ **/
+ void setJavaVersion( String newVer );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]