Java 8 TabularData - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TabularData class.

This code example shows how to use the following methods:get, size
            Map<String, List<String>> query = new HashMap<String, List<String>>();
            query.put(objectName, Arrays.asList("otherMethod", "testMethod(long)", "testMethod(java.lang.String)"));
            query.put(objectName2, Collections.<String>emptyList());
            query.put(objectName3, Collections.<String>emptyList());
            TabularData result = mb.canInvoke(query);
            assertEquals(5, result.size());
 
            CompositeData cd = result.get(new Object[]{objectName, "testMethod(long)"});
            assertEquals(objectName, cd.get("ObjectName"));
            assertEquals("testMethod(long)", cd.get("Method"));
            assertEquals(true, cd.get("CanInvoke"));
            CompositeData cd2 = result.get(new Object[]{objectName, "testMethod(java.lang.String)"});
            assertEquals(objectName, cd2.get("ObjectName"));
            assertEquals("testMethod(java.lang.String)", cd2.get("Method"));
            assertEquals(false, cd2.get("CanInvoke"));
            CompositeData cd3 = result.get(new Object[]{objectName, "otherMethod"});
            assertEquals(objectName, cd3.get("ObjectName"));
            assertEquals("otherMethod", cd3.get("Method"));
            assertEquals(true, cd3.get("CanInvoke"));
            CompositeData cd4 = result.get(new Object[]{objectName2, ""});

