Package javax.management.openmbean

Examples of javax.management.openmbean.OpenMBeanAttributeInfoSupport


      assertTrue("Unexpected hash code for info w/default value", info.hashCode() == hashCode(info));
   }

   public void testNullDefaultValueHashCode() throws Exception
   {
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                null);
      assertTrue("Unexpected hash code for info w/null default value",
                 info.hashCode() == hashCode(info));
   }
View Full Code Here


                 info.hashCode() == hashCode(info));
   }

   public void testLegalValueHashCode() throws Exception
   {
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                new Float(1.00),
                                                new Float[]{
                                                   new Float(0.75),
                                                   new Float(1.00),
                                                   new Float(1.50)});
      assertTrue("Unexpected hash code for info w/legal values",
                 info.hashCode() == hashCode(info));
   }
View Full Code Here

                 info.hashCode() == hashCode(info));
   }

   public void testEmptyLegalValueHashCode() throws Exception
   {
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                new Float(1.00),
                                                new Float[0]);
      assertTrue("Unexpected hash code for info w/empty legal values",
                 info.hashCode() == hashCode(info));
   }
View Full Code Here

                 info.hashCode() == hashCode(info));
   }

   public void testMinMaxValueHashCode() throws Exception
   {
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                new Float(1.00),
                                                new Float(0.75),
                                                new Float(1.50));
      assertTrue("Unexpected hash code for info w/minmax values",
                 info.hashCode() == hashCode(info));
   }
View Full Code Here

                 info.hashCode() == hashCode(info));
   }

   public void testNullMinValueHashCode() throws Exception
   {
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                new Float(1.00),
                                                null,
                                                new Float(1.50));
      assertTrue("Unexpected hash code for info w/null min values",
                 info.hashCode() == hashCode(info));
   }
View Full Code Here

                 info.hashCode() == hashCode(info));
   }

   public void testNullMaxValueHashCode() throws Exception
   {
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                new Float(1.00),
                                                new Float(0.75),
                                                null);
      assertTrue("Unexpected hash code for info w/empty legal values",
                 info.hashCode() == hashCode(info));
   }
View Full Code Here

   public void testEquals() throws Exception
   {
      try
      {

         OpenMBeanAttributeInfoSupport o1 =
                 new OpenMBeanAttributeInfoSupport("name", "The name", SimpleType.STRING, false, true, false);
         OpenMBeanAttributeInfoSupport o2 =
                 new OpenMBeanAttributeInfoSupport("name", "The name", SimpleType.STRING, false, true, false);
         OpenMBeanAttributeInfoSupport o3 =
                 new OpenMBeanAttributeInfoSupport("name", "The name", SimpleType.STRING, true, false, false);

         assertTrue(!o1.equals(null));
         assertTrue(o1.equals(o2));
         assertEquals(o1.hashCode(), o2.hashCode());
         assertTrue(!o1.equals(o3));
View Full Code Here

   }

   public void testSixParamCtor() throws Exception
   {
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false);
      assertTrue("Null info constructed", info != null);
      assertTrue("OpenType should be FLOAT",
                 info.getOpenType().equals(SimpleType.FLOAT));
      assertTrue("Attribute should be readable", info.isReadable());
      assertFalse("Attribute should not be writeable", info.isWritable());
      assertFalse("Attribute is not 'is", info.isIs());

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport(null,
                                           "how much it costs",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false);
         fail("Expecting exception for null name");
      }
      catch (IllegalArgumentException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("",
                                           "how much it costs",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false);
         fail("Expecting exception for empty name");
      }
      catch (IllegalArgumentException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           null,
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false);
         fail("Expecting exception for null description");
      }
      catch (IllegalArgumentException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false);
         fail("Expecting exception for empty description");
      }
      catch (IllegalArgumentException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           null,
                                           true,
                                           false,
                                           false);
View Full Code Here

   }

   public void testSevenParamCtor() throws Exception
   {
      Float defaultvalue = new Float(1.00);
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                defaultvalue);
      assertTrue("Null info constructed", info != null);
      assertTrue("Expecting default value of 1.00", defaultvalue.equals((Float)info.getDefaultValue()));

      info =
      new OpenMBeanAttributeInfoSupport("price",
                                        "how much it costs",
                                        SimpleType.FLOAT,
                                        true,
                                        false,
                                        false,
                                        null);
      assertTrue("Null info constructed", info != null);
      assertFalse("There should be no default value", info.hasDefaultValue());
   }
View Full Code Here

   public void testEightParamCtor() throws Exception
   {
      Float[] legalvalues = {new Float(0.75), new Float(1.00), new Float(1.50)};
      Float defaultvalue = new Float(1.00);
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                defaultvalue,
                                                legalvalues);
      assertTrue("Null info constructed", info != null);
      Set legalset = info.getLegalValues();
      assertTrue("Legal set is the wrong size", legalset.size() == legalvalues.length);
      assertTrue("0.75 not in legal set",
                 legalset.contains(new Float(0.75)));
      assertTrue("1.00 not in legal set",
                 legalset.contains(new Float(1.00)));
      assertTrue("1.50 not in legal set",
                 legalset.contains(new Float(1.50)));

      info =
      new OpenMBeanAttributeInfoSupport("price",
                                        "how much it costs",
                                        SimpleType.FLOAT,
                                        true,
                                        false,
                                        false,
                                        defaultvalue,
                                        null);
      assertTrue("Null info constructed", info != null);
      assertFalse("There should be no legal value set for null",
                  info.hasLegalValues());

      info =
      new OpenMBeanAttributeInfoSupport("price",
                                        "how much it costs",
                                        SimpleType.FLOAT,
                                        true,
                                        false,
                                        false,
                                        defaultvalue,
                                        new Float[0]);
      assertTrue("Null info constructed", info != null);
      assertFalse("There should be no legal value set for Float[0]",
                  info.hasLegalValues());

      info =
      new OpenMBeanAttributeInfoSupport("price",
                                        "how much it costs",
                                        SimpleType.FLOAT,
                                        true,
                                        false,
                                        false,
                                        null,
                                        legalvalues);
      assertTrue("Null info constructed", info != null);
      assertFalse("Has a default value", info.hasDefaultValue());

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false,
                                           "Invalid Default Value",
                                           new Float[0]);
         fail("Expecting exception for invalid default value");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false,
                                           defaultvalue,
                                           new Object[]{new Float(0.75), "$1.50"});
         fail("Expecting exception for invalid legal value");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

      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);
         fail("Expecting exception for default not in legal set");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           SimpleType.INTEGER,
                                           true,
                                           false,
                                           false,
View Full Code Here

TOP

Related Classes of javax.management.openmbean.OpenMBeanAttributeInfoSupport

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.