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

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

Introduction

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

Prototype

public List<Path> getSourcePaths() 

Source Link

Usage

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

License:Apache License

@Test
public void testArguments() throws Exception {
    /*//  w  w  w  . jav  a2 s .  c om
     * <arg>-update</arg>
     * <arg>-blocking</arg><arg>true</arg> <arg>-maxMaps</arg><arg>20</arg>
     * <arg>-sourcePaths</arg><arg>${distcpSourcePaths}</arg>
     * <arg>-targetPath</arg><arg>${distcpTargetPaths}</arg>
     */
    FeedReplicator replicator = new FeedReplicator();
    DistCpOptions options = replicator.getDistCpOptions(new String[] { "true", "-maxMaps", "5", "-sourcePaths",
            "hdfs://localhost:8020/tmp/", "-targetPath", "hdfs://localhost1:8020/tmp/" });

    List<Path> srcPaths = new ArrayList<Path>();
    srcPaths.add(new Path("hdfs://localhost:8020/tmp/"));
    Assert.assertEquals(options.getSourcePaths(), srcPaths);
    Assert.assertEquals(options.getTargetPath(), new Path("hdfs://localhost1:8020/tmp/"));
}

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

License:Apache License

@Test
public void testIncludePath() throws Exception {
    // Set the include Path so that CustomReplicator is used and the source and targetPaths are modified.
    String includePath = defaultPath + "/test-colo";
    // 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);
    Configuration conf = cluster.getConf();
    conf.set("falcon.include.path", includePath);
    replicator.setConf(conf);//  w  w  w .  j a v a2 s  . c om
    DistCpOptions options = replicator.getDistCpOptions(cmd, true);
    Assert.assertEquals(options.getTargetPath().toString(), includePath);
    Assert.assertEquals(options.getSourcePaths().get(0).toString(), includePath);
}

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

License:Apache License

private void validateMandatoryArguments(DistCpOptions options, List<Path> srcPaths, boolean shouldSyncFolder) {
    Assert.assertEquals(options.getMaxMaps(), 3);
    Assert.assertEquals(options.getMapBandwidth(), 4);
    Assert.assertEquals(options.getSourcePaths(), srcPaths);
    Assert.assertEquals(options.getTargetPath(), new Path(defaultPath));
    Assert.assertEquals(options.shouldSyncFolder(), shouldSyncFolder);
}

From source file:org.apache.ivory.repliation.FeedReplicatorTest.java

License:Apache License

@Test
public void testArguments() throws Exception {
    /*//from   w  ww.  j  a va  2  s.co  m
     * <arg>-update</arg>
     * <arg>-blocking</arg><arg>true</arg> <arg>-maxMaps</arg><arg>20</arg>
     * <arg>-sourcePaths</arg><arg>${distcpSourcePaths}</arg>
     * <arg>-targetPath</arg><arg>${distcpTargetPaths}</arg>
     */
    FeedReplicator replicator = new FeedReplicator();
    DistCpOptions options = replicator
            .getDistCpOptions(new String[] { "-update", "-blocking", "true", "-maxMaps", "5", "-sourcePaths",
                    "hdfs://localhost:8020/tmp/", "-targetPath", "hdfs://localhost1:8020/tmp/" });

    List<Path> srcPaths = new ArrayList<Path>();
    srcPaths.add(new Path("hdfs://localhost:8020/tmp/"));
    Assert.assertEquals(options.getSourcePaths(), srcPaths);
    Assert.assertEquals(options.getTargetPath(), new Path("hdfs://localhost1:8020/tmp/"));
}