package org.jboss.loom.migrators._ext;

import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.jboss.loom.utils.ClassUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *  Base class to prepare external migrators test environment (copies files etc.).
 * 
 *  @author Ondrej Zizka, ozizka at redhat.com
 */
public class ExternalMigratorsTestEnv {
    private static final Logger log = LoggerFactory.getLogger( ExternalMigratorsTestEnv.class );

    protected static File workDir;
    
    @BeforeClass
    public static void copyTestExtMigratorFiles() throws IOException {
        workDir = new File("target/extMigrators/");
        FileUtils.forceMkdir( workDir );
        ClassUtils.copyResourceToDir( ExternalMigratorsLoader.class, "TestMigrator.mig.xml", workDir );
        ClassUtils.copyResourceToDir( ExternalMigratorsLoader.class, "TestJaxbBean.groovy",  workDir );
    }
    
    @AfterClass
    public static void deleteTestExtMigratorFiles() throws IOException {
        FileUtils.forceDelete( workDir );
    }

}// class

@@ -827,38 +827,39 @@
 xternalMigrators
-Loader
+TestEnv
 .class, %22TestMig
@@ -847,24 +847,28 @@
 Env.class, %22
+res/
 TestMigrator
@@ -948,14 +948,15 @@
 tors
-Loader
+TestEnv
 .cla
@@ -960,16 +960,20 @@
 class, %22
+res/
 TestJaxb

Move test to test src