Package javax.management.modelmbean

Examples of javax.management.modelmbean.DescriptorSupport


   }

   public void testNullStringArrayCtorParm() throws Exception
   {
      String[] nullfields = null;
      DescriptorSupport ds = new DescriptorSupport(nullfields);
      Object[] fields = ds.getFieldValues(null);
      assertEquals("Expecting 0 length array", fields.length, 0);
   }
View Full Code Here


   public void testToXMLString() throws Exception
   {
      String[] fields = {"wine", "vineyard", "year", "price"};
      Object[] values = {"Amarone", "Allegrini", "1996", new Integer(90)};
      DescriptorSupport ds = new DescriptorSupport(fields, values);
      String xml = ds.toXMLString();
      assertTrue("Descriptor from XML != Descriptor", descriptorsEqual(ds, (new DescriptorSupport(xml))));

      fields = new String[]{"wine=Amarone", "vineyard=Allegrini", "year=1996"};
      ds = new DescriptorSupport(fields);
      xml = ds.toXMLString();
      assertTrue("Descriptor from XML != Descriptor", descriptorsEqual(ds, (new DescriptorSupport(xml))));
   }
View Full Code Here

      assertTrue("Descriptor from XML != Descriptor", descriptorsEqual(ds, (new DescriptorSupport(xml))));
   }

   public void testEmptyDescriptorToXMLString() throws Exception
   {
      DescriptorSupport ds = new DescriptorSupport();
      String xml = ds.toXMLString();
      assertEquals("Unexpected xml: " + xml, xml, "<Descriptor></Descriptor>");
   }
View Full Code Here

   public void testGetFieldsUnknownName()
   {
      String[] fields = {"wine", "vineyard", "year"};
      String[] values = {"Amarone", "Allegrini", "1996"};
      DescriptorSupport ds = new DescriptorSupport(fields, values);
      Object fv = ds.getFieldValue("price");
      assertNull(fv);
      fields = new String[]{"wine", "vineyard", "year", "price"};
      Object[] fvs = ds.getFieldValues(fields);
      assertEquals("wrong number of values", fvs.length, fields.length);
      assertNull(fvs[3]);
   }
View Full Code Here

   public void testGetFieldsEmptyArray()
   {
      String[] fields = {"wine", "vineyard", "year"};
      String[] values = {"Amarone", "Allegrini", "1996"};
      DescriptorSupport ds = new DescriptorSupport(fields, values);
      Object[] fvs = ds.getFieldValues(new String[0]);
      assertEquals("Expecting empty array", fvs.length, 0);
   }
View Full Code Here

   public void testRemoveField()
   {
      String[] fields = {"wine", "vineyard", "year", "price"};
      Object[] values = {"Amarone", "Allegrini", "1996", new Integer(90)};
      DescriptorSupport ds = new DescriptorSupport(fields, values);
      assertEquals("Expecting " + fields.length + " names", ds.getFieldNames().length, fields.length);
      ds.removeField("price");
      assertEquals("Expecting " + (fields.length - 1) + " names", ds.getFieldNames().length, fields.length - 1);
   }
View Full Code Here

   public void testRemoveNonexistentFieldDoesntThrow()
   {
      String[] fields = {"wine", "vineyard", "year"};
      String[] values = {"Amarone", "Allegrini", "1996"};
      DescriptorSupport ds = new DescriptorSupport(fields, values);
      ds.removeField("price");
   }
View Full Code Here

   public void testRemoveNullField()
   {
      String[] fields = {"wine", "vineyard", "year"};
      String[] values = {"Amarone", "Allegrini", "1996"};
      DescriptorSupport ds = new DescriptorSupport(fields, values);
      ds.removeField(null);
   }
View Full Code Here

      xmldescriptor.append("name=\"bogus\" ");
      xmldescriptor.append("value=\"xyzzy\"");
      xmldescriptor.append(">");
      xmldescriptor.append("</field>");
      xmldescriptor.append("</Descriptor>");
      DescriptorSupport ds = new DescriptorSupport(xmldescriptor.toString());
      String xml = ds.toXMLString();
      assertTrue("Descriptor from XML != Descriptor", descriptorsEqual(ds, (new DescriptorSupport(xml))));
   }
View Full Code Here

   }

   public void testXMLSpecialStringConstructor() throws Exception
   {
      String[] fields = {"name=Lawrence", "nickname=(Larry)"};
      DescriptorSupport ds = new DescriptorSupport(fields);
      String xml = ds.toXMLString();
      DescriptorSupport xmlds = new DescriptorSupport(xml);
      assertTrue("Descriptors not equal", descriptorsEqual(ds, xmlds));
   }
View Full Code Here

TOP

Related Classes of javax.management.modelmbean.DescriptorSupport

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.