Package org.rhq.core.domain.criteria

Examples of org.rhq.core.domain.criteria.GenericDriftChangeSetCriteria


    //@Test(groups = "pinning", dependsOnMethods = "pinTemplate")
    private void persistChangeSetWhenTemplateGetsPinned() throws Exception {

        DriftDefinitionTemplate template = loadTemplate(TEST_PIN_TEMPLATE);

        GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterId(template.getChangeSetId());

        PageList<? extends DriftChangeSet<?>> changeSets = driftMgr.findDriftChangeSetsByCriteria(getOverlord(),
            criteria);

        assertEquals("Expected to find change set for pinned template", 1, changeSets.size());
View Full Code Here


        }
        return definitions.get(0);
    }

    private DriftChangeSet<?> loadChangeSet(String id) throws Exception {
        GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterId(id);
        PageList<? extends DriftChangeSet<?>> changeSets = driftMgr.findDriftChangeSetsByCriteria(getOverlord(),
            criteria);

        if (changeSets.isEmpty()) {
            return null;
View Full Code Here

        // clear our list of currently selected records because we're recreating the carousel members
        selectedRecords.clear();

        // Fetch the ChangeSets ("header" info only, these will be held in memory)
        GenericDriftChangeSetCriteria changeSetCriteria = new GenericDriftChangeSetCriteria();
        // Limit to change sets for the relevant drift detection definition
        changeSetCriteria.addFilterDriftDefinitionId(driftDefId);
        // Never include the initial snapshot, limit to drift instances only
        changeSetCriteria.addFilterStartVersion("1");
        // Limit to change sets meeting any current carousel filtering criteria       
        if (isRefresh) {
            addCarouselCriteria(changeSetCriteria);
        }

        // return most recent first
        changeSetCriteria.addSortVersion(PageOrdering.DESC);

        driftService.findDriftChangeSetsByCriteria(changeSetCriteria,
            new AsyncCallback<PageList<? extends DriftChangeSet>>() {

                public void onSuccess(PageList<? extends DriftChangeSet> result) {
View Full Code Here

        });

        driftMgr.pinSnapshot(getOverlord(), driftDef.getId(), 1);

        // Verify that there is now only one change set for the drift def
        GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterDriftDefinitionId(driftDef.getId());

        PageList<? extends DriftChangeSet<?>> changeSets = driftMgr.findDriftChangeSetsByCriteria(getOverlord(),
            criteria);
        assertEquals("All change sets except the change set representing the pinned snapshot should be removed", 1,
            changeSets.size());
View Full Code Here

                + ", driftDefinitionName: " + driftDefName + "]");
        }
        DriftDefinition driftDef = defs.get(0);

        DriftServerPluginFacet driftServerPlugin = getServerPlugin();
        GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterResourceId(resourceId);
        criteria.addFilterDriftDefinitionId(driftDef.getId());
        criteria.addFilterVersion(Integer.toString(version));
        criteria.fetchDrifts(true);

        PageList<? extends DriftChangeSet<?>> changeSets = driftServerPlugin.findDriftChangeSetsByCriteria(overlord,
            criteria);
        if (changeSets.isEmpty()) {
            log.warn("Cannot process repeat change set. No change set found for [driftDefinitionId: "
View Full Code Here

            }

            ++startVersion;
        }

        GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterCategory(DriftChangeSetCategory.DRIFT);
        criteria.addFilterStartVersion(String.valueOf(startVersion));
        if (null != request.getVersion()) {
            criteria.addFilterEndVersion(Integer.toString(request.getVersion()));
        }
        criteria.addFilterDriftDefinitionId(request.getDriftDefinitionId());
        criteria.addFilterDriftDirectory(request.getDirectory());
        criteria.setStrict(true);
        criteria.fetchDrifts(true);
        criteria.addSortVersion(PageOrdering.ASC);
        criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as the code assumes all the results will be returned.

        PageList<? extends DriftChangeSet<?>> changeSets = findDriftChangeSetsByCriteria(subject, criteria);
        for (DriftChangeSet<? extends Drift<?, ?>> changeSet : changeSets) {
            result.addChangeSet(changeSet);
        }
View Full Code Here

        return result;
    }

    private DriftChangeSet<? extends Drift<?, ?>> loadInitialChangeSet(Subject subject, DriftSnapshotRequest request) {
        DriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterCategory(COVERAGE);
        criteria.addFilterVersion("0");
        // One of the next two filters will be null
        criteria.addFilterDriftDefinitionId(request.getDriftDefinitionId());
        criteria.addFilterId(request.getTemplateChangeSetId());
        criteria.fetchDrifts(true);
        criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as the code assumes all the results will be returned.

        PageList<? extends DriftChangeSet<?>> changeSets = findDriftChangeSetsByCriteria(subject, criteria);
        if (changeSets.isEmpty()) {
            return null;
        }
View Full Code Here

        DriftDefinitionCriteria criteria) {

        PageList<DriftDefinition> defs = findDriftDefinitionsByCriteria(subject, criteria);
        PageList<DriftDefinitionComposite> result = new PageList<DriftDefinitionComposite>(defs.getPageControl());
        List<DriftDefinitionComposite> composites = new ArrayList<DriftDefinitionComposite>(defs.size());
        GenericDriftChangeSetCriteria csCriteria = new GenericDriftChangeSetCriteria();
        for (DriftDefinition def : defs) {
            DriftDefinitionComposite composite = new DriftDefinitionComposite(def, null);
            csCriteria.addFilterDriftDefinitionId(def.getId());
            csCriteria.addSortVersion(PageOrdering.DESC);
            csCriteria.setPageControl(PageControl.getSingleRowInstance());
            PageList<? extends DriftChangeSet<?>> changeSets = findDriftChangeSetsByCriteria(subject, csCriteria);
            if (!changeSets.isEmpty()) {
                composite.setMostRecentChangeset(changeSets.get(0));
            }
            composites.add(composite);
View Full Code Here

            log.debug(callingMethod + ": " + stats.toString());
        }
    }

    private DriftChangeSet<?> loadPreviousChangeSet(Subject subject, Drift<?, ?> drift) {
        GenericDriftChangeSetCriteria criteria = new GenericDriftChangeSetCriteria();
        criteria.addFilterResourceId(drift.getChangeSet().getResourceId());
        criteria.addFilterDriftDefinitionId(drift.getChangeSet().getDriftDefinitionId());
        criteria.addFilterVersion(Integer.toString(drift.getChangeSet().getVersion() - 1));
        criteria.setPageControl(PageControl.getSingleRowInstance());

        PageList<? extends DriftChangeSet<?>> results = findDriftChangeSetsByCriteria(subject, criteria);
        // TODO handle empty results
        return results.get(0);
    }
View Full Code Here

        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);
        criteria.addFilterResourceId(resourceId1);
        criteria.addFilterVersion("1");

        Mapper mapper = new Mapper();
        DriftChangeSetDTO expected = mapper.toDTO(changeSet2);
       
        PageList<? extends DriftChangeSet<?>> actualChangeSets = driftServer.findDriftChangeSetsByCriteria(null,
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.criteria.GenericDriftChangeSetCriteria

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.