Search in sources :

Example 1 with MigratableUtil

use of org.codice.ddf.migration.util.MigratableUtil in project ddf by codice.

the class PlatformMigratableTest method testExportExceptionThrownWhenCopyingFileFromSystemPropertyValue.

@Test(expected = MigrationException.class)
public void testExportExceptionThrownWhenCopyingFileFromSystemPropertyValue() throws Exception {
    // Setup
    MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
    doThrow(MigrationException.class).when(mockMigratableUtil).copyFileFromSystemPropertyValue(any(String.class), eq(exportDirectory), Matchers.<Collection<MigrationWarning>>any());
    PlatformMigratable platformMigratable = new PlatformMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
    // Perform test
    platformMigratable.export(exportDirectory);
}
Also used : MigrationWarning(org.codice.ddf.migration.MigrationWarning) MigratableUtil(org.codice.ddf.migration.util.MigratableUtil) Test(org.junit.Test)

Example 2 with MigratableUtil

use of org.codice.ddf.migration.util.MigratableUtil in project ddf by codice.

the class PlatformMigratableTest method testExportValidRelativePaths.

@Test
public void testExportValidRelativePaths() throws Exception {
    // Setup
    MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
    PlatformMigratable platformMigratable = new PlatformMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
    // Perform Test
    platformMigratable.export(exportDirectory);
    // Verify
    assertWsSecurityExport(mockMigratableUtil);
    assertSystemPropertiesFilesExport(mockMigratableUtil);
    assertKeystoresExport(mockMigratableUtil);
    assertAppListExported(mockMigratableUtil);
}
Also used : MigratableUtil(org.codice.ddf.migration.util.MigratableUtil) Test(org.junit.Test)

Example 3 with MigratableUtil

use of org.codice.ddf.migration.util.MigratableUtil 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);
}
Also used : Path(java.nio.file.Path) MigrationWarning(org.codice.ddf.migration.MigrationWarning) MigratableUtil(org.codice.ddf.migration.util.MigratableUtil) Test(org.junit.Test)

Example 4 with MigratableUtil

use of org.codice.ddf.migration.util.MigratableUtil in project ddf by codice.

the class SecurityMigratableTest method testExportValidRelativePaths.

@Test
public void testExportValidRelativePaths() 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());
    when(mockMigratableUtil.getJavaPropertyValue(SERVER_SIGNATURE_PROPERTIES_PATH, CRL_PROP_KEY)).thenReturn(EXPECTED_SERVER_SIGNATURE_CRL_PATH.toString());
    when(mockMigratableUtil.getJavaPropertyValue(ISSUER_ENCRYPTION_PROPERTIES_PATH, CRL_PROP_KEY)).thenReturn(EXPECTED_ISSUER_ENCRYPTION_CRL_PATH.toString());
    when(mockMigratableUtil.getJavaPropertyValue(ISSUER_SIGNATURE_PROPERTIES_PATH, CRL_PROP_KEY)).thenReturn(EXPECTED_ISSUER_SIGNATURE_CRL_PATH.toString());
    SecurityMigratable securityMigratable = new SecurityMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
    // Perform Test
    securityMigratable.export(EXPORT_DIRECTORY);
    // Verify
    assertCrlExport(mockMigratableUtil);
    assertPdpDirectoryExport(mockMigratableUtil);
}
Also used : MigratableUtil(org.codice.ddf.migration.util.MigratableUtil) Test(org.junit.Test)

Example 5 with MigratableUtil

use of org.codice.ddf.migration.util.MigratableUtil in project ddf by codice.

the class SecurityMigratableTest method testExportExceptionThrownWhenReadingCrlPropsFile.

@Test(expected = MigrationException.class)
public void testExportExceptionThrownWhenReadingCrlPropsFile() {
    // Setup
    MigratableUtil mockMigratableUtil = mock(MigratableUtil.class);
    doThrow(MigrationException.class).when(mockMigratableUtil).getJavaPropertyValue(SERVER_ENCRYPTION_PROPERTIES_PATH, CRL_PROP_KEY);
    SecurityMigratable securityMigratable = new SecurityMigratable(DESCRIBABLE_BEAN, mockMigratableUtil);
    // Perform test
    securityMigratable.export(EXPORT_DIRECTORY);
}
Also used : MigratableUtil(org.codice.ddf.migration.util.MigratableUtil) Test(org.junit.Test)

Aggregations

MigratableUtil (org.codice.ddf.migration.util.MigratableUtil)14 Test (org.junit.Test)14 MigrationWarning (org.codice.ddf.migration.MigrationWarning)10 MigrationMetadata (org.codice.ddf.migration.MigrationMetadata)5 Path (java.nio.file.Path)4 ArrayList (java.util.ArrayList)2