use of org.codice.ddf.migration.util.MigratableUtil 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.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);
}
use of org.codice.ddf.migration.util.MigratableUtil 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