Search in sources :

Example 6 with FeatureDetails

use of org.codice.ddf.admin.application.rest.model.FeatureDetails in project ddf by codice.

the class ApplicationServiceBeanTest method testGetAllFeatures.

/**
 * Tests the {@link ApplicationServiceBean#getAllFeatures()} method
 *
 * @throws Exception
 */
@Test
public void testGetAllFeatures() throws Exception {
    ApplicationServiceBean serviceBean = newApplicationServiceBean();
    List<FeatureDetails> testFeatureDetailsList = new ArrayList<>();
    FeatureDetails testFeatureDetails1 = mock(FeatureDetails.class);
    testFeatureDetailsList.add(testFeatureDetails1);
    when(testFeatureDetails1.getName()).thenReturn(TEST_FEATURE_DETAILS);
    when(testFeatureDetails1.getVersion()).thenReturn(TEST_VERSION);
    when(testFeatureDetails1.getStatus()).thenReturn(TEST_FEATURE_STATUS);
    when(testFeatureDetails1.getRepository()).thenReturn(TEST_REPO_NAME);
    when(testAppService.getAllFeatures()).thenReturn(testFeatureDetailsList);
    assertThat("Features returned should match testFeatureDetailsList features", (String) serviceBean.getAllFeatures().get(0).get("name"), is(testFeatureDetailsList.get(0).getName()));
    verify(testAppService).getAllFeatures();
}
Also used : FeatureDetails(org.codice.ddf.admin.application.rest.model.FeatureDetails) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

FeatureDetails (org.codice.ddf.admin.application.rest.model.FeatureDetails)6 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 FeaturesService (org.apache.karaf.features.FeaturesService)3 Repository (org.apache.karaf.features.Repository)3 ApplicationService (org.codice.ddf.admin.application.service.ApplicationService)3 URI (java.net.URI)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Feature (org.apache.karaf.features.Feature)1