Examples of InventoryManager


Examples of org.rhq.core.pc.inventory.InventoryManager

        List<String> args = startScriptConfig.getStartScriptArgs();
        args.add("-Dfoo=bar");
        startScriptConfig.setStartScriptArgs(args);

        // Restart the server ResourceComponent so it picks up the changes we just made to the plugin config.
        InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
        inventoryManager.deactivateResource(getServerResource());
        ResourceContainer serverContainer = inventoryManager.getResourceContainer(getServerResource());
        inventoryManager.activateResource(getServerResource(), serverContainer, true);

        // Finally restart it using the Start op and make sure it has come back up.
        invokeOperationAndAssertSuccess(getServerResource(), START_OPERATION_NAME, null);
        avail = getAvailability(getServerResource());
        assertEquals(avail, AvailabilityType.UP);
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

        Configuration pluginConfig = resourceFromServer.getPluginConfiguration();
        pluginConfig.setSimpleValue("user", MANAGEMENT_USERNAME);
        pluginConfig.setSimpleValue("password", MANAGEMENT_PASSWORD);

        // Restart the ResourceComponent, so it will start using the new plugin config.
        InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
        try {
            inventoryManager.updatePluginConfiguration(resource.getId(), pluginConfig);
        } catch (InvalidPluginConfigurationClientException e) {
            throw new IllegalStateException(e);
        }
    }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

        others.removeAll(Arrays.asList(failedResource));
        checkResourcesUpgraded(others, others.size());
    }

    protected void addChildrenToFail(Resource parent, ResType childResType, int... childrenOrdinals) {
        InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
        ResourceContainer parentContainer = inventoryManager.getResourceContainer(parent);
        BaseResourceComponentInterface parentComponent = (BaseResourceComponentInterface) parentContainer
            .getResourceComponent();
        if (parentComponent==null) {
            throw new RuntimeException("Did not get a container for parent " + parent.getName() + ", " + parent.getUuid() + ", " + parent.getId());
        }

        Map<String, Set<Integer>> childrenToFail = new HashMap<String, Set<Integer>>();
        Set<Integer> ordinals = new HashSet<Integer>();
        for (int i = 0; i < childrenOrdinals.length; ++i) {
            ordinals.add(childrenOrdinals[i]);
        }

        childrenToFail.put(childResType.getResourceTypeName(), ordinals);

        Configuration newPluginConfig = parentComponent.createPluginConfigurationWithMarkedFailures(childrenToFail);

        try {
            int resourceId = parent.getId();
            inventoryManager.updatePluginConfiguration(resourceId, newPluginConfig);
        } catch (InvalidPluginConfigurationClientException e) {
            fail("Updating plugin configuration failed.", e);
        } catch (PluginContainerException e) {
            fail("Updating plugin configuration failed.", e);
        }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

           
            restoreBindingSets(sbm, originalBindingSets);
           
            AppServerUtils.shutdownServer();
           
            InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
            inventoryManager.updatePluginConfiguration(AppServerUtils.getASResource().getId(), originalPluginConfiguration);

            AppServerUtils.startServer();
        } catch (Exception e) {
            fail("Failed to restore the SBM configuration after the tests!!!", e);
        }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

           
            Resource asResource = AppServerUtils.getASResource();
            Configuration newServerConfig = asResource.getPluginConfiguration();
            newServerConfig.put(new PropertySimple("namingURL", "jnp://localhost:1199"));

            InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
            inventoryManager.updatePluginConfiguration(asResource.getId(), newServerConfig);
           
            System.out.println("Expecting the server to come up with JNP url jnp://localhost:1199");
           
            AppServerUtils.startServer();
           
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

            //this test depends on the active binding set name change test that set the active binding set to
            //ports-01 that adds 100 to all standard bindings. We changed the standard binding above
            //so now we have to add that 100 to the expected port.
            newServerConfig.put(new PropertySimple("namingURL", "jnp://localhost:" + (jnpPort + 100)));

            InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
            inventoryManager.updatePluginConfiguration(asResource.getId(), newServerConfig);
           
            System.out.println("Expecting the server to come up with JNP URL jnp://localhost:" + (jnpPort + 100));
           
            AppServerUtils.startServer();
           
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

        PluginMetadataManager pluginMetadataManager = PluginContainer.getInstance().getPluginManager()
            .getMetadataManager();
        ResourceType appServerResourceType = pluginMetadataManager.getType(APPLICATION_SERVER_RESOURCE_NAME,
            PLUGIN_NAME);

        InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();

        Set<Resource> appServers = inventoryManager.getResourcesWithType(appServerResourceType);

        if (appServers.size() != 1) {
            throw new IllegalStateException("Expected to find exactly 1 AS5 server, but found " + appServers.size()
                + " instead.");
        }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

        return (DeploymentManager) invokeMethod("getDeploymentManager", connection, (MethodArgDef[])null);
    }

    private static void waitForServerUp() throws InterruptedException {
        //wait until we see the server back up
        InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
        Resource asResource = getASResource();
       
        boolean serverUp = inventoryManager.getCurrentAvailability(asResource, false).forResource(asResource.getId()) == AvailabilityType.UP;
        while(!serverUp) {
            System.out.println("Waiting for the plugin to notice the server back up...");
            Thread.sleep(1000);

            serverUp = inventoryManager.getCurrentAvailability(asResource, false).forResource(asResource.getId()) == AvailabilityType.UP;
        }
       
        //cool, the component reports the server up, but we need to wait a bit more
        //so that the server can finish up its start up procedures...
        Thread.sleep(3000);
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

    protected Configuration getTestResourceConfiguration() {
        throw new UnsupportedOperationException();
    }

    protected static Set<Resource> getResources(ResourceType resourceType) {
        InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
        return inventoryManager.getResourcesWithType(resourceType);
    }
View Full Code Here

Examples of org.rhq.core.pc.inventory.InventoryManager

        }
    }

    @Test
    public void discoverStorageNode() {
        InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
        InventoryReport inventoryReport = inventoryManager.executeServerScanImmediately();

        if (inventoryReport.getAddedRoots().isEmpty()) {
            // could be empty if the storage node is already in inventory from
            // a prior discovery scan.
            Resource platform = inventoryManager.getPlatform();
            storageNode = findCassandraNode(platform.getChildResources(), "127.0.0.1");
        } else {
            storageNode = findCassandraNode(inventoryReport.getAddedRoots(), "127.0.0.1");
        }
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.