javax.management.openmbean.SimpleType Java Examples

The following examples show how to use javax.management.openmbean.SimpleType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpAdaptor.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public TestClass(String str, URL url)
{
   this.str = str;
   this.url = url;
   list.add("a");
   list.add("b");
   list.add("c");
   map.put("1", "a");
   map.put("2", "b");
   map.put("3", "c");
   try
   {
      CompositeType type = new CompositeType("My type",
                                             "My type",
                                             new String[]{"item1", "item2"},
                                             new String[]{"item1", "item2"},
                                             new OpenType[]{SimpleType.STRING, SimpleType.STRING});
      compositeData = new CompositeDataSupport(type, new String[]{"item1", "item2"}, new Object[]{"item value 1", "item value 2"});
   }
   catch (OpenDataException e)
   {
      e.printStackTrace();
   }

}
 
Example #2
Source File: ExpressionTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testByteArrayObject() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.BYTES);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, ArrayType.getPrimitiveArrayType(byte[].class));

    ModelNode node = new ModelNode();
    node.get("one").set(new byte[] {1,2});
    node.get("two").set(new byte[] {3,4});

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertTrue(Arrays.equals(new byte[] {1,2}, (byte[])tabularData.get(new Object[] {"one"}).get("value")));
    Assert.assertTrue(Arrays.equals(new byte[] {3,4}, (byte[])tabularData.get(new Object[] {"two"}).get("value")));

    //Allow plain map as well? Yeah why not!
    Map<String, byte[]> map = new HashMap<String, byte[]>();
    map.put("one", new byte[] {1,2});
    map.put("two", new byte[] {3,4});
    Assert.assertEquals(node, converter.toModelNode(map));
}
 
Example #3
Source File: JmxValueFunctionsTest.java    From brooklyn-server with Apache License 2.0 6 votes vote down vote up
@Test
public void testCompositeDataToMap() throws Exception {
    CompositeType compositeType = new CompositeType(
            "MyCompositeType", 
            "my composite descr", 
            new String[] {"key1", "key2"}, 
            new String[] {"key1 descr", "key2 descr"}, 
            new OpenType[] {SimpleType.STRING, SimpleType.STRING});
    Map<String, ?> items = ImmutableMap.of(
            "key1", "val1",
            "key2", "val2");
    CompositeData data = new CompositeDataSupport(compositeType, items);
    
    Map<String,?> result = JmxValueFunctions.compositeDataToMap(data);
    assertEquals(result, items);
    
    Map<?,?> result2 = JmxValueFunctions.compositeDataToMap().apply(data);
    assertEquals(result2, items);
}
 
Example #4
Source File: LegacyTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testSimpleTypeObjectExpressions() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    description.get(EXPRESSIONS_ALLOWED).set(true);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);

    ModelNode node = new ModelNode();
    node.get("one").set(new ValueExpression("${this.should.not.exist.!!!!!:1}"));
    node.get("two").set(new ValueExpression("${this.should.not.exist.!!!!!:2}"));

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertEquals((long) 1, tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertEquals((long) 2, tabularData.get(new Object[] {"two"}).get("value"));
}
 
Example #5
Source File: LegacyTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testSimpleTypeObjectEmpty() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);

    ModelNode node = new ModelNode();
    node.get("one").set("");
    node.get("two").set("");

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertNull(tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertNull(tabularData.get(new Object[] {"two"}).get("value"));

    ModelNode expected = new ModelNode();
    expected.get("one");
    expected.get("two");

    Assert.assertEquals(expected, converter.toModelNode(tabularData));
}
 
Example #6
Source File: GcInfoCompositeData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static synchronized OpenType[] getBaseGcInfoItemTypes() {
    if (baseGcInfoItemTypes == null) {
        OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
        baseGcInfoItemTypes = new OpenType<?>[] {
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,

            memoryUsageOpenType,
            memoryUsageOpenType,
        };
    }
    return baseGcInfoItemTypes;
}
 