5
CodeRank
This code example shows how to use the following methods:get, size
        Session mockSession = createMockedSession(channelId, unacknowledgedMessages, localTransactionBegins, blocked);
 
        when(_mockConnection.getSessions()).thenReturn(Collections.singletonList(mockSession));
 
        TabularData table = _connectionMBean.channels();
        assertEquals("Unexpected number of rows in table", 1, table.size());
 
        final CompositeData row = table.get(new Integer[] {channelId} );
        assertChannelRow(row, channelId, unacknowledgedMessages, transactional, blocked);
    } 
 
    public void testChannelsWithSingleNonTransactionalSession() throws Exception
    { 
        int channelId = 10;
        int unacknowledgedMessages = 2;
        long localTransactionBegins = 0;
        boolean transactional  = false;
        boolean blocked = false;
 
        Session mockSession = createMockedSession(channelId, unacknowledgedMessages, localTransactionBegins, blocked);
5
CodeRank
This code example shows how to use the following methods:get, size
 
        Map<String, List<String>> map2 = new HashMap<String, List<String>>();
        map2.put(systemMBean.toString(), Collections.<String>emptyList());
        map2.put(serviceMBean.toString(), Arrays.asList("getServices(boolean)", "getServices(long)", "getServices(long,boolean)", "getServices()"));
        TabularData td2 = (TabularData) connection.invoke(securityMBean, "canInvoke", new Object [] {map2}, new String [] {Map.class.getName()});
        assertEquals(5, td2.size());
 
        CompositeData cd1 = td2.get(new Object [] {serviceMBean.toString(), "getServices(boolean)"});
        assertEquals(serviceMBean.toString(), cd1.get("ObjectName"));
        assertEquals("getServices(boolean)", cd1.get("Method"));
        assertTrue((Boolean) cd1.get("CanInvoke"));
 
        CompositeData cd2 = td2.get(new Object [] {serviceMBean.toString(), "getServices(long)"});
        assertEquals(serviceMBean.toString(), cd2.get("ObjectName"));
        assertEquals("getServices(long)", cd2.get("Method"));
        assertEquals(isManager, cd2.get("CanInvoke"));
 
        CompositeData cd3 = td2.get(new Object [] {serviceMBean.toString(), "getServices(long,boolean)"});
        assertEquals(serviceMBean.toString(), cd3.get("ObjectName"));
        assertEquals("getServices(long,boolean)", cd3.get("Method"));

5
CodeRank
This code example shows how to use the following methods:size
        } 
    } 
 
    private int getInstancesNum(MBeanServerConnection connection, ObjectName name) throws Exception {
        TabularData instances = (TabularData) connection.getAttribute(name, "Instances");
        return instances.size();
    } 
 
    @Test
    public void cloneCommand() throws Exception {
        System.out.println(executeCommand("instance:clone root itest3"));
        assertContains("itest3", executeCommand("instance:list")); 
    } 
 
    @Test
    public void cloneViaMBean() throws Exception {
        JMXConnector connector = null;
        try { 
            connector = this.getJMXConnector();
            MBeanServerConnection connection = connector.getMBeanServerConnection();
5
CodeRank
This code example shows how to use the following methods:size
        try { 
            connector = this.getJMXConnector();
            MBeanServerConnection connection = connector.getMBeanServerConnection();
            ObjectName name = new ObjectName("org.apache.karaf:type=feature,name=root");
            TabularData features = (TabularData) connection.getAttribute(name, "Features");
            assertTrue(features.size() > 0);
        } finally { 
        	close(connector);
        } 
    } 
 
    @Test
    public void installUninstallCommand() throws Exception {
        System.out.println(executeCommand("feature:install -v wrapper", new RolePrincipal("admin")));
        assertFeatureInstalled("wrapper"); 
        System.out.println(executeCommand("feature:uninstall wrapper", new RolePrincipal("admin")));
        assertFeatureNotInstalled("wrapper"); 
    } 
 
    @Test
5
CodeRank
This code example shows how to use the following methods:size
            ObjectName name = new ObjectName("org.apache.karaf:type=obr,name=root");
            @SuppressWarnings("unchecked") 
            List<String> urls = (List<String>) connection.getAttribute(name, "Urls");
            assertEquals(0, urls.size());
            TabularData bundles = (TabularData) connection.getAttribute(name, "Bundles");
            assertEquals(0, bundles.size());
        } finally { 
        	close(connector);
        } 
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:size
	private void updateFeaturesData(MBeanServerConnection connection)
			throws MetricUnreachableException, MetricNotFoundException { 
		TabularData tdFeatures = retreiveTabularAttributeData(connection, objnameFeatures,
				"Features"); 
 
		long featuresTotal = tdFeatures.size();
 
		TabularData tdRepos = retreiveTabularAttributeData(connection, objnameFeatures,
				"Repositories"); 
 
		long repositoriesTotal = tdRepos.size();
		 
		dataCache.put("#Features", new MetricValue(featuresTotal));
		dataCache.put("#FeatureRepositories", new MetricValue(repositoriesTotal));
	} 
	 
	private void updateServicesData(MBeanServerConnection connection)
			throws MetricUnreachableException, MetricNotFoundException { 
		TabularData td = retreiveTabularMethodData(connection, objnameServices,
				"list"); 
4
CodeRank
This code example shows how to use the following methods:size
        try { 
            connector = this.getJMXConnector();
            MBeanServerConnection connection = connector.getMBeanServerConnection();
            ObjectName name = new ObjectName("org.apache.karaf:type=web,name=root");
            TabularData webBundles = (TabularData) connection.getAttribute(name, "WebBundles");
            assertEquals(0, webBundles.size());
        } finally { 
            close(connector);
        } 
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:size
        try { 
            connector = this.getJMXConnector();
            MBeanServerConnection connection = connector.getMBeanServerConnection();
            ObjectName name = new ObjectName("org.apache.karaf:type=http,name=root");
            TabularData servlets = (TabularData) connection.getAttribute(name, "Servlets");
            assertTrue(servlets.size() > 0);
        } finally { 
            close(connector);
        } 
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:size
        try { 
            connector = this.getJMXConnector();
            MBeanServerConnection connection = connector.getMBeanServerConnection();
            ObjectName name = new ObjectName("org.apache.karaf:type=service,name=root");
            TabularData services = (TabularData) connection.getAttribute(name, "Services");
            assertTrue(services.size() > 0);
        } finally { 
            close(connector);
        } 
    } 
 
} 
5
CodeRank
See Code Examples for Java 8 TabularData Methods: