Examples of MergeResourceResponse


Examples of org.rhq.core.domain.discovery.MergeResourceResponse

        assertNotNull(template);

        Configuration pluginConfig = template.createConfiguration();
        setupTemplatedPluginConfig(pluginConfig);

        MergeResourceResponse response = getInventoryManager().manuallyAddResource(jmxServerType,
            getPlatform().getId(), pluginConfig, -1);

        assertNotNull(response, "Manual add response is null");

        jmxServerResourceId = response.getResourceId();

        ResourceContainer resourceContainer = getInventoryManager().getResourceContainer(jmxServerResourceId);
        @SuppressWarnings("rawtypes")
        ResourceComponent resourceComponent = resourceContainer.getResourceComponent();
View Full Code Here

Examples of org.rhq.core.domain.discovery.MergeResourceResponse

        DiscoveryServerService discoveryServerService = Mockito.mock(DiscoveryServerService.class);
        when(discoveryServerService.addResource(any(Resource.class), anyInt())).thenAnswer(
            new Answer<MergeResourceResponse>() {
                @Override
                public MergeResourceResponse answer(InvocationOnMock invocation) throws Throwable {
                    return new MergeResourceResponse(resourceIdGenerator.decrementAndGet(), System.currentTimeMillis(),
                        false);
                }
            });
        ServerServices serverServices = new ServerServices();
        serverServices.setDiscoveryServerService(discoveryServerService);
View Full Code Here

Examples of org.rhq.core.domain.discovery.MergeResourceResponse

        myPluginConfig.put(new PropertySimple("test", "value"));

        ResourceType resourceType = pluginContainer.getPluginManager().getMetadataManager()
            .getType("Manual Add Server", "test");

        MergeResourceResponse response = inventoryManager.manuallyAddResource(resourceType, platform.getId(),
            myPluginConfig, -1);

        assertFalse(response.resourceAlreadyExisted(), "The manual add resource shouldn't have existed");
        assertNotEquals(response.getResourceId(), 0, "The manual add resource should have had its resource id set");

        ResourceContainer resourceContainer = inventoryManager.getResourceContainer(response.getResourceId());
        ResourceContext<?> resourceContext = resourceContainer.getResourceContext();

        assertEquals(resourceContext.getPluginConfiguration(), myPluginConfig,
            "The manual add resource doesn't have the expected plugin config.");

        assertTrue(resourceContext.getAvailabilityContext() instanceof AvailabilityContextImpl,
            "Unexpected implementation clas of the AvailabilityContext, please fix this test.");
        assertEquals(((AvailabilityContextImpl) resourceContext.getAvailabilityContext()).getResource().getId(),
            response.getResourceId(),
            "Availability subsystem isn't aware of the correct resource id for manual add resource");

        assertTrue(resourceContext.getContentContext() instanceof ContentContextImpl,
            "Unexpected implementation class of ContentContext, please fix this test");
        assertEquals(((ContentContextImpl) resourceContext.getContentContext()).getResourceId(),
            response.getResourceId(),
            "Content subsystem isn't aware of the correct resource id for manual add resource");

        assertTrue(resourceContext.getEventContext() instanceof EventContextImpl,
            "Unexpected implementation clas of the EventContext, please fix this test.");
        assertEquals(((EventContextImpl) resourceContext.getEventContext()).getResource().getId(),
            response.getResourceId(), "Event subsystem isn't aware of the correct resource id for manual add resource");

        assertTrue(resourceContext.getOperationContext() instanceof OperationContextImpl,
            "Unexpected implementation clas of the OperationContext, please fix this test.");
        assertEquals(((OperationContextImpl) resourceContext.getOperationContext()).getResourceId(),
            response.getResourceId(),
            "Operation subsystem isn't aware of the correct resource id for manual add resource");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.