@Test public void testLoadTestMigrator() throws Throwable { try { File workDir = new File("target/extMigrators/"); FileUtils.forceMkdir( workDir ); ClassUtils.copyResourceToDir( ExternalMigratorsLoaderTest.class, "res/TestMigrator.mig.xml", workDir ); ClassUtils.copyResourceToDir( ExternalMigratorsLoaderTest.class, "res/TestJaxbBean.groovy", workDir ); Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> migs = new ExternalMigratorsLoader().loadMigrators( workDir, new IMigratorFilter.All(), new GlobalConfiguration() ); assertEquals("1 migrator loaded", 1, migs.size()); DefinitionBasedMigrator mig = migs.values().iterator().next(); assertEquals("1 migrator loaded", "MailExtMigrator", mig.getClass().getName()); } catch( Throwable ex ){ ex.printStackTrace(); throw ex; } }
public Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> loadMigrators( File dir, IMigratorFilter filter, GlobalConfiguration globConf ) throws MigrationException { this.descriptors = loadMigratorDefinitions( dir, globConf ); for( Iterator<MigratorDefinition> it = descriptors.iterator(); it.hasNext(); ) { if( ! filter.filterDefinition( it.next() ) ) it.remove(); } log.debug("Filtering left " + descriptors.size() + " migrator definitions conforming to " + filter); Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> migs = instantiateMigratorsFromDefinitions( this.descriptors, this.fragmentJaxbClasses, globConf ); return migs; }
ExternalMigratorsLoader { public Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> loadMigrators( File dir, IMigratorFilter filter, GlobalConfiguration globConf ) throws MigrationException { this.descriptors = loadMigratorDefinitions( dir, globConf ); for( Iterator<MigratorDefinition> it = descriptors.iterator(); it.hasNext(); ) { if( ! filter.filterDefinition( it.next() ) ) it.remove(); } log.debug("Filtering left " + descriptors.size() + " migrator definitions conforming to " + filter); Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> migs = instantiateMigratorsFromDefinitions( this.descriptors, this.fragmentJaxbClasses, globConf ); return migs; } }
ExternalMigratorsLoader { public Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> loadMigrators( File dir, IMigratorFilter filter, GlobalConfiguration globConf ) throws MigrationException { this.descriptors = loadMigratorDefinitions( dir, globConf ); for( Iterator<MigratorDefinition> it = descriptors.iterator(); it.hasNext(); ) { if( ! filter.filterDefinition( it.next() ) ) it.remove(); } log.debug("Filtering left " + descriptors.size() + " migrator definitions conforming to " + filter); Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> migs = instantiateMigratorsFromDefinitions( this.descriptors, this.fragmentJaxbClasses, globConf ); return migs; }  }
ExternalMigratorsLoader { public Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> loadMigrators( File dir, IMigratorFilter filter, GlobalConfiguration globConf ) throws MigrationException { this.descriptors = loadMigratorDefinitions( dir, globConf ); for( Iterator<MigratorDefinition> it = descriptors.iterator(); it.hasNext(); ) { if( ! filter.filterDefinition( it.next() ) ) it.remove(); } log.debug("Filtering left " + descriptors.size() + " migrator definitions conforming to " + filter); Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> migs = instantiateMigratorsFromDefinitions( this.descriptors, this.fragmentJaxbClasses, globConf ); return migs; }  Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> loadMigrators(
            File dir, IMigratorFilter filter, GlobalConfiguration globConf ); static List<MigratorDefinition> loadMigratorDefinitions( File dir, GlobalConfiguration gc ); static Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> instantiateMigratorsFromDefinitions(
            List<MigratorDefinition> defs, 
            Map<String, Class<? extends IConfigFragment>> fragClasses,
            GlobalConfiguration globConf
        ); }
ExternalMigratorsLoader { public Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> loadMigrators( File dir, IMigratorFilter filter, GlobalConfiguration globConf ) throws MigrationException { this.descriptors = loadMigratorDefinitions( dir, globConf ); for( Iterator<MigratorDefinition> it = descriptors.iterator(); it.hasNext(); ) { if( ! filter.filterDefinition( it.next() ) ) it.remove(); } log.debug("Filtering left " + descriptors.size() + " migrator definitions conforming to " + filter); Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> migs = instantiateMigratorsFromDefinitions( this.descriptors, this.fragmentJaxbClasses, globConf ); return migs; }  Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> loadMigrators(
            File dir, IMigratorFilter filter, GlobalConfiguration globConf ); static List<MigratorDefinition> loadMigratorDefinitions( File dir, GlobalConfiguration gc ); static Map<Class<? extends DefinitionBasedMigrator>, DefinitionBasedMigrator> instantiateMigratorsFromDefinitions(
            List<MigratorDefinition> defs, 
            Map<String, Class<? extends IConfigFragment>> fragClasses,
            GlobalConfiguration globConf
        );  }