Package org.codinjutsu.tools.mongo.model

Examples of org.codinjutsu.tools.mongo.model.MongoCollection


            MongoDatabase mongoDatabase = (MongoDatabase) userObject;
            super.getTreeCellRendererComponent(mongoTree, mongoDatabase.getName(), isSelected, isExpanded, isLeaf, row, focus);
            setIcon(MONGO_DATABASE);
            return this;
        } else if (userObject instanceof MongoCollection) {
            MongoCollection mongoCollection = (MongoCollection) userObject;
            super.getTreeCellRendererComponent(mongoTree, mongoCollection.getName(), isSelected, isExpanded, isLeaf, row, focus);
            setIcon(MONGO_COLLECTION);
            return this;
        } else {
            return super.getTreeCellRendererComponent(mongoTree, value, isSelected, isExpanded, isLeaf, row, focus);
        }
View Full Code Here


    @Test
    public void loadCollectionsWithEmptyFilter() throws Exception {
        MongoQueryOptions mongoQueryOptions = new MongoQueryOptions();
        mongoQueryOptions.setResultLimit(3);
        MongoCollectionResult mongoCollectionResult = mongoManager.loadCollectionValues(serverConfiguration, new MongoCollection("dummyCollection", "test"), mongoQueryOptions);
        Assert.assertNotNull(mongoCollectionResult);
        Assert.assertEquals(3, mongoCollectionResult.getMongoObjects().size());
    }
View Full Code Here

    @Test
    public void updateMongoDocument() throws Exception {
        MongoQueryOptions mongoQueryOptions = new MongoQueryOptions();
        mongoQueryOptions.addQuery((BasicDBObject) JSON.parse("{'$match': {'label': 'tete'}}"));
        MongoCollection mongoCollection = new MongoCollection("dummyCollection", "test");
        MongoCollectionResult initialData = mongoManager.loadCollectionValues(serverConfiguration, mongoCollection, mongoQueryOptions);
        Assert.assertEquals(1, initialData.getMongoObjects().size());
        DBObject initialMongoDocument = initialData.getMongoObjects().get(0);

        initialMongoDocument.put("price", 25);
View Full Code Here

    @Test
    public void deleteMongoDocument() throws Exception {
        MongoQueryOptions mongoQueryOptions = new MongoQueryOptions();
        mongoQueryOptions.addQuery((BasicDBObject) JSON.parse("{'$match': {'label': 'tete'}}"));
        MongoCollection mongoCollection = new MongoCollection("dummyCollection", "test");
        MongoCollectionResult initialData = mongoManager.loadCollectionValues(serverConfiguration, mongoCollection, mongoQueryOptions);
        Assert.assertEquals(1, initialData.getMongoObjects().size());
        DBObject initialMongoDocument = initialData.getMongoObjects().get(0);

        mongoManager.delete(serverConfiguration, mongoCollection, initialMongoDocument.get("_id"));
View Full Code Here

    public void loadCollectionsWithMatchOperator() throws Exception {
        MongoQueryOptions mongoQueryOptions = new MongoQueryOptions();
        mongoQueryOptions.addQuery((BasicDBObject) JSON.parse("{'$match': {'price': 15}}"));
        mongoQueryOptions.addQuery((BasicDBObject) JSON.parse("{'$project': {'label': 1, 'price': 1}}"));
        mongoQueryOptions.addQuery((BasicDBObject) JSON.parse("{'$group': {'_id': '$label', 'total': {'$sum': '$price'}}}"));
        MongoCollectionResult mongoCollectionResult = mongoManager.loadCollectionValues(serverConfiguration, new MongoCollection("dummyCollection", "test"), mongoQueryOptions);
        Assert.assertNotNull(mongoCollectionResult);

        List<DBObject> mongoObjects = mongoCollectionResult.getMongoObjects();

        Assert.assertEquals(2, mongoObjects.size());
View Full Code Here

TOP

Related Classes of org.codinjutsu.tools.mongo.model.MongoCollection

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.