use of org.codice.ddf.migration.util.MigratableUtil in project ddf by codice.
the class PlatformMigratableTest method testExportExceptionThrownWhenCopyingDirectory.
@Test(expected = MigrationException.class)
public void testExportExceptionThrownWhenCopyingDirectory() throws Exception {
// Setup
MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
doThrow(MigrationException.class).when(mockMigratableUtil).copyDirectory(any(Path.class), eq(exportDirectory), Matchers.<Collection<MigrationWarning>>any());
PlatformMigratable platformMigratable = new PlatformMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
// Perform test
platformMigratable.export(exportDirectory);
}
use of org.codice.ddf.migration.util.MigratableUtil in project ddf by codice.
the class SecurityMigratableTest method testExportCrlIsNull.
@Test
public void testExportCrlIsNull() {
// Setup
MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
when(mockMigratableUtil.getJavaPropertyValue(SERVER_ENCRYPTION_PROPERTIES_PATH, CRL_PROP_KEY)).thenReturn(null);
SecurityMigratable securityMigratable = new SecurityMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
// Perform test
MigrationMetadata migrationMetadata = securityMigratable.export(EXPORT_DIRECTORY);
// Verify
verify(mockMigratableUtil, never()).copyFile(eq(EXPECTED_SERVER_ENCRYPTION_CRL_PATH), eq(EXPORT_DIRECTORY), anyCollectionOf(MigrationWarning.class));
assertThat(migrationMetadata.getMigrationWarnings().size(), is(0));
}
use of org.codice.ddf.migration.util.MigratableUtil in project ddf by codice.
the class SecurityMigratableTest method testWarningsReturned.
@Test
public void testWarningsReturned() throws Exception {
MigratableUtil migratableUtil = mock(MigratableUtil.class);
MigrationWarning expectedWarning = new MigrationWarning("Expected Warning");
doAnswer(new MigrationWarningAnswer(expectedWarning)).when(migratableUtil).copyDirectory(eq(PDP_POLICIES_DIR_REL_PATH), eq(EXPORT_DIRECTORY), Matchers.<Collection<MigrationWarning>>any());
SecurityMigratable securityMigratable = new SecurityMigratable(DESCRIBABLE_BEAN, migratableUtil);
MigrationMetadata migrationMetadata = securityMigratable.export(EXPORT_DIRECTORY);
assertThat(migrationMetadata.getMigrationWarnings(), containsInAnyOrder(expectedWarning));
}
use of org.codice.ddf.migration.util.MigratableUtil in project ddf by codice.
the class SecurityMigratableTest method testExportCrlIsBlank.
@Test(expected = MigrationException.class)
public void testExportCrlIsBlank() {
// Setup
MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
when(mockMigratableUtil.getJavaPropertyValue(SERVER_ENCRYPTION_PROPERTIES_PATH, CRL_PROP_KEY)).thenReturn("");
SecurityMigratable securityMigratable = new SecurityMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
// Perform test
securityMigratable.export(EXPORT_DIRECTORY);
}
Aggregations