use of org.codice.ddf.admin.application.service.Application in project ddf by codice.
the class ApplicationNodeImplTest method testEqualsObjParam.
/**
* Tests the {@link ApplicationNodeImpl#equals(Object)} method for the case where the
* parameter is null, the parameter is the same object, the parameter is not an
* ApplicationNodeImpl object, and where the parameter is a different ApplicationNodeImpl
* which has the same application
*/
@Test
public void testEqualsObjParam() {
Application testApp = mock(Application.class);
ApplicationNode testNode = new ApplicationNodeImpl(testApp);
ApplicationNode testNode2 = new ApplicationNodeImpl(testApp);
// Case 1:
assertFalse(testNode.equals(null));
// Case 2:
assertTrue(testNode.equals(testNode));
// Case 3:
assertFalse(testNode.equals(testApp));
// Case 4:
assertTrue(testNode.equals(testNode2));
}
use of org.codice.ddf.admin.application.service.Application 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.codice.ddf.admin.application.service.Application 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.codice.ddf.admin.application.service.Application 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.codice.ddf.admin.application.service.Application 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());
}
Aggregations