Search in sources :

Example 1 with REPOSITORY_URI

use of org.apache.karaf.features.management.FeaturesServiceMBean.REPOSITORY_URI in project karaf by apache.

the class JmxRepositoryTest method testJmxRepositoryCompositeData.

@Test
public void testJmxRepositoryCompositeData() throws Exception {
    Features features = new Features();
    features.setName("test-1.0.0");
    features.getRepository().add("mvn:org.test/test-dependency/1.0.0/xml/features");
    features.getFeature().add(new Feature("test-feature", "1.0.0"));
    URI uri = new URI("mvn:org.test/test/1.0.0/xml/features");
    Repository repository = new RepositoryImpl(uri, features, true);
    JmxRepository jmxRepository = new JmxRepository(repository);
    CompositeData compositeData = jmxRepository.asCompositeData();
    assertEquals("test-1.0.0", compositeData.get(REPOSITORY_NAME));
    assertEquals(uri.toString(), compositeData.get(REPOSITORY_URI));
    assertTrue((Boolean) compositeData.get(REPOSITORY_BLACKLISTED));
    String[] repositoryUris = (String[]) compositeData.get(REPOSITORY_REPOSITORIES);
    assertEquals(1, repositoryUris.length);
    assertEquals("mvn:org.test/test-dependency/1.0.0/xml/features", repositoryUris[0]);
    TabularData repositoryFeatures = (TabularData) compositeData.get(REPOSITORY_FEATURES);
    assertEquals(1, repositoryFeatures.size());
    assertNotNull(repositoryFeatures.get(new Object[] { "test-feature", "1.0.0" }));
}
Also used : Repository(org.apache.karaf.features.Repository) RepositoryImpl(org.apache.karaf.features.internal.service.RepositoryImpl) CompositeData(javax.management.openmbean.CompositeData) Features(org.apache.karaf.features.internal.model.Features) Feature(org.apache.karaf.features.internal.model.Feature) REPOSITORY_URI(org.apache.karaf.features.management.FeaturesServiceMBean.REPOSITORY_URI) URI(java.net.URI) TabularData(javax.management.openmbean.TabularData) Test(org.junit.Test)

Aggregations

URI (java.net.URI)1 CompositeData (javax.management.openmbean.CompositeData)1 TabularData (javax.management.openmbean.TabularData)1 Repository (org.apache.karaf.features.Repository)1 Feature (org.apache.karaf.features.internal.model.Feature)1 Features (org.apache.karaf.features.internal.model.Features)1 RepositoryImpl (org.apache.karaf.features.internal.service.RepositoryImpl)1 REPOSITORY_URI (org.apache.karaf.features.management.FeaturesServiceMBean.REPOSITORY_URI)1 Test (org.junit.Test)1