Example #7
Source File: StreamServiceTest.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
private CompositeType streamStateType_2_1_20() throws OpenDataException {
  String typeName = "org.apache.cassandra.streaming.StreamState";
  String description = "StreamState";
  String[] itemNames = {
      "currentRxBytes",
      "currentTxBytes",
      "description",
      "planId",
      "rxPercentage",
      "sessions",
      "totalRxBytes",
      "totalTxBytes",
      "txPercentage"
  };
  String[] itemDescriptions = {
      "currentRxBytes",
      "currentTxBytes",
      "description",
      "planId",
      "rxPercentage",
      "sessions",
      "totalRxBytes",
      "totalTxBytes",
      "txPercentage"
  };

  OpenType[] itemTypes = {
      SimpleType.LONG,
      SimpleType.LONG,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.DOUBLE,
      ArrayType.getArrayType(makeSessionsTypePost2_1()),
      SimpleType.LONG,
      SimpleType.LONG,
      SimpleType.DOUBLE
  };

  return new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes);
}
 
Example #8
Source File: MerlinMXBean.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static ArrayType make(SimpleType baseType, boolean primitiveArray) {
    try {
        return new ArrayType(baseType, primitiveArray);
    } catch (OpenDataException e) {
        throw new Error(e);
    }
}
 
Example #9
Source File: TypeConverters.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Object[] toArray(List<Object> list) {
    if (getOpenType() == SimpleType.STRING) {
        return list.toArray(new String[list.size()]);
    }
    return list.toArray(new Object[list.size()]);
}
 
Example #10
Source File: GcInfoCompositeData.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static synchronized OpenType[] getBaseGcInfoItemTypes() {
    if (baseGcInfoItemTypes == null) {
        OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
        baseGcInfoItemTypes = new OpenType<?>[] {
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,

            memoryUsageOpenType,
            memoryUsageOpenType,
        };
    }
    return baseGcInfoItemTypes;
}
 
Example #11
Source File: StreamServiceTest.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
private CompositeType streamStateType_4_0_0() throws OpenDataException {
  String typeName = "org.apache.cassandra.streaming.StreamState";
  String description = "StreamState";
  String[] itemNames = {
      "currentRxBytes",
      "currentTxBytes",
      "description",
      "planId",
      "rxPercentage",
      "sessions",
      "totalRxBytes",
      "totalTxBytes",
      "txPercentage"
  };
  String[] itemDescriptions = {
      "currentRxBytes",
      "currentTxBytes",
      "description",
      "planId",
      "rxPercentage",
      "sessions",
      "totalRxBytes",
      "totalTxBytes",
      "txPercentage"
  };
  OpenType[] itemTypes = {
      SimpleType.LONG,
      SimpleType.LONG,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.DOUBLE,
      ArrayType.getArrayType(makeSessionsType4_0()),
      SimpleType.LONG,
      SimpleType.LONG,
      SimpleType.DOUBLE
  };

  return new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes);
}
 
Example #12
Source File: ExpressionTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testLongEmptyConverter() {
    ModelNode description = createDescription(ModelType.LONG);
    TypeConverter converter = getConverter(description);
    Assert.assertEquals(SimpleType.STRING, converter.getOpenType());
    Assert.assertNull(converter.fromModelNode(new ModelNode().set("")));
}
 
Example #13
Source File: ExpressionTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testSimpleTypeList() throws Exception {
    ModelNode description = createDescription(ModelType.LIST, ModelType.INT);
    TypeConverter converter = getConverter(description);
    Assert.assertEquals(ArrayType.getArrayType(SimpleType.STRING), converter.getOpenType());
    ModelNode node = new ModelNode();
    node.add(1);
    node.add(2);
    Assert.assertTrue(Arrays.equals(new String[] {"1", "2"} ,assertCast(String[].class, converter.fromModelNode(node))));
    Assert.assertEquals(node, converter.toModelNode(new String[] {"1", "2"}));
}
 
Example #14
Source File: MXBeanTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void testMXBean(MBeanServer mbs, ObjectName on)
        throws Exception {
    MBeanInfo mbi = mbs.getMBeanInfo(on);
    MBeanAttributeInfo[] attrs = mbi.getAttributes();
    int nattrs = attrs.length;
    if (mbi.getAttributes().length != 1)
        failure("wrong number of attributes: " + attrs);
    else {
        MBeanAttributeInfo mbai = attrs[0];
        if (mbai.getName().equals("Ints")
            && mbai.isReadable() && !mbai.isWritable()
            && mbai.getDescriptor().getFieldValue("openType")
                .equals(new ArrayType<int[]>(SimpleType.INTEGER, true))
            && attrs[0].getType().equals("[I"))
            success("MBeanAttributeInfo");
        else
            failure("MBeanAttributeInfo: " + mbai);
    }

    int[] ints = (int[]) mbs.getAttribute(on, "Ints");
    if (equal(ints, new int[] {1, 2, 3}, null))
        success("getAttribute");
    else
        failure("getAttribute: " + Arrays.toString(ints));

    ExplicitMXBean proxy =
        JMX.newMXBeanProxy(mbs, on, ExplicitMXBean.class);
    int[] pints = proxy.getInts();
    if (equal(pints, new int[] {1, 2, 3}, null))
        success("getAttribute through proxy");
    else
        failure("getAttribute through proxy: " + Arrays.toString(pints));
}
 
