/** * Runs the console installer twice, verifying that a second uninstall key is created. * * @throws Exception for any error */ @Test @InstallFile("samples/windows/install.xml") public void testRejectMultipleInstallation() throws Exception { Assume.assumeTrue( "This test must be run as administrator, or with Windows UAC turned off", !skipTests && isAdminUser); checkInstall(container, APP_NAME); removeLock(); ConsoleInstallerContainer container2 = new TestConsoleInstallerContainer(); TestConsoleInstaller installer2 = container2.getComponent(TestConsoleInstaller.class); RegistryDefaultHandler handler2 = container2.getComponent(RegistryDefaultHandler.class); InstallData installData2 = container2.getComponent(InstallData.class); TestConsole console2 = installer2.getConsole(); console2.addScript("CheckedHelloPanel", "n"); assertFalse(registryKeyExists(handler2, UNINSTALL_KEY2)); installer2.run(Installer.CONSOLE_INSTALL, null, new String[0]); // verify the installation thinks it was unsuccessful assertFalse(installData2.isInstallSuccess()); // make sure the script has completed TestConsole console = installer2.getConsole(); assertTrue("Script still running panel: " + console.getScriptName(), console.scriptCompleted()); // verify the second registry key hasn't been created assertFalse(registryKeyExists(handler2, UNINSTALL_KEY2)); }
/** Called by {@link Housekeeper} to cleanup after installation. */ @Override public void cleanUp() { if (!installData.isInstallSuccess()) { // Shortcuts may have been deleted, but let's try to delete them once again for (String file : files) { File fl = new File(file); if (fl.exists()) { fl.delete(); } } } }