Examples of MongoDBChangeSetEntry


Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

        expected.setDriftDefinitionName(driftDefName);
        expected.setCategory(COVERAGE);
        expected.setVersion(0);
        expected.setDriftHandlingMode(normal);

        MongoDBChangeSetEntry entry1 = new MongoDBChangeSetEntry("1.bin", FILE_ADDED);
        entry1.setNewFileHash(file1SHA);
        expected.add(entry1);

        MongoDBChangeSetEntry entry2 = new MongoDBChangeSetEntry("2.bin", FILE_ADDED);
        entry2.setNewFileHash(file2SHA);
        expected.add(entry2);

        String[] ignore = new String[] {"id", "objectId", "ctime"};
        assertChangeSetMatches("Failed to persist change set", expected, actual, ignore);
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

        expected.setDriftDefinitionName(driftDefName);
        expected.setCategory(COVERAGE);
        expected.setVersion(0);
        expected.setDriftHandlingMode(normal);

        MongoDBChangeSetEntry entry1 = new MongoDBChangeSetEntry("1.bin", FILE_ADDED);
        entry1.setNewFileHash(file1SHA);
        expected.add(entry1);

        MongoDBChangeSetEntry entry2 = new MongoDBChangeSetEntry("2.bin", FILE_ADDED);
        entry2.setNewFileHash(file2SHA);
        expected.add(entry2);

        String[] ignore = new String[] {"id", "objectId", "ctime"};
        assertChangeSetMatches("Failed to persist change set", expected, actual, ignore);
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

        expected.setDriftDefinitionName(driftDefName);
        expected.setCategory(DRIFT);
        expected.setVersion(1);
        expected.setDriftHandlingMode(normal);

        MongoDBChangeSetEntry entry1 = new MongoDBChangeSetEntry("1.bin", FILE_CHANGED);
        entry1.setOldFileHash(oldFile1SHA);
        entry1.setNewFileHash(newFile1SHA);
        expected.add(entry1);

        MongoDBChangeSetEntry entry2 = new MongoDBChangeSetEntry("2.bin", FILE_REMOVED);
        entry2.setOldFileHash(file2SHA);
        expected.add(entry2);

        String[] ignore = new String[] {"id", "objectId", "ctime"};
        assertChangeSetMatches("Failed to persist change set", expected, actual, ignore);
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

        changeSet.setResourceId(1);
        changeSet.setDriftDefinitionName("testdef");
        changeSet.setCategory(COVERAGE);
        changeSet.setVersion(0);
       
        MongoDBChangeSetEntry entry = new MongoDBChangeSetEntry("./1.bin", FILE_ADDED);
        entry.setNewFileHash(file1.getName());
        changeSet.add(entry);
       
        changeSetDAO.save(changeSet);
       
        driftServer.purgeOrphanedContent();
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

        changeSet1.setDriftDefinitionName(driftDefName);
        changeSet1.setResourceId(resourceId1);
        changeSet1.setCategory(COVERAGE);
        changeSet1.setVersion(0);

        MongoDBChangeSetEntry entry1 = new MongoDBChangeSetEntry("./1.bin", FILE_ADDED);
        entry1.setNewFileHash("./1.bin");
        changeSet1.add(entry1);

        changeSetDAO.save(changeSet1);
       
        MongoDBChangeSet changeSet2 = new MongoDBChangeSet();
        changeSet2.setDriftDefinitionId(driftDefId);
        changeSet2.setDriftDefinitionName(driftDefName);
        changeSet2.setResourceId(resourceId1);
        changeSet2.setCategory(DRIFT);
        changeSet2.setVersion(1);

        MongoDBChangeSetEntry entry2 = new MongoDBChangeSetEntry("./1.bin", FILE_CHANGED);
        entry2.setNewFileHash(sha256("./1.bin.new"));
        entry2.setOldFileHash(sha256("./1.bin"));
        changeSet2.add(entry2);
       
        MongoDBChangeSetEntry entry3 = new MongoDBChangeSetEntry("./2.bin", FILE_ADDED);
        entry3.setNewFileHash("./2.bin");
        changeSet2.add(entry3);
       
        changeSetDAO.save(changeSet2);
       

        MongoDBChangeSet changeSet3 = new MongoDBChangeSet();
        changeSet3.setDriftDefinitionId(driftDefId);
        changeSet3.setDriftDefinitionName(driftDefName);
        changeSet3.setResourceId(resourceId2);
        changeSet3.setCategory(COVERAGE);
        changeSet3.setVersion(0);
       
        MongoDBChangeSetEntry entry4 = new MongoDBChangeSetEntry("./3.bin", FILE_ADDED);
        entry4.setNewFileHash(sha256("./3.bin"));
        changeSet3.add(entry4);
        changeSetDAO.save(changeSet3);
       
        GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterDriftDefinitionId(driftDefId);
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

        changeSet1.setDriftDefinitionName(driftDefName);
        changeSet1.setResourceId(resourceId1);
        changeSet1.setCategory(COVERAGE);
        changeSet1.setVersion(0);

        MongoDBChangeSetEntry entry1 = new MongoDBChangeSetEntry("./1.bin", FILE_ADDED);
        entry1.setNewFileHash("./1.bin");
        changeSet1.add(entry1);

        changeSetDAO.save(changeSet1);

        MongoDBChangeSet changeSet2 = new MongoDBChangeSet();
        changeSet2.setDriftDefinitionId(driftDefId);
        changeSet2.setDriftDefinitionName(driftDefName);
        changeSet2.setResourceId(resourceId1);
        changeSet2.setCategory(DRIFT);
        changeSet2.setVersion(1);

        MongoDBChangeSetEntry entry2 = new MongoDBChangeSetEntry("./1.bin", FILE_CHANGED);
        entry2.setNewFileHash(sha256("./1.bin.new"));
        entry2.setOldFileHash(sha256("./1.bin"));
        changeSet2.add(entry2);

        MongoDBChangeSetEntry entry3 = new MongoDBChangeSetEntry("./2.bin", FILE_ADDED);
        entry3.setNewFileHash("./2.bin");
        changeSet2.add(entry3);

        changeSetDAO.save(changeSet2);


        MongoDBChangeSet changeSet3 = new MongoDBChangeSet();
        changeSet3.setDriftDefinitionId(driftDefId);
        changeSet3.setDriftDefinitionName(driftDefName);
        changeSet3.setResourceId(resourceId2);
        changeSet3.setCategory(COVERAGE);
        changeSet3.setVersion(0);

        MongoDBChangeSetEntry entry4 = new MongoDBChangeSetEntry("./3.bin", FILE_ADDED);
        entry4.setNewFileHash(sha256("./3.bin"));
        changeSet3.add(entry4);
        changeSetDAO.save(changeSet3);

        GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterDriftDefinitionId(driftDefId);
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

        changeSet1.setDriftDefinitionName(driftDefName);
        changeSet1.setResourceId(resourceId1);
        changeSet1.setCategory(COVERAGE);
        changeSet1.setVersion(0);

        MongoDBChangeSetEntry entry1 = new MongoDBChangeSetEntry("./1.bin", FILE_ADDED);
        entry1.setNewFileHash("./1.bin");
        changeSet1.add(entry1);

        changeSetDAO.save(changeSet1);

        MongoDBChangeSet changeSet2 = new MongoDBChangeSet();
        changeSet2.setDriftDefinitionId(driftDefId);
        changeSet2.setDriftDefinitionName(driftDefName);
        changeSet2.setResourceId(resourceId1);
        changeSet2.setCategory(DRIFT);
        changeSet2.setVersion(1);

        MongoDBChangeSetEntry entry2 = new MongoDBChangeSetEntry("./1.bin", FILE_CHANGED);
        entry2.setNewFileHash(sha256("./1.bin.new"));
        entry2.setOldFileHash(sha256("./1.bin"));
        changeSet2.add(entry2);

        MongoDBChangeSetEntry entry3 = new MongoDBChangeSetEntry("./2.bin", FILE_ADDED);
        entry3.setNewFileHash("./2.bin");
        changeSet2.add(entry3);

        changeSetDAO.save(changeSet2);


        MongoDBChangeSet changeSet3 = new MongoDBChangeSet();
        changeSet3.setDriftDefinitionId(driftDefId);
        changeSet3.setDriftDefinitionName(driftDefName);
        changeSet3.setResourceId(resourceId2);
        changeSet3.setCategory(COVERAGE);
        changeSet3.setVersion(0);

        MongoDBChangeSetEntry entry4 = new MongoDBChangeSetEntry("./3.bin", FILE_ADDED);
        entry4.setNewFileHash(sha256("./3.bin"));
        changeSet3.add(entry4);
        changeSetDAO.save(changeSet3);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterResourceIds(resourceId1);
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

        changeSet1.setDriftDefinitionName(driftDefName);
        changeSet1.setResourceId(resourceId1);
        changeSet1.setCategory(COVERAGE);
        changeSet1.setVersion(0);

        MongoDBChangeSetEntry entry1 = new MongoDBChangeSetEntry("./1.bin", FILE_ADDED);
        entry1.setNewFileHash("./1.bin");
        changeSet1.add(entry1);

        changeSetDAO.save(changeSet1);

        MongoDBChangeSet changeSet2 = new MongoDBChangeSet();
        changeSet2.setDriftDefinitionId(driftDefId);
        changeSet2.setDriftDefinitionName(driftDefName);
        changeSet2.setResourceId(resourceId1);
        changeSet2.setCategory(DRIFT);
        changeSet2.setVersion(1);

        MongoDBChangeSetEntry entry2 = new MongoDBChangeSetEntry("./1.bin", FILE_CHANGED);
        entry2.setNewFileHash(sha256("./1.bin.new"));
        entry2.setOldFileHash(sha256("./1.bin"));
        changeSet2.add(entry2);

        MongoDBChangeSetEntry entry3 = new MongoDBChangeSetEntry("./2.bin", FILE_ADDED);
        entry3.setNewFileHash("./2.bin");
        changeSet2.add(entry3);

        changeSetDAO.save(changeSet2);


        MongoDBChangeSet changeSet3 = new MongoDBChangeSet();
        changeSet3.setDriftDefinitionId(driftDefId);
        changeSet3.setDriftDefinitionName(driftDefName);
        changeSet3.setResourceId(resourceId2);
        changeSet3.setCategory(COVERAGE);
        changeSet3.setVersion(0);

        MongoDBChangeSetEntry entry4 = new MongoDBChangeSetEntry("./3.bin", FILE_ADDED);
        entry4.setNewFileHash(sha256("./3.bin"));
        changeSet3.add(entry4);
        changeSetDAO.save(changeSet3);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterResourceIds(resourceId1);
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

                DriftChangeSetDTO.class.getSimpleName());
    }

    @Test
    public void mapNewEntryToDTO() {
        MongoDBChangeSetEntry entry = new MongoDBChangeSetEntry("./foo", FILE_ADDED);
        entry.setChangeSet(new MongoDBChangeSet());
        entry.setNewFileHash("1ab2c34d");
        entry.setOldFileHash("4dc32b1a");
        entry.setCategory(FILE_CHANGED);
       
        Mapper mapper = new Mapper();
        DriftDTO actual = mapper.toDTO(entry);
       
        DriftDTO expected = new DriftDTO();
        expected.setId(entry.getId());
        expected.setCategory(entry.getCategory());
        expected.setPath(entry.getPath());
        expected.setDirectory(entry.getDirectory());
        expected.setCtime(entry.getCtime());
        expected.setNewDriftFile(newDriftFileDTO(entry.getNewFileHash()));
        expected.setOldDriftFile(newDriftFileDTO(entry.getOldFileHash()));
       
        assertPropertiesMatch("Failed to map " + MongoDBChangeSetEntry.class.getSimpleName() + " to " +
                DriftDTO.class.getSimpleName(),expected, actual, "oldDriftFile", "newDriftFile");
        assertPropertiesMatch(newDriftFileDTO(entry.getNewFileHash()), actual.getNewDriftFile(),
                "Failed to map newDriftFile property");
        assertPropertiesMatch(newDriftFileDTO(entry.getOldFileHash()), actual.getOldDriftFile(),
                "Failed to map oldDriftFile property");
    }
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry

                summary.setDriftDefinitionName(headers.getDriftDefinitionName());
                summary.setCreatedTime(changeSet.getCtime());

                for (FileEntry fileEntry : reader) {
                    String path = FileUtil.useForwardSlash(fileEntry.getFile());
                    MongoDBChangeSetEntry entry = new MongoDBChangeSetEntry(path, fileEntry.getType());

                    switch (fileEntry.getType()) {
                        case FILE_ADDED:
                            entry.setNewFileHash(fileEntry.getNewSHA());
                            if (fileDAO.findOne(fileEntry.getNewSHA()) == null) {
                                missingContent.add(newDriftFile(fileEntry.getNewSHA()));
                            }
                            break;
                        case FILE_CHANGED:
                            entry.setOldFileHash(fileEntry.getOldSHA());
                            entry.setNewFileHash(fileEntry.getNewSHA());
                            if (fileDAO.findOne(fileEntry.getNewSHA()) == null) {
                                missingContent.add(newDriftFile(fileEntry.getNewSHA()));
                            }
                            if (fileDAO.findOne(fileEntry.getOldSHA()) == null) {
                                missingContent.add(newDriftFile(fileEntry.getNewSHA()));
                            }
                            break;
                        default: // FILE_REMOVED
                            entry.setOldFileHash(fileEntry.getOldSHA());
                            if (fileDAO.findOne(fileEntry.getOldSHA()) == null) {
                                missingContent.add(newDriftFile(fileEntry.getOldSHA()));
                            }
                    }
                    changeSet.add(entry);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.