Search in sources :

Example 1 with ConfigurationMigratable

use of org.codice.ddf.migration.ConfigurationMigratable in project ddf by codice.

the class TestMigratable method testGetOptionalMigratableInfo.

@Test
public void testGetOptionalMigratableInfo() {
    DescribableBean bean1 = new DescribableBean("1.0", "ddf.platform", "Platform Migratable", "Exports platform config", "Codice");
    DescribableBean bean2 = new DescribableBean("2.0", "ddf.catalog", "Catalog Migratable", "Exports catalog metacards", "Codice");
    List<ConfigurationMigratable> mockConfigs = mock(List.class);
    List<DataMigratable> migratables = new ArrayList<>();
    migratables.add(new TestMigratable(bean1, 3));
    migratables.add(new TestMigratable(bean2, 4));
    ConfigurationMigrationManager manager = new ConfigurationMigrationManager(configurationAdminMigration, mBeanServer, mockConfigs, migratables);
    Collection<Describable> describables = manager.getOptionalMigratableInfo();
    verifyDescriptionEqual((Describable) describables.toArray()[0], bean1);
    verifyDescriptionEqual((Describable) describables.toArray()[1], bean2);
}
Also used : DescribableBean(org.codice.ddf.migration.DescribableBean) Describable(org.codice.ddf.platform.services.common.Describable) ArrayList(java.util.ArrayList) ConfigurationMigratable(org.codice.ddf.migration.ConfigurationMigratable) DataMigratable(org.codice.ddf.migration.DataMigratable) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with ConfigurationMigratable

use of org.codice.ddf.migration.ConfigurationMigratable in project ddf by codice.

the class ConfigurationMigrationManager method exportMigratables.

private Collection<MigrationWarning> exportMigratables(Path exportDirectory) throws IOException {
    List<MigrationWarning> warnings = new LinkedList<>();
    for (ConfigurationMigratable configMigratable : configurationMigratables) {
        warnings.addAll(exportMigratable(configMigratable, exportDirectory));
    }
    for (DataMigratable dataMigratable : dataMigratables) {
        Path dataMigratableDirectory = exportDirectory.resolve(dataMigratable.getId());
        Files.createDirectories(dataMigratableDirectory);
        warnings.addAll(exportMigratable(dataMigratable, exportDirectory));
    }
    return warnings;
}
Also used : Path(java.nio.file.Path) MigrationWarning(org.codice.ddf.migration.MigrationWarning) ConfigurationMigratable(org.codice.ddf.migration.ConfigurationMigratable) DataMigratable(org.codice.ddf.migration.DataMigratable) LinkedList(java.util.LinkedList)

Aggregations

ConfigurationMigratable (org.codice.ddf.migration.ConfigurationMigratable)2 DataMigratable (org.codice.ddf.migration.DataMigratable)2 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 DescribableBean (org.codice.ddf.migration.DescribableBean)1 MigrationWarning (org.codice.ddf.migration.MigrationWarning)1 Describable (org.codice.ddf.platform.services.common.Describable)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1