Java Code Examples for javax.management.openmbean.TabularDataSupport#get()

The following examples show how to use javax.management.openmbean.TabularDataSupport#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: JmxExporterSpiTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** */
@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 2
Source File: JmxExporterSpiTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** */
@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 3
Source File: JmxExporterSpiTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** */
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 4
Source File: JmxExporterSpiTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** */
@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();
}