Package javax.management

Examples of javax.management.MBeanServerConnection.createMBean()


   public void testInvokeThrowsCustomException() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);

      try
      {
         mbsc.invoke(name, "throwCustomException", null, null);
View Full Code Here


   public void testInvokeThrowsRuntimeException() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);

      try
      {
         mbsc.invoke(name, "throwRuntimeException", null, null);
View Full Code Here

   public void testIsInstanceOf() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);

      boolean isInstanceOf = mbsc.isInstanceOf(name, Support.class.getName());
      if (!isInstanceOf) fail("Class");
View Full Code Here

   public void testIsRegistered() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);

      boolean isRegistered = mbsc.isRegistered(name);
      if (!isRegistered) fail();
   }
View Full Code Here

   public void testSetAttribute() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);

      String attribute = "Name";
      String value = "mx4j";
      mbsc.setAttribute(name, new Attribute(attribute, value));
View Full Code Here

   public void testSetAttributes() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);

      String attribute = "Name";
      String value = "mx4j";
      AttributeList attributes = new AttributeList();
View Full Code Here

   public void testUnregisterMBean() throws Exception
   {
      MBeanServerConnection mbsc = getMBeanServerConnection(newMBeanServer());
      ObjectName name = ObjectName.getInstance("", "test", "invocation");
      ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
      assertNotNull(instance);

      mbsc.unregisterMBean(name);
      if (mbsc.isRegistered(name)) fail();
   }
View Full Code Here

      ObjectName delegateName = ObjectName.getInstance("JMImplementation:type=MBeanServerDelegate");
      cntion.addNotificationListener(delegateName, listener, null, null);
      sleep(1000);

      ObjectName name = ObjectName.getInstance(":mbean=mlet");
      cntion.createMBean(MLet.class.getName(), name, null);
      sleep(1000);
      Notification notification = (Notification)listener.get();
      assertNotNull(notification);
      listener.reset();
View Full Code Here

         JMXConnector cntor = JMXConnectorFactory.connect(cntorServer.getAddress(), clientEnv);
         MBeanServerConnection mbsc = cntor.getMBeanServerConnection();

         ObjectName name = ObjectName.getInstance("", "test", "invocation");
         ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
         assertNotNull(instance);

         Boolean result = (Boolean)mbsc.invoke(name, "authenticated", new Object[]{principalName}, new String[]{String.class.getName()});
         assertTrue(result.booleanValue());
      }
View Full Code Here

         principals.add(new JMXPrincipal(delegatedName));
         Subject delegate = new Subject(true, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
         MBeanServerConnection mbsc = cntor.getMBeanServerConnection(delegate);

         ObjectName name = ObjectName.getInstance("", "test", "invocation");
         ObjectInstance instance = mbsc.createMBean(Support.class.getName(), name, null);
         assertNotNull(instance);

         Boolean result = (Boolean)mbsc.invoke(name, "delegated", new Object[]{delegatedName}, new String[]{String.class.getName()});
         assertTrue(result.booleanValue());
      }
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.