use of org.codice.ddf.migration.MigrationWarning in project ddf by codice.
the class SecurityMigratableTest method testExportExceptionThrownWhenCopyingDirectory.
@Test(expected = MigrationException.class)
public void testExportExceptionThrownWhenCopyingDirectory() throws Exception {
MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
doThrow(MigrationException.class).when(mockMigratableUtil).copyDirectory(any(Path.class), eq(EXPORT_DIRECTORY), Matchers.<Collection<MigrationWarning>>any());
SecurityMigratable securityMigratable = new SecurityMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
securityMigratable.export(EXPORT_DIRECTORY);
}
use of org.codice.ddf.migration.MigrationWarning in project ddf by codice.
the class SecurityMigratableTest method testExportExceptionThrownWhenCopyingFile.
@Test(expected = MigrationException.class)
public void testExportExceptionThrownWhenCopyingFile() throws Exception {
// Setup
MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
when(mockMigratableUtil.getJavaPropertyValue(SERVER_ENCRYPTION_PROPERTIES_PATH, CRL_PROP_KEY)).thenReturn(EXPECTED_SERVER_ENCRYPTION_CRL_PATH.toString());
doThrow(MigrationException.class).when(mockMigratableUtil).copyFile(any(Path.class), eq(EXPORT_DIRECTORY), Matchers.<Collection<MigrationWarning>>any());
SecurityMigratable securityMigratable = new SecurityMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
// Perform test
securityMigratable.export(EXPORT_DIRECTORY);
}
use of org.codice.ddf.migration.MigrationWarning in project ddf by codice.
the class TestMigratable method exportWhenMigratablesReturnWarnings.
@Test
public void exportWhenMigratablesReturnWarnings() throws Exception {
ConfigurationMigrationManager configurationMigrationManager = createConfigurationMigrationManager();
MigrationWarning[] expectedWarnings = new MigrationWarning[] { new MigrationWarning("Warning1"), new MigrationWarning("Warning2") };
when(configurationMigratable.export(any(Path.class))).thenReturn(new MigrationMetadata(ImmutableList.of(expectedWarnings[0])));
when(dataMigratable.export(any(Path.class))).thenReturn(new MigrationMetadata(ImmutableList.of(expectedWarnings[1])));
Collection<MigrationWarning> migrationWarnings = export(() -> configurationMigrationManager.export(exportDirectory));
assertThat(migrationWarnings, containsInAnyOrder(expectedWarnings));
verify(configurationMigratable).export(exportDirectory);
verify(dataMigratable).export(exportDirectory);
}
use of org.codice.ddf.migration.MigrationWarning in project ddf by codice.
the class TestMigratable method exportWithWarnings.
@Test
public void exportWithWarnings() {
ConfigurationMigrationManager configurationMigrationManager = createConfigurationMigrationManager();
MigrationWarning migrationWarning = new MigrationWarning("");
Collection<MigrationWarning> warningList = new ArrayList<>();
warningList.add(migrationWarning);
MigrationMetadata warning = new MigrationMetadata(warningList);
when(configurationMigratable.export(any(Path.class))).thenReturn(warning);
Collection<MigrationWarning> migrationWarnings = configurationMigrationManager.export(exportDirectory);
assertThat(migrationWarnings, contains(migrationWarning));
}
use of org.codice.ddf.migration.MigrationWarning in project ddf by codice.
the class PlatformMigratableTest method testExportExceptionThrownWhenCopyingFile.
@Test(expected = MigrationException.class)
public void testExportExceptionThrownWhenCopyingFile() throws Exception {
// Setup
MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
doThrow(MigrationException.class).when(mockMigratableUtil).copyFile(any(Path.class), eq(exportDirectory), Matchers.<Collection<MigrationWarning>>any());
PlatformMigratable platformMigratable = new PlatformMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
// Perform test
platformMigratable.export(exportDirectory);
}
Aggregations