Search in sources :

Example 6 with MapReduceJob

use of com.mongodb.hadoop.testutils.MapReduceJob in project mongo-hadoop by mongodb.

the class TestStandalone method testMultipleCollectionSupport.

@Test
public void testMultipleCollectionSupport() {
    mongoImport(getInputUri().getCollection(), TREASURY_JSON_PATH);
    mongoImport(inputUri2.getCollection(), TREASURY_JSON_PATH);
    MapReduceJob treasuryJob = new MapReduceJob("com.mongodb.hadoop.examples.treasury.TreasuryYieldXMLConfig").jar(JOBJAR_PATH).param(MONGO_SPLITTER_CLASS, MultiMongoCollectionSplitter.class.getName()).inputUris(getInputUri(), inputUri2).outputUri(getOutputUri());
    if (isHadoopV1()) {
        treasuryJob.outputCommitter(MongoOutputCommitter.class);
    }
    treasuryJob.execute(isRunTestInVm());
    compareDoubled(getClient(getInputUri()).getDB(getOutputUri().getDatabase()).getCollection(getOutputUri().getCollection()));
}
Also used : MapReduceJob(com.mongodb.hadoop.testutils.MapReduceJob) MultiMongoCollectionSplitter(com.mongodb.hadoop.splitter.MultiMongoCollectionSplitter) Test(org.junit.Test)

Example 7 with MapReduceJob

use of com.mongodb.hadoop.testutils.MapReduceJob in project mongo-hadoop by mongodb.

the class TestStandalone method testTreasuryJsonConfig.

@Test
public void testTreasuryJsonConfig() {
    mongoImport("yield_historical.in3", TREASURY_JSON_PATH);
    MapReduceJob treasuryJob = new MapReduceJob("com.mongodb.hadoop.examples.treasury.TreasuryYieldXMLConfig").jar(JOBJAR_PATH).param(MONGO_SPLITTER_CLASS, MultiMongoCollectionSplitter.class.getName()).param(MULTI_COLLECTION_CONF_KEY, collectionSettings().toString()).outputUri(getOutputUri());
    if (isHadoopV1()) {
        treasuryJob.outputCommitter(MongoOutputCommitter.class);
    }
    treasuryJob.execute(isRunTestInVm());
    compareDoubled(getClient(getInputUri()).getDB(getOutputUri().getDatabase()).getCollection(getOutputUri().getCollection()));
}
Also used : MapReduceJob(com.mongodb.hadoop.testutils.MapReduceJob) MultiMongoCollectionSplitter(com.mongodb.hadoop.splitter.MultiMongoCollectionSplitter) Test(org.junit.Test)

Example 8 with MapReduceJob

use of com.mongodb.hadoop.testutils.MapReduceJob in project mongo-hadoop by mongodb.

the class TestSharded method testShardedClusterWithGtLtQueryFormats.

@Test
public void testShardedClusterWithGtLtQueryFormats() {
    DBCollection collection = getMongos().getDB("mongo_hadoop").getCollection("yield_historical.out");
    collection.drop();
    MapReduceJob job = new MapReduceJob(TreasuryYieldXMLConfig.class.getName()).jar(JOBJAR_PATH).inputUris(getInputUri()).outputUri(getOutputUri()).param(SPLITS_USE_RANGEQUERY, "true");
    if (isHadoopV1()) {
        job.outputCommitter(MongoOutputCommitter.class);
    }
    job.execute(isRunTestInVm());
    compareResults(collection, getReference());
    collection.drop();
    job.param(INPUT_QUERY, "{\"_id\":{\"$gt\":{\"$date\":1182470400000}}}").inputUris(getInputUri()).execute(isRunTestInVm());
    // Make sure that this fails when rangequery is used with a query that conflicts
    assertEquals(0, collection.count());
}
Also used : DBCollection(com.mongodb.DBCollection) MapReduceJob(com.mongodb.hadoop.testutils.MapReduceJob) TreasuryYieldXMLConfig(com.mongodb.hadoop.examples.treasury.TreasuryYieldXMLConfig) Test(org.junit.Test)

Example 9 with MapReduceJob

use of com.mongodb.hadoop.testutils.MapReduceJob in project mongo-hadoop by mongodb.

the class TestSharded method testBasicInputSource.

@Test
public void testBasicInputSource() {
    MapReduceJob job = new MapReduceJob(TreasuryYieldXMLConfig.class.getName()).jar(JOBJAR_PATH).inputUris(getInputUri()).outputUri(getOutputUri());
    if (isHadoopV1()) {
        job.outputCommitter(MongoOutputCommitter.class);
    }
    job.execute(isRunTestInVm());
    compareResults(getMongos().getDB("mongo_hadoop").getCollection("yield_historical.out"), getReference());
}
Also used : MapReduceJob(com.mongodb.hadoop.testutils.MapReduceJob) Test(org.junit.Test)

Aggregations

MapReduceJob (com.mongodb.hadoop.testutils.MapReduceJob)9 Test (org.junit.Test)8 DBCollection (com.mongodb.DBCollection)4 TreasuryYieldXMLConfig (com.mongodb.hadoop.examples.treasury.TreasuryYieldXMLConfig)4 BasicDBObject (com.mongodb.BasicDBObject)2 DBObject (com.mongodb.DBObject)2 MongoClientURI (com.mongodb.MongoClientURI)2 MultiMongoCollectionSplitter (com.mongodb.hadoop.splitter.MultiMongoCollectionSplitter)2 MongoClientURIBuilder (com.mongodb.hadoop.util.MongoClientURIBuilder)2 DB (com.mongodb.DB)1 MongoClient (com.mongodb.MongoClient)1 BaseHadoopTest (com.mongodb.hadoop.testutils.BaseHadoopTest)1 List (java.util.List)1