Examples of MBeanServerConnection


Examples of javax.management.MBeanServerConnection

    * @throws Exception
    */
   public void testUnAuthorizedAccess() throws Exception
   {
      InitialContext ctx = getInitialContext();
      MBeanServerConnection conn = (MBeanServerConnection) ctx.lookup("jmx/invoker/ConfigurableAuthorizedRMIAdaptor");
      ObjectName server = new ObjectName("jboss.system:type=Server");
      try
      {
         String version = (String) conn.getAttribute(server, "Version");
         log.info("Obtained server version: "+version);
         fail("Was able to get server Version attribute");
      }
      catch(Exception e)
      {
View Full Code Here

Examples of javax.management.MBeanServerConnection

    * Check if I can get the available templates
    */
   public void testListModuleTemplates() throws Exception
   {
      log.info("+++ testListModuleTemplates");
      MBeanServerConnection server = getServer();
      try
      {
         boolean isRegistered = server.isRegistered(deploymentService);
         assertTrue(deploymentService + " is registered", isRegistered);
         log.info("Loaded templates: "
               + server.invoke(deploymentService, "listModuleTemplates",
                     new Object[] {}, new String[] {}));
      }
      finally
      {
         // empty
View Full Code Here

Examples of javax.management.MBeanServerConnection

         String jndiName1 = "TestDataSource1";
         String jndiName2 = "TestDataSource2";
         String delim = File.separator;

         // Find the server directory
         MBeanServerConnection server = getServer();
         ObjectName serverConfig = new ObjectName(
               "jboss.system:type=ServerConfig");
         String serverHome = ((File) server.getAttribute(serverConfig,
               "ServerHomeDir")).getCanonicalPath();
         log.info("serverHome = " + serverHome);

         // Find the directory where the test module resides
         String myPath = new File("").getAbsolutePath();
View Full Code Here

Examples of javax.management.MBeanServerConnection

   }

   private String createModule(String module, String template, HashMap props)
         throws Exception
   {
      MBeanServerConnection server = getServer();

      // create the module
      module = (String) server
            .invoke(deploymentService, "createModule", new Object[] { module,
                  template, props }, new String[] { "java.lang.String",
                  "java.lang.String", "java.util.HashMap" });

      log.info("Module '" + module + "' created: " + module);
View Full Code Here

Examples of javax.management.MBeanServerConnection

      return module;
   }

   private boolean removeModule(String module) throws Exception
   {
      MBeanServerConnection server = getServer();

      // remove the module, in case it exists
      Boolean removed = (Boolean) server.invoke(deploymentService,
            "removeModule", new Object[] { module },
            new String[] { "java.lang.String" });

      log.info("Module '" + module + "' removed: " + removed);
View Full Code Here

Examples of javax.management.MBeanServerConnection

      return removed.booleanValue();
   }

   private boolean deployModule(String module) throws Exception
   {
      MBeanServerConnection server = getServer();

      // Deploy the module (move to ./deploy)
      server.invoke(deploymentService, "deployModuleAsynch",
            new Object[] { module }, new String[] { "java.lang.String" });

      return verifyDeploy(server, module);
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

      return verifyDeploy(server, module);
   }

   private boolean undeployModule(String module) throws Exception
   {
      MBeanServerConnection server = getServer();
      try
      {
         // Get the deployed URL
         URL deployedURL = (URL) server.invoke(deploymentService,
               "getDeployedURL", new Object[] { module },
               new String[] { "java.lang.String" });

         // Undeploy the module (move to ./undeploy)
         server.invoke(deploymentService, "undeployModuleAsynch",
               new Object[] { module }, new String[] { "java.lang.String" });

         // Ask the MainDeployer every 3 secs, 5 times (15secs max wait) if
         // the module was undeployed
         Boolean isDeployed = new Boolean(false);
         for (int tries = 0; tries < 5; tries++)
         {
            // sleep for 3 secs
            Thread.sleep(3000);
            isDeployed = (Boolean) server
                  .invoke(mainDeployer, "isDeployed",
                        new Object[] { deployedURL },
                        new String[] { "java.net.URL" });

            if (!isDeployed.booleanValue())
View Full Code Here

Examples of javax.management.MBeanServerConnection

    * @throws Exception
    *            Bad things happened.
    */
   private boolean updateMBean(MBeanData data) throws Exception
   {
      MBeanServerConnection server = getServer();
      log.info("Updating MBean '" + data + "'");

      // create the module
      boolean result = false;
      result = ((Boolean) server.invoke(deploymentService, "updateMBean",
            new Object[] { data },
            new String[] { "org.jboss.services.deployment.MBeanData" }))
            .booleanValue();

      log.info("MBean '" + data + "' update result: " + result);
View Full Code Here

Examples of javax.management.MBeanServerConnection

         Thread.sleep(10000);

         // Compare all of the changed attribute values to the actual values.
         // They must all match for the test to pass.
         InitialContext ic = new InitialContext();
         MBeanServerConnection server = (MBeanServerConnection) ic.lookup("jmx/invoker/RMIAdaptor");
         ObjectName objectName = new ObjectName(data.getName());
         Properties attrs = data.getAttributes();
         Enumeration keys = attrs.keys();
         log.info("Verifying MBean attribute values:");
         while (keys.hasMoreElements())
         {
            String attr = (String) keys.nextElement();
            String expected = (String) attrs.get(attr);
            Object obj = server.getAttribute(objectName, attr);
            String actual = obj.toString();
            log.info("-- attribute    = " + attr);
            log.info("   expect value = " + expected);
            log.info("   actual value = " + actual);
            log.info("   actual type  = " + obj.getClass().getName());
View Full Code Here

Examples of javax.management.MBeanServerConnection

   private boolean updateDataSource(String module, String template,
         HashMap props) throws Exception
   {
      log.info("updateDataSource('" + module + "', '" + template + "', "
            + props);
      MBeanServerConnection server = getServer();

      // update the data source
      module = (String) server
            .invoke(deploymentService, "updateDataSource", new Object[] {
                  module, template, props }, new String[] { "java.lang.String",
                  "java.lang.String", "java.util.HashMap" });

      // sleep for 3 secs to allow the old datasource to be undeployed first
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.