Package javax.management.openmbean

Examples of javax.management.openmbean.TabularData


        // ManagedService operations
       
        assertNull(managedServiceA.getConfig());
       
        // create a configuration for A
        TabularData data = mbean.getProperties("org.apache.aries.jmx.test.ServiceA");
        assertEquals(0, data.size());
       
        PropertyData<String> p1 = PropertyData.newInstance("A1", "first");
        data.put(p1.toCompositeData());
        PropertyData<Integer> p2 = PropertyData.newInstance("A2", 2);
        data.put(p2.toCompositeData());
       
        mbean.update("org.apache.aries.jmx.test.ServiceA", data);
       
        Thread.sleep(1000);
        Dictionary<String, Object> config = managedServiceA.getConfig();
        assertNotNull(config);
        assertEquals(3, config.size());
        assertEquals("org.apache.aries.jmx.test.ServiceA", config.get(Constants.SERVICE_PID));
        assertEquals("first", config.get("A1"));
        assertEquals(2, config.get("A2"));
       
        //delete
        mbean.deleteForLocation("org.apache.aries.jmx.test.ServiceA", a.getLocation());
       
        Thread.sleep(1000);
        assertNull(managedServiceA.getConfig());
       
       
        // ManagedServiceFactory operations
       
        String cpid = mbean.createFactoryConfiguration("jmx.test.B.factory");
        assertNotNull(cpid);
        assertTrue(cpid.contains("jmx.test.B.factory"));
       
        TabularData fConfig = mbean.getProperties(cpid);
        assertNotNull(fConfig);
        assertEquals(0, fConfig.values().size());
       
        PropertyData<String> prop1 = PropertyData.newInstance("B1", "value1");
        fConfig.put(prop1.toCompositeData());
        PropertyData<Boolean> prop2 = PropertyData.newInstance("B2", true);
        fConfig.put(prop2.toCompositeData());
       
        mbean.update(cpid, fConfig);
       
        Thread.sleep(1000);
       
View Full Code Here


        assertEquals(2, bpBundleIds.length);
        // test getLastEvent
        BlueprintEventValidator sampleValidator = new BlueprintEventValidator(sampleBundleId, extenderBundleId, 2);
        sampleValidator.validate(stateProxy.getLastEvent(sampleBundleId));
        // test getLastEvents
        TabularData lastEvents = stateProxy.getLastEvents();
        assertEquals(BlueprintStateMBean.OSGI_BLUEPRINT_EVENTS_TYPE,lastEvents.getTabularType());
        sampleValidator.validate(lastEvents.get(new Long[]{sampleBundleId}));
       
        //////////////////////////////
        //Test BlueprintMetadataMBean
        //////////////////////////////
       
View Full Code Here

        long[] importingBundlesId = packagaState
                .getImportingBundles("org.osgi.jmx.framework", "1.5.0", exportingBundles[0]);
        assertTrue("Should find bundles importing org.osgi.jmx.framework", importingBundlesId.length > 0);

        TabularData table = packagaState.listPackages();
        assertNotNull("TabularData containing CompositeData with packages info shouldn't be null", table);
        assertEquals("TabularData should be a type PACKAGES", PackageStateMBean.PACKAGES_TYPE, table.getTabularType());
        Collection colData = table.values();
        assertNotNull("Collection of CompositeData shouldn't be null", colData);
        assertFalse("Collection of CompositeData should contain elements", colData.isEmpty());

        boolean isRemovalPending = packagaState.isRemovalPending("org.osgi.jmx.framework", "1.5.0", exportingBundles[0]);
        assertFalse("Should removal pending on org.osgi.jmx.framework be false", isRemovalPending);
View Full Code Here

        has = (Boolean) mbeanServer.invoke(name, "hasTypeConverter", new Object[]{"java.math.BigInteger", "int"}, new String[]{"java.lang.String", "java.lang.String"});
        assertFalse("Should not have type converter", has.booleanValue());

        // we have more than 150 converters out of the box
        TabularData data = (TabularData) mbeanServer.invoke(name, "listTypeConverters", null, null);
        assertTrue("Should be more than 150 converters, was: " + data.size(), data.size() >= 150);
    }
