Search in sources :

Example 71 with Template

use of io.fabric8.openshift.api.model.Template in project fabric8 by fabric8io.

the class ParseTest method testParseTemplate.

@Test
public void testParseTemplate() throws Exception {
    Template template = assertParseExampleFile("template.json", Template.class);
    List<HasMetadata> objects = template.getObjects();
    assertNotEmpty("objects", objects);
    assertTrue("size is " + objects.size(), objects.size() == 2);
    Object service = objects.get(0);
    assertThat(service).isInstanceOf(Service.class);
    Object rc = objects.get(1);
    assertThat(rc).isInstanceOf(ReplicationController.class);
    System.out.println("Generated JSON: " + toJson(template));
}
Also used : Template(io.fabric8.openshift.api.model.Template) Test(org.junit.Test)

Aggregations

Template (io.fabric8.openshift.api.model.Template)23 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)19 File (java.io.File)14 IOException (java.io.IOException)13 HashMap (java.util.HashMap)12 Test (org.junit.Test)12 KubernetesList (io.fabric8.kubernetes.api.model.KubernetesList)11 Service (io.fabric8.kubernetes.api.model.Service)10 Container (io.fabric8.kubernetes.api.model.Container)8 PodTemplateSpec (io.fabric8.kubernetes.api.model.PodTemplateSpec)7 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)7 OpenShiftHelper (io.vertx.it.openshift.utils.OpenShiftHelper)7 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 BeforeClass (org.junit.BeforeClass)7 PodSpec (io.fabric8.kubernetes.api.model.PodSpec)6 TreeMap (java.util.TreeMap)6 ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)5 Parameter (io.fabric8.openshift.api.model.Parameter)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)4