Package org.rhq.core.domain.operation

Examples of org.rhq.core.domain.operation.GroupOperationHistory


            }
        }

        assert results != null;
        assert results.size() == 1 : "-->" + results;
        GroupOperationHistory history = results.get(0);
        assert history.getStatus() == OperationRequestStatus.INPROGRESS : history;

        // get the one resource history from the group
        PageList<ResourceOperationHistory> results2 = null;

        for (int i = 0; i < 5; i++) {
            Thread.sleep(1000L);
            results2 = operationManager.findPendingResourceOperationHistories(overlord(), newResource.getId(),
                PageControl.getUnlimitedInstance());
            if ((results2 != null) && (results2.size() > 0)) {
                break; // operation was triggered - got the history item
            }
        }

        assert results2.size() == 1 : "Should have had 1 resource history result: " + results2;

        ResourceOperationHistory rHistory = results2.get(0);
        assert rHistory.getStatus() == OperationRequestStatus.INPROGRESS : rHistory;

        // cancel the group history - which cancels all the resource histories
        operationManager.cancelOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 1;
        assert results.get(0).getStatus() == OperationRequestStatus.CANCELED : results.get(0);
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        assert results2.size() == 1 : "Should have had 1 resource history result: " + results2;
        assert results2.get(0).getStatus() == OperationRequestStatus.CANCELED : results2.get(0);

        // try to cancel it again, just to make sure it blows up appropriately
        try {
            operationManager.cancelOperationHistory(overlord(), history.getId(), false);
            assert false : "Should not have been able to cancel an operation that is not INPROGRESS";
        } catch (EJBException expected) {
            // expected
        }

        // purge the group history
        operationManager.deleteOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0; // none left, we purged the only group history there was
View Full Code Here


            }
        }

        assert results != null;
        assert results.size() == 1;
        GroupOperationHistory history = results.get(0);
        assert history.getStatus() == OperationRequestStatus.INPROGRESS : history;

        // get the one resource history from the group
        PageList<ResourceOperationHistory> results2;
        results2 = operationManager.findPendingResourceOperationHistories(overlord(), newResource.getId(),
            PageControl.getUnlimitedInstance());
        assert results2.size() == 1 : "Should have had 1 resource history result: " + results2;

        ResourceOperationHistory rHistory = results2.get(0);
        assert rHistory.getStatus() == OperationRequestStatus.INPROGRESS : rHistory;

        // cancel the group history - but we'll see that even though the group history will say canceled,
        // this doesn't actually cancel the FINISHED resource operation.  This simulates the fact that
        // the agent couldn't cancel the resource op since it already finished.
        operationManager.cancelOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results.size() == 1;
        assert results.get(0).getStatus() == OperationRequestStatus.CANCELED : results.get(0);

        results = operationManager.findPendingGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results.size() == 0;

        // still pending - our operation wasn't really canceled - waiting for the agent to tell us its finished
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        assert results2.size() == 0;
        results2 = operationManager.findPendingResourceOperationHistories(overlord(), newResource.getId(),
            PageControl.getUnlimitedInstance());
        assert results2.size() == 1;
        assert results2.get(0).getStatus() == OperationRequestStatus.INPROGRESS : results2.get(0);

        // purge the group history (note we tell it to even purge those in progress)
        operationManager.deleteOperationHistory(overlord(), history.getId(), true);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0; // none left, we purged the only group history there was
