/** Installs the configuration files needed at startup. */ @Override protected Option[] configureCustom() { String managedServiceConfigPath = managedServiceStartupConfig.getResourcePath(); String managedServiceFactoryConfigPath = managedServiceFactoryStartupConfig.getResourcePath(); String invalidConfigPath = invalidStartupConfigFile.getResourcePath(); try { return options( installStartupFile( getClass().getResourceAsStream(managedServiceConfigPath), "/etc" + managedServiceConfigPath), installStartupFile( getClass().getResourceAsStream(managedServiceFactoryConfigPath), "/etc" + managedServiceFactoryConfigPath), installStartupFile( getClass().getResourceAsStream(invalidConfigPath), "/etc" + invalidConfigPath)); } catch (Exception e) { LOGGER.error( "Could not copy config files {}, {} and {} to /etc directory", managedServiceConfigPath, managedServiceFactoryConfigPath, invalidConfigPath); return null; } }
/** * Tests that a saved configuration will be exported * * @throws Exception */ @Test public void testExportAfterSavingAConfiguration() throws Exception { closeFileHandlesInEtc(); resetInitialState(); managedServiceNewConfig1.addConfigurationFileAndWait(configAdmin); console.runCommand(EXPORT_COMMAND); assertThat( "Saved configuration should be exported.", getPathToExportedConfig(getDefaultExportDirectory(), managedServiceNewConfig1.pid) .toFile() .isFile(), is(true)); }
@Test public void testConfigurationFileWithInvalidFormat() throws Exception { invalidConfig.addConfigurationFile(); invalidConfig.assertFileMovedToFailedDirectory(); }
@Test public void testConfigurationFileWithNoFactoryOrServicePid() throws IOException { configWithNoPid.addConfigurationFile(); configWithNoPid.assertFileMovedToFailedDirectory(); }
@Test public void testCreateNewManagedServiceFactoryConfigurationFile() throws Exception { managedServiceFactoryNewConfig.addConfigurationFileAndWait(configAdmin); managedServiceFactoryNewConfig.assertFileMovedToProcessedDirectory(); }
@Test public void aRunFirstTestStartUpWithInvalidFile() { invalidStartupConfigFile.assertFileMovedToFailedDirectory(); }
@Test public void aRunFirstTestStartUpWithExistingManagedServiceFactoryConfigurationFile() throws Exception { managedServiceFactoryStartupConfig.assertConfigurationPropertiesSet(configAdmin); managedServiceFactoryStartupConfig.assertFileMovedToProcessedDirectory(); }