Examples of ResourceContext


Examples of org.rhq.core.pluginapi.inventory.ResourceContext

        }

        if (prepareResourceForActivation(resource, container, updatedPluginConfig)) {
            container.setResourceComponentState(ResourceComponentState.STARTING);

            ResourceContext context;
            ResourceComponent component;

            try {
                context = container.getResourceContext();
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

    @NotNull
    Set<Resource> executeComponentDiscovery(ResourceType resourceType, ResourceDiscoveryComponent discoveryComponent,
        ResourceContainer parentContainer, List<ProcessScanResult> processScanResults) {

        ResourceContext parentResourceContext = parentContainer.getResourceContext();
        ResourceComponent parentComponent = parentContainer.getResourceComponent();
        Resource parentResource = parentContainer.getResource();

        long startTime = System.currentTimeMillis();
        if (log.isDebugEnabled()) {
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

    private ResourceContainer getResourceContainer() throws Exception {
        Resource resource = new Resource("TestPlatformKey", "MyTestPlatform", PluginMetadataManager.TEST_PLATFORM_TYPE);
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        ResourceContainer resourceContainer = new ResourceContainer(resource, contextClassLoader);
        ResourceContext resourceContext = new ResourceContext(resource, null, null, null, null, null, null, null, null,
                null, null, null, null, null, new ComponentInvocationContextImpl());
        resourceContainer.setResourceContext(resourceContext);
        ResourceComponent resourceComponent = new MockResourceComponent(false);
        resourceContainer.setResourceComponent(resourceComponent);
        resourceComponent.start(resourceContext);
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

        }
    }

    public static void main(String[] args) throws Exception {
        SmartDiskComponent sdc = new SmartDiskComponent();
        sdc.start(new ResourceContext(new Resource("/dev/sda", "foo", new ResourceType()), null, null, null, null,
            null, null, null, null, null, null, null, null, PluginContainerDeployment.AGENT));
        sdc.getValues(null, null);

    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

        ColumnFamilyDiscoveryComponent columnFamilyDiscoveryComponent = new ColumnFamilyDiscoveryComponent();

        // Mock keyspace context
        ResourceDiscoveryContext mockContext = mock(ResourceDiscoveryContext.class);
        ResourceContext mockParentContext = mock(ResourceContext.class);
        when(mockContext.getParentResourceContext()).thenReturn(mockParentContext);
        when(mockParentContext.getResourceKey()).thenReturn("rhq");

        assertEquals(mockContext.getParentResourceContext().getResourceKey(), "rhq");

        // Do the actual discovery parsing
        Set<DiscoveredResourceDetails> discoveredResourceDetails = columnFamilyDiscoveryComponent.discoverResources(mockContext);
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

        OperationContext operationContext = new OperationContextImpl(0);
        ContentContext contentContext = new ContentContextImpl(0);
        PluginContainerDeployment pluginContainerDeployment = null;
        AvailabilityContext availContext = new AvailabilityContextImpl(resource, pluginContainer.getInventoryManager());
        InventoryContext inventoryContext = new InventoryContextImpl(resource, pluginContainer.getInventoryManager());
        ResourceContext context = new ResourceContext(resource, parentResourceComponent, parentResourceContext,
            resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName,
            eventContext, operationContext, contentContext, availContext, inventoryContext, pluginContainerDeployment);
        Assert.assertNotNull(context.getEventContext());
        component.start(context);
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

        availabilityContext = new AvailabilityContextImpl(cresource, pluginContainer.getInventoryManager());
        inventoryContext = new InventoryContextImpl(cresource, pluginContainer.getInventoryManager());

        EventContext eventContext = new EventContextImpl(resource, eventManager);
        ResourceContext context = new ResourceContext(cresource, parentComponent,
                null, rdc, systemInfo, temporaryDirectory, dataDirectory,
                pluginContainerName, eventContext, operationContext, contentContext,
                availabilityContext, inventoryContext, pluginContainerDeployment);

        component.start(context);
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

        AvailabilityContext availContext = new AvailabilityContextImpl(cresource, pluginContainer.getInventoryManager());
        InventoryContext inventoryContext = new InventoryContextImpl(cresource, pluginContainer.getInventoryManager());

        EventContext eventContext = new EventContextImpl(resource, eventManager);
        ResourceContext context = new ResourceContext(cresource, parentComponent,
                null, rdc, systemInfo, temporaryDirectory, dataDirectory,
                pluginContainerName, eventContext, operationContext, contentContext,
                availContext, inventoryContext,pluginContainerDeployment);

        component.start(context);
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test
    public void loadResourceConfigurationWithType() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        ResourceContext mockResourceContext = mock(ResourceContext.class);

        ResourceType mockResourceType = mock(ResourceType.class);
        when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);

        ConfigurationDefinition mockConfigurationDefinition = mock(ConfigurationDefinition.class);
        when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);

        ConfigurationTemplate mockConfigurationTemplate = mock(ConfigurationTemplate.class);
        when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);

        Configuration mockConfiguration = mock(Configuration.class);
        when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);

        Property mockProperty = mock(Property.class);
        when(mockConfiguration.get(eq("__type"))).thenReturn(mockProperty);

        Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
        when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);

        ConfigurationLoadDelegate mockConfigurationLoadDelegate = mock(ConfigurationLoadDelegate.class);
        PowerMockito.whenNew(ConfigurationLoadDelegate.class)
            .withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
            .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
            .thenReturn(mockConfigurationLoadDelegate);

        when(mockConfigurationLoadDelegate.loadResourceConfiguration()).thenReturn(mockConfiguration);

        PropertySimple pathPropertySimple = new PropertySimple("path", "abc=def,xyz=test1");
        when(mockConfiguration.get(eq("path"))).thenReturn(pathPropertySimple);
        when(mockResourceContext.getPluginConfiguration()).thenReturn(mockConfiguration);

        ASConnection mockASConnection = mock(ASConnection.class);

        PropertySimple typePropertySimple = new PropertySimple("__type", "xyz");
        PowerMockito.whenNew(PropertySimple.class).withParameterTypes(String.class, Object.class)
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.ResourceContext

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test
    public void loadResourceConfigurationWithName() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        ResourceContext mockResourceContext = mock(ResourceContext.class);

        ResourceType mockResourceType = mock(ResourceType.class);
        when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);

        ConfigurationDefinition mockConfigurationDefinition = mock(ConfigurationDefinition.class);
        when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);

        ConfigurationTemplate mockConfigurationTemplate = mock(ConfigurationTemplate.class);
        when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);

        Configuration mockConfiguration = mock(Configuration.class);
        when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);

        Property mockProperty = mock(Property.class);
        when(mockConfiguration.get("_type")).thenReturn(null);
        when(mockConfiguration.get(eq("__name"))).thenReturn(mockProperty);


        Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
        when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);

        ConfigurationLoadDelegate mockConfigurationLoadDelegate = mock(ConfigurationLoadDelegate.class);
        PowerMockito.whenNew(ConfigurationLoadDelegate.class)
            .withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
            .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
            .thenReturn(mockConfigurationLoadDelegate);

        when(mockConfigurationLoadDelegate.loadResourceConfiguration()).thenReturn(mockConfiguration);

        PropertySimple pathPropertySimple = new PropertySimple("path", "abc=def,xyz=test1");
        when(mockConfiguration.get(eq("path"))).thenReturn(pathPropertySimple);
        when(mockResourceContext.getPluginConfiguration()).thenReturn(mockConfiguration);

        ASConnection mockASConnection = mock(ASConnection.class);

        PropertySimple namePropertySimple = new PropertySimple("__name", "test1");
        PowerMockito.whenNew(PropertySimple.class).withParameterTypes(String.class, Object.class)
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.