View Full Code Here

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 1;
        GroupOperationHistory history = results.get(0);
        assert history.getId() > 0 : history;
        assert history.getJobId() != null : history;
        assert history.getJobName() != null : history;
        assert history.getJobGroup() != null : history;
        assert history.getErrorMessage() == null : history;
        assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
        assert history.getSubjectName().equals(overlord().getName()) : history;

        PageList<GroupOperationLastCompletedComposite> list;
        list = operationManager.findRecentlyCompletedGroupOperations(overlord(), PageControl.getUnlimitedInstance());
        assert list.size() == 1;
        assert list.get(0).getOperationHistoryId() == history.getId();
        assert list.get(0).getGroupId() == newGroup.getId();
        assert list.get(0).getGroupName().equals(newGroup.getName());
        assert list.get(0).getOperationName().equals("Test Operation");

        // get the one resource history from the group
        PageList<ResourceOperationHistory> results2;
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        assert results2.size() == 1 : "Should have had 1 result: " + results2;

        ResourceOperationHistory rHistory = results2.get(0);
        assert rHistory.getId() > 0 : rHistory;
        assert rHistory.getJobId() != null : rHistory;
        assert rHistory.getJobName() != null : rHistory;
        assert rHistory.getJobGroup() != null : rHistory;
        assert rHistory.getErrorMessage() == null : rHistory;
        assert rHistory.getStatus() == OperationRequestStatus.SUCCESS : rHistory;
        assert rHistory.getSubjectName().equals(overlord().getName()) : rHistory;

        operationManager.deleteOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0; // none left, we purged the only group history there was
View Full Code Here

            testOpComplete = !results.isEmpty();
        } while (!testOpComplete && (nanoTime() - start) < MINUTES.toNanos(2));

        assert testOpComplete;
        assertEquals(1, results.size());
        GroupOperationHistory history = results.get(0);
        assert history.getId() > 0 : history;
        assert history.getJobId() != null : history;
        assert history.getJobName() != null : history;
        assert history.getJobGroup() != null : history;
        assert history.getErrorMessage() == null : history;
        assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
        assert history.getSubjectName().equals(overlord().getName()) : history;

        PageList<GroupOperationLastCompletedComposite> list;
        list = operationManager.findRecentlyCompletedGroupOperations(overlord(), PageControl.getUnlimitedInstance());
        assert list.size() == 1;
        assert list.get(0).getOperationHistoryId() == history.getId();
        assert list.get(0).getGroupId() == newGroup.getId();
        assert list.get(0).getGroupName().equals(newGroup.getName());
        assert list.get(0).getOperationName().equals("Test Operation");

        // get the one resource history from the group
        PageList<ResourceOperationHistory> results2;
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        assert results2.size() == 1 : "Should have had 1 result: " + results2;

        ResourceOperationHistory rHistory = results2.get(0);
        assert rHistory.getId() > 0 : rHistory;
        assert rHistory.getJobId() != null : rHistory;
        assert rHistory.getJobName() != null : rHistory;
        assert rHistory.getJobGroup() != null : rHistory;
        assert rHistory.getErrorMessage() == null : rHistory;
        assert rHistory.getStatus() == OperationRequestStatus.SUCCESS : rHistory;
        assert rHistory.getSubjectName().equals(overlord().getName()) : rHistory;

        operationManager.deleteOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0; // none left, we purged the only group history there was
View Full Code Here

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 1;
        GroupOperationHistory history = results.get(0);
        assert history.getId() > 0 : history;
        assert history.getJobId() != null : history;
        assert history.getJobName() != null : history;
        assert history.getJobGroup() != null : history;
        assert history.getErrorMessage() == null : history;
        assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
        assert history.getSubjectName().equals(overlord().getName()) : history;

        PageList<GroupOperationLastCompletedComposite> list;
        list = operationManager.findRecentlyCompletedGroupOperations(overlord(), PageControl.getUnlimitedInstance());
        assert list.size() == 1;
        assert list.get(0).getOperationHistoryId() == history.getId();
        assert list.get(0).getGroupId() == newGroup.getId();
        assert list.get(0).getGroupName().equals(newGroup.getName());
        assert list.get(0).getOperationName().equals("Test Operation");

        // get the one resource history from the group
        PageList<ResourceOperationHistory> results2;
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        assert results2.size() == 1 : "Should have had 1 result: " + results2;

        ResourceOperationHistory rHistory = results2.get(0);
        assert rHistory.getId() > 0 : rHistory;
        assert rHistory.getJobId() != null : rHistory;
        assert rHistory.getJobName() != null : rHistory;
        assert rHistory.getJobGroup() != null : rHistory;
        assert rHistory.getErrorMessage() == null : rHistory;
        assert rHistory.getStatus() == OperationRequestStatus.SUCCESS : rHistory;
        assert rHistory.getSubjectName().equals(overlord().getName()) : rHistory;

        operationManager.deleteOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0; // none left, we purged the only group history there was
