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

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


        this.resourceComposite = resourceComposite;
    }

    @Override
    protected ResourceOperationSchedule createOperationSchedule() {
        ResourceOperationSchedule resourceOperationSchedule = new ResourceOperationSchedule();
        Resource fakeResource = new Resource();
        fakeResource.setId(resourceComposite.getResource().getId());
        resourceOperationSchedule.setResource(fakeResource);
       
//        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 instance over the wire, because the SLFB needs only the id
        return resourceOperationSchedule;
View Full Code Here


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

        final ResourceOperationSchedule scheduleToAdd = copyValues(recordToAdd);

        operationService.scheduleResourceOperation(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

        });
    }

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

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

        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 20000L; // the operation timeout is defined at 10 seconds, we'll block it for 20s

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
            System.currentTimeMillis() + 5000L));
        ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(overlord(), resource.getId(),
            PREFIX + "testOp", null, trigger, PREFIX + "desc");
        List<ResourceOperationSchedule> schedules;
        schedules = operationManager.findScheduledResourceOperations(overlord(), resource.getId());
        assert schedules != null;
        assert schedules.size() == 1;
View Full Code Here

        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 0L;

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
            System.currentTimeMillis() + 10000L));
        ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(overlord(), resource.getId(),
            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.getResource().getId() == newResource.getId();

        List<ResourceOperationSchedule> schedules;
        schedules = operationManager.findScheduledResourceOperations(overlord(), resource.getId());
        assert schedules != null;
        assert schedules.size() == 1;
        ResourceOperationSchedule returnedSchedule = schedules.get(0);
        assert returnedSchedule.getSubject().equals(overlord());
        assert returnedSchedule.getResource().getId() == resource.getId();
        assert returnedSchedule.getParameters() == null;
        assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
        assert returnedSchedule.getDescription().equals(PREFIX + "desc");

        PageList<ResourceOperationScheduleComposite> list;
        list = operationManager
            .findCurrentlyScheduledResourceOperations(overlord(), PageControl.getUnlimitedInstance());
        assert list.size() == 1;
        assert list.get(0).getResourceId() == resource.getId();
        assert list.get(0).getResourceName().equals(resource.getName());
        assert list.get(0).getOperationName().equals("Test Operation");

        // let's immediately unschedule it before it triggers
        operationManager.unscheduleResourceOperation(overlord(), returnedSchedule.getJobId().toString(),
            returnedSchedule.getResource().getId());

        list = operationManager
            .findCurrentlyScheduledResourceOperations(overlord(), PageControl.getUnlimitedInstance());
        assert list.size() == 0;
View Full Code Here

        params.put(new PropertySimple("param1", "group-test"));
        params.put(new PropertySimple("param2", "blah"));

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
            System.currentTimeMillis() + 10000L));
        ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(overlord(), resource.getId(),
            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.getResource().getId() == newResource.getId();

        int configId = params.getId();
        Configuration returnedConfiguration = configurationManager.getConfigurationById(configId);
        assert returnedConfiguration.getProperties().size() == 2;
        assert returnedConfiguration.getSimple("param1").getStringValue().equals("group-test");
        assert returnedConfiguration.getSimple("param2").getStringValue().equals("blah");

        List<ResourceOperationSchedule> schedules;
        schedules = operationManager.findScheduledResourceOperations(overlord(), resource.getId());
        assert schedules != null;
        assert schedules.size() == 1;
        ResourceOperationSchedule returnedSchedule = schedules.get(0);
        assert returnedSchedule.getSubject().equals(overlord());
        assert returnedSchedule.getResource().getId() == resource.getId();
        assert returnedSchedule.getParameters() != null;
        assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
        assert returnedSchedule.getDescription().equals(PREFIX + "desc");

        // let's immediately unschedule it before it triggers
        operationManager.unscheduleResourceOperation(overlord(), returnedSchedule.getJobId().toString(),
            returnedSchedule.getResource().getId());

        // history should never have existed - we unscheduled faster than its trigger
        PageList<ResourceOperationHistory> results;
        results = operationManager.findCompletedResourceOperationHistories(overlord(), resource.getId(), null, null,
            PageControl.getUnlimitedInstance());
View Full Code Here

        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 0L;

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
            System.currentTimeMillis() + 5000L));
        ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(overlord(), resource.getId(),
            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.getResource().getId() == newResource.getId();

        List<ResourceOperationSchedule> schedules;
        schedules = operationManager.findScheduledResourceOperations(overlord(), resource.getId());
        assert schedules != null;
        assert schedules.size() == 1;
        ResourceOperationSchedule returnedSchedule = schedules.get(0);
        assert returnedSchedule.getSubject().equals(overlord());
        assert returnedSchedule.getResource().getId() == resource.getId();
        assert returnedSchedule.getParameters() == null;
        assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
        assert returnedSchedule.getDescription().equals(PREFIX + "desc");

        Thread.sleep(9000L); // wait for it to be triggered and complete

        PageList<ResourceOperationHistory> results;
        results = operationManager.findCompletedResourceOperationHistories(overlord(), resource.getId(), null, null,
View Full Code Here

        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 0L;

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
            System.currentTimeMillis() + 5000L));
        ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(overlord(), resource.getId(),
            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.getResource().getId() == newResource.getId();

        List<ResourceOperationSchedule> schedules;
        schedules = operationManager.findScheduledResourceOperations(overlord(), resource.getId());
        assert schedules != null;
        assert schedules.size() == 1;
        ResourceOperationSchedule returnedSchedule = schedules.get(0);
        assert returnedSchedule.getSubject().equals(overlord());
        assert returnedSchedule.getResource().getId() == resource.getId();
        assert returnedSchedule.getParameters() == null;
        assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
        assert returnedSchedule.getDescription().equals(PREFIX + "desc");

        Thread.sleep(9000L); // wait for it to be triggered and complete

        PageList<ResourceOperationHistory> results;
        results = operationManager.findCompletedResourceOperationHistories(overlord(), resource.getId(), null, null,
View Full Code Here

        simulatedOperation_Timeout = true;
        simulatedOperation_Sleep = 0L;

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
            System.currentTimeMillis() + 5000L));
        ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(overlord(), resource.getId(),
            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.getResource().getId() == newResource.getId();

        List<ResourceOperationSchedule> schedules;
        schedules = operationManager.findScheduledResourceOperations(overlord(), resource.getId());
        assert schedules != null;
        assert schedules.size() == 1;
        ResourceOperationSchedule returnedSchedule = schedules.get(0);
        assert returnedSchedule.getSubject().equals(overlord());
        assert returnedSchedule.getResource().getId() == resource.getId();
        assert returnedSchedule.getParameters() == null;
        assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
        assert returnedSchedule.getDescription().equals(PREFIX + "desc");

        Thread.sleep(9000L); // wait for it to be triggered and complete

        PageList<ResourceOperationHistory> results;
        results = operationManager.findCompletedResourceOperationHistories(overlord(), resource.getId(), null, null,
View Full Code Here

        simulatedOperation_Timeout = false;
        simulatedOperation_Sleep = 0L;

        Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
            System.currentTimeMillis()));
        ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(overlord(), resource.getId(),
            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.getResource().getId() == newResource.getId();

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

        PageList<ResourceOperationHistory> results;
        results = operationManager.findCompletedResourceOperationHistories(overlord(), resource.getId(), null, null,
View Full Code Here

TOP

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

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.