Example #15
Source File: LegacyTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testLongEmptyConverter() {
    ModelNode description = createDescription(ModelType.LONG);
    TypeConverter converter = getConverter(description);
    Assert.assertEquals(SimpleType.LONG, converter.getOpenType());
    Assert.assertNull(converter.fromModelNode(new ModelNode().set("")));
}
 
Example #16
Source File: JMXUtils.java    From alfresco-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static OpenType<?> getOpenType(Object o)
{
    if(o instanceof Long)
    {
        return SimpleType.LONG;
    }
    else if(o instanceof String)
    {
        return SimpleType.STRING;
    }
    else if(o instanceof Date)
    {
        return SimpleType.DATE;
    }
    else if(o instanceof Integer)
    {
        return SimpleType.INTEGER;
    }
    else if(o instanceof Boolean)
    {
        return SimpleType.BOOLEAN;
    }
    else if(o instanceof Double)
    {
        return SimpleType.DOUBLE;
    }
    else if(o instanceof Float)
    {
        return SimpleType.FLOAT;
    }
    else
    {
        throw new IllegalArgumentException();
    }
}
 
Example #17
Source File: GcInfoCompositeData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static synchronized OpenType[] getBaseGcInfoItemTypes() {
    if (baseGcInfoItemTypes == null) {
        OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
        baseGcInfoItemTypes = new OpenType<?>[] {
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,

            memoryUsageOpenType,
            memoryUsageOpenType,
        };
    }
    return baseGcInfoItemTypes;
}
 
Example #18
Source File: MerlinMXBean.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static ArrayType make(SimpleType baseType, boolean primitiveArray) {
    try {
        return new ArrayType(baseType, primitiveArray);
    } catch (OpenDataException e) {
        throw new Error(e);
    }
}
 
Example #19
Source File: SimpleRouter.java    From tomee with Apache License 2.0 5 votes vote down vote up
@ManagedAttribute
public TabularData getActiveRoutes() {
    if (routes.length == 0) {
        return null;
    }

    final OpenType<?>[] types = new OpenType<?>[routes.length];
    final String[] keys = new String[types.length];
    final String[] values = new String[types.length];

    for (int i = 0; i < types.length; i++) {
        types[i] = SimpleType.STRING;
        keys[i] = routes[i].getOrigin().substring(prefix.length());
        values[i] = routes[i].getRawDestination().substring(prefix.length());
    }

    try {
        final CompositeType ct = new CompositeType("routes", "routes", keys, keys, types);
        final TabularType type = new TabularType("router", "routes", ct, keys);
        final TabularDataSupport data = new TabularDataSupport(type);

        final CompositeData line = new CompositeDataSupport(ct, keys, values);
        data.put(line);
        return data;
    } catch (final OpenDataException e) {
        return null;
    }
}
 
Example #20
Source File: MXBeanTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void testMXBean(MBeanServer mbs, ObjectName on)
        throws Exception {
    MBeanInfo mbi = mbs.getMBeanInfo(on);
    MBeanAttributeInfo[] attrs = mbi.getAttributes();
    int nattrs = attrs.length;
    if (mbi.getAttributes().length != 1)
        failure("wrong number of attributes: " + attrs);
    else {
        MBeanAttributeInfo mbai = attrs[0];
        if (mbai.getName().equals("Ints")
            && mbai.isReadable() && !mbai.isWritable()
            && mbai.getDescriptor().getFieldValue("openType")
                .equals(new ArrayType<int[]>(SimpleType.INTEGER, true))
            && attrs[0].getType().equals("[I"))
            success("MBeanAttributeInfo");
        else
            failure("MBeanAttributeInfo: " + mbai);
    }

    int[] ints = (int[]) mbs.getAttribute(on, "Ints");
    if (equal(ints, new int[] {1, 2, 3}, null))
        success("getAttribute");
    else
        failure("getAttribute: " + Arrays.toString(ints));

    ExplicitMXBean proxy =
        JMX.newMXBeanProxy(mbs, on, ExplicitMXBean.class);
    int[] pints = proxy.getInts();
    if (equal(pints, new int[] {1, 2, 3}, null))
        success("getAttribute through proxy");
    else
        failure("getAttribute through proxy: " + Arrays.toString(pints));
}
 
