Example usage for org.apache.hadoop.tools DistCpOptions shouldDeleteMissing

List of usage examples for org.apache.hadoop.tools DistCpOptions shouldDeleteMissing

Introduction

In this page you can find the example usage for org.apache.hadoop.tools DistCpOptions shouldDeleteMissing.

Prototype

public boolean shouldDeleteMissing() 

Source Link

Usage

From source file:org.apache.falcon.replication.FeedReplicatorTest.java

License:Apache License

@Test
public void testArguments() throws Exception {
    /*//from  w ww. j  a va2  s  .  c  om
     * <arg>-update</arg>
     * <arg>-blocking</arg><arg>true</arg>
     * <arg>-maxMaps</arg><arg>3</arg>
     * <arg>-mapBandwidth</arg><arg>4</arg>
     * <arg>-sourcePaths</arg><arg>${distcpSourcePaths}</arg>
     * <arg>-targetPath</arg><arg>${distcpTargetPaths}</arg>
     */

    // creates jailed cluster in which DistCpOtions command can be tested.
    EmbeddedCluster cluster = EmbeddedCluster.newCluster("FeedReplicatorTest");

    final String[] args = { "true", "-maxMaps", "3", "-mapBandwidth", "4", "-sourcePaths", defaultPath,
            "-targetPath", defaultPath, "-falconFeedStorageType", Storage.TYPE.FILESYSTEM.name(), };

    FeedReplicator replicator = new FeedReplicator();
    CommandLine cmd = replicator.getCommand(args);
    replicator.setConf(cluster.getConf());
    DistCpOptions options = replicator.getDistCpOptions(cmd, false);

    List<Path> srcPaths = new ArrayList<Path>();
    srcPaths.add(new Path(defaultPath));
    validateMandatoryArguments(options, srcPaths, true);
    Assert.assertTrue(options.shouldDeleteMissing());
}

From source file:org.apache.falcon.replication.FeedReplicatorTest.java

License:Apache License

private void validateOptionalArguments(DistCpOptions options) {
    Assert.assertTrue(options.shouldOverwrite());
    Assert.assertFalse(options.shouldIgnoreFailures());
    Assert.assertFalse(options.shouldSkipCRC());
    Assert.assertFalse(options.shouldDeleteMissing());
    Assert.assertFalse(options.shouldPreserve(DistCpOptions.FileAttribute.BLOCKSIZE));
    Assert.assertTrue(options.shouldPreserve(DistCpOptions.FileAttribute.REPLICATION));
    Assert.assertFalse(options.shouldPreserve(DistCpOptions.FileAttribute.PERMISSION));
    Assert.assertTrue(options.shouldPreserve(DistCpOptions.FileAttribute.USER));
    Assert.assertFalse(options.shouldPreserve(DistCpOptions.FileAttribute.GROUP));
    Assert.assertFalse(options.shouldPreserve(DistCpOptions.FileAttribute.CHECKSUMTYPE));
    Assert.assertTrue(options.shouldPreserve(DistCpOptions.FileAttribute.ACL));
    Assert.assertFalse(options.shouldPreserve(DistCpOptions.FileAttribute.XATTR));
    Assert.assertFalse(options.shouldPreserve(DistCpOptions.FileAttribute.TIMES));
}