Package com.mongodb.hadoop.util

Examples of com.mongodb.hadoop.util.MongoClientURIBuilder


public class StandaloneMongoSplitterTest {

    @Test
    public void unshardedCollection() throws UnknownHostException, SplitFailedException {
        MongoClient client = new MongoClient("localhost", 27017);
        MongoClientURI uri = new MongoClientURIBuilder()
                                 .collection("mongo_hadoop", "splitter_test")
                                 .build();
        DBCollection collection = client.getDB(uri.getDatabase()).getCollection(uri.getCollection());
        collection.drop();
        for (int i = 0; i < 10000; i++) {
View Full Code Here


    private static final Log LOG = LogFactory.getLog(TestStandalone.class);
    private final MongoClientURI inputUri2;


    public TestStandalone() {
        inputUri2 = authCheck(new MongoClientURIBuilder()
                                  .collection("mongo_hadoop", "yield_historical.in2"))
                        .build();
    }
View Full Code Here

        node.put(MONGO_SPLITTER_CLASS, SingleMongoSplitter.class.getName());
        node.put(SPLITS_USE_RANGEQUERY, true);
        node.put(INPUT_NOTIMEOUT, true);
        settings.add(node);

        MongoClientURI inputUri3 = authCheck(new MongoClientURIBuilder()
                                                 .collection("mongo_hadoop", "yield_historical.in3"))
                                       .build();

        node = new ObjectNode(JsonNodeFactory.instance);
        node.put(INPUT_URI, inputUri3.toString());
View Full Code Here

        MongoClientURI outputUri = getOutputUri();

        new MapReduceJob(TreasuryYieldXMLConfig.class.getName())
            .jar(JOBJAR_PATH)
            .inputUris(getInputUri())
            .outputUris(outputUri, new MongoClientURIBuilder(outputUri).port(27018).build())
            .execute(isRunTestInVm());

        compareResults(getMongos().getDB(outputUri.getDatabase()).getCollection(outputUri.getCollection()), getReference());

        DBObject opCounterAfter1 = (DBObject) getMongos().getDB("admin").command("serverStatus").get("opcounters");
View Full Code Here

        new MapReduceJob(TreasuryYieldXMLConfig.class.getName())
            .jar(JOBJAR_PATH)
            .param(SPLITS_SLAVE_OK, "true")
            .param(SPLITS_USE_SHARDS, "true")
            .param(SPLITS_USE_CHUNKS, "false")
            .inputUris(new MongoClientURIBuilder(getInputUri()).readPreference(ReadPreference.secondary()).build())
            .execute(isRunTestInVm());

        compareResults(collection, getReference());
        collection.drop();

        new MapReduceJob(TreasuryYieldXMLConfig.class.getName())
            .jar(JOBJAR_PATH)
            .inputUris(new MongoClientURIBuilder(getInputUri()).readPreference(ReadPreference.secondary()).build())
            .param(SPLITS_SLAVE_OK, "true")
            .param(SPLITS_USE_SHARDS, "true")
            .param(SPLITS_USE_CHUNKS, "true")
            .execute(isRunTestInVm());
        compareResults(collection, getReference());
View Full Code Here

        DBCollection collection = getMongos().getDB("mongo_hadoop").getCollection("yield_historical.out");
        collection.drop();

        MapReduceJob job = new MapReduceJob(TreasuryYieldXMLConfig.class.getName())
                               .jar(JOBJAR_PATH)
                               .inputUris(new MongoClientURIBuilder(getInputUri()).readPreference(ReadPreference.secondary()).build())
                               .outputUris(getOutputUri())
                               .param(SPLITS_USE_RANGEQUERY, "true");
        job.execute(isRunTestInVm());

        compareResults(collection, getReference());
View Full Code Here

        reference.add(dbObject("_id", 2006, "count", 250, "avg", 4.7949999999999955, "sum", 1198.7499999999989));
        reference.add(dbObject("_id", 2007, "count", 251, "avg", 4.634661354581674, "sum", 1163.3000000000002));
        reference.add(dbObject("_id", 2008, "count", 251, "avg", 3.6642629482071714, "sum", 919.73));
        reference.add(dbObject("_id", 2009, "count", 250, "avg", 3.2641200000000037, "sum", 816.0300000000009));
        reference.add(dbObject("_id", 2010, "count", 189, "avg", 3.3255026455026435, "sum", 628.5199999999996));
        inputUri = authCheck(new MongoClientURIBuilder()
                                 .collection("mongo_hadoop", "yield_historical.in")).build();
        outputUri = authCheck(new MongoClientURIBuilder()
                                  .collection("mongo_hadoop", "yield_historical.out")).build();
    }
View Full Code Here

        }
    }

    @Test
    public void tagsIndex() throws URISyntaxException, UnknownHostException, IllegalAccessException {
        MongoClientURI uri = authCheck(new MongoClientURIBuilder()
                                           .collection("mongo_hadoop", "bookstore_tags")
                                      ).build();
        MongoClient mongoClient = new MongoClient(uri);
        DBCollection collection = mongoClient.getDB(uri.getDatabase())
                                             .getCollection(uri.getCollection());
View Full Code Here

    }

    public MongoClient getMongos2() {
        if (mongos == null) {
            try {
                mongos = new MongoClient(new MongoClientURIBuilder(getInputUri()).port(27018).build());
            } catch (UnknownHostException e) {
                throw new RuntimeException(e.getMessage(), e);
            }
        }
        return mongos;
View Full Code Here

    }

    public MongoClient getShard1() {
        if (shard2 == null) {
            try {
                shard2 = new MongoClient(authCheck(new MongoClientURIBuilder().port(27217)).build());
            } catch (UnknownHostException e) {
                throw new RuntimeException(e.getMessage(), e);
            }
        }
        return shard2;
View Full Code Here

TOP

Related Classes of com.mongodb.hadoop.util.MongoClientURIBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.