Package org.rhq.core.domain.resource

Examples of org.rhq.core.domain.resource.ResourceType


    @Override
    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent<?>> context)
        throws InvalidPluginConfigurationException, Exception {

        ResourceType rt = context.getResourceType();
        int count = Integer.valueOf(rt.getDescription()).intValue(); // type descriptor is a number - the # of res. to discover

        HashSet<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(count);
        for (int i = 1; i <= count; i++) {
            String key = rt.getName() + "_" + i;
            String name = rt.getName() + "_" + i;
            String version = "1";
            DiscoveredResourceDetails resource = new DiscoveredResourceDetails(rt, key, name, version, null,
                context.getDefaultPluginConfiguration(), null);
            details.add(resource);
        }
View Full Code Here


        String inputParentResourceKey = randomStrings[1];
        String inputResourceUuid = randomStrings[2];

        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        ResourceType mockResourceType = mock(ResourceType.class);

        Resource mockResource = mock(Resource.class);
        when(mockResource.getResourceKey()).thenReturn(inputResourceKey);
        when(mockResource.getUuid()).thenReturn(inputResourceUuid);
        when(mockResource.getResourceType()).thenReturn(mockResourceType);
View Full Code Here

        String inputResourceUuid = randomStrings[4];

        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        ResourceType mockResourceType = mock(ResourceType.class);

        Resource mockResource = mock(Resource.class);
        when(mockResource.getResourceKey()).thenReturn(inputResourceKey);
        when(mockResource.getUuid()).thenReturn(inputResourceUuid);
        when(mockResource.getResourceType()).thenReturn(mockResourceType);
View Full Code Here

        String inputParentResourceKey = randomStrings[1];
        String inputResourceUuid = randomStrings[2];

        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        ResourceType mockResourceType = mock(ResourceType.class);

        Resource mockResource = mock(Resource.class);
        when(mockResource.getResourceKey()).thenReturn(inputResourceKey);
        when(mockResource.getUuid()).thenReturn(inputResourceUuid);
        when(mockResource.getResourceType()).thenReturn(mockResourceType);
View Full Code Here

        String inputParentResourceKey = randomStrings[1];
        String inputResourceUuid = randomStrings[2];

        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        ResourceType mockResourceType = mock(ResourceType.class);

        Resource mockResource = mock(Resource.class);
        when(mockResource.getResourceKey()).thenReturn(inputResourceKey);
        when(mockResource.getUuid()).thenReturn(inputResourceUuid);
        when(mockResource.getResourceType()).thenReturn(mockResourceType);
View Full Code Here

        String inputParentResourceKey = randomStrings[1];
        String inputResourceUuid = randomStrings[2];

        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        ResourceType mockResourceType = mock(ResourceType.class);

        Resource mockResource = mock(Resource.class);
        when(mockResource.getResourceKey()).thenReturn(inputResourceKey);
        when(mockResource.getUuid()).thenReturn(inputResourceUuid);
        when(mockResource.getResourceType()).thenReturn(mockResourceType);
View Full Code Here

        String inputResourceUuid = randomStrings[5];

        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        ResourceType mockResourceType = mock(ResourceType.class);

        Resource mockResource = mock(Resource.class);
        when(mockResource.getResourceKey()).thenReturn(inputResourceKey);
        when(mockResource.getUuid()).thenReturn(inputResourceUuid);
        when(mockResource.getResourceType()).thenReturn(mockResourceType);
View Full Code Here

        getTransactionManager().resume(runningTransaction);
    }
   

    private ResourceType createResourceType() throws Exception {
        ResourceType resourceType = new ResourceType("RHQ Storage Node", "RHQStorage", ResourceCategory.SERVER, null);
        ConfigurationDefinition pluginConfigurationDefinition = new ConfigurationDefinition("config", null);
        pluginConfigurationDefinition.put(new PropertyDefinitionSimple("host", null, true, PropertySimpleType.STRING));
        resourceType.setPluginConfigurationDefinition(pluginConfigurationDefinition);
        getEntityManager().persist(resourceType);

        return resourceType;
    }
View Full Code Here

        Query q = em.createQuery("SELECT r FROM Resource r");
        List<Resource> resources = q.getResultList();
        Resource res = resources.get(0);
        if (!(res.getResourceType().getCategory() == ResourceCategory.PLATFORM))
            res = resourceManager.getPlaformOfResource(overlord, res.getId());
        ResourceType type = res.getResourceType();

        EventDefinition def;
        Set<EventDefinition> eventDefs = type.getEventDefinitions();
        if (eventDefs != null && !eventDefs.isEmpty()) {
            def = eventDefs.iterator().next();
        } else {
            throw new RuntimeException("No event definition found, should not happen");
        }
View Full Code Here

        getTransactionManager().begin();
        try {
            EntityManager em = getEntityManager();

            //add our new metric template that we are going to perform the tests with
            testData.fakeType = new ResourceType(RESOURCE_TYPE_NAME, PLUGIN_NAME, ResourceCategory.PLATFORM, null);

            MeasurementDefinition mdef = new MeasurementDefinition(METRIC_NAME, MeasurementCategory.PERFORMANCE,
                MeasurementUnits.NONE, DataType.MEASUREMENT, true, 600000, DisplayType.SUMMARY);
            testData.fakeType.addMetricDefinition(mdef);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.resource.ResourceType

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.