javax.management.openmbean.TabularDataSupport Java Examples
The following examples show how to use
javax.management.openmbean.TabularDataSupport.
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: DynamicMBeanWrapper.java From deltaspike with Apache License 2.0 | 6 votes |
private TabularData toTabularData(final String typeName, final String description, final Table table) { final OpenType<?>[] types = new OpenType<?>[table.getColumnNames().size()]; for (int i = 0; i < types.length; i++) { types[i] = SimpleType.STRING; } try { final String[] keys = table.getColumnNames().toArray(new String[table.getColumnNames().size()]); final CompositeType ct = new CompositeType( typeName, description, keys, keys, types); final TabularType type = new TabularType(typeName, description, ct, keys); final TabularDataSupport data = new TabularDataSupport(type); for (final Collection<String> line : table.getLines()) { data.put(new CompositeDataSupport(ct, keys, line.toArray(new Object[line.size()]))); } return data; } catch (final OpenDataException e) { throw new IllegalArgumentException(e); } }
Example #2
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ @Test public void testCachesView() throws Exception { Set<String> cacheNames = new HashSet<>(Arrays.asList("cache-1", "cache-2")); for (String name : cacheNames) ignite.createCache(name); TabularDataSupport data = systemView(CACHES_VIEW); assertEquals(ignite.context().cache().cacheDescriptors().size(), data.size()); for (int i = 0; i < data.size(); i++) { CompositeData row = data.get(new Object[] {i}); cacheNames.remove(row.get("cacheName")); } assertTrue(cacheNames.toString(), cacheNames.isEmpty()); }
Example #3
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ @Test public void testCacheGroupsView() throws Exception { Set<String> grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2")); for (String grpName : grpNames) ignite.createCache(new CacheConfiguration<>("cache-" + grpName).setGroupName(grpName)); TabularDataSupport grps = systemView(CACHE_GRPS_VIEW); assertEquals(ignite.context().cache().cacheGroupDescriptors().size(), grps.size()); for (Map.Entry entry : grps.entrySet()) { CompositeData row = (CompositeData)entry.getValue(); grpNames.remove(row.get("cacheGroupName")); } assertTrue(grpNames.toString(), grpNames.isEmpty()); }
Example #4
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ @Test public void testServices() throws Exception { ServiceConfiguration srvcCfg = new ServiceConfiguration(); srvcCfg.setName("service"); srvcCfg.setMaxPerNodeCount(1); srvcCfg.setService(new DummyService()); ignite.services().deploy(srvcCfg); TabularDataSupport srvs = systemView(SVCS_VIEW); assertEquals(ignite.context().service().serviceDescriptors().size(), srvs.size()); CompositeData sysView = srvs.get(new Object[] {0}); assertEquals(srvcCfg.getName(), sysView.get("name")); assertEquals(srvcCfg.getMaxPerNodeCount(), sysView.get("maxPerNodeCount")); assertEquals(DummyService.class.getName(), sysView.get("serviceClass")); }
Example #5
Source File: LocalMBeanServer.java From tomee with Apache License 2.0 | 6 votes |
public static TabularData tabularData(final String typeName, final String typeDescription, final String[] names, final Object[] values) { if (names.length == 0) { return null; } final OpenType<?>[] types = new OpenType<?>[names.length]; for (int i = 0; i < types.length; i++) { types[i] = SimpleType.STRING; } try { final CompositeType ct = new CompositeType(typeName, typeDescription, names, names, types); final TabularType type = new TabularType(typeName, typeDescription, ct, names); final TabularDataSupport data = new TabularDataSupport(type); final CompositeData line = new CompositeDataSupport(ct, names, values); data.put(line); return data; } catch (final OpenDataException e) { return null; } }
Example #6
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ private void checkContinuousQueryView(IgniteEx origNode, IgniteEx checkNode) { TabularDataSupport qrys = systemView(checkNode, CQ_SYS_VIEW); assertEquals(1, qrys.size()); for (int i = 0; i < qrys.size(); i++) { CompositeData cq = qrys.get(new Object[] {i}); assertEquals("cache-1", cq.get("cacheName")); assertEquals(100, cq.get("bufferSize")); assertEquals(1000L, cq.get("interval")); assertEquals(origNode.localNode().id().toString(), cq.get("nodeId")); if (origNode.localNode().id().equals(checkNode.localNode().id())) assertTrue(cq.get("localListener").toString().startsWith(getClass().getName())); else assertNull(cq.get("localListener")); assertTrue(cq.get("remoteFilter").toString().startsWith(getClass().getName())); assertNull(cq.get("localTransformedListener")); assertNull(cq.get("remoteTransformer")); } }
Example #7
Source File: BatchEEMBeanImpl.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Override public TabularData getStepExecutions(final long jobExecutionId) { final List<StepExecution> executions = operator().getStepExecutions(jobExecutionId); try { final TabularDataSupport data = new TabularDataSupport(STEP_EXECUTION_TABULAR_TYPE); for (final StepExecution n : executions) { data.put(new CompositeDataSupport(STEP_EXECUTION_COMPOSITE_TYPE, STEP_EXECUTION_ATTRIBUTES, asArray(n))); } return data; } catch (final OpenDataException e) { return null; } }
Example #8
Source File: JSON1.java From ysoserial with MIT License | 5 votes |
/** * Will call all getter methods on payload that are defined in the given interfaces */ public static Map makeCallerChain ( Object payload, Class... ifaces ) throws OpenDataException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, Exception, ClassNotFoundException { CompositeType rt = new CompositeType("a", "b", new String[] { "a" }, new String[] { "a" }, new OpenType[] { javax.management.openmbean.SimpleType.INTEGER }); TabularType tt = new TabularType("a", "b", rt, new String[] { "a" }); TabularDataSupport t1 = new TabularDataSupport(tt); TabularDataSupport t2 = new TabularDataSupport(tt); // we need to make payload implement composite data // it's very likely that there are other proxy impls that could be used AdvisedSupport as = new AdvisedSupport(); as.setTarget(payload); InvocationHandler delegateInvocationHandler = (InvocationHandler) Reflections.newInstance("org.springframework.aop.framework.JdkDynamicAopProxy", as); InvocationHandler cdsInvocationHandler = Gadgets.createMemoizedInvocationHandler(Gadgets.createMap("getCompositeType", rt)); InvocationHandler invocationHandler = (InvocationHandler) Reflections.newInstance("com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl"); ((Map) Reflections.getFieldValue(invocationHandler, "classToInvocationHandler")).put(CompositeData.class, cdsInvocationHandler); Reflections.setFieldValue(invocationHandler, "defaultHandler", delegateInvocationHandler); final CompositeData cdsProxy = Gadgets.createProxy(invocationHandler, CompositeData.class, ifaces); JSONObject jo = new JSONObject(); Map m = new HashMap(); m.put("t", cdsProxy); Reflections.setFieldValue(jo, "properties", m); Reflections.setFieldValue(jo, "properties", m); Reflections.setFieldValue(t1, "dataMap", jo); Reflections.setFieldValue(t2, "dataMap", jo); return Gadgets.makeMap(t1, t2); }
Example #9
Source File: BatchEEMBeanImpl.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Override public TabularData getJobExecution(final long executionId) { final JobExecution execution = operator().getJobExecution(executionId); try { final TabularDataSupport data = new TabularDataSupport(JOB_EXECUTION_TABULAR_TYPE); data.put(new CompositeDataSupport(JOB_EXECUTION_COMPOSITE_TYPE, JOB_EXECUTION_ATTRIBUTES, asArray(execution))); return data; } catch (final OpenDataException e) { return null; } }
Example #10
Source File: BatchEEMBeanImpl.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Override public TabularData getJobExecutions(final long id, final String name) { final List<JobExecution> executions = operator().getJobExecutions(new JobInstanceImpl(id, name)); try { final TabularDataSupport data = new TabularDataSupport(JOB_EXECUTION_TABULAR_TYPE); for (final JobExecution n : executions) { data.put(new CompositeDataSupport(JOB_EXECUTION_COMPOSITE_TYPE, JOB_EXECUTION_ATTRIBUTES, asArray(n))); } return data; } catch (final OpenDataException e) { return null; } }
Example #11
Source File: BatchEEMBeanImpl.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Override public TabularData getJobInstance(final long executionId) { final JobInstance instance = operator().getJobInstance(executionId); try { final TabularDataSupport data = new TabularDataSupport(JOB_INSTANCES_TABULAR_TYPE); data.put(new CompositeDataSupport(JOB_INSTANCES_COMPOSITE_TYPE, JOB_INSTANCES_ATTRIBUTES, new Object[] { instance.getJobName(), instance.getInstanceId() })); return data; } catch (final OpenDataException e) { return null; } }
Example #12
Source File: BatchEEMBeanImpl.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Override public TabularData getParameters(final long executionId) { final Properties parameters = operator().getParameters(executionId); try { final TabularDataSupport data = new TabularDataSupport(PROPERTIES_TABULAR_TYPE); for (final Map.Entry<Object, Object> entry : parameters.entrySet()) { data.put(new CompositeDataSupport(PROPERTIES_COMPOSITE_TYPE, PROPERTIES_ATTRIBUTES, new Object[] { entry.getKey(), entry.getValue() })); } return data; } catch (final OpenDataException e) { return null; } }
Example #13
Source File: JMXUtil.java From tesb-studio-se with Apache License 2.0 | 5 votes |
public static long[] getBundlesList() throws Exception { String KARAF_BUNDLE_MBEAN = "org.apache.karaf:type=bundle,name=" + instanceName; ObjectName objectBundle = new ObjectName(KARAF_BUNDLE_MBEAN); Set<Object> existsBundles = ((TabularDataSupport) mbsc.getAttribute(objectBundle, "Bundles")).keySet(); Object[] bundleIds = existsBundles.toArray(); long[] bundleIDs = new long[existsBundles.size()]; for (int i = 0; i < bundleIds.length; i++) { String id = bundleIds[i].toString(); bundleIDs[i] = Long.parseLong(id.substring(1, id.length() - 1)); } return bundleIDs; }
Example #14
Source File: AdminDistributedSystemJmxImpl.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public TabularData getMissingPersistentMembersJMX() throws AdminException { try { Set<PersistentID> members = super.getMissingPersistentMembers(); TabularData results = new TabularDataSupport(PERSISTENT_ID_TABLE_TYPE); for(PersistentID id : members) { CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS, new Object[] {id.getHost().toString(), id.getDirectory(), id.getUUID().toString()}); results.put(idData); } return results; } catch( OpenDataException e) { logger.warning(LocalizedStrings.ONE_ARG, "Exception occurred while getting missing persistent members.", e); throw new AdminException(e); } }
Example #15
Source File: JavaMailJMSStatistics.java From javamail with Apache License 2.0 | 5 votes |
private static CompositeData convert(MessageAndAddresses maa) { if (maa == null) { return null; } try { TabularData addrData = new TabularDataSupport(TAB_ADDR_TYPE); for(Address addr : maa.getAddresses()) { addrData.put(new CompositeDataSupport(ROW_ADDR_TYPE, new String[]{"addressType", "address"}, new Object[]{addr.getType(), addr.toString()})); } TabularData headerData = new TabularDataSupport(TAB_HEADER_TYPE); Enumeration en = maa.getMessage().getAllHeaders(); while (en.hasMoreElements()) { Header header = (Header) en.nextElement(); headerData.put(new CompositeDataSupport(ROW_HEADER_TYPE, new String[]{"header-name", "header-value"}, new Object[]{header.getName(), header.getValue()})); } String error = null; if (maa.getException() != null) { StringWriter sw = new StringWriter(); sw.append(maa.getException().toString()); maa.getException().printStackTrace(new PrintWriter(sw)); sw.flush(); error = sw.toString(); } return new CompositeDataSupport(MAIL_INFO_TYPE, new String[] {"messageId", "date", "subject", "toAddresses", "headers", "errorDescription"}, new Object[]{maa.getMessage().getMessageID(), new Date(maa.getTimestamp()), maa.getMessage().getSubject(), addrData, headerData, error} ); } catch (OpenDataException | MessagingException e) { throw new IllegalArgumentException("cannot convert MessageAndAddresses to CompositeData", e); } }
Example #16
Source File: JMXUtil.java From tesb-studio-se with Apache License 2.0 | 5 votes |
/** * for Job installation * * @param bundle * @return * @throws ReflectionException */ public static long[] installBundle(File bundle) throws Exception { try { // MBeanServerConnection mbsc = createJMXconnection(); String KARAF_BUNDLE_MBEAN = "org.apache.karaf:type=bundle,name=" + instanceName; ObjectName objectBundle = new ObjectName(KARAF_BUNDLE_MBEAN); Set<Object> existsBundles = ((TabularDataSupport) mbsc.getAttribute(objectBundle, "Bundles")).keySet(); Object bundleId = mbsc.invoke(objectBundle, "install", new Object[] { "file:" + bundle.getAbsolutePath() }, new String[] { String.class.getName() }); Set<Object> newBundles = ((TabularDataSupport) mbsc.getAttribute(objectBundle, "Bundles")).keySet(); newBundles.removeAll(existsBundles); Object[] bundleIds = newBundles.toArray(); long[] newIds = new long[bundleIds.length]; for (int i = 0; i < bundleIds.length; i++) { String id = bundleIds[i].toString(); newIds[i] = Long.parseLong(id.substring(1, id.length() - 1)); mbsc.invoke(objectBundle, "start", new Object[] { String.valueOf(newIds[i]) }, new String[] { String.class.getName() }); } return newIds; // bundleId instanceof Long ? (long) bundleId : 0; } finally { // closeJMXConnection(); } }
Example #17
Source File: JmxValueFunctionsTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@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 #18
Source File: JMXUtil.java From tesb-studio-se with Apache License 2.0 | 5 votes |
public static String[] getBundlesName() throws Exception { String KARAF_BUNDLE_MBEAN = "org.apache.karaf:type=bundle,name=" + instanceName; ObjectName objectBundle = new ObjectName(KARAF_BUNDLE_MBEAN); Collection<Object> values = ((TabularDataSupport) mbsc.getAttribute(objectBundle, "Bundles")).values(); Object[] bundles = values.toArray(); String[] bundleNames = new String[values.size()]; for (int i = 0; i < bundles.length; i++) { bundleNames[i] = String.valueOf(((javax.management.openmbean.CompositeDataSupport) bundles[i]).get("Name")); } return bundleNames; }
Example #19
Source File: DeltaSpikeConfigInfo.java From deltaspike with Apache License 2.0 | 5 votes |
@Override public TabularData getConfigSources() { ClassLoader originalCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(appConfigClassLoader); String typeName = "ConfigSources"; OpenType<?>[] types = new OpenType<?>[]{SimpleType.INTEGER, SimpleType.STRING}; String[] keys = new String[]{"Ordinal", "ConfigSource"}; CompositeType ct = new CompositeType(typeName, typeName, keys, keys, types); TabularType type = new TabularType(typeName, typeName, ct, keys); TabularDataSupport configSourceInfo = new TabularDataSupport(type); ConfigSource[] configSources = ConfigResolver.getConfigSources(); for (ConfigSource configSource : configSources) { configSourceInfo.put( new CompositeDataSupport(ct, keys, new Object[]{configSource.getOrdinal(), configSource.getConfigName()})); } return configSourceInfo; } catch (OpenDataException e) { throw new RuntimeException(e); } finally { // set back the original TCCL Thread.currentThread().setContextClassLoader(originalCl); } }
Example #20
Source File: BatchEEMBeanImpl.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Override public TabularData getJobInstances(final String jobName, final int start, final int count) { final List<JobInstance> instances = operator().getJobInstances(jobName, start, count); try { final TabularDataSupport data = new TabularDataSupport(JOB_INSTANCES_TABULAR_TYPE); for (final JobInstance n : instances) { data.put(new CompositeDataSupport(JOB_INSTANCES_COMPOSITE_TYPE, JOB_INSTANCES_ATTRIBUTES, new Object[] { n.getJobName(), n.getInstanceId() })); } return data; } catch (final OpenDataException e) { return null; } }
Example #21
Source File: JmxFeedTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testJmxAttributeOfTypeTabularDataProviderConvertedToMap() throws Exception { // Create the CompositeType and TabularData CompositeType compositeType = new CompositeType( "typeName", "description", new String[] {"myint", "mystring", "mybool"}, // item names new String[] {"myint", "mystring", "mybool"}, // item descriptions, can't be null or empty string new OpenType<?>[] {SimpleType.INTEGER, SimpleType.STRING, SimpleType.BOOLEAN} ); TabularType tt = new TabularType( "typeName", "description", compositeType, new String[] {"myint"} ); TabularDataSupport tds = new TabularDataSupport(tt); tds.put(new CompositeDataSupport( compositeType, new String[] {"mybool", "myint", "mystring"}, new Object[] {true, 1234, "on"} )); // Create MBean GeneralisedDynamicMBean mbean = jmxService.registerMBean(ImmutableMap.of(attributeName, tds), objectName); feed = JmxFeed.builder() .entity(entity) .pollAttribute(new JmxAttributePollConfig<Map>(mapAttribute) .objectName(objectName) .attributeName(attributeName) .onSuccess((Function)JmxValueFunctions.tabularDataToMap())) .build(); // Starts with value defined when registering... assertSensorEventually( mapAttribute, ImmutableMap.of("myint", 1234, "mystring", "on", "mybool", Boolean.TRUE), TIMEOUT_MS); }
Example #22
Source File: JmxValueFunctionsTest.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Test public void testTabularDataToMap() 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<?,?> result = JmxValueFunctions.tabularDataToMap(table); assertEquals(result, row2); Map<?,?> result2 = JmxValueFunctions.tabularDataToMap().apply(table); assertEquals(result2, row2); }
Example #23
Source File: TabularDataOrderTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static TabularData makeTable() throws OpenDataException { TabularData td = new TabularDataSupport(tt); for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) { CompositeData cd = new CompositeDataSupport( ct, new String[] {"name", "int"}, new Object[] {entry.getKey(), entry.getValue()}); td.put(cd); } return td; }
Example #24
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 5 votes |
/** */ @Test public void testPagesList() throws Exception { String cacheName = "cacheFL"; IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(new CacheConfiguration<Integer, Integer>() .setName(cacheName).setAffinity(new RendezvousAffinityFunction().setPartitions(2))); // Put some data to cache to init cache partitions. for (int i = 0; i < 10; i++) cache.put(i, i); TabularDataSupport view = filteredSystemView(ignite, CACHE_GRP_PAGE_LIST_VIEW, U.map( CachePagesListViewWalker.CACHE_GROUP_ID_FILTER, cacheId(cacheName), CachePagesListViewWalker.PARTITION_ID_FILTER, 0, CachePagesListViewWalker.BUCKET_NUMBER_FILTER, 0 )); assertEquals(1, view.size()); view = filteredSystemView(ignite, CACHE_GRP_PAGE_LIST_VIEW, U.map( CachePagesListViewWalker.CACHE_GROUP_ID_FILTER, cacheId(cacheName), CachePagesListViewWalker.BUCKET_NUMBER_FILTER, 0 )); assertEquals(2, view.size()); }
Example #25
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 5 votes |
/** */ public TabularDataSupport filteredSystemView(IgniteEx g, String name, Map<String, Object> filter) { try { DynamicMBean mbean = metricRegistry(g.name(), VIEWS, name); MBeanOperationInfo[] opers = mbean.getMBeanInfo().getOperations(); assertEquals(1, opers.length); assertEquals(FILTER_OPERATION, opers[0].getName()); MBeanParameterInfo[] paramInfo = opers[0].getSignature(); Object params[] = new Object[paramInfo.length]; String signature[] = new String[paramInfo.length]; for (int i = 0; i < paramInfo.length; i++) { params[i] = filter.get(paramInfo[i].getName()); signature[i] = paramInfo[i].getType(); } return (TabularDataSupport)mbean.invoke(FILTER_OPERATION, params, signature); } catch (Exception e) { throw new RuntimeException(e); } }
Example #26
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 5 votes |
/** */ public TabularDataSupport systemView(IgniteEx g, String name) { try { DynamicMBean caches = metricRegistry(g.name(), VIEWS, name); MBeanAttributeInfo[] attrs = caches.getMBeanInfo().getAttributes(); assertEquals(1, attrs.length); return (TabularDataSupport)caches.getAttribute(VIEWS); } catch (Exception e) { throw new RuntimeException(e); } }
Example #27
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 5 votes |
/** */ @Test public void testComputeBroadcast() throws Exception { CyclicBarrier barrier = new CyclicBarrier(6); for (int i = 0; i < 5; i++) { ignite.compute().broadcastAsync(() -> { try { barrier.await(); barrier.await(); } catch (InterruptedException | BrokenBarrierException e) { throw new RuntimeException(e); } }); } barrier.await(); TabularDataSupport tasks = systemView(TASKS_VIEW); assertEquals(5, tasks.size()); CompositeData t = tasks.get(new Object[] {0}); assertFalse((Boolean)t.get("internal")); assertNull(t.get("affinityCacheName")); assertEquals(-1, t.get("affinityPartitionId")); assertTrue(t.get("taskClassName").toString().startsWith(getClass().getName())); assertTrue(t.get("taskName").toString().startsWith(getClass().getName())); assertEquals(ignite.localNode().id().toString(), t.get("taskNodeId")); assertEquals("0", t.get("userVersion")); barrier.await(); }
Example #28
Source File: SystemViewMBean.java From ignite with Apache License 2.0 | 5 votes |
/** * Gets tabular data with system view content. */ private TabularDataSupport viewContent(Map<String, Object> filter) { TabularDataSupport rows = new TabularDataSupport(sysViewType); AttributeToMapVisitor visitor = new AttributeToMapVisitor(); try { int idx = 0; Iterable<R> iter = filter != null && sysView instanceof FiltrableSystemView ? () -> ((FiltrableSystemView<R>)sysView).iterator(filter) : sysView; for (R row : iter) { Map<String, Object> data = new HashMap<>(); visitor.data(data); sysView.walker().visitAll(row, visitor); data.put(ID, idx++); rows.put(new CompositeDataSupport(rowType, data)); } } catch (OpenDataException e) { throw new IgniteException(e); } return rows; }
Example #29
Source File: TabularDataOrderTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static TabularData makeTable() throws OpenDataException { TabularData td = new TabularDataSupport(tt); for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) { CompositeData cd = new CompositeDataSupport( ct, new String[] {"name", "int"}, new Object[] {entry.getKey(), entry.getValue()}); td.put(cd); } return td; }
Example #30
Source File: TabularDataOrderTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static TabularData makeTable() throws OpenDataException { TabularData td = new TabularDataSupport(tt); for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) { CompositeData cd = new CompositeDataSupport( ct, new String[] {"name", "int"}, new Object[] {entry.getKey(), entry.getValue()}); td.put(cd); } return td; }