javax.management.openmbean.TabularData#get ( )源码实例Demo

下面列出了javax.management.openmbean.TabularData#get ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码2 项目: TencentKona-8   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码3 项目: jdk8u60   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码4 项目: openjdk-jdk8u   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码6 项目: openjdk-jdk9   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码7 项目: incubator-batchee   文件: JMXTest.java
@Test
public void stepExecutions() throws Exception {
    final TabularData instance = TabularData.class.cast(result("getStepExecutions", id));
    assertEquals(1, instance.size());

    final CompositeData cd = instance.get(List.class.cast(instance.keySet().iterator().next()).toArray());
    assertEquals(id, cd.get("stepExecutionId"));
    assertEquals("jmx-step", cd.get("stepName"));
    assertEquals("mock", cd.get("Exit status"));
    assertEquals("COMPLETED", cd.get("Batch status"));
    assertEquals(0L, cd.get("Commit"));
}
 
源代码8 项目: incubator-batchee   文件: JMXTest.java
@Test
public void jobExecution() throws Exception {
    final TabularData instance = TabularData.class.cast(result("getJobExecution", id));
    assertEquals(1, instance.size());

    final CompositeData cd = instance.get(List.class.cast(instance.keySet().iterator().next()).toArray());
    assertEquals(id, cd.get("executionId"));
    assertEquals("jmx", cd.get("jobName"));
    assertEquals("COMPLETED", cd.get("Exit status"));
    assertEquals("COMPLETED", cd.get("Batch status"));
}
 
源代码9 项目: openjdk-8-source   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码10 项目: openjdk-8   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码11 项目: jdk8u_jdk   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码12 项目: jdk8u-jdk   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
源代码13 项目: jdk8u-dev-jdk   文件: ValidateOpenTypes.java
private static String getProperty(TabularData td, String propName) {
    CompositeData cd = td.get(new Object[] { propName});
    if (cd != null) {
        String key = (String) cd.get("key");
        if (!propName.equals(key)) {
             throw new RuntimeException("TEST FAILED: " +
                 key + " property found" +
                 " but expected to be " + propName);
        }
        return (String) cd.get("value");
    }
    return null;
}
 
@Test
public void properlyAggregateMapsByKeyAccordingToTheirValueAggregationPolicy() throws Exception {
	Map<String, Integer> map_1 = new HashMap<>();
	map_1.put("a", 1);
	map_1.put("b", 2);
	map_1.put("c", 100);

	Map<String, Integer> map_2 = new HashMap<>();
	map_2.put("b", 2);
	map_2.put("c", 200);
	map_2.put("d", 5);

	MBeanWithMap mBeanWithMap_1 = new MBeanWithMap(map_1);
	MBeanWithMap mBeanWithMap_2 = new MBeanWithMap(map_2);

	DynamicMBean mbean = createDynamicMBeanFor(mBeanWithMap_1, mBeanWithMap_2);

	TabularData tabularData = (TabularData) mbean.getAttribute("nameToNumber");

	assertEquals(4, tabularData.size());

	CompositeData row_1 = tabularData.get(keyForTabularData("a"));
	assertEquals(1, row_1.get("value"));

	CompositeData row_2 = tabularData.get(keyForTabularData("b"));
	assertEquals(2, row_2.get("value"));

	CompositeData row_3 = tabularData.get(keyForTabularData("c"));
	assertNull(row_3.get("value"));

	CompositeData row_4 = tabularData.get(keyForTabularData("d"));
	assertEquals(5, row_4.get("value"));
}
 
源代码15 项目: brooklyn-server   文件: JmxValueFunctions.java
public static Map<List<?>, Map<String, Object>> tabularDataToMapOfMaps(TabularData table) {
    Map<List<?>, Map<String, Object>> result = Maps.newLinkedHashMap();
    for (Object k : table.keySet()) {
        final Object[] kValues = ((List<?>)k).toArray();
        CompositeData v = table.get(kValues);
        result.put((List<?>)k, compositeDataToMap(v));
    }
    return result;
}
 
