use of org.jboss.tools.openshift.core.odo.Application in project jbosstools-openshift by jbosstools.
the class OdoCli method parseApplications.
private static List<Application> parseApplications(String json) {
List<Application> result = new ArrayList<>();
try {
JsonNode root = JSON_MAPPER.readTree(json);
root.get("items").forEach(item -> result.add(Application.of(item.get("metadata").get("name").asText())));
} catch (IOException e) {
}
return result;
}
use of org.jboss.tools.openshift.core.odo.Application in project jbosstools-openshift by jbosstools.
the class OpenShiftApplicationExplorerContentProviderTest method checkClusterWithSingleProjectAndSingleAppReturnsLinkToCreateComponent.
@Test
public void checkClusterWithSingleProjectAndSingleAppReturnsLinkToCreateComponent() throws InterruptedException, TimeoutException, IOException {
mockProject("myproject");
Application app = mock(Application.class);
doReturn(Collections.singletonList(app)).when(odo).getApplications(eq("myproject"));
Object[] childs = provider.getChildren(model);
assertEquals(1, childs.length);
Object element = childs[0];
assertTrue(element instanceof ProjectElement);
childs = provider.getChildren(element);
assertEquals(1, childs.length);
element = childs[0];
assertTrue(element instanceof ApplicationElement);
childs = provider.getChildren(element);
assertEquals(1, childs.length);
element = childs[0];
assertTrue(element instanceof CreateComponentMessageElement<?>);
}
Aggregations