View Full Code Here

        assertArrayEquals(new byte[] { 10, 20, 30 }, config);
       
       
        // test list information
       
        TabularData data = mbean.listInformation();
        assertNotNull(data);
        assertEquals(JmxConstants.PROPERTIES_TYPE, data.getTabularType());
        assertTrue(data.values().size() >= 1);
        PropertyData<byte[]> configEntry = PropertyData.from(data.get(new Object[] {PROVISIONING_AGENT_CONFIG }));
        assertNotNull(configEntry);
        assertArrayEquals(new byte[] { 10, 20, 30 }, configEntry.getValue());

       
        // test add information
       
        PropertyData<String> reference = PropertyData.newInstance(PROVISIONING_REFERENCE, "rsh://0.0.0.0/provX");
        data.put(reference.toCompositeData());
       
        mbean.addInformation(data);
       
        info = ps.getInformation();
        assertNotNull(info);
        assertTrue(info.size() >= 2);
        config = (byte[]) info.get(PROVISIONING_AGENT_CONFIG);
        assertNotNull(config);
        assertArrayEquals(new byte[] { 10, 20, 30 }, config);
        String ref = (String) info.get(PROVISIONING_REFERENCE);
        assertNotNull(ref);
        assertEquals("rsh://0.0.0.0/provX", ref);
       
       
        // test set information
       
        data.clear();
        PropertyData<String> newRef = PropertyData.newInstance(PROVISIONING_REFERENCE, "rsh://0.0.0.0/newProvRef");
        data.put(newRef.toCompositeData());
       
        mbean.setInformation(data);
        info = ps.getInformation();
        assertNotNull(info);
        assertTrue(info.size() >= 1);
View Full Code Here

        }
    }

    public TabularData listTypeConverters() {
        try {
            TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listTypeConvertersTabularType());
            List<Class[]> converters = registry.listAllTypeConvertersFromTo();
            for (Class[] entry : converters) {
                CompositeType ct = CamelOpenMBeanTypes.listTypeConvertersCompositeType();
                String from = entry[0].getCanonicalName();
                String to = entry[1].getCanonicalName();
                CompositeData data = new CompositeDataSupport(ct, new String[]{"from", "to"}, new Object[]{from, to});
                answer.put(data);
            }
            return answer;
        } catch (Exception e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
View Full Code Here

        return _jmxUtils.getManagedConnections(VIRTUAL_HOST_NAME);
    }

    private CompositeDataSupport getTheOneChannelRow(final ManagedConnection mBean) throws Exception
    {
        TabularData channelsData = getChannelsDataWithRetry(mBean);

        assertEquals("Unexpected number of rows in channel table", 1, channelsData.size());

        @SuppressWarnings("unchecked")
        final Iterator<CompositeDataSupport> rowItr = (Iterator<CompositeDataSupport>) channelsData.values().iterator();
        final CompositeDataSupport row = rowItr.next();
        return row;
    }
View Full Code Here

    }

    private TabularData getChannelsDataWithRetry(final ManagedConnection mBean)
            throws IOException, JMException
    {
        TabularData channelsData = mBean.channels();
        int retries = 0;
        while(channelsData.size() == 0 && retries < 5)
        {
            sleep();
            channelsData = mBean.channels();
            retries++;
        }
View Full Code Here

    public void testViewEffectiveRuntimeLoggerLevels() throws Exception
    {
        final String qpidMainLogger = "org.apache.qpid";

        TabularData table = _loggingManagement.viewEffectiveRuntimeLoggerLevels();
        final CompositeData row = table.get(new String[] {qpidMainLogger} );
        assertChannelRow(row, qpidMainLogger, "DEBUG");
    }
View Full Code Here

    public void testViewConfigFileLoggerLevels() throws Exception
    {
        final String operationalLoggingLogger = "qpid.message";

        TabularData table = _loggingManagement.viewConfigFileLoggerLevels();
        final CompositeData row = table.get(new String[] {operationalLoggingLogger} );
        assertChannelRow(row, operationalLoggingLogger, "INFO");
    }
View Full Code Here

TOP

Related Classes of javax.management.openmbean.TabularData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.