Package javax.management.openmbean

Examples of javax.management.openmbean.TabularType


         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)
View Full Code Here


      CompositeType compositeType2 = new CompositeType("typeName2", "description",
         itemNames, itemDescriptions, itemTypes);
      ArrayType compArrayType3 = new ArrayType(2, compositeType2);
      assertTrue("compData1 should not be a value of array type, wrong element type", compArrayType3.isValue(compData1) == false);

      TabularType tabularType = new TabularType("typeName", "description", compositeType, new String[] { "name1" });
      TabularDataSupport tds = new TabularDataSupport(tabularType);
      TabularDataSupport[][] tabData1 = new TabularDataSupport[][]
      {
         { tds, null }, { tds, tds }
      };

      ArrayType tabArrayType1 = new ArrayType(2, tabularType);
      assertTrue("tabData1 should be a value of array type", tabArrayType1.isValue(tabData1));

      ArrayType tabArrayType2 = new ArrayType(1, tabularType);
      assertTrue("tabData1 should not be a value of array type, wrong number of dimensions", tabArrayType2.isValue(tabData1) == false);

      TabularType tabularType2 = new TabularType("typeName2", "description", compositeType, new String[] { "name1" });
      ArrayType tabArrayType3 = new ArrayType(2, tabularType2);
      assertTrue("tabData1 should not be a value of array type, wrong element type", tabArrayType3.isValue(tabData1) == false);
   }
View Full Code Here

      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);

      assertEquals(TabularData.class.getName(), tabularType.getClassName());
      assertEquals("description", tabularType.getDescription());
      assertEquals("typeName", tabularType.getTypeName());
      assertTrue("Tabular type should not be an array", tabularType.isArray() == false);
   }
View Full Code Here

      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);

      assertEquals(rowType, tabularType.getRowType());
   }
View Full Code Here

      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);

      List indexList = tabularType.getIndexNames();
      assertTrue("wrong number of index names", indexList.size() == 2);
      assertTrue("index list should contain name1", indexList.contains("name1"));
      assertTrue("index list should contain name2", indexList.contains("name2"));
      Iterator i = indexList.iterator();
      assertTrue("first index is name1", i.next().equals("name1"));
View Full Code Here

      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);

      assertTrue("null is not a value of tabular type", tabularType.isValue(null) == false);
      assertTrue("object is not a value of tabular type", tabularType.isValue(new Object()) == false);

      TabularDataSupport data = new TabularDataSupport(tabularType);
      assertTrue("data should is a value", tabularType.isValue(data));

      TabularType tabularType2 = new TabularType("typeName", "description", rowType, indexNames);
      data = new TabularDataSupport(tabularType2);
      assertTrue("data is a value, even though the tabular type is a different instance",
                 tabularType.isValue(data));

      tabularType2 = new TabularType("typeName2", "description", rowType, indexNames);
      data = new TabularDataSupport(tabularType2);
      assertTrue("data should not be a value, they have different type names",
                 tabularType.isValue(data) == false);

      CompositeType rowType2 = new CompositeType("rowTypeName2", "rowDescription",
         itemNames, itemDescriptions, itemTypes);
      tabularType2 = new TabularType("typeName", "description", rowType2, indexNames);
      data = new TabularDataSupport(tabularType2);
      assertTrue("data should not be a value, they have different row types",
                 tabularType.isValue(data) == false);

      String[] indexNames2 = new String[] { "name2", "name1" };
      tabularType2 = new TabularType("typeName", "description", rowType, indexNames2);
      data = new TabularDataSupport(tabularType2);
      assertTrue("data should not be a value, they have different index names",
                 tabularType.isValue(data) == false);
   }
View Full Code Here

      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);

      assertTrue("null is not equal to tabular type", tabularType.equals(null) == false);
      assertTrue("object is not a equal to tabular type", tabularType.equals(new Object()) == false);

      TabularType tabularType2 = new TabularType("typeName", "description", rowType, indexNames);
      assertTrue("Should be equal, even though the tabular type is a different instance",
                 tabularType.equals(tabularType2));
      assertTrue("Should be equal, even though the tabular type is a different instance",
                 tabularType2.equals(tabularType));

      tabularType2 = new TabularType("typeName2", "description", rowType, indexNames);
      assertTrue("should not be equal, they have different type names",
                 tabularType.equals(tabularType2) == false);
      assertTrue("should not be equal, they have different type names",
                 tabularType2.equals(tabularType) == false);

      CompositeType rowType2 = new CompositeType("rowTypeName2", "rowDescription",
         itemNames, itemDescriptions, itemTypes);
      tabularType2 = new TabularType("typeName", "description", rowType2, indexNames);
      assertTrue("should not be a equal, they have different row types",
                 tabularType.equals(tabularType2) == false);
      assertTrue("should not be a equal, they have different row types",
                 tabularType2.equals(tabularType) == false);

      String[] indexNames2 = new String[] { "name2", "name1" };
      tabularType2 = new TabularType("typeName", "description", rowType, indexNames2);
      assertTrue("should not be equal, they have different index names",
                 tabularType.equals(tabularType2) == false);
      assertTrue("should not be equal, they have different index names",
                 tabularType2.equals(tabularType) == false);
   }
View Full Code Here

      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);

      int myHashCode = "typeName".hashCode() + rowType.hashCode()
         + "name1".hashCode() + "name2".hashCode();
      assertTrue("Wrong hash code generated", myHashCode == tabularType.hashCode());
   }
View Full Code Here

      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);

      String toString = tabularType.toString();

      assertTrue("toString() should contain the tabular type class name",
         toString.indexOf(TabularType.class.getName()) != -1);
      assertTrue("toString() should contain the type name",
         toString.indexOf("typeName") != -1);
View Full Code Here

      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);

      // Serialize it
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(tabularType);
View Full Code Here

TOP

Related Classes of javax.management.openmbean.TabularType

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.