Package org.rhq.modules.plugins.jbossas7.json

Examples of org.rhq.modules.plugins.jbossas7.json.ReadResource


         for (MeasurementScheduleRequest req : metrics) {
            if (req.getName().equals("appuid")) {

                Address addr = new Address("core-service=platform-mbean,type=runtime");
                ReadAttribute op = new ReadAttribute(addr,"system-properties");
                ASConnection conn = parent.getASConnection();
                ComplexResult result = conn.executeComplex(op);

                if (result.isSuccess()) {
                    Map<String,Object> data = result.getResult();
                    if (data.containsKey("OPENSHIFT_APP_UUID")) {
                        String uid = (String) data.get("OPENSHIFT_APP_UUID");
View Full Code Here


@Test(groups = { "integration", "nonpc" }, dependsOnGroups = "discovery")
public abstract class AbstractIntegrationTest {

    String uploadToAs(String deploymentPath) throws IOException {
        String fileName = new File(deploymentPath).getName();
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
View Full Code Here

@Test(groups = { "integration", "nonpc" }, dependsOnGroups = "discovery")
public abstract class AbstractIntegrationTest {

    String uploadToAs(String deploymentPath) throws IOException {
        String fileName = new File(deploymentPath).getName();
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
View Full Code Here

            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
        ASUploadConnection conn = new ASUploadConnection(asConnectionParams, fileName);
        OutputStream os = conn.getOutputStream();

        InputStream fis = getClass().getClassLoader().getResourceAsStream(deploymentPath);
        if (fis == null) {
            File inputFile = new File(deploymentPath);
            if (!inputFile.canRead()) {
                throw new FileNotFoundException("Input stream for path [" + deploymentPath
                    + "] could not be opened - does the file exist either in the test classpath or on the filesystem?");
            }
            fis = new FileInputStream(inputFile);
        }

        StreamUtil.copy(fis, os, false);
        try {
            fis.close();
        } catch (IOException e) {
            // ignore
        }

        JsonNode node = conn.finishUpload();
        //        System.out.println(node);
        assert node != null : "No result from upload - node was null";
        assert node.has("outcome") : "No outcome from upload";
        String outcome = node.get("outcome").getTextValue();
        assert outcome.equals("success") : "Upload was no success, but: [" + outcome + "]";
View Full Code Here

    @Test(enabled = false)
    public void readSocketBindings() throws Exception {
        ConfigurationDefinition configDef = loadServiceDescriptor("SocketBindingGroupDomain");

        Address a = new Address("socket-binding-group=standard-sockets");
        ConfigurationLoadDelegate loadDelegate = new ConfigurationLoadDelegate(configDef,
            getDomainControllerASConnection(), a);
        Configuration conf = loadDelegate.loadResourceConfiguration();

        assert conf != null : "Did not get a configuration back";
        PropertySimple ps = conf.getSimple("default-interface");
        assert ps != null : "No property 'default-interface' found";
        String tmp = ps.getStringValue();
View Full Code Here

    @Test(enabled = false)
    public void readUpdateSocketBindings() throws Exception {
        ConfigurationDefinition configDef = loadServiceDescriptor("SocketBindingGroupDomain");

        Address a = new Address("socket-binding-group=standard-sockets");
        ConfigurationLoadDelegate loadDelegate = new ConfigurationLoadDelegate(configDef,
            getDomainControllerASConnection(), a);
        Configuration conf = loadDelegate.loadResourceConfiguration();

        assert conf != null : "Did not get a configuration back";

        PropertyList pl = conf.getList("*");
        assert pl != null;
        List<Property> listContent = pl.getList();
        assert !listContent.isEmpty() : "List '*' has no elements";
        assert listContent.get(0) instanceof PropertyMap : "List content is no map";
        for (Property p : listContent) {
            PropertyMap pm = (PropertyMap) p;
            Map<String, Property> pmap = pm.getMap();
            assert pmap.size() == 6;
            PropertySimple name = (PropertySimple) pmap.get("name");
            assert name != null;
            assert name.getStringValue() != null;
            if ("http".equals(name.getStringValue())) {
                PropertySimple portProp = (PropertySimple) pmap.get("port");
                assert portProp != null;
                assert portProp.getStringValue() != null;

                portProp.setStringValue("8081");
            }
            if ("https".equals(name.getStringValue())) {
                PropertySimple portProp = (PropertySimple) pmap.get("port");
                assert portProp != null;
                assert portProp.getStringValue() != null;

                portProp.setStringValue("9443");
            }
        }

        // We have changed http port to 8081 and https to 9443, lets write back

        ConfigurationWriteDelegate cwd = new ConfigurationWriteDelegate(configDef, getDomainControllerASConnection(), a);
        ConfigurationUpdateReport report = new ConfigurationUpdateReport(conf);
        cwd.updateResourceConfiguration(report);
        assert report.getStatus() == ConfigurationUpdateStatus.SUCCESS;

        // now check the result (and change back)

        Configuration conf2 = loadDelegate.loadResourceConfiguration();
        assert conf2 != null : "Did not get a configuration back";
        List<Property> pl2 = conf.getList("*").getList();
        for (Property p : pl2) {
            PropertyMap pm = (PropertyMap) p;
            Map<String, Property> pmap = pm.getMap();
View Full Code Here

            // Now we have to send this as an update, so the properties are created properly
            ConfigurationUpdateReport updateReport = new ConfigurationUpdateReport(report.getResourceConfiguration());
            ConfigurationDefinition configDef = report.getResourceType().getResourceConfigurationDefinition();
            Address address = new Address(getAddress());
            address.add(report.getPluginConfiguration().getSimpleValue("path"),report.getUserSpecifiedResourceName());
            ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
            delegate.updateResourceConfiguration(updateReport);

            if (updateReport.getStatus() != ConfigurationUpdateStatus.SUCCESS) {
                report.setErrorMessage(updateReport.getErrorMessage());
                report.setStatus(CreateResourceStatus.FAILURE);
            }
View Full Code Here

            }
        }

        // We have changed http port to 8081 and https to 9443, lets write back

        ConfigurationWriteDelegate cwd = new ConfigurationWriteDelegate(configDef, getDomainControllerASConnection(), a);
        ConfigurationUpdateReport report = new ConfigurationUpdateReport(conf);
        cwd.updateResourceConfiguration(report);
        assert report.getStatus() == ConfigurationUpdateStatus.SUCCESS;

        // now check the result (and change back)

        Configuration conf2 = loadDelegate.loadResourceConfiguration();
        assert conf2 != null : "Did not get a configuration back";
        List<Property> pl2 = conf.getList("*").getList();
        for (Property p : pl2) {
            PropertyMap pm = (PropertyMap) p;
            Map<String, Property> pmap = pm.getMap();
            PropertySimple name = (PropertySimple) pmap.get("name");
            assert name != null;
            assert name.getStringValue() != null;
            if ("http".equals(name.getStringValue())) {
                PropertySimple portProp = (PropertySimple) pmap.get("port");
                assert portProp != null;
                assert portProp.getStringValue() != null;

                portProp.setStringValue("8080");
            }
            if ("https".equals(name.getStringValue())) {
                PropertySimple portProp = (PropertySimple) pmap.get("port");
                assert portProp != null;
                assert portProp.getStringValue() != null;

                portProp.setStringValue("8443");
            }
        }
        report = new ConfigurationUpdateReport(conf);
        cwd.updateResourceConfiguration(report);
        assert report.getStatus() == ConfigurationUpdateStatus.SUCCESS;
    }
View Full Code Here

      if (!name.startsWith(INTERNAL))
         return;

      name = name.substring(INTERNAL_SIZE);

      PluginStats stats = PluginStats.getInstance();
      MeasurementDataNumeric data;
      Double val;
      if (name.equals("mgmtRequests")) {
         val = (double) stats.getRequestCount();
      } else if (name.equals("requestTime")) {
         val = (double) stats.getRequestTime();
      } else if (name.equals("maxTime")) {
         val = (double) stats.getMaxTime();
      } else
         val = Double.NaN;

      data = new MeasurementDataNumeric(req, val);
      report.addData(data);
View Full Code Here

         * stay the same when the resource is discovered the next
         * time
         */

        ResourceComponent parent = discoveryContext.getParentResourceComponent();
        StandaloneASComponent parentComponent = (StandaloneASComponent) parent;
        File homeDir = parentComponent.getServerPluginConfiguration().getHomeDir();
        if (homeDir==null || !homeDir.exists()) {
            return Collections.EMPTY_SET;
        }
        String home = homeDir.getAbsolutePath();

View Full Code Here

TOP

Related Classes of org.rhq.modules.plugins.jbossas7.json.ReadResource

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.