源代码16 项目: glowroot   文件: LiveJvmServiceImpl.java
private static MBeanDump.MBeanValue getTabularDataValue(TabularData tabularData) {
    // linked hash map used to preserve row ordering
    List<MBeanDump.MBeanValueMapEntry> outerEntries = Lists.newArrayList();
    Set<String> attributeNames = tabularData.getTabularType().getRowType().keySet();
    for (Object key : tabularData.keySet()) {
        // TabularData.keySet() returns "Set<List<?>> but is declared Set<?> for
        // compatibility reasons" (see javadocs) so safe to cast to List<?>
        List<?> keyList = (List<?>) key;
        @SuppressWarnings("argument.type.incompatible")
        String keyString = Joiner.on(", ").join(keyList);
        @SuppressWarnings("argument.type.incompatible")
        CompositeData compositeData = tabularData.get(keyList.toArray());
        // linked hash map used to preserve attribute ordering
        List<MBeanDump.MBeanValueMapEntry> innerEntries = Lists.newArrayList();
        for (String attributeName : attributeNames) {
            innerEntries.add(MBeanDump.MBeanValueMapEntry.newBuilder()
                    .setKey(attributeName)
                    .setValue(getMBeanAttributeValue(compositeData.get(attributeName)))
                    .build());
        }
        outerEntries.add(MBeanDump.MBeanValueMapEntry.newBuilder()
                .setKey(keyString)
                .setValue(MBeanDump.MBeanValue.newBuilder()
                        .setMap(MBeanDump.MBeanValueMap.newBuilder()
                                .addAllEntry(innerEntries))
                        .build())
                .build());
    }
    return MBeanDump.MBeanValue.newBuilder()
            .setMap(MBeanDump.MBeanValueMap.newBuilder()
                    .addAllEntry(outerEntries))
            .build();
}
 
源代码17 项目: incubator-batchee   文件: JMXTest.java
@Test
public void jobInstances() throws Exception {
    final TabularData instance = TabularData.class.cast(result("getJobInstances", "jmx", 0, 1));
    assertEquals(1, instance.size());

    final CompositeData cd = instance.get(new Object[]{"jmx", id});
    assertEquals(id, cd.get("instanceId"));
    assertEquals("jmx", cd.get("jobName"));
}
 
源代码18 项目: incubator-batchee   文件: JMXTest.java
@Test
public void parameters() throws Exception {
    final TabularData instance = TabularData.class.cast(result("getParameters", id));
    assertEquals(1, instance.size());

    final CompositeData cd = instance.get(List.class.cast(instance.keySet().iterator().next()).toArray());
    assertEquals("foo", cd.get("key"));
    assertEquals("bar", cd.get("value"));
}
 
源代码19 项目: incubator-batchee   文件: JMXTest.java
@Test
public void jobInstance() throws Exception {
    final TabularData instance = TabularData.class.cast(result("getJobInstance", id));
    assertEquals(1, instance.size());

    final CompositeData cd = instance.get(new Object[]{"jmx", id});
    assertEquals(id, cd.get("instanceId"));
    assertEquals("jmx", cd.get("jobName"));
}
 
源代码20 项目: incubator-batchee   文件: JMXTest.java
@Test
public void jobExecutions() throws Exception {
    final TabularData instance = TabularData.class.cast(result("getJobExecutions", id, "jmx"));
    assertEquals(1, instance.size());

    final CompositeData cd = instance.get(List.class.cast(instance.keySet().iterator().next()).toArray());
    assertEquals(id, cd.get("executionId"));
    assertEquals("jmx", cd.get("jobName"));
    assertEquals("COMPLETED", cd.get("Exit status"));
    assertEquals("COMPLETED", cd.get("Batch status"));
}