Example usage for org.apache.commons.io FileUtils copyDirectory

List of usage examples for org.apache.commons.io FileUtils copyDirectory

Introduction

In this page you can find the example usage for org.apache.commons.io FileUtils copyDirectory.

Prototype

public static void copyDirectory(File srcDir, File destDir) throws IOException 

Source Link

Document

Copies a whole directory to a new location preserving the file dates.

Usage

From source file:au.org.ala.delta.confor.ConforTestCase.java

@Before
public void setUp() throws Exception {
    File directory = urlToFile("/dataset/");
    File dest = new File(System.getProperty("java.io.tmpdir"));
    FileUtils.copyDirectory(directory, dest);

    _samplePath = FilenameUtils.concat(dest.getAbsolutePath(), getDataSet());
    _directivesFilePath = FilenameUtils.concat(_samplePath, directivesFileName());

}

From source file:BuildIntegrationTest.java

@Before
public void setup() throws IOException {

    //Copy Plugin source files to temp directory to be checked
    FileUtils.copyDirectory(new File("src/test/resources"), testProjectDir.getRoot());

    //Add Plugin classpath to the test runner
    File testClassPath = new File("build/createClasspathManifest/plugin-classpath.txt");

    if (!testClassPath.exists()) {
        throw new IllegalStateException(
                "Did not find plugin classpath resource, run `testClasses` build task.");
    }// www  . jav a  2 s  .  com

    List<String> classPathStrings = FileUtils.readLines(testClassPath, null);

    classPaths = new ArrayList<>();

    for (String classPath : classPathStrings) {
        classPaths.add(new File(classPath));
    }

    System.out.println(">>>>>>>>>>> Build Integration Test Started");
}

From source file:de.flapdoodle.embed.mongo.config.processlistener.CopyDbFilesFromDirBeforeProcessStop.java

@Override
public void onAfterProcessStop(File dbDir, boolean dbDirIsTemp) {
    try {//from w w  w  .j  a va2s  .  com
        FileUtils.copyDirectory(dbDir, _destination);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:net.fatlenny.datacitation.service.GitCitationDBServiceTest.java

@Before
public void setUp() throws IOException {
    File file = new File("src/test/resources/gitCitationDB");

    temporaryFolder.create();//from   www.  j  a va  2s  .co m
    projectFolder = temporaryFolder.newFolder();

    FileUtils.copyDirectory(file, projectFolder);

    service = new GitCitationDBService(projectFolder.getAbsolutePath());
}

From source file:com.kylinolap.common.util.LocalFileMetadataTestCase.java

@Override
public void createTestMetadata() {
    KylinConfig.destoryInstance();//ww w  .  j a  v a 2s.c  om

    this.tempTestMetadataUrl = "../examples/test_metadata";
    try {
        FileUtils.deleteDirectory(new File(tempTestMetadataUrl));
        FileUtils.copyDirectory(new File(testDataFolder), new File(tempTestMetadataUrl));
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    if (System.getProperty(KylinConfig.KYLIN_CONF) == null && System.getenv(KylinConfig.KYLIN_CONF) == null)
        System.setProperty(KylinConfig.KYLIN_CONF, tempTestMetadataUrl);

    KylinConfig.getInstanceFromEnv().setMetadataUrl(tempTestMetadataUrl);

}

From source file:ml.shifu.shifu.udf.FullScoreUDFTest.java

@BeforeClass
public void setUp() throws Exception {
    File models = new File("src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models");
    FileUtils.copyDirectory(models, tmpModels);

    instance = new FullScoreUDF("LOCAL",
            "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ModelConfig.json",
            "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ColumnConfig.json",
            "src/test/resources/example/cancer-judgement/DataStore/DataSet1/.pig_header", "|");
}

From source file:de.oppermann.pomutils.VersionReplaceTest.java

@Override
protected void setUp() throws Exception {
    super.setUp();
    System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");

    File testTargetResourceFolder = new File("target/testresources/versionReplacer");
    FileUtils.deleteDirectory(testTargetResourceFolder);
    FileUtils.copyDirectory(new File("src/test/resources/versionReplacer"), testTargetResourceFolder);
}

From source file:com.gs.obevo.db.scenariotests.OnboardingDeployTest.java

@Test
public void onboardingTest() throws Exception {
    final File srcDir = new File("./src/test/resources/scenariotests/onboardingDeploy");
    final File destDir = new File("./target/scenariotests/onboardingDeploy");
    FileUtils.deleteQuietly(destDir);//from   w  w w  .  j  a  v a2s  .  c  om

    FileUtils.copyDirectory(srcDir, destDir);

    LOG.info("Part 1 - do the deployment w/ onboarding mode");
    DbDeployerAppContext deployContext = DbEnvironmentFactory.getInstance()
            .readOneFromSourcePath(destDir.getAbsolutePath(), "test").buildAppContext();

    try {
        deployContext.setupEnvInfra().cleanEnvironment().deploy(new MainDeployerArgs().onboardingMode(true));
    } catch (RuntimeException exc) {
        exc.printStackTrace();
        // ignoring
    }

    // Verify that the exception files have been created properly
    assertTrue(new File(destDir, "SCHEMA1/staticdata/exceptions/TABLE_A.csv").exists());
    assertTrue(new File(destDir, "SCHEMA1/staticdata/exceptions/TABLE_B.csv").exists());
    assertTrue(new File(destDir, "SCHEMA1/table/exceptions/TABLE_C.ddl").exists());
    assertTrue(new File(destDir, "SCHEMA1/table/exceptions/TABLE_WITH_ERROR.ddl").exists());
    assertTrue(new File(destDir, "SCHEMA1/view/exceptions/VIEW_WITH_ERROR.sql").exists());
    assertTrue(new File(destDir, "SCHEMA1/view/dependentOnExceptions/VIEW_DEPENDING_ON_BAD_VIEW.sql").exists());

    LOG.info("Part 2 - rerun the deploy and ensure the data remains as is");
    deployContext = DbEnvironmentFactory.getInstance().readOneFromSourcePath(destDir.getAbsolutePath(), "test")
            .buildAppContext();

    try {
        deployContext.deploy(new MainDeployerArgs().onboardingMode(true));
    } catch (RuntimeException exc) {
        exc.printStackTrace();
        // ignoring
    }

    // Same assertions as before should hold
    assertTrue(new File(destDir, "SCHEMA1/staticdata/exceptions/TABLE_A.csv").exists());
    assertTrue(new File(destDir, "SCHEMA1/staticdata/exceptions/TABLE_B.csv").exists());
    assertTrue(new File(destDir, "SCHEMA1/table/exceptions/TABLE_C.ddl").exists());
    assertTrue(new File(destDir, "SCHEMA1/table/exceptions/TABLE_WITH_ERROR.ddl").exists());
    assertTrue(new File(destDir, "SCHEMA1/view/exceptions/VIEW_WITH_ERROR.sql").exists());
    assertTrue(new File(destDir, "SCHEMA1/view/dependentOnExceptions/VIEW_DEPENDING_ON_BAD_VIEW.sql").exists());

    LOG.info("Part 3 - fix the view and verify that it is moved back to the regular folder");
    FileUtils.copyFile(new File(srcDir, "VIEW_WITH_ERROR.corrected.sql"),
            new File(destDir, "SCHEMA1/view/exceptions/VIEW_WITH_ERROR.sql"));

    deployContext = DbEnvironmentFactory.getInstance().readOneFromSourcePath(destDir.getAbsolutePath(), "test")
            .buildAppContext();

    try {
        deployContext.deploy(new MainDeployerArgs().onboardingMode(true));
    } catch (RuntimeException exc) {
        exc.printStackTrace();
        // ignoring
    }

    assertTrue(new File(destDir, "SCHEMA1/staticdata/exceptions/TABLE_A.csv").exists());
    assertTrue(new File(destDir, "SCHEMA1/staticdata/exceptions/TABLE_B.csv").exists());
    assertTrue(new File(destDir, "SCHEMA1/table/exceptions/TABLE_C.ddl").exists());
    assertTrue(new File(destDir, "SCHEMA1/table/exceptions/TABLE_WITH_ERROR.ddl").exists());
    // These two have changed from above
    assertTrue(new File(destDir, "SCHEMA1/view/VIEW_WITH_ERROR.sql").exists());
    assertTrue(new File(destDir, "SCHEMA1/view/VIEW_DEPENDING_ON_BAD_VIEW.sql").exists());
}

From source file:eu.mihosoft.vfxwebkit.DemoApplication.java

@Override
public void start(Stage primaryStage) {
    Path tmpFile = null;/*  w w  w  . j  a  v a 2s . c o m*/
    try {
        tmpFile = Files.createTempDirectory("eu.mihosoft.vfxwebkit");
    } catch (IOException ex) {
        Logger.getLogger(DemoApplication.class.getName()).log(Level.SEVERE, null, ex);
        System.exit(1);
    }

    try {
        FileUtils.copyDirectory(new File("src/main/resources/eu/mihosoft/vfxwebkit/"), tmpFile.toFile());
        //            FileUtils.copyDirectory(
        //                    new File("/Users/miho/Qt/qt/5.5/clang_64/lib/"),
        //                    new File(tmpFile.toFile(),"native/osx/"));
    } catch (IOException ex) {
        Logger.getLogger(DemoApplication.class.getName()).log(Level.SEVERE, null, ex);
    }

    File libraryPath = new File(tmpFile.toFile(), "native/osx/libvfxwebkit.1.0.0.dylib");

    System.load(libraryPath.getAbsolutePath());

    //        new Thread(()->{NativeBinding.INSTANCE.init();}).start();

    //        NativeBinding.INSTANCE.init();

    VFXWebNode webView = VFXWebNode.newInstance(VFXWebNode.NodeType.JFX_DIRECT_BUFFER);
    //        webView.getEngine().load("http://learningwebgl.com/lessons/lesson04/index.html");

    Window w = new Window("Qt WebKit & WebGL inside JavaFX");
    w.setPrefSize(600, 440);

    w.getContentPane().getChildren().add(webView.getNode());

    //        Window w2 = new Window("JavaFX WebView");
    //        w2.setLayoutX(620);
    //        w2.setPrefSize(600, 440);
    //        
    //        WebView fxview = new WebView();
    //        fxview.getEngine().load("http://learningwebgl.com/lessons/lesson04/index.html");
    //        
    //        w2.getContentPane().getChildren().add(fxview);

    Pane root = new Pane();
    root.getChildren().add(w);

    Scene scene = new Scene(root, 1280, 1024);

    primaryStage.setTitle("Hello Native Qt, hello WebGL!");
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:com.sindicetech.siren.solr.facet.TestSirenFacetProcessorFactory.java

@BeforeClass
private static void initManagedSchemaCore() throws Exception {
    /* Create temporary solrHome folder in the target/ folder for this test because it
     * creates the managed-schema file which we don't want in src/main/resources/...
     * and it renames the original schema-*.xml to schema-*.xml.bak - also undesirable.
     * //  ww w  .j av  a2 s.c  o  m
     * The {@link SolrServerTestCase}, extended by UpdateProcessorTestBase, takes care of
     * keeping the schema clean between individual test runs. 
     * 
     * We don't remove the temporary solrHome folder because it will be cleaned later by 
     * mvn clean anyway (and perhaps more reliably, e.g. on Windows, etc.).
     */
    File tempSolrHome = new File("target" + File.separator
            + TestSirenFacetProcessorFactory.class.getSimpleName() + System.currentTimeMillis());

    FileUtils.copyDirectory(new File(SOLR_HOME), tempSolrHome);
    // make the dir easier to find by time, otherwise it would have last modified time of 
    // the original SOLR_HOME
    tempSolrHome.setLastModified(System.currentTimeMillis());

    initCore("solrconfig-facets.xml", "schema-facets.xml", tempSolrHome.getAbsolutePath());
}