Methods Summary |
---|
public static void | main(java.lang.String[] args)
final TestRunner runner= new TestRunner();
final TestResult result = runner.doRun(JvmOptionsTest.suite(), false);
System.exit(result.errorCount() + result.failureCount());
|
private void | printOptions(JvmOptions o)
String[] options = o.getJvmOptions();
System.out.println("============================");
for (int i = 0; i < options.length; i++)
{
System.out.println("Option[" + options[i] + "]");
}
System.out.println("============================");
|
protected void | setUp()
|
public static junit.framework.Test | suite()
TestSuite suite = new TestSuite(JvmOptionsTest.class);
return suite;
|
protected void | tearDown()
|
public void | testAddDuplicateJvmOptions0()
String[] sa = new String[] {"-x=y"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.addJvmOptions(new String[] {"-x=y"});
Assert.assertTrue(Arrays.equals(new String[] {"-x=y"}, invalid));
Assert.assertTrue(Arrays.equals(new String[] {"-x=y"},
options.getJvmOptions()));
|
public void | testAddDuplicateJvmOptions1()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.addJvmOptions(new String[] {"-a=b"});
Assert.assertTrue(Arrays.equals(new String[] {"-a=b"}, invalid));
Assert.assertTrue(Arrays.equals(new String[] {"-x=y", "-a=b"},
options.getJvmOptions()));
|
public void | testAddDuplicateJvmOptions2()
String[] sa = new String[] {"-x=y -a=b"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.addJvmOptions(new String[] {"-a=b"});
Assert.assertTrue(Arrays.equals(new String[] {"-a=b"}, invalid));
Assert.assertTrue(Arrays.equals(new String[] {"-x=y -a=b"},
options.getJvmOptions()));
|
public void | testAddDuplicateJvmOptions3()
String[] sa = new String[] {"-x=y -a=b"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.addJvmOptions(new String[] {"-a=b", "-c=d"});
Assert.assertTrue(Arrays.equals(new String[] {"-a=b"}, invalid));
Assert.assertTrue(Arrays.equals(new String[] {"-x=y -a=b", "-c=d"},
options.getJvmOptions()));
|
public void | testAddDuplicateJvmOptions4()
String[] sa = new String[] {"-x=y -a=b"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.addJvmOptions(new String[] {"-a=b -c=d"});
Assert.assertTrue(invalid.length == 0);
Assert.assertTrue(Arrays.equals(new String[] {"-x=y -a=b", "-a=b -c=d"},
options.getJvmOptions()));
|
public void | testAddInValidJvmOptions()
JvmOptions options = new JvmOptions(new String[] {"-option_with_dash"});
try
{
options.addJvmOptions(new String[] {"option_with_no_dash"});
}
catch (InvalidJvmOptionException e)
{
//ok
}
|
public void | testAddJvmOptions()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.addJvmOptions(new String[] {"-c=d"});
Assert.assertTrue(invalid.length == 0);
Assert.assertTrue(Arrays.equals(new String[] {"-x=y", "-a=b", "-c=d"},
options.getJvmOptions()));
|
public void | testAddJvmOptionsNull()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
try
{
options.addJvmOptions(null);
Assert.assertTrue(false);
}
catch (IllegalArgumentException iae)
{
Assert.assertTrue(Arrays.equals(sa, options.getJvmOptions()));
}
|
public void | testAddJvmOptionsZeroLength()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
options.addJvmOptions(new String[0]);
Assert.assertTrue(Arrays.equals(sa, options.getJvmOptions()));
|
public void | testAddNullJvmOption()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
try
{
options.addJvmOptions(new String[] {null});
Assert.assertTrue(false);
}
catch (IllegalArgumentException iae)
{
Assert.assertTrue(Arrays.equals(sa, options.getJvmOptions()));
}
|
public void | testAppServerJvmOptions()
String[] options = new String[] {
"-client",
"-Djava.endorsed.dirs=${com.sun.aas.installRoot}/lib/endorsed",
"-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy",
"-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf",
"-Dsun.rmi.dgc.server.gcInterval=3600000",
"-Dcom.sun.web.console.appbase=/${com.sun.aas.installRoot}/lib/install/applications/com_sun_web_ui",
"-Xmx512m",
"-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks",
"-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks",
"-Djava.ext.dirs=${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext",
"-Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver",
"-Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl"
};
try
{
JvmOptions jvmOptions = new JvmOptions(options);
Assert.assertTrue(Arrays.equals(options, jvmOptions.getJvmOptions()));
}
catch (InvalidJvmOptionException e)
{
Assert.assertTrue(false);
}
|
public void | testCreateInValidJvmOptions()
try
{
JvmOptions options = new JvmOptions(new String[] {"option_with_no_dash"});
}
catch (InvalidJvmOptionException e)
{
//ok
}
|
public void | testCreateJvmOptions()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
Assert.assertTrue(Arrays.equals(sa, options.getJvmOptions()));
sa = new String[] {"-x=y -a=b", "-a=b"};
options = new JvmOptions(sa);
Assert.assertTrue(Arrays.equals(sa, options.getJvmOptions()));
sa = new String[] {"-x=y -x=y"};
options = new JvmOptions(sa);
Assert.assertTrue(Arrays.equals(
new String[] {"-x=y"}, options.getJvmOptions()));
|
public void | testCreateNull()
try
{
JvmOptions options = new JvmOptions(null);
Assert.assertTrue(false);
}
catch (IllegalArgumentException iae)
{
//ok
}
|
public void | testCreateOptionNull()
String[] sa = new String[] {"-x=y", null};
try
{
JvmOptions options = new JvmOptions(sa);
Assert.assertTrue(false);
}
catch (IllegalArgumentException iae)
{
//ok
}
|
public void | testDeleteInValidJvmOptions()
JvmOptions options = new JvmOptions(new String[] {"-option_with_dash"});
options.deleteJvmOptions(new String[] {"option_with_no_dash"});
Assert.assertTrue(Arrays.equals(
new String[] {"-option_with_dash"}, options.getJvmOptions()));
|
public void | testDeleteJvmOptions()
String[] sa = new String[] {"-x=y"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.deleteJvmOptions(new String[]{"-x=y"});
Assert.assertTrue(invalid.length == 0);
Assert.assertTrue(Arrays.equals(
new String[0], options.getJvmOptions()));
|
public void | testDeleteJvmOptions1()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.deleteJvmOptions(new String[]{"-x=y"});
Assert.assertTrue(invalid.length == 0);
Assert.assertTrue(Arrays.equals(
new String[]{"-a=b"}, options.getJvmOptions()));
|
public void | testDeleteJvmOptions2()
String[] sa = new String[] {"-x=y -a=b"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.deleteJvmOptions(new String[]{"-x=y"});
Assert.assertTrue(invalid.length == 0);
Assert.assertTrue(Arrays.equals(
new String[]{"-a=b"}, options.getJvmOptions()));
|
public void | testDeleteJvmOptions3()
String[] sa = new String[] {"-x=y -a=b -c=d"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.deleteJvmOptions(new String[]{"-x=y", "-c=d"});
Assert.assertTrue(invalid.length == 0);
Assert.assertTrue(Arrays.equals(
new String[]{"-a=b"}, options.getJvmOptions()));
|
public void | testDeleteJvmOptions4()
String[] sa = new String[] {"-x=y -a=b", "-a=b -c=d"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.deleteJvmOptions(new String[]{"-x=y", "-c=d"});
Assert.assertTrue(invalid.length == 0);
Assert.assertTrue(Arrays.equals(
new String[]{"-a=b"}, options.getJvmOptions()));
|
public void | testDeleteJvmOptions5()
String[] sa = new String[] {"-x=y"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.deleteJvmOptions(new String[]{"-c=d"});
Assert.assertTrue(Arrays.equals(invalid, new String[]{"-c=d"}));
Assert.assertTrue(Arrays.equals(
new String[]{"-x=y"}, options.getJvmOptions()));
|
public void | testDeleteJvmOptions6()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.deleteJvmOptions(new String[]{"-a=b", "-c=d"});
Assert.assertTrue(Arrays.equals(invalid, new String[]{"-c=d"}));
Assert.assertTrue(Arrays.equals(
new String[]{"-x=y"}, options.getJvmOptions()));
|
public void | testDeleteJvmOptions7()
String[] sa = new String[] {"-x=y "};
JvmOptions options = new JvmOptions(sa);
String[] invalid = options.deleteJvmOptions(new String[]{"-a=b"});
Assert.assertTrue(Arrays.equals(invalid, new String[]{"-a=b"}));
Assert.assertTrue(Arrays.equals(
new String[]{"-x=y"}, options.getJvmOptions()));
|
public void | testDeleteJvmOptionsNull()
String[] sa = new String[] {"-x=y"};
JvmOptions options = new JvmOptions(sa);
try
{
options.deleteJvmOptions(null);
}
catch (IllegalArgumentException iae)
{
Assert.assertTrue(Arrays.equals(sa, options.getJvmOptions()));
}
|
public void | testDeleteJvmOptionsZeroLength()
String[] sa = new String[] {"-x=y", "-a=b"};
JvmOptions options = new JvmOptions(sa);
options.deleteJvmOptions(new String[0]);
Assert.assertTrue(Arrays.equals(sa, options.getJvmOptions()));
|
public void | testDeleteNullJvmOption()
String[] sa = new String[] {"-x=y"};
JvmOptions options = new JvmOptions(sa);
try
{
options.deleteJvmOptions(new String[]{null});
}
catch (IllegalArgumentException iae)
{
Assert.assertTrue(Arrays.equals(sa, options.getJvmOptions()));
}
|
public void | testJvmOptions()
String[] sa = new String[] {"-x=y"};
JvmOptions options = new JvmOptions(sa);
options.addJvmOptions(new String[]{"-a=b", "-c=d"});
Assert.assertTrue(Arrays.equals(
new String[]{"-x=y", "-a=b", "-c=d"}, options.getJvmOptions()));
options.addJvmOptions(new String[]{"-a=b -c=d"});
Assert.assertTrue(Arrays.equals(
new String[]{"-x=y", "-a=b", "-c=d", "-a=b -c=d"}, options.getJvmOptions()));
String[] invalid = options.deleteJvmOptions(new String[]{"-a=b"});
Assert.assertTrue(invalid.length == 0);
|
public void | testJvmOptionsElement()
JvmOptionsElement e = new JvmOptionsElement("-x=y");
Assert.assertFalse(e.hasNext());
JvmOptionsElement next = new JvmOptionsElement("-a=b");
e.setNext(next);
Assert.assertTrue(e.hasNext());
Assert.assertEquals(next, e.next());
JvmOptionsElement next1 = new JvmOptionsElement("-c=d");
next.setNext(next1);
Assert.assertEquals(next1, e.next().next());
JvmOptionsElement next2 = new JvmOptionsElement("-a=b -c=d");
next1.setNext(next2);
boolean b = e.deleteJvmOption("-a=b");
Assert.assertTrue(b);
|
public void | testQuotedOptions()
String[] options = new String[] {"-Dfile=\"a b\""};
JvmOptions jvmOptions = new JvmOptions(options);
Assert.assertTrue(Arrays.equals(options, jvmOptions.getJvmOptions()));
jvmOptions.deleteJvmOptions(options);
try {
new JvmOptions(new String[] {"-Dfile=\""});
Assert.assertTrue(false);
} catch (InvalidJvmOptionException e) {}
try {
new JvmOptions(new String[] {"-Dx=\"a\" -Dy=\"b"});
Assert.assertTrue(false);
} catch (InvalidJvmOptionException e) {}
try {
new JvmOptions(new String[] {"-Dx=\"a\" -Dy=\"b"});
Assert.assertTrue(false);
} catch (InvalidJvmOptionException e) {}
|
public void | testZeroLength()
JvmOptions options = new JvmOptions(new String[0]);
Assert.assertTrue(Arrays.equals(new String[0], options.getJvmOptions()));
|