Package javax.management.openmbean

Examples of javax.management.openmbean.ArrayType


      try
      {
         OpenMBeanParameterInfoSupport info =
                 new OpenMBeanParameterInfoSupport("currency",
                                                   "monetary currency",
                                                   new ArrayType(1, SimpleType.STRING),
                                                   null);
         assertTrue("Null info constructed", info != null);

         info =
         new OpenMBeanParameterInfoSupport("currency",
                                           "monetary currency",
                                           new ArrayType(1, SimpleType.STRING),
                                           "Euro");
         fail("Expecting OpenDataException");
      }
      catch (OpenDataException x)
      {
View Full Code Here


      try
      {
         OpenMBeanParameterInfoSupport info =
                 new OpenMBeanParameterInfoSupport("currency",
                                                   "monetary currency",
                                                   new ArrayType(1, SimpleType.STRING),
                                                   null,
                                                   new String[]{"Dollar", "Euro", "Yen"});
         fail("Expecting OpenDataException");
      }
      catch (OpenDataException x)
View Full Code Here

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           new ArrayType(1, SimpleType.FLOAT),
                                           true,
                                           false,
                                           false,
                                           defaultvalue,
                                           null);
         fail("Expecting exception for non null default w/ArrayType attribute");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           new ArrayType(1, SimpleType.FLOAT),
                                           true,
                                           false,
                                           false,
                                           null,
                                           new Float[]{new Float(0.75), new Float(1.50)});
         fail("Expecting exception for non null legal set w/ArrayType attribute");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           new ArrayType(1, SimpleType.FLOAT),
                                           true,
                                           false,
                                           false,
                                           new Float(0.25),
                                           legalvalues);
View Full Code Here

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           new ArrayType(1, SimpleType.FLOAT),
                                           true,
                                           false,
                                           false,
                                           defaultvalue,
                                           minvalue,
View Full Code Here

      super.tearDown();
   }

   public void testIsValue() throws Exception
   {
      ArrayType simple = new ArrayType(1, SimpleType.STRING);

      String[] stringarray = {"do", "re", "mi"};
      assertTrue("Expecting equality for array of strings", simple.isValue(stringarray));
      assertFalse("Expecting inequality for array of ints", simple.isValue(new int[]{1, 2, 3, 4}));
      assertFalse("Expecting inequality for null", simple.isValue(null));
      assertFalse("Expecting inequality for string", simple.isValue("fa"));

      String[] items = {"type", "winery", "vintage"};
      String[] descriptions = {"Type of wine", "Wine producer", "Year produced"};
      OpenType[] types = {SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER};
      CompositeType wine = new CompositeType("wine", "nectar of the gods", items, descriptions, types);

      items = new String[]{"type", "brewery"};
      descriptions = new String[]{"Type of beer", "Beer producer"};
      types = new OpenType[]{SimpleType.STRING, SimpleType.STRING};
      CompositeType beer = new CompositeType("beer", "a meal in a glass", items, descriptions, types);

      ArrayType composite = new ArrayType(1, wine);

      CompositeDataSupport amarone =
              new CompositeDataSupport(wine,
                                       new String[]{"type", "winery", "vintage"},
                                       new Object[]{"red", "Allegrini", new Integer(1996)});
      CompositeDataSupport orvieto =
              new CompositeDataSupport(wine,
                                       new String[]{"type", "winery", "vintage"},
                                       new Object[]{"white", "Ruffino", new Integer(2002)});
      CompositeData[] winecellar = {amarone, orvieto};
      CompositeData[] sparsewines = {amarone, null, orvieto};

      CompositeDataSupport stout =
              new CompositeDataSupport(beer,
                                       new String[]{"type", "brewery"},
                                       new Object[]{"stout", "Guiness"});
      CompositeData[] beerlist = {stout};

      CompositeData[] mixer = {amarone, stout, orvieto};

      assertTrue("Expecting equality for array of wines", composite.isValue(winecellar));
      assertTrue("Expecting equality for sparse array of wines", composite.isValue(sparsewines));
      assertFalse("Expecting inequality for array of beer", composite.isValue(beerlist));
      assertFalse("Expecting inequality for mixed array", composite.isValue(mixer));
      assertFalse("Expecting inequality for single wine", composite.isValue(orvieto));

      ArrayType winematrix = new ArrayType(2, wine);

      CompositeData[][] matrix = {{amarone, orvieto}, {orvieto, amarone}};
      assertTrue("Expecting equality for wine matrix", winematrix.isValue(matrix));
      assertFalse("Expecting inequality for wine vector", winematrix.isValue(winecellar));

      winematrix = new ArrayType(2, wine);
      CompositeData[][] matrix2 = new CompositeData[1][1];
      assertTrue("Expecting equality for wine matrix", winematrix.isValue(matrix2));
   }
View Full Code Here

      assertTrue("Expecting equality for wine matrix", winematrix.isValue(matrix2));
   }

   public void testEquals() throws Exception
   {
      ArrayType a1 = new ArrayType(1, SimpleType.LONG);
      ArrayType a2 = new ArrayType(1, SimpleType.LONG);
      ArrayType a3 = new ArrayType(2, SimpleType.LONG);
      ArrayType a4 = new ArrayType(2, SimpleType.STRING);

      assertTrue(a1.equals(a2));
      assertTrue(!a1.equals(a3));
      assertTrue(!a1.equals(a4));
View Full Code Here

   {
      String[] items = {"type", "winery", "vintage"};
      String[] descriptions = {"Type of wine", "Wine producer", "Year produced"};
      OpenType[] types = {SimpleType.STRING, SimpleType.STRING, SimpleType.DATE};
      CompositeType californiaWine = new CompositeType("California", "Vino", items, descriptions, types);
      ArrayType aone = new ArrayType(2, californiaWine);
      ArrayType atwo = new ArrayType(2, californiaWine);
      assertTrue("Expecting equality for identical composite types", aone.equals(atwo));

      CompositeType italianWine = new CompositeType("Italia", "Vino", items, descriptions, types);
      atwo = new ArrayType(2, italianWine);
      assertFalse("Expecting inequality for different composite types", aone.equals(atwo));
   }
View Full Code Here

      assertFalse("Expecting inequality for different composite types", aone.equals(atwo));
   }

   public void testClassName() throws Exception
   {
      ArrayType a1 = new ArrayType(2, SimpleType.STRING);
      assertEquals(a1.getClassName(), "[[Ljava.lang.String;");
      assertEquals(a1.getTypeName(), "[[Ljava.lang.String;");

   }
View Full Code Here

   public void testHashCode() throws Exception
   {


      ArrayType a1 = new ArrayType(2, SimpleType.STRING);
      ArrayType a2 = new ArrayType(2, SimpleType.STRING);

      assertTrue(a1.hashCode() == a2.hashCode());

   }
View Full Code Here

   public void testBadSize() throws Exception
   {
      try
      {
         ArrayType t = new ArrayType(0, SimpleType.STRING);
      }
      catch (IllegalArgumentException x)
      {
         assertTrue(true); // success
      }
View Full Code Here

TOP

Related Classes of javax.management.openmbean.ArrayType

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.