Example #21
Source File: GcInfoCompositeData.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
static synchronized OpenType[] getBaseGcInfoItemTypes() {
    if (baseGcInfoItemTypes == null) {
        OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
        baseGcInfoItemTypes = new OpenType<?>[] {
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,

            memoryUsageOpenType,
            memoryUsageOpenType,
        };
    }
    return baseGcInfoItemTypes;
}
 
Example #22
Source File: GcInfoCompositeData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static synchronized OpenType[] getBaseGcInfoItemTypes() {
    if (baseGcInfoItemTypes == null) {
        OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
        baseGcInfoItemTypes = new OpenType<?>[] {
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,
            SimpleType.LONG,

            memoryUsageOpenType,
            memoryUsageOpenType,
        };
    }
    return baseGcInfoItemTypes;
}
 
Example #23
Source File: StreamServiceTest.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
private CompositeType streamStateType_2_0_17() throws OpenDataException {
  String typeName = "org.apache.cassandra.streaming.StreamState";
  String description = "StreamState";
  String[] itemNames = {
      "currentRxBytes",
      "currentTxBytes",
      "description",
      "planId",
      "rxPercentage",
      "sessions",
      "totalRxBytes",
      "totalTxBytes",
      "txPercentage"
  };
  String[] itemDescriptions = {
      "currentRxBytes",
      "currentTxBytes",
      "description",
      "planId",
      "rxPercentage",
      "sessions",
      "totalRxBytes",
      "totalTxBytes",
      "txPercentage"
  };
  OpenType[] itemTypes = {
      SimpleType.LONG,
      SimpleType.LONG,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.DOUBLE,
      ArrayType.getArrayType(makeSessionsTypePre2_1()),
      SimpleType.LONG,
      SimpleType.LONG,
      SimpleType.DOUBLE
  };

  return new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes);
}
 
Example #24
Source File: MerlinMXBean.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static ArrayType make(SimpleType baseType, boolean primitiveArray) {
    try {
        return new ArrayType(baseType, primitiveArray);
    } catch (OpenDataException e) {
        throw new Error(e);
    }
}
 
Example #25
Source File: StreamServiceTest.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
private CompositeType makeSessionsTypePost2_1() throws OpenDataException {
  String typeName = "org.apache.cassandra.streaming.SessionInfo";
  String description = "SessionInfo";
  String[] itemNames = {
      "connecting",
      "peer",
      "planId",
      "receivingFiles",
      "receivingSummaries",
      "sendingFiles",
      "sendingSummaries",
      "sessionIndex",
      "state"
  };
  String[] itemDescriptions = {
      "connecting",
      "peer",
      "planId",
      "receivingFiles",
      "receivingSummaries",
      "sendingFiles",
      "sendingSummaries",
      "sessionIndex",
      "state"
  };
  OpenType[] itemTypes = {
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.STRING,
      ArrayType.getArrayType(makeFilesType_2_1_20()),
      ArrayType.getArrayType(makeSummariesType_pre_4_0()),
      ArrayType.getArrayType(makeFilesType_2_1_20()),
      ArrayType.getArrayType(makeSummariesType_pre_4_0()),
      SimpleType.INTEGER,
      SimpleType.STRING,
  };

  return new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes);

}
 
Example #26
Source File: OpenTypeSupport.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected <T> TabularType createTabularType(Class<T> type, OpenType openType) throws OpenDataException {
   String typeName = "java.util.Map<java.lang.String, " + type.getName() + ">";
   String[] keyValue = new String[]{"key", "value"};
   OpenType[] openTypes = new OpenType[]{SimpleType.STRING, openType};
   CompositeType rowType = new CompositeType(typeName, typeName, keyValue, keyValue, openTypes);
   return new TabularType(typeName, typeName, rowType, new String[]{"key"});
}
 
