Package test.implementation.modelmbean.support

Examples of test.implementation.modelmbean.support.Test


    * This test uses the xmbean.dtd
    */
   public void testCachedAttribute2() throws Exception
   {
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      Test resource = new Test();
      Descriptor d = new DescriptorSupport();
      d.setField(RESOURCE_REFERENCE, resource);
      d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml");
      d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");

      XMBean mmb = new XMBean(d, DESCRIPTOR);
     
      ObjectName name = new ObjectName(":test=test");
      server.registerMBean(mmb, name);
     
      server.getAttribute(name, "Something");

      assertTrue(resource.getBarCount() == 1);
     
      server.setAttribute(name, new Attribute("Something", "yksi"));

      assertTrue(resource.getFooCount() == 1);
     
      String str = (String)server.getAttribute(name, "Something");
     
      assertTrue(resource.getBarCount() == 1);
      assertTrue(str.equals("yksi"));
     
      try { Thread.sleep(1100); } catch (Throwable t) {}
     
      server.getAttribute(name, "Something");
     
      assertTrue(resource.getBarCount() == 2);
     
      server.setAttribute(name, new Attribute("Something", "kaksi"));
     
      assertTrue(resource.getFooCount() == 2);
     
      try { Thread.sleep(1100); } catch (Throwable t) {}
     
      str = (String)server.getAttribute(name, "Something");
     
      assertTrue(resource.getBarCount() == 3);
      assertTrue(str.equals("kaksi"));
     
      str = (String)server.getAttribute(name, "Something");
     
      assertTrue(resource.getBarCount() == 3);
      assertTrue(str.equals("kaksi"));
   }
View Full Code Here


    * Tests attribute change notifications
    */
   public void testAttributeChangeNotifications() throws Exception
   {
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      Test resource = new Test();
      Descriptor d = new DescriptorSupport();
      d.setField(RESOURCE_REFERENCE, resource);
      d.setField(RESOURCE_TYPE, "file:./src/main/test/implementation/modelmbean/support/xml/TrivialManagementInterface5.xml");
      d.setField(SAX_PARSER, "org.apache.crimson.parser.XMLReaderImpl");

View Full Code Here

TOP

Related Classes of test.implementation.modelmbean.support.Test

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.