View Full Code Here

            PageControl.getUnlimitedInstance());

        // the group job executed twice
        assert results != null;
        assert results.size() == 2 : results;
        GroupOperationHistory history0 = results.get(0);
        GroupOperationHistory history1 = results.get(1);
        assert history0.getId() > 0 : history0;
        assert history0.getJobId() != null : history0;
        assert history0.getJobName() != null : history0;
        assert history0.getJobGroup() != null : history0;
        assert history0.getErrorMessage() == null : history0;
        assert history0.getStatus() == OperationRequestStatus.SUCCESS : history0;
        assert history0.getSubjectName().equals(overlord().getName()) : history0;
        assert history1.getId() > 0 : history1;
        assert history1.getId() != history0.getId() : history1;
        assert history1.getJobId() != null : history1;
        assert !history1.getJobId().equals(history0.getJobId()) : history1;
        assert history1.getJobName() != null : history1;
        assert history1.getJobGroup() != null : history1;
        assert history1.getErrorMessage() == null : history1;
        assert history1.getStatus() == OperationRequestStatus.SUCCESS : history1;
        assert history1.getSubjectName().equals(overlord().getName()) : history1;

        // get the one resource's two history items from the group (resource executed once per group trigger)
        PageList<ResourceOperationHistory> results2;
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        assert results2.size() == 2 : "Should have had 2 results since it was triggered twice: " + results2;

        ResourceOperationHistory rHistory0 = results2.get(0);
        assert rHistory0.getId() > 0 : rHistory0;
        assert rHistory0.getJobId() != null : rHistory0;
        assert rHistory0.getJobName() != null : rHistory0;
        assert rHistory0.getJobGroup() != null : rHistory0;
        assert rHistory0.getErrorMessage() == null : rHistory0;
        assert rHistory0.getStatus() == OperationRequestStatus.SUCCESS : rHistory0;
        assert rHistory0.getSubjectName().equals(overlord().getName()) : rHistory0;

        ResourceOperationHistory rHistory1 = results2.get(1);
        assert rHistory1.getId() > 0 : rHistory1;
        assert rHistory1.getId() != rHistory0.getId() : rHistory1;
        assert rHistory1.getJobId() != null : rHistory1;
        assert !rHistory1.getJobId().equals(rHistory0.getJobId()) : rHistory1;
        assert rHistory1.getJobId().getJobGroup().equals(rHistory1.getJobGroup()) : rHistory1;
        assert rHistory1.getJobId().getJobName().equals(rHistory1.getJobName()) : rHistory1;
        assert rHistory1.getJobName() != null : rHistory1;
        assert rHistory1.getJobGroup() != null : rHistory1;
        assert rHistory1.getJobGroup().equals(rHistory0.getJobGroup()) : rHistory1;
        assert rHistory1.getErrorMessage() == null : rHistory1;
        assert rHistory1.getStatus() == OperationRequestStatus.SUCCESS : rHistory1;
        assert rHistory1.getSubjectName().equals(overlord().getName()) : rHistory1;

        operationManager.deleteOperationHistory(overlord(), history0.getId(), false);
        operationManager.deleteOperationHistory(overlord(), history1.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0 : results; // none left, we purged the two group histories
View Full Code Here

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 1;
        GroupOperationHistory history = results.get(0);
        assert history.getId() > 0 : history;
        assert history.getJobId() != null : history;
        assert history.getJobName() != null : history;
        assert history.getJobGroup() != null : history;
        assert history.getErrorMessage() == null : history;
        assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
        assert history.getSubjectName().equals(overlord().getName()) : history;
        assert history.getGroup().getId() == newGroup.getId();

        // parameters and results are lazily loaded in the paginated queries, but are eagerly individually
        history = (GroupOperationHistory) operationManager.getOperationHistoryByHistoryId(overlord(), history.getId());
        assert history.getParameters().getId() != scheduleParamId : "params should be copies - not shared";

        // get the one resource history from the group
        PageList<ResourceOperationHistory> results2;
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        ResourceOperationHistory rHistory = results2.get(0);
        assert rHistory.getId() > 0 : rHistory;
        assert rHistory.getJobId() != null : rHistory;
        assert rHistory.getJobName() != null : rHistory;
        assert rHistory.getJobGroup() != null : rHistory;
        assert rHistory.getErrorMessage() == null : rHistory;
        assert rHistory.getStatus() == OperationRequestStatus.SUCCESS : rHistory;
        assert rHistory.getSubjectName().equals(overlord().getName()) : rHistory;

        // parameters and results are lazily loaded in the paginated queries, but are eagerly individually
        rHistory = (ResourceOperationHistory) operationManager.getOperationHistoryByHistoryId(overlord(),
            rHistory.getId());
        assert rHistory.getResults() != null;
        assert rHistory.getResults().getSimple("param1echo") != null;
        assert rHistory.getResults().getSimple("param1echo").getStringValue().equals("group-test");
        assert rHistory.getParameters().getId() != scheduleParamId : "params should be copies - not shared";
        assert rHistory.getParameters().getId() != history.getParameters().getId() : "params should be copies - not shared";

        operationManager.deleteOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0; // none left, we purged the only group history there was
View Full Code Here

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 1 : "Did not get 1 result back, but " + results.size();
        GroupOperationHistory history = results.get(0);
        assert history.getId() > 0 : history;
        assert history.getJobId() != null : history;
        assert history.getJobName() != null : history;
        assert history.getJobGroup() != null : history;
        assert history.getErrorMessage() != null : history;
        assert history.getErrorMessage().indexOf(newResource.getName()) > -1 : history; // the name will be in the group error message
        assert history.getStatus() == OperationRequestStatus.FAILURE : history;
        assert history.getSubjectName().equals(overlord().getName()) : history;

        // get the one resource history from the group
        PageList<ResourceOperationHistory> results2;
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        ResourceOperationHistory rHistory = results2.get(0);
        assert rHistory.getId() > 0 : rHistory;
        assert rHistory.getJobId() != null : rHistory;
        assert rHistory.getJobName() != null : rHistory;
        assert rHistory.getJobGroup() != null : rHistory;
        assert rHistory.getErrorMessage() != null : rHistory;
        assert rHistory.getErrorMessage().indexOf("an error!") > -1 : rHistory;
        assert rHistory.getStatus() == OperationRequestStatus.FAILURE : rHistory;
        assert rHistory.getSubjectName().equals(overlord().getName()) : rHistory;

        operationManager.deleteOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0; // none left, we purged the only group history there was
View Full Code Here

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 1;
        GroupOperationHistory history = results.get(0);
        assert history.getId() > 0 : history;
        assert history.getJobId() != null : history;
        assert history.getJobName() != null : history;
        assert history.getJobGroup() != null : history;
        assert history.getErrorMessage() != null : history;
        assert history.getErrorMessage().indexOf(newResource.getName()) > -1 : history; // the name will be in the group error message
        assert history.getStatus() == OperationRequestStatus.FAILURE : history;
        assert history.getSubjectName().equals(overlord().getName()) : history;

        // get the one resource history from the group
        PageList<ResourceOperationHistory> results2;
        results2 = operationManager.findCompletedResourceOperationHistories(overlord(), newResource.getId(), null,
            null, PageControl.getUnlimitedInstance());
        ResourceOperationHistory rHistory = results2.get(0);
        assert rHistory.getId() > 0 : rHistory;
        assert rHistory.getJobId() != null : rHistory;
        assert rHistory.getJobName() != null : rHistory;
        assert rHistory.getJobGroup() != null : rHistory;
        assert rHistory.getErrorMessage() != null : rHistory;
        assert rHistory.getErrorMessage().indexOf("Timed out") > -1 : rHistory;
        assert rHistory.getStatus() == OperationRequestStatus.FAILURE : rHistory;
        assert rHistory.getSubjectName().equals(overlord().getName()) : rHistory;

        operationManager.deleteOperationHistory(overlord(), history.getId(), false);
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
            PageControl.getUnlimitedInstance());
        assert results != null;
        assert results.size() == 0; // none left, we purged the only group history there was
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.operation.GroupOperationHistory

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.