Search in sources :

Example 1 with Application

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;
}
Also used : ArrayList(java.util.ArrayList) JsonNode(com.fasterxml.jackson.databind.JsonNode) IOException(java.io.IOException) Application(org.jboss.tools.openshift.core.odo.Application)

Example 2 with Application

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<?>);
}
Also used : ApplicationElement(org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationElement) ProjectElement(org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ProjectElement) Application(org.jboss.tools.openshift.core.odo.Application) Test(org.junit.Test)

Aggregations

Application (org.jboss.tools.openshift.core.odo.Application)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ApplicationElement (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ApplicationElement)1 ProjectElement (org.jboss.tools.openshift.internal.ui.models.applicationexplorer.ProjectElement)1 Test (org.junit.Test)1