Examples of ASConnection


Examples of frontend.alphaspawn.ASConnection

   */
  protected boolean connect () {
    boolean failed = true;
   
    // Attempt to open a connection to the server
    ASConnection conn = (ASConnection)ASConnection.open();
    if ( conn != null ) {
      // A connection has been successfully open
      // Find the username/password for the bot in it's spawn.ini file
      LoginInfo login = SpawnConfiguration.allocateLoginInfo();
      if ( login != null ) {
        // The username/password for the bot has been found
        // Memorize the info for further usage
        conn.setLoginInfo( login );
       
        try {
          // Connecting to the zone
          if ( conn.connect() ) {
            // The connection to the zone is in process
            // The connection will be establish successfully once
            // the Connected event is receive in processEvent method.
           
            // Memorize the connection object for further usage
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

         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

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

            .setHost(STANDALONE_HOST) //
            .setPort(STANDALONE_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
        return new ASConnection(asConnectionParams);
    }
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
        return new ASConnection(asConnectionParams);
    }
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .setKeepAliveTimeout(Long.valueOf(-1)) //
            .createASConnectionParams();
        ASConnection asConnection = new ASConnection(asConnectionParams);
        List<Future<Result>> results = doTest(asConnection);
        checkResults(results, true);
        // Wait a bit
        Thread.sleep(1000 * 30);
        // We should still be able to reach the server
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
        ASConnection asConnection = new ASConnection(asConnectionParams);
        List<Future<Result>> results = doTest(asConnection);
        checkResults(results, true);
        // Wait for EAP to close persistent connections server side
        Thread.sleep(1000 * 30);
        // We should still be able to reach the server
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .setKeepAliveTimeout(Long.valueOf(1000 * 60 * 60)) //
            .createASConnectionParams();
        ASConnection asConnection = new ASConnection(asConnectionParams);
        List<Future<Result>> results = doTest(asConnection);
        checkResults(results, true);
        // Wait for EAP to close persistent connections server side
        Thread.sleep(1000 * 30);
        // Next operation should fail as server has closed connection and client did not
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

* @author Heiko W. Rupp
*/
public class ServerGroupTest extends AbstractIntegrationTest {

    public void createServerGroupViaApi() throws Exception {
        ASConnection connection = getDomainControllerASConnection();
        HostControllerComponent hcc = new HostControllerComponent();
        hcc.setConnection(connection);

        Configuration rc = new Configuration();
        rc.put(new PropertySimple("profile", "default"));
        rc.put(new PropertySimple("socket-binding-group", "standard-sockets"));
        ResourceType rt = new ResourceType("ServerGroup", PLUGIN_NAME, ResourceCategory.SERVICE, null);

        String serverGroupName = "_test-sg";
        try {
            CreateResourceReport report = new CreateResourceReport(serverGroupName, rt, new Configuration(), rc, null);
            report = hcc.createResource(report);

            assert report != null : "Report was null.";
            assert report.getStatus() == CreateResourceStatus.SUCCESS : "Create was a failure: "
                + report.getErrorMessage();
        } finally {
            Remove r = new Remove("server-group", serverGroupName);
            connection.execute(r);
        }
    }
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

            connection.execute(r);
        }
    }

    public void badCreateServerGroupViaApi() throws Exception {
        ASConnection connection = getDomainControllerASConnection();
        HostControllerComponent hcc = new HostControllerComponent();
        hcc.setConnection(connection);

        Configuration rc = new Configuration();
        rc.put(new PropertySimple("profile", "luzibumpf")); // Does not exist op should fail
        rc.put(new PropertySimple("socket-binding-group", "standard-sockets"));
        ResourceType rt = new ResourceType("ServerGroup", PLUGIN_NAME, ResourceCategory.SERVICE, null);

        String serverGroupName = "_test-sg";
        try {
            CreateResourceReport report = new CreateResourceReport(serverGroupName, rt, new Configuration(), rc, null);
            report = hcc.createResource(report);

            assert report != null : "Report was null.";
            assert report.getStatus() == CreateResourceStatus.FAILURE : "Is AS7-1430 solved ?";
            assert report.getException() == null : report.getException();
        } finally {
            Remove r = new Remove("server-group", serverGroupName);
            connection.execute(r);
        }
    }
View Full Code Here

Examples of org.rhq.modules.plugins.jbossas7.ASConnection

        Address destination = new Address(PROFILE);
        destination.addSegment(SECURITY_RESOURCE_KEY);
        String securityDomainId = TEST_DOMAIN + "2";
        destination.addSegment(SECURITY_DOMAIN_RESOURCE_KEY + "=" + securityDomainId);

        ASConnection connection = getDomainControllerASConnection();
        Result result = new Result();
        Operation op = null;
        //delete old one if present to setup clean slate
        op = new Operation("remove", destination);
        result = connection.execute(op);

        //build/rebuild hierarchy
        op = new Operation("add", destination);
        result = connection.execute(op);
        assert result.getOutcome().equals("success") : "Add of Security Domain has failed: "
            + result.getFailureDescription();

        //Ex. profile=standalone-ha,subsystem=security,security-domain
        String addressPrefix = PROFILE + "," + SECURITY_RESOURCE_KEY + "," + SECURITY_DOMAIN_RESOURCE_KEY;

        //loop over standard types and add base details for all of them to security domain
        String address = "";
        for (String attribute : jsonMap.keySet()) {
            if (attribute.equals("policy-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",authorization=classic";
            } else if (attribute.equals("acl-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",acl=classic";
            } else if (attribute.equals("mapping-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",mapping=classic";
            } else if (attribute.equals("trust-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",identity-trust=classic";
            } else if (attribute.equals("provider-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",audit=classic";
            } else if (attribute.equals("login-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",authentication=classic";
            } else {
                assert false : "An unknown attribute '" + attribute
                    + "' was found. Is there a new type to be supported?";
            }

            //build the operation to add the component
            ////Load json map into ModuleOptionType
            try {
                // loading jsonMap contents for Ex. 'login-module'
                JsonNode node = mapper.readTree(jsonMap.get(attribute));
                Object obj = mapper.treeToValue(node, Object.class);
                result.setResult(obj);
                result.setOutcome("success");
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }

            //populate the Value component complete with module Options.
            List<Value> moduleTypeValue = populateSecurityDomainModuleOptions(result, loadModuleOptionType(attribute));
            op = createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
            //submit the command
            result = connection.execute(op);
            assert result.getOutcome().equals("success") : "Add ModuleOptionType has failed: "
                + result.getFailureDescription();
        }
    }
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.