Package org.rhq.core.domain.measurement

Examples of org.rhq.core.domain.measurement.ResourceAvailability


            assert entityManager.find(Resource.class, platform.getId()) != null : "Did not setup platform - cannot test";

            assertResults(entityManager, fiveMinutesAgo, 0);
            assertCount(entityManager, fiveMinutesAgo, 0);

            ResourceAvailability resourceAvail = new ResourceAvailability(platform, AvailabilityType.DOWN);
            entityManager.persist(resourceAvail);
            Availability avail = new Availability(platform, AvailabilityType.DOWN);
            entityManager.persist(avail);

            //commitAndBegin();
            results = assertResults(entityManager, fiveMinutesAgo, 1);
            assertCount(entityManager, fiveMinutesAgo, 1);
            assertComposite(results.get(0), platform, 0);
            assert results.get(0).getAvailabilityType() == AvailabilityType.DOWN;
            assertComposite(results.get(0), platform, 0);
            assert results.get(0).getAvailabilityType() == AvailabilityType.DOWN;

            ResourceAvailability resourceAvail2 = new ResourceAvailability(platform2, AvailabilityType.DOWN);
            entityManager.persist(resourceAvail2);
            Availability avail2 = new Availability(platform2, null, AvailabilityType.DOWN);
            entityManager.persist(avail2);

            //commitAndBegin();
View Full Code Here


        resource.setVersion(version);
        return this;
    }

    public ResourceBuilder withCurrentAvailability(AvailabilityType availabilityType) {
        ResourceAvailability availability = new ResourceAvailability(resource,  availabilityType);
        resource.setCurrentAvailability(availability);
        return this;
    }
View Full Code Here

            String detailsUrl = LinkManager.getResourceLink(storageNodeResource.getId());
            String formattedValue = StringUtility.escapeHtml(storageNodeResource.getName());
            storageNodeItemText = LinkManager.getHref(detailsUrl, formattedValue);

            // set the availability
            ResourceAvailability availability = storageNodeResource.getCurrentAvailability();
            if (storageNodeResource.getCurrentAvailability() != null
                && storageNodeResource.getCurrentAvailability().getAvailabilityType() != null) {
                availabilityItemText = imgHTML(ImageManager.getAvailabilityIconFromAvailType(availability
                    .getAvailabilityType()));
            }
        } else {
            storageNodeItemText = MSG.common_label_none();
        }
View Full Code Here

        resourceName = preprocess(resourceName);
        Resource resource = new Resource(resourceName, resourceName, type);
        resource.setUuid("" + new Random().nextInt());
        resource.setInventoryStatus(InventoryStatus.COMMITTED);
        resource.initCurrentAvailability(); // the only way I can see to intialize the avail list
        resource.setCurrentAvailability(new ResourceAvailability(resource, avail));
        resource.getAvailability().clear();
        resource.getAvailability().add(new Availability(resource, 0L, avail));

        group.addExplicitResource(resource);
        resource.getExplicitGroups().add(group);
View Full Code Here

        resourceName = preprocess(resourceName);
        Resource resource = new Resource(resourceName, resourceName, type);
        resource.setUuid("" + new Random().nextInt());
        resource.setInventoryStatus(InventoryStatus.COMMITTED);
        resource.setCurrentAvailability(new ResourceAvailability(resource, AvailabilityType.UP));

        em.persist(resource);
        em.flush();

        return resource;
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.measurement.ResourceAvailability

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.