use of org.apache.karaf.features.internal.service.RepositoryImpl in project ddf by codice.
the class ApplicationImplTest method testAppEquality.
/**
* Tests that applications can be compared to each other for equality.
*
* @throws Exception
*/
@Test
public void testAppEquality() throws Exception {
RepositoryImpl repo1 = new RepositoryImpl(getClass().getClassLoader().getResource(FILE_MAIN_FEATURE).toURI());
repo1.load();
Application testApp1 = new ApplicationImpl(repo1);
Application testApp1Duplicate = new ApplicationImpl(repo1);
Application testAppNull = null;
RepositoryImpl repo2 = new RepositoryImpl(getClass().getClassLoader().getResource(FILE_NO_MAIN_FEATURES).toURI());
repo2.load();
Application testApp2 = new ApplicationImpl(repo2);
assertTrue(testApp1.equals(testApp1));
assertTrue(testApp2.equals(testApp2));
assertTrue(testApp1.equals(testApp1Duplicate));
assertFalse(testApp1.equals(testApp2));
assertFalse(testApp2.equals(testApp1));
assertFalse(testApp1.equals(testAppNull));
}
use of org.apache.karaf.features.internal.service.RepositoryImpl in project ddf by codice.
the class ApplicationImplTest method testAppGetters.
/**
* Verify that the application is properly exposing the underlying
* repository.
*
* @throws Exception
*/
@Test
public void testAppGetters() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getClassLoader().getResource(FILE_NO_MAIN_FEATURES).toURI());
repo.load();
Application testApp = new ApplicationImpl(repo);
assertEquals(TEST_APP, testApp.getName());
Set<Feature> appFeatures = testApp.getFeatures();
assertNotNull(appFeatures);
assertEquals(repo.getFeatures().length, appFeatures.size());
assertTrue(appFeatures.containsAll(Arrays.asList(repo.getFeatures())));
assertNull(testApp.getMainFeature());
assertEquals(NUM_BUNDLES, testApp.getBundles().size());
}
use of org.apache.karaf.features.internal.service.RepositoryImpl in project ddf by codice.
the class ApplicationImplTest method testGetDescription.
/**
* Tests the {@link ApplicationImpl#getDescription()} method
*
* @throws Exception
*/
@Test
public void testGetDescription() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getClassLoader().getResource(FILE_MAIN_FEATURE).toURI());
repo.load();
Application testApp = new ApplicationImpl(repo);
assertEquals(MAIN_FEATURE_NAME, testApp.getDescription());
}
use of org.apache.karaf.features.internal.service.RepositoryImpl in project ddf by codice.
the class ApplicationImplTest method testMainFeature.
/**
* Tests that if an application HAS a main feature that the properties in it
* are properly parsed and set.
*
* @throws Exception
*/
@Test
public void testMainFeature() throws Exception {
String mainFeatureName = "main-feature";
String mainFeatureVersion = "1.0.1";
String mainFeatureDescription = "Main Feature Test";
String appToString = mainFeatureName + " - " + mainFeatureVersion;
RepositoryImpl repo = new RepositoryImpl(getClass().getClassLoader().getResource(FILE_MAIN_FEATURE).toURI());
repo.load();
Application testApp = new ApplicationImpl(repo);
assertEquals(mainFeatureName, testApp.getName());
assertEquals(mainFeatureVersion, testApp.getVersion());
assertEquals(mainFeatureDescription, testApp.getDescription());
assertNotNull(testApp.toString());
assertEquals(appToString, testApp.toString());
assertNotNull(testApp.getMainFeature());
}
use of org.apache.karaf.features.internal.service.RepositoryImpl in project karaf by apache.
the class SubsystemTest method test1.
@Test
public void test1() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data1/features.xml").toURI());
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root", "f1");
addToMapSet(features, "root/apps1", "f2");
Map<String, Set<String>> expected = new HashMap<>();
addToMapSet(expected, "root", "a/1.0.0");
addToMapSet(expected, "root", "c/1.0.0");
addToMapSet(expected, "root/apps1", "b/1.0.0");
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data1"));
resolver.prepare(Arrays.asList(repo.getFeatures()), features, Collections.emptyMap());
resolver.resolve(Collections.emptySet(), FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE, null, null, null);
verify(resolver, expected);
}
Aggregations