InterlokLauncher extends Launcher { protected String[] rebuildArgs() throws Exception { String[] rebuiltArgs = commandLine .remove(ARG_ADAPTER_CLASSPATH) .remove(ARG_IGNORE_SUBDIRS) .convertToNormal(ARG_FAILOVER) .convertToNormal(ARG_CONTAINER) .convertToNormal(ARG_PASSWORD) .render(); debug("Args for Main-Class : ", Arrays.asList(rebuiltArgs)); return rebuiltArgs; } InterlokLauncher(String[] argv); static void main(String[] args);  }
@Test public void testRebuild() throws Exception { InterlokLauncher launcher = new InterlokLauncher(new String[] { "-ignoreSubDirs", "--adapterClasspath", "./lib", "--configcheck", "bootstrap.properties" }); String[] rebuild = launcher.rebuildArgs(); assertEquals(2, rebuild.length); assertEquals("--configcheck", rebuild[0]); assertEquals("bootstrap.properties", rebuild[1]); }
@Test public void testRebuild_NoArgs() throws Exception { InterlokLauncher launcher = new InterlokLauncher(new String[] { "my.properties" }); String[] rebuild = launcher.rebuildArgs(); assertEquals(1, rebuild.length); assertEquals("my.properties", rebuild[0]); }
@Test public void testRebuild_Failover() throws Exception { InterlokLauncher launcher = new InterlokLauncher(new String[] { "--failover", "my.properties" }); String[] rebuild = launcher.rebuildArgs(); assertEquals(1, rebuild.length); assertEquals("my.properties", rebuild[0]); }
@Test public void testRebuild_FailoverWithNoProperties() throws Exception { InterlokLauncher launcher = new InterlokLauncher(new String[] { "--failover" }); String[] rebuild = launcher.rebuildArgs(); assertEquals(0, rebuild.length); }
@Test public void testRebuild_Container() throws Exception { InterlokLauncher launcher = new InterlokLauncher(new String[] { "--container", "my.properties" }); String[] rebuild = launcher.rebuildArgs(); assertEquals(1, rebuild.length); assertEquals("my.properties", rebuild[0]); }
@Test public void testRebuild_ContainerWithNoProperties() throws Exception { InterlokLauncher launcher = new InterlokLauncher(new String[] { "--container" }); String[] rebuild = launcher.rebuildArgs(); assertEquals(0, rebuild.length); }
@Test public void testRebuild_Password() throws Exception { InterlokLauncher launcher = new InterlokLauncher(new String[] { "-password", "PW:", "Hello" }); String[] rebuild = launcher.rebuildArgs(); assertEquals(2, rebuild.length); assertEquals("PW:", rebuild[0]); assertEquals("Hello", rebuild[1]); }