Package org.rhq.core.domain.operation.bean

Examples of org.rhq.core.domain.operation.bean.GroupOperationSchedule


        // not take long becaues the callers of this method normally limit the number of operations
        // returned to something very small (i.e. less than 10).
        Subject overlord = subjectManager.getOverlord();
        for (GroupOperationScheduleComposite composite : results) {
            try {
                GroupOperationSchedule sched = getGroupOperationSchedule(subject, composite.getJobId().toString());
                OperationDefinition def = getSupportedGroupOperation(overlord, composite.getGroupId(),
                    sched.getOperationName(), false);
                composite.setOperationName((def.getDisplayName() != null) ? def.getDisplayName() : sched
                    .getOperationName());
            } catch (SchedulerException se) {
                LOG.error("A schedule entity is out of sync with the scheduler - there is no job scheduled: "
                    + composite, se);
            } catch (Exception e) {
View Full Code Here


        this.groupComposite = groupComposite;
    }

    @Override
    protected GroupOperationSchedule createOperationSchedule() {
        GroupOperationSchedule groupOperationSchedule = new GroupOperationSchedule();
        ResourceGroup fakeGroup = new ResourceGroup("dummy");
        fakeGroup.setId(groupComposite.getResourceGroup().getId());
        groupOperationSchedule.setGroup(this.groupComposite.getResourceGroup());
       
//      resourceOperationSchedule.setResource(this.resourceComposite.getResource());
//      this was causing the serialization issues in GWT 2.5.0 (bz1058318), however there is no need to send the
//      fully initialized resource group instance over the wire, because the SLFB needs only the id       
//        groupOperationSchedule.setGroup(this.groupComposite.getResourceGroup());
View Full Code Here

    @Override
    protected void executeAdd(Record recordToAdd, final DSRequest request, final DSResponse response) {
        addRequestPropertiesToRecord(request, recordToAdd);

        final GroupOperationSchedule scheduleToAdd = copyValues(recordToAdd);

        operationService.scheduleGroupOperation(scheduleToAdd, new AsyncCallback<Integer>() {
            public void onSuccess(Integer scheduleId) {
                scheduleToAdd.setId(scheduleId);
                sendSuccessResponse(request, response, scheduleToAdd);
            }

            public void onFailure(Throwable caught) {
                throw new RuntimeException("Failed to add " + scheduleToAdd, caught);
View Full Code Here

        record.setAttribute(Field.EXECUTION_ORDER, executionOrder);
    }

    @Override
    protected void executeRemove(Record recordToRemove, final DSRequest request, final DSResponse response) {
        final GroupOperationSchedule scheduleToRemove = copyValues(recordToRemove);

        operationService.unscheduleGroupOperation(scheduleToRemove, new AsyncCallback<Void>() {
            public void onSuccess(Void result) {
                sendSuccessResponse(request, response, scheduleToRemove);
            }
View Full Code Here

        return record;
    }

    @Override
    public GroupOperationSchedule copyValues(Record from) {
        GroupOperationSchedule groupOperationSchedule = super.copyValues(from);

        List<Resource> executionOrder = (List<Resource>) from.getAttributeAsObject(Field.EXECUTION_ORDER);
        groupOperationSchedule.setExecutionOrder(executionOrder);
        groupOperationSchedule.setHaltOnFailure(from.getAttributeAsBoolean(Field.HALT_ON_FAILURE));

        return groupOperationSchedule;
    }
View Full Code Here

        simulatedOperation_Error = null;
        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 0L;

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", 1, 2000L);
        GroupOperationSchedule schedule = operationManager.scheduleGroupOperation(overlord(), newGroup.getId(),
            new int[] { newResource.getId() }, true, PREFIX + "testOp", null, trigger, PREFIX + "desc");
        assert schedule != null;
        assert schedule.getDescription().equals(PREFIX + "desc");
        assert schedule.getOperationName().equals(PREFIX + "testOp");
        assert schedule.getParameters() == null;
        assert schedule.getGroup().getId() == newGroup.getId();

        Thread.sleep(8000L); // wait for it to finish, should be fast

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
View Full Code Here

        // the manager will ignore duplicates in the list - we put dups in here to
        // test the comma-separator parser in the manager
        int[] order = new int[] { newResource.getId(), newResource.getId() };

        GroupOperationSchedule schedule = operationManager.scheduleGroupOperation(overlord(), newGroup.getId(), order,
            true, PREFIX + "testOp", params, trigger, PREFIX + "desc");
        assert schedule != null;
        assert schedule.getDescription().equals(PREFIX + "desc");
        assert schedule.getOperationName().equals(PREFIX + "testOp");
        assert schedule.getParameters() != null;
        assert schedule.getParameters().getId() > 0;
        assert schedule.getParameters().getNames().size() == 2;
        assert schedule.getParameters().getNames().contains("param1");
        assert schedule.getParameters().getNames().contains("param2");
        assert schedule.getParameters().getSimple("param1").getStringValue().equals("group-test");
        assert schedule.getParameters().getSimple("param2").getStringValue().equals("blah");
        assert schedule.getGroup().getId() == newGroup.getId();

        int scheduleParamId = schedule.getParameters().getId();

        Thread.sleep(4000L); // wait for it to finish, should be fast

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
View Full Code Here

        simulatedOperation_Error = "an error!";
        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 0L;

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date());
        GroupOperationSchedule schedule = operationManager.scheduleGroupOperation(overlord(), newGroup.getId(),
            new int[] { newResource.getId() }, true, PREFIX + "testOp", null, trigger, PREFIX + "desc");
        assert schedule != null;
        assert schedule.getDescription().equals(PREFIX + "desc");
        assert schedule.getOperationName().equals(PREFIX + "testOp");
        assert schedule.getParameters() == null;
        assert schedule.getGroup().getId() == newGroup.getId();

        Thread.sleep(4000L); // wait for it to finish, should be fast

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
View Full Code Here

        simulatedOperation_Error = null;
        simulatedOperation_Timeout = true;
        simulatedOperation_Sleep = 0L;

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date());
        GroupOperationSchedule schedule = operationManager.scheduleGroupOperation(overlord(), newGroup.getId(),
            new int[] { newResource.getId() }, true, PREFIX + "testOp", null, trigger, PREFIX + "desc");
        assert schedule != null;
        assert schedule.getDescription().equals(PREFIX + "desc");
        assert schedule.getOperationName().equals(PREFIX + "testOp");
        assert schedule.getParameters() == null;
        assert schedule.getGroup().getId() == newGroup.getId();

        Thread.sleep(4000L); // wait for it to finish, should be fast

        PageList<GroupOperationHistory> results;
        results = operationManager.findCompletedGroupOperationHistories(overlord(), newGroup.getId(),
View Full Code Here

        Resource resource = newResource;
        ResourceGroup group = newGroup;
        Calendar calendar = new GregorianCalendar();
        calendar.add(Calendar.SECOND, 2);
        Subject overlord = overlord();
        GroupOperationSchedule schedule = operationManager.scheduleGroupOperationUsingCron(overlord, newGroup.getId(),
            new int[] { resource.getId() }, true, PREFIX + "testOp", null, calendar.get(Calendar.SECOND) + " "
                + calendar.get(Calendar.MINUTE) + " * * * ?", 20, PREFIX + "desc");

        assert schedule != null;
        assert schedule.getDescription().equals(PREFIX + "desc");
        assert schedule.getOperationName().equals(PREFIX + "testOp");
        assert schedule.getParameters() != null;
        assert schedule.getGroup().getId() == group.getId();

        List<GroupOperationSchedule> results;
        results = operationManager.findScheduledGroupOperations(overlord, group.getId());
        assert results != null;
        assert results.size() == 1;
        GroupOperationSchedule returnedSchedule = results.get(0);
        assert returnedSchedule.getId() > 0 : returnedSchedule;
        assert returnedSchedule.getJobId() != null : returnedSchedule;
        assert returnedSchedule.getJobName() != null : returnedSchedule;
        assert returnedSchedule.getJobGroup() != null : returnedSchedule;
        assert returnedSchedule.getDescription().equals(PREFIX + "desc");
        assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
        assert returnedSchedule.getParameters() != null;
        assert returnedSchedule.getGroup().getId() == group.getId();

        System.out.println("WAITING FOR 4.5s FOR THE SCHEDULED OPERATION TO FINISH");
        Thread.sleep(4500L);

        PageList<ResourceOperationHistory> resultsHist;
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.operation.bean.GroupOperationSchedule

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.