@Test
public void testInstallCommand() throws Exception {
Thread.sleep(12000);
CommandProcessor cp = getOsgiService(CommandProcessor.class);
CommandSession cs = cp.createSession(System.in, System.out, System.err);
try {
cs.execute("log:display");
fail("command should not exist");
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().indexOf("Command not found") >= 0);
}
Bundle b = getInstalledBundle("org.apache.felix.karaf.shell.log");
b.start();
Thread.sleep(1000);
cs.execute("log:display");
b.stop();
Thread.sleep(1000);
try {
cs.execute("log:display");
fail("command should not exist");
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().indexOf("Command not found") >= 0);
}
cs.close();
}