Example #27
Source File: MerlinMXBean.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static ArrayType make(SimpleType baseType, boolean primitiveArray) {
    try {
        return new ArrayType(baseType, primitiveArray);
    } catch (OpenDataException e) {
        throw new Error(e);
    }
}
 
Example #28
Source File: MXBeanTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testMXBean(MBeanServer mbs, ObjectName on)
        throws Exception {
    MBeanInfo mbi = mbs.getMBeanInfo(on);
    MBeanAttributeInfo[] attrs = mbi.getAttributes();
    int nattrs = attrs.length;
    if (mbi.getAttributes().length != 1)
        failure("wrong number of attributes: " + attrs);
    else {
        MBeanAttributeInfo mbai = attrs[0];
        if (mbai.getName().equals("Ints")
            && mbai.isReadable() && !mbai.isWritable()
            && mbai.getDescriptor().getFieldValue("openType")
                .equals(new ArrayType<int[]>(SimpleType.INTEGER, true))
            && attrs[0].getType().equals("[I"))
            success("MBeanAttributeInfo");
        else
            failure("MBeanAttributeInfo: " + mbai);
    }

    int[] ints = (int[]) mbs.getAttribute(on, "Ints");
    if (equal(ints, new int[] {1, 2, 3}, null))
        success("getAttribute");
    else
        failure("getAttribute: " + Arrays.toString(ints));

    ExplicitMXBean proxy =
        JMX.newMXBeanProxy(mbs, on, ExplicitMXBean.class);
    int[] pints = proxy.getInts();
    if (equal(pints, new int[] {1, 2, 3}, null))
        success("getAttribute through proxy");
    else
        failure("getAttribute through proxy: " + Arrays.toString(pints));
}
 
Example #29
Source File: JmxValueFunctionsTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@Test
public void testTabularDataToMapOfMaps() throws Exception {
    CompositeType rowType = new CompositeType(
            "MyRowType", 
            "my row descr", 
            new String[] {"key1", "key2"}, 
            new String[] {"key1 descr", "key2 descr"}, 
            new OpenType[] {SimpleType.STRING, SimpleType.STRING});
    TabularType tabularType = new TabularType(
            "MyTabularType", 
            "my table descr", 
            rowType,
            new String[] {"key1"});
    Map<String, ?> row1 = ImmutableMap.of(
            "key1", "row1.val1",
            "key2", "row1.val2");
    Map<String, ?> row2 = ImmutableMap.of(
            "key1", "row2.val1",
            "key2", "row2.val2");
    TabularDataSupport table = new TabularDataSupport(tabularType);
    table.put(new CompositeDataSupport(rowType, row1));
    table.put(new CompositeDataSupport(rowType, row2));
    
    Map<List<?>, Map<String, Object>> result = JmxValueFunctions.tabularDataToMapOfMaps(table);
    assertEquals(result, ImmutableMap.of(ImmutableList.of("row1.val1"), row1, ImmutableList.of("row2.val1"), row2));
    
    Map<?,?> result2 = JmxValueFunctions.tabularDataToMapOfMaps().apply(table);
    assertEquals(result2, ImmutableMap.of(ImmutableList.of("row1.val1"), row1, ImmutableList.of("row2.val1"), row2));
}
 
Example #30
Source File: StreamServiceTest.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
private CompositeType makeFilesType_4_0_0() throws OpenDataException {
  String typeName = "org.apache.cassandra.streaming.ProgressInfo";
  String description = "ProgressInfo";
  String[] itemNames = {
      "currentBytes",
      "direction",
      "fileName",
      "peer",
      "peer storage port",
      "planId",
      "sessionIndex",
      "totalBytes"
  };
  String[] itemDescriptions = {
      "currentBytes",
      "direction",
      "fileName",
      "peer",
      "peer storage port",
      "planId",
      "sessionIndex",
      "totalBytes"
  };
  OpenType[] itemTypes = {
      SimpleType.LONG,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.STRING,
      SimpleType.INTEGER,
      SimpleType.STRING,
      SimpleType.INTEGER,
      SimpleType.LONG,
  };

  return new CompositeType(typeName, description, itemNames, itemDescriptions, itemTypes);
}