Package javax.management.openmbean

Examples of javax.management.openmbean.OpenMBeanAttributeInfoSupport


   public void testNineParameCtor() throws Exception
   {
      Float defaultvalue = new Float(1.00);
      Float minvalue = new Float(0.75);
      Float maxvalue = new Float(1.50);
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false,
                                                defaultvalue,
                                                minvalue,
                                                maxvalue);
      assertTrue("Null info constructed", info != null);
      assertTrue("Expecting min value of 0.75",
                 info.hasMinValue() && minvalue.equals((Float)info.getMinValue()));
      assertTrue("Expecting max value of 1.50",
                 info.hasMaxValue() && maxvalue.equals((Float)info.getMaxValue()));

      info =
      new OpenMBeanAttributeInfoSupport("price",
                                        "how much it costs",
                                        SimpleType.FLOAT,
                                        true,
                                        false,
                                        false,
                                        defaultvalue,
                                        null,
                                        maxvalue);
      assertTrue("Null info constructed", info != null);
      assertFalse("Not expecting a min value",
                  info.hasMinValue());
      assertTrue("Expecting max value of 1.50",
                 info.hasMaxValue() && maxvalue.equals((Float)info.getMaxValue()));

      info =
      new OpenMBeanAttributeInfoSupport("price",
                                        "how much it costs",
                                        SimpleType.FLOAT,
                                        true,
                                        false,
                                        false,
                                        defaultvalue,
                                        minvalue,
                                        null);
      assertTrue("Null info constructed", info != null);
      assertTrue("Expecting min value of 0.75",
                 info.hasMinValue() && minvalue.equals((Float)info.getMinValue()));
      assertFalse("Not expecting a max value",
                  info.hasMaxValue());

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false,
                                           "1.00",
                                           minvalue,
                                           maxvalue);
         fail("Expecting exception for bad default value type");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false,
                                           defaultvalue,
                                           "0.75",
                                           maxvalue);
         fail("Expecting exception for bad min value type");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false,
                                           defaultvalue,
                                           minvalue,
                                           "1.50");
         fail("Expecting exception for bad min value type");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

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

      try
      {
         info =
         new OpenMBeanAttributeInfoSupport("price",
                                           "how much it costs",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false,
                                           defaultvalue,
                                           maxvalue,
                                           minvalue);
         fail("Expecting exception for min > max");
      }
      catch (OpenDataException x)
      {
         assertTrue(true);
      }

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


      }
   }

   public void testSimpleInfoHashCode()
   {
      OpenMBeanAttributeInfoSupport info =
              new OpenMBeanAttributeInfoSupport("price",
                                                "how much it costs",
                                                SimpleType.FLOAT,
                                                true,
                                                false,
                                                false);
      assertTrue("Unexpected hash code for simple info", info.hashCode() == hashCode(info));
   }
View Full Code Here

      assertTrue("Unexpected hash code for simple info", info.hashCode() == hashCode(info));
   }

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

      assertTrue("Expecting identical hash codes (only description is different)",
                 infotwo.hashCode() == infoone.hashCode());

      OpenMBeanAttributeInfo[] testattrs =
              new OpenMBeanAttributeInfoSupport[]{
                 new OpenMBeanAttributeInfoSupport("Uptime",
                                                   "how long it's been running",
                                                   SimpleType.FLOAT,
                                                   true,
                                                   false,
                                                   false),
                 new OpenMBeanAttributeInfoSupport("Exchanges",
                                                   "number of exchanges completed",
                                                   SimpleType.FLOAT,
                                                   true,
                                                   false,
                                                   false)};
View Full Code Here

   protected void setUp() throws Exception
   {
      attrs =
      new OpenMBeanAttributeInfoSupport[]{
         new OpenMBeanAttributeInfoSupport("Exchanges",
                                           "number of exchanges completed",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false),
         new OpenMBeanAttributeInfoSupport("Uptime",
                                           "how long it's been running",
                                           SimpleType.FLOAT,
                                           true,
                                           false,
                                           false)};
View Full Code Here

                    setter.getDescriptor());
        }

        final MBeanAttributeInfo ai;
        if (canUseOpenInfo(originalType)) {
            ai = new OpenMBeanAttributeInfoSupport(attributeName,
                                                   description,
                                                   openType,
                                                   isReadable,
                                                   isWritable,
                                                   isIs,
View Full Code Here

                      String description) {
        if (equal(description, ai.getDescription()))
            return ai;
        if (ai instanceof OpenMBeanAttributeInfo) {
            OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
            return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                     description,
                                                     oai.getOpenType(),
                                                     ai.isReadable(),
                                                     ai.isWritable(),
                                                     ai.isIs(),
View Full Code Here

        OpenMBeanOperationInfoSupport[] operations = new OpenMBeanOperationInfoSupport[2];
        MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[0];

        try {
            // Define the attributes
            attributes[0] = new OpenMBeanAttributeInfoSupport( ATTR_ID,
                                                               "Knowledge Base Id",
                                                               SimpleType.STRING,
                                                               true,
                                                               false,
                                                               false );
            attributes[1] = new OpenMBeanAttributeInfoSupport( ATTR_SESSION_COUNT,
                                                               "Number of created sessions for this Knowledge Base",
                                                               SimpleType.LONG,
                                                               true,
                                                               false,
                                                               false );
            attributes[2] = new OpenMBeanAttributeInfoSupport( ATTR_GLOBALS,
                                                               "List of globals",
                                                               globalsTableType,
                                                               true,
                                                               false,
                                                               false );
            attributes[3] = new OpenMBeanAttributeInfoSupport( ATTR_PACKAGES,
                                                               "List of Packages",
                                                               new ArrayType( 1,
                                                                              SimpleType.STRING ),
                                                               true,
                                                               false,
View Full Code Here

        OpenMBeanOperationInfoSupport[] operations = new OpenMBeanOperationInfoSupport[2];
        MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[0];

        try {
            // Define the attributes
            attributes[0] = new OpenMBeanAttributeInfoSupport( ATTR_ID,
                                                               "Knowledge Base Id",
                                                               SimpleType.STRING,
                                                               true,
                                                               false,
                                                               false );
            attributes[1] = new OpenMBeanAttributeInfoSupport( ATTR_SESSION_COUNT,
                                                               "Number of created sessions for this Knowledge Base",
                                                               SimpleType.LONG,
                                                               true,
                                                               false,
                                                               false );
            attributes[2] = new OpenMBeanAttributeInfoSupport( ATTR_GLOBALS,
                                                               "List of globals",
                                                               globalsTableType,
                                                               true,
                                                               false,
                                                               false );
            attributes[3] = new OpenMBeanAttributeInfoSupport( ATTR_PACKAGES,
                                                               "List of Packages",
                                                               new ArrayType( 1,
                                                                              SimpleType.STRING ),
                                                               true,
                                                               false,
View Full Code Here

            if (attrVal instanceof TypedValGetter) {
                String typeName = ((TypedValGetter) attrVal).getType().getTypeName();
                attrInfo[i] = new MBeanAttributeInfo(attrNames[i], typeName, attrNames[i], true, false, false);
            } else if (attrVal instanceof TabularDataGetter) {
                TabularDataGetter getter = (TabularDataGetter) attrVal;
                attrInfo[i] = new OpenMBeanAttributeInfoSupport(getter.getTypeName(), getter.getTypeDesc(),
                        getter.getTableType(), true, false, false);
            } else if (attrVal instanceof TabularData) {
                TabularType tt = ((TabularData) attrVal).getTabularType();
                attrInfo[i] = new OpenMBeanAttributeInfoSupport(tt.getTypeName(), tt.getDescription(),
                        tt, true, false, false);
            } else {
                attrInfo[i] = new MBeanAttributeInfo(attrNames[i],
                        attr.getValue() != null ? attr.getValue().getClass().getName() : "<null>",
                        attrNames[i], 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.