Examples of MBeanServerConnection


Examples of javax.management.MBeanServerConnection

                // we can run the recovery manager out of process? The server addr would need to be on a per
                // jndiname basis, as we may be doing recovery for a whole cluster. We would need AS
                // jmx classes (and the db drivers naturally) on the recovery manager classpath.

                InitialContext context = new InitialContext();
                MBeanServerConnection server = (MBeanServerConnection)context.lookup("jmx/invoker/RMIAdaptor");
                ObjectName objectName = new ObjectName("jboss.jca:name="+_dataSourceId+",service=ManagedConnectionFactory");

                if(_username !=null && _password !=null)
                {
                  SecurityAssociation.setPrincipal(new SimplePrincipal(_username));
                  SecurityAssociation.setCredential(_password);
                }

                String className = (String)server.invoke(objectName, "getManagedConnectionFactoryAttribute", new Object[] {"XADataSourceClass"}, new String[] {"java.lang.String"});
            if (log.isDebugEnabled())
        {
                  log.debug("AppServerJDBCXARecovery datasource classname = "+className);
                }

                if(_username !=null && _password !=null)
                {
                  SecurityAssociation.setPrincipal(new SimplePrincipal(_username));
                  SecurityAssociation.setCredential(_password);
                }

                String properties = (String)server.invoke(objectName, "getManagedConnectionFactoryAttribute", new Object[] {"XADataSourceProperties"}, new String[] {"java.lang.String"});
                // debug disabled due to security paranoia - it may log datasource password in cleartext.
                // log.debug("AppServerJDBCXARecovery.result="+properties);

/*               
                ObjectName txCmObjectName = new ObjectName("jboss.jca:name=" +_dataSourceId + ",service=XATxCM");
View Full Code Here

Examples of javax.management.MBeanServerConnection

   public void testSetCustom()
      throws Exception
   {
      log.info("+++ testSetCustom");
      MBeanServerConnection server = getServer();
      server.setAttribute(getObjectName(), new Attribute("Custom", new CustomClass("changed")));
      CustomClass custom = (CustomClass) server.getAttribute(getObjectName(), "Custom");
      assertEquals("changed", custom.getValue());
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

    * @throws Exception
    */
   public void testClassNotFoundException() throws Exception
   {
      log.info("+++ testClassNotFoundException");
      MBeanServerConnection server = getServer();
      ObjectName name = new ObjectName("jboss.test:test=testClassNotFoundException");
      try
      {
         server.createMBean("org.jboss.text.jmx.DoesNotExist", name);
         fail("Was able to create org.jboss.text.jmx.DoesNotExist mbean");
      }
      catch (ReflectionException e)
      {
         Exception ex = e.getTargetException();
View Full Code Here

Examples of javax.management.MBeanServerConnection

         env.put(JMXConnector.CREDENTIALS, creds);
      }

      JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"+getServerHostForURL()+":1090/jmxrmi");
      JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
      MBeanServerConnection adaptor = jmxc.getMBeanServerConnection();
      return adaptor;
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   public void testSetCustom()
      throws Exception
   {
      log.info("+++ testSetCustom");
      MBeanServerConnection server = getJMXServer();
      server.setAttribute(getObjectName(), new Attribute("Custom", new CustomClass("changed")));
      CustomClass custom = (CustomClass) server.getAttribute(getObjectName(), "Custom");
      assertEquals("changed", custom.getValue());
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

    * @throws Exception
    */
   public void testClassNotFoundException() throws Exception
   {
      log.info("+++ testClassNotFoundException");
      MBeanServerConnection server = getJMXServer();
      ObjectName name = new ObjectName("jboss.test:test=testClassNotFoundException");
      try
      {
         server.createMBean("org.jboss.text.jmx.DoesNotExist", name);
         fail("Was able to create org.jboss.text.jmx.DoesNotExist mbean");
      }
      catch (ReflectionException e)
      {
         Exception ex = e.getTargetException();
View Full Code Here

Examples of javax.management.MBeanServerConnection

      super(name);
   }

   public void testPOJOAdvised1() throws Exception
   {
      MBeanServerConnection server = getServer();
      ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester1");
      Object[] params = {};
      String[] sig = {};
      server.invoke(testerName, "checkPOJOAdvised", params, sig);
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

      server.invoke(testerName, "checkPOJOAdvised", params, sig);
   }
  
   public void testPOJOAdvised2() throws Exception
   {
      MBeanServerConnection server = getServer();
      ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester2");
      Object[] params = {};
      String[] sig = {};
      server.invoke(testerName, "checkPOJOAdvised", params, sig);
   }
View Full Code Here

Examples of javax.management.MBeanServerConnection

   public void testExpectedValues1() throws Exception
   {
      deploy("aop-scopedattachtest1.aop");
      try
      {
         MBeanServerConnection server = getServer();
         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester1");
         Integer iv = (Integer)server.getAttribute(testerName, "ExpectedInterceptorValue");
         Integer ia = (Integer)server.getAttribute(testerName, "ExpectedAspectValue");
         assertEquals(11, iv.intValue());
         assertEquals(21, ia.intValue());
      }
      finally
      {
View Full Code Here

Examples of javax.management.MBeanServerConnection

   public void testExpectedValues2() throws Exception
   {
      deploy("aop-scopedattachtest2.aop");
      try
      {
         MBeanServerConnection server = getServer();
         ObjectName testerName = new ObjectName("jboss.aop:name=ScopedTester2");
         Integer iv = (Integer)server.getAttribute(testerName, "ExpectedInterceptorValue");
         Integer ia = (Integer)server.getAttribute(testerName, "ExpectedAspectValue");
         assertEquals(12, iv.intValue());
         assertEquals(22, ia.intValue());
      }
      finally
      {
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.