@Test public void testJmxFeatureCompositeData() throws Exception { Feature feature = new Feature(); feature.setName("test-feature"); feature.setVersion("1.0.0"); feature.setBlacklisted(true); Dependency dependency = new Dependency(); dependency.setName("test-dependent-feature"); dependency.setVersion("1.0.0"); feature.getFeature().add(dependency); Bundle bundle = new Bundle(); bundle.setLocation("mvn:org.test/test/1.0.0"); feature.getBundle().add(bundle); Config config = new Config(); config.setName(FEATURE_CONFIG_PID); config.setValue("org.test.pid"); config.setAppend(false); config.getProperties().put("test-key", "test-value"); feature.getConfig().add(config); ConfigFile configFile = new ConfigFile(); configFile.setFinalname("test-configfile.cfg"); feature.getConfigfile().add(configFile); JmxFeature jmxFeature = new JmxFeature(feature, true, true); CompositeData compositeData = jmxFeature.asCompositeData(); assertEquals("test-feature", compositeData.get(FEATURE_NAME)); assertEquals("1.0.0", compositeData.get(FEATURE_VERSION)); assertTrue((Boolean) compositeData.get(FEATURE_INSTALLED)); assertTrue((Boolean) compositeData.get(FEATURE_BLACKLISTED)); assertTrue((Boolean) compositeData.get(FEATURE_REQUIRED)); TabularData featureDependencies = (TabularData) compositeData.get(FEATURE_DEPENDENCIES); assertEquals(1, featureDependencies.size()); assertNotNull(featureDependencies.get(new Object[] {"test-dependent-feature", "1.0.0"})); String[] bundleUrls = (String[]) compositeData.get(FEATURE_BUNDLES); assertEquals(new String[] {"mvn:org.test/test/1.0.0"}, bundleUrls); TabularData featureConfigs = (TabularData) compositeData.get(FEATURE_CONFIGURATIONS); assertEquals(1, featureConfigs.size()); assertNotNull(featureConfigs.get(new Object[] {FEATURE_CONFIG_PID})); TabularData featureConfigFiles = (TabularData) compositeData.get(FEATURE_CONFIGURATIONFILES); assertEquals(1, featureConfigFiles.size()); assertNotNull(featureConfigFiles.get(new Object[] {"test-configfile.cfg"})); }
public CompositeData asCompositeData() { return data; }
JmxFeature { public CompositeData asCompositeData() { return data; } }
JmxFeature { public CompositeData asCompositeData() { return data; } JmxFeature(Feature feature, boolean installed, boolean required); }
JmxFeature { public CompositeData asCompositeData() { return data; } JmxFeature(Feature feature, boolean installed, boolean required); CompositeData asCompositeData(); static TabularData tableFrom(Collection<JmxFeature> features); }
JmxFeature { public CompositeData asCompositeData() { return data; } JmxFeature(Feature feature, boolean installed, boolean required); CompositeData asCompositeData(); static TabularData tableFrom(Collection<JmxFeature> features); static final CompositeType FEATURE; static final TabularType FEATURE_TABLE; static final CompositeType FEATURE_IDENTIFIER; static final TabularType FEATURE_IDENTIFIER_TABLE; static final CompositeType FEATURE_CONFIG_ELEMENT; static final TabularType FEATURE_CONFIG_ELEMENT_TABLE; static final CompositeType FEATURE_CONFIG; static final TabularType FEATURE_CONFIG_TABLE; static final CompositeType FEATURE_CONFIG_FILES; static final TabularType FEATURE_CONFIG_FILES_TABLE; }