Java Code Examples for javax.management.openmbean.TabularData#get()
The following examples show how to use
javax.management.openmbean.TabularData#get() .
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: ValidateOpenTypes.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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; }
Example 2
Source File: JMXTest.java From incubator-batchee with Apache License 2.0 | 5 votes |
@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")); }
Example 3
Source File: JMXTest.java From incubator-batchee with Apache License 2.0 | 5 votes |
@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")); }
Example 4
Source File: JMXTest.java From incubator-batchee with Apache License 2.0 | 5 votes |
@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")); }
Example 5
Source File: JMXTest.java From incubator-batchee with Apache License 2.0 | 5 votes |
@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")); }
Example 6
Source File: LiveJvmServiceImpl.java From glowroot with Apache License 2.0 | 5 votes |
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(); }
Example 7
Source File: JmxValueFunctions.java From brooklyn-server with Apache License 2.0 | 5 votes |
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; }
Example 8
Source File: DynamicMBeanFactoryAttributesTest.java From datakernel with Apache License 2.0 | 5 votes |
@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")); }
Example 9
Source File: ValidateOpenTypes.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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; }
Example 10
Source File: ValidateOpenTypes.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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; }
Example 11
Source File: ValidateOpenTypes.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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; }
Example 12
Source File: ValidateOpenTypes.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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; }
Example 13
Source File: ValidateOpenTypes.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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; }
Example 14
Source File: JMXTest.java From incubator-batchee with Apache License 2.0 | 5 votes |
@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")); }
Example 15
Source File: JMXTest.java From incubator-batchee with Apache License 2.0 | 5 votes |
@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")); }
Example 16
Source File: ValidateOpenTypes.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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; }
Example 17
Source File: ValidateOpenTypes.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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; }
Example 18
Source File: ValidateOpenTypes.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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; }
Example 19
Source File: ValidateOpenTypes.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; }
Example 20
Source File: ValidateOpenTypes.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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; }