Package javax.management.openmbean

Examples of javax.management.openmbean.OpenMBeanAttributeInfoSupport


      throws Exception
   {
      boolean caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            null, "description", SimpleType.INTEGER, true, true, false);
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "", "description", SimpleType.INTEGER, true, true, false);
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", null, SimpleType.INTEGER, true, true, false);
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null description");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "", SimpleType.INTEGER, true, true, false);
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty description");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "", "description", SimpleType.INTEGER, true, true, false);
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", null, true, true, false);
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
View Full Code Here


      throws Exception
   {
      boolean caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            null, "description", SimpleType.INTEGER, true, true, false, new Integer(3));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "", "description", SimpleType.INTEGER, true, true, false, new Integer(3));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", null, SimpleType.INTEGER, true, true, false, new Integer(3));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null description");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "", SimpleType.INTEGER, true, true, false, new Integer(3));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty description");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "", "description", SimpleType.INTEGER, true, true, false, new Integer(3));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", null, true, true, false, new Integer(3));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null simple type");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.STRING, true, true, false, new Integer(3));
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for wrong simple type and default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, new String[0]);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for array type and default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't execpt OpenDataException for array type and no default value");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, data);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for tabular type and default value");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
View Full Code Here

      throws Exception
   {
      boolean caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            null, "description", SimpleType.INTEGER, true, true, false,
            new Integer(3), new Integer[] { new Integer(3), new Integer(4) });
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "", "description", SimpleType.INTEGER, true, true, false,
            new Integer(3), new Integer[] { new Integer(3), new Integer(4) });
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", null, SimpleType.INTEGER, true, true, false,
            new Integer(3), new Integer[] { new Integer(3), new Integer(4) });
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null description");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "", SimpleType.INTEGER, true, true, false, new Integer(3),
            new Integer[] { new Integer(3), new Integer(4) });
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty description");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "", "description", SimpleType.INTEGER, true, true, false,
            new Integer(3), new Integer[] { new Integer(3), new Integer(4) });
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", null, true, true, false,
            new Integer(3), new Integer[] { new Integer(3), new Integer(4) });
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null simple type");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.STRING, true, true, false,
            new Integer(3), new Integer[] { new Integer(3), new Integer(4) });
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for wrong simple type and default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, new String[0], null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for array type and default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for array type and no default value and legals");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, data, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for tabular type and default value");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for tabular type and null default value and legals");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, null, new String[] { "hello", "goodbye" });
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for array type and default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, null, new String[0]);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for array type and no default value and empty legals");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, null, new TabularDataSupport[] { data });
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for tabular type and legal values");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, null, new TabularDataSupport[0]);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for tabular type and null default value and empty legals");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.STRING, true, true, false,
            new Integer(3), new Integer[] { new Integer(2), new Integer(4) });
      }
      catch (OpenDataException e)
      {
View Full Code Here

      throws Exception
   {
      boolean caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            null, "description", SimpleType.INTEGER, true, true, false,
            new Integer(3), new Integer(3), new Integer(4));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "", "description", SimpleType.INTEGER, true, true, false,
            new Integer(3), new Integer(3), new Integer(4));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", null, SimpleType.INTEGER, true, true, false, new Integer(3), new Integer(3), new Integer(4));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null description");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "", SimpleType.INTEGER, true, true, false, new Integer(3), new Integer(3), new Integer(4));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty description");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "", "description", SimpleType.INTEGER, true, true, false, new Integer(3), new Integer(3), new Integer(4));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for an empty name");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", null, true, true, false, new Integer(3), new Integer(3), new Integer(4));
      }
      catch (IllegalArgumentException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected IllegalArgumentException for null simple type");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.STRING, true, true, false, new Integer(3), null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for wrong simple type and default value");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.STRING, true, true, false, null, new Integer(3), null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for wrong simple type and minimum value");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.STRING, true, true, false, null, null, new Integer(3));
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for wrong simple type and maximum value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, new String[0], null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for array type and default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, null, null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for array type and no default value");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, data, null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for tabular type and default value");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, null, null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for tabular type and null default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, new String[] { "hello", "goodbye" }, null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for array type and default value");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.STRING, true, true, false,
            new Integer(3), new Integer(4), new Integer(5));
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for default value less than minimum value");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.INTEGER, true, true, false,
            new Integer(4), new Integer(4), new Integer(5));
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for default value equal minimum value");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.INTEGER, true, true, false,
            new Integer(6), new Integer(4), new Integer(5));
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for default value greater than maximum value");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.INTEGER, true, true, false,
            new Integer(5), new Integer(4), new Integer(5));
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for default value equal maximum value");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.INTEGER, true, true, false,
            null, new Integer(4), new Integer(3));
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for minimum greater than maximum value");

      caught = false;
      try
      {
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", SimpleType.INTEGER, true, true, false,
            null, new Integer(4), new Integer(4));
      }
      catch (OpenDataException e)
      {
View Full Code Here

   // Tests ---------------------------------------------------------------------

   public void testOpenMBeanAttributeInfoSupport()
      throws Exception
   {
      OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, "default");
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals("default", info.getDefaultValue());
      assertEquals(true, info.hasDefaultValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(false, info.hasDefaultValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, new Integer(3), new Integer(2), new Integer(4));
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(new Integer(3), info.getDefaultValue());
      assertEquals(new Integer(2), info.getMinValue());
      assertEquals(new Integer(4), info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, new Integer(2), new Integer(4));
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(new Integer(2), info.getMinValue());
      assertEquals(new Integer(4), info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, new Integer(3), null, new Integer(4));
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(new Integer(3), info.getDefaultValue());
      assertEquals(null, info.getMinValue());
      assertEquals(new Integer(4), info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, new Integer(3), new Integer(2), null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(new Integer(3), info.getDefaultValue());
      assertEquals(new Integer(2), info.getMinValue());
      assertEquals(null, info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, null, new Integer(4));
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(null, info.getMinValue());
      assertEquals(new Integer(4), info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, new Integer(2), null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(new Integer(2), info.getMinValue());
      assertEquals(null, info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, new Integer(3), null, null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(new Integer(3), info.getDefaultValue());
      assertEquals(null, info.getMinValue());
      assertEquals(null, info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, null, null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(null, info.getMinValue());
      assertEquals(null, info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, "default",
         new Object[] { "legal1", "legal2", "default" });
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals("default", info.getDefaultValue());
      assertEquals(3, info.getLegalValues().size());
      assertTrue("legal1 should be a legal value", info.getLegalValues().contains("legal1"));
      assertTrue("legal2 should be a legal value", info.getLegalValues().contains("legal2"));
      assertTrue("default should be a legal value", info.getLegalValues().contains("default"));

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, null,
         new Object[] { "legal1", "legal2", "default" });
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(3, info.getLegalValues().size());
      assertTrue("legal1 should be a legal value", info.getLegalValues().contains("legal1"));
      assertTrue("legal2 should be a legal value", info.getLegalValues().contains("legal2"));
      assertTrue("default should be a legal value", info.getLegalValues().contains("default"));

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, "default", null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals("default", info.getDefaultValue());
      assertEquals(null, info.getLegalValues());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, null, null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(null, info.getLegalValues());
   }
View Full Code Here

      return new OpenDataException("OpenDataException");
   }

   public OpenMBeanAttributeInfoSupport createOpenMBeanAttributeInfoSupport()
   {
      return new OpenMBeanAttributeInfoSupport("attrib", "An Attribute", SimpleType.STRING, true, true, false);
   }
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

   // Tests ---------------------------------------------------------------------

   public void testOpenMBeanAttributeInfoSupport()
      throws Exception
   {
      OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, "default");
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals("default", info.getDefaultValue());
      assertEquals(true, info.hasDefaultValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, (String) null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(false, info.hasDefaultValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, new Integer(3), new Integer(2), new Integer(4));
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(new Integer(3), info.getDefaultValue());
      assertEquals(new Integer(2), info.getMinValue());
      assertEquals(new Integer(4), info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, new Integer(2), new Integer(4));
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(new Integer(2), info.getMinValue());
      assertEquals(new Integer(4), info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, new Integer(3), null, new Integer(4));
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(new Integer(3), info.getDefaultValue());
      assertEquals(null, info.getMinValue());
      assertEquals(new Integer(4), info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, new Integer(3), new Integer(2), null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(new Integer(3), info.getDefaultValue());
      assertEquals(new Integer(2), info.getMinValue());
      assertEquals(null, info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, null, new Integer(4));
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(null, info.getMinValue());
      assertEquals(new Integer(4), info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, new Integer(2), null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(new Integer(2), info.getMinValue());
      assertEquals(null, info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, new Integer(3), null, null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(new Integer(3), info.getDefaultValue());
      assertEquals(null, info.getMinValue());
      assertEquals(null, info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, null, null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.Integer", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(null, info.getMinValue());
      assertEquals(null, info.getMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, "default",
         new String[] { "legal1", "legal2", "default" });
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals("default", info.getDefaultValue());
      assertEquals(3, info.getLegalValues().size());
      assertTrue("legal1 should be a legal value", info.getLegalValues().contains("legal1"));
      assertTrue("legal2 should be a legal value", info.getLegalValues().contains("legal2"));
      assertTrue("default should be a legal value", info.getLegalValues().contains("default"));

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, null,
         new String[] { "legal1", "legal2", "default" });
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(3, info.getLegalValues().size());
      assertTrue("legal1 should be a legal value", info.getLegalValues().contains("legal1"));
      assertTrue("legal2 should be a legal value", info.getLegalValues().contains("legal2"));
      assertTrue("default should be a legal value", info.getLegalValues().contains("default"));

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, "default", null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals("default", info.getDefaultValue());
      assertEquals(null, info.getLegalValues());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, null, null);
      assertEquals("name", info.getName());
      assertEquals("description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertEquals(true, info.isWritable());
      assertEquals(true, info.isReadable());
      assertEquals(false, info.isIs());
      assertEquals(null, info.getDefaultValue());
      assertEquals(null, info.getLegalValues());
   }
View Full Code Here

   }

   public void testOpenType()
      throws Exception
   {
      OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false);
      assertEquals(SimpleType.STRING, info.getOpenType());
   }
View Full Code Here

   }

   public void testHas()
      throws Exception
   {
      OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, "default");
      assertEquals(true, info.hasDefaultValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.STRING, true, true, false, (String) null);
      assertEquals(false, info.hasDefaultValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, new Integer(3), null);
      assertEquals(true, info.hasMinValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, null, null);
      assertEquals(false, info.hasMinValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, null, new Integer(3));
      assertEquals(true, info.hasMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, null, null);
      assertEquals(false, info.hasMaxValue());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, new Integer[] { new Integer(3) });
      assertEquals(true, info.hasLegalValues());

      info = new OpenMBeanAttributeInfoSupport(
         "name", "description", SimpleType.INTEGER, true, true, false, null, null);
      assertEquals(false, info.hasLegalValues());
   }
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.