Package javax.management.openmbean

Examples of javax.management.openmbean.TabularDataSupport


         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      data.putAll((Map) null);
      assertTrue("Put all null is ok", data.isEmpty());

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      HashMap toPut = new HashMap();
      toPut.put(new Object(), compData);
      data.putAll(toPut);
      assertTrue("Put all added one", data.size() == 1);
      assertTrue("Put all added the correct data", data.containsValue(compData));

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      toPut = new HashMap();
      toPut.put(new Object(), compData2);
      toPut.put(new Object(), compData3);
      data.putAll(toPut);
      assertTrue("Put all added two", data.size() == 3);
      assertTrue("Put all added the correct data", data.containsValue(compData2));
      assertTrue("Put all added the correct data", data.containsValue(compData3));
      assertTrue("Put all original data still present", data.containsValue(compData));
   }
View Full Code Here


         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      data.putAll((CompositeData[]) null);
      assertTrue("Put all null is ok", data.isEmpty());

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      CompositeData[] toPut = new CompositeData[] { compData };
      data.putAll(toPut);
      assertTrue("Put all added one", data.size() == 1);
      assertTrue("Put all added the correct data", data.containsValue(compData));

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      toPut = new CompositeData[] { compData2, compData3 };
      data.putAll(toPut);
      assertTrue("Put all added two", data.size() == 3);
      assertTrue("Put all added the correct data", data.containsValue(compData2));
      assertTrue("Put all added the correct data", data.containsValue(compData3));
      assertTrue("Put all original data still present", data.containsValue(compData));
   }
View Full Code Here

         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      data.putAll((CompositeData[]) null);
      assertTrue("Put all null is ok", data.isEmpty());

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      HashMap toPut = new HashMap();
      toPut.put(new Object(), compData);
      toPut.put(new Object(), compData2);
      toPut.put(new Object(), compData3);
      data.putAll(toPut);

      data.clear();
      assertTrue("Clear should clear the data", data.isEmpty());
   }
View Full Code Here

         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      assertTrue("Initial size is zero", data.size() == 0);

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      CompositeData[] toPut = new CompositeData[] { compData };
      data.putAll(toPut);
      assertTrue("Expected one element", data.size() == 1);

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      toPut = new CompositeData[] { compData2, compData3 };
      data.putAll(toPut);
      assertTrue("Expected three elements", data.size() == 3);

      data.remove(new Object[] { "value1", new Integer(4) });
      assertTrue("Expected two elements", data.size() == 2);

      data.clear();
      assertTrue("Expected no elements", data.size() == 0);
   }
View Full Code Here

         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      assertTrue("Initially empty", data.isEmpty());

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      CompositeData[] toPut = new CompositeData[] { compData };
      data.putAll(toPut);
      assertTrue("Not empty after a put", data.isEmpty() == false);

      data.clear();
      assertTrue("Expected no elements", data.isEmpty());
   }
View Full Code Here

         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      data.putAll((CompositeData[]) null);
      assertTrue("Put all null is ok", data.isEmpty());

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      HashMap toPut = new HashMap();
      toPut.put(new Object(), compData);
      toPut.put(new Object(), compData2);
      toPut.put(new Object(), compData3);
      data.putAll(toPut);

      Set keySet = data.keySet();
      assertTrue("Key set should contain 3 elements", keySet.size() == 3);
      assertTrue("Key set should contain index [value1, 2]",
         keySet.contains(Arrays.asList(new Object[] { "value1", new Integer(2) })));
      assertTrue("Key set should contain index [value1, 3]",
         keySet.contains(Arrays.asList(new Object[] { "value1", new Integer(3) })));
View Full Code Here

         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      data.putAll((CompositeData[]) null);
      assertTrue("Put all null is ok", data.isEmpty());

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      HashMap toPut = new HashMap();
      toPut.put(new Object(), compData);
      toPut.put(new Object(), compData2);
      toPut.put(new Object(), compData3);
      data.putAll(toPut);

      Collection values = data.values();
      assertTrue("Values should contain 3 elements", values.size() == 3);
      assertTrue("Values should contain index compData", values.contains(compData));
      assertTrue("Values should contain index compData2", values.contains(compData2));
      assertTrue("Values should contain index compData3", values.contains(compData3));
   }
View Full Code Here

         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      data.putAll((CompositeData[]) null);
      assertTrue("Put all null is ok", data.isEmpty());

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      HashMap toPut = new HashMap();
      toPut.put(new Object(), compData);
      toPut.put(new Object(), compData2);
      toPut.put(new Object(), compData3);
      data.putAll(toPut);

      TabularDataSupport clone = (TabularDataSupport) data.clone();
      assertTrue("Clone should have the same tabular type", data.getTabularType().equals(clone.getTabularType()));
      assertTrue("Clone should have the same number of elements", data.size() == clone.size());
      CompositeData compDataClone = clone.get(new Object[] {"value1", new Integer(2) });
      assertTrue("Should be a shallow clone", compData == compDataClone);
   }
View Full Code Here

         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      assertTrue("Null should not be equal", data.equals(null) == false);
      assertTrue("Only TabularData should be equal", data.equals(new Object()) == false);

      assertTrue("An instance should equal itself", data.equals(data));

      TabularDataSupport data2 = new TabularDataSupport(tabularType);

      assertTrue("Two different instances with the same tabular type are equal", data.equals(data2));
      assertTrue("Two different instances with the same tabular type are equal", data2.equals(data));

      TabularType tabularType2 = new TabularType("typeName2", "description", rowType, indexNames);
      data2 = new TabularDataSupport(tabularType2);

      assertTrue("Instances with different tabular type are not equal", data.equals(data2) == false);
      assertTrue("Instances with different tabular type are not equal", data2.equals(data) == false);

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      HashMap toPut = new HashMap();
      toPut.put(new Object(), compData);
      toPut.put(new Object(), compData2);
      toPut.put(new Object(), compData3);

      data.putAll(toPut);
      data2 = new TabularDataSupport(tabularType);
      data2.putAll(toPut);
      assertTrue("Instances with the same composite data are equal", data.equals(data2));
      assertTrue("Instances with the same composite data are equal", data2.equals(data));

      toPut = new HashMap();
      toPut.put(new Object(), compData);
      toPut.put(new Object(), compData2);
      data2 = new TabularDataSupport(tabularType);
      data2.putAll(toPut);
      assertTrue("Instances with different composite data are not equal", data.equals(data2) == false);
      assertTrue("Instances with different composite data are not equal", data2.equals(data) == false);
   }
View Full Code Here

         itemNames, itemDescriptions, itemTypes);

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

      TabularDataSupport data = new TabularDataSupport(tabularType);

      data.putAll((CompositeData[]) null);
      assertTrue("Put all null is ok", data.isEmpty());

      HashMap map = new HashMap();
      map.put("name1", "value1");
      map.put("name2", new Integer(2));
      CompositeDataSupport compData = new CompositeDataSupport(rowType, map);

      HashMap map2 = new HashMap();
      map2.put("name1", "value1");
      map2.put("name2", new Integer(3));
      CompositeDataSupport compData2 = new CompositeDataSupport(rowType, map2);

      HashMap map3 = new HashMap();
      map3.put("name1", "value1");
      map3.put("name2", new Integer(4));
      CompositeDataSupport compData3 = new CompositeDataSupport(rowType, map3);

      HashMap toPut = new HashMap();
      toPut.put(new Object(), compData);
      toPut.put(new Object(), compData2);
      toPut.put(new Object(), compData3);
      data.putAll(toPut);

      int myHashCode = tabularType.hashCode() + compData.hashCode() + compData2.hashCode() + compData3.hashCode();
      assertTrue("Wrong hash code generated", myHashCode == data.hashCode());
   }
View Full Code Here

TOP

Related Classes of javax.management.openmbean.TabularDataSupport

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.