Search in sources :

Example 11 with TaskConfigurationModel

use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel in project intellij-tekton by redhat-developer.

the class TaskConfigurationModelTest method checkTaskModelWithMultipleInputs.

@Test
public void checkTaskModelWithMultipleInputs() throws IOException {
    String configuration = load("task14.yaml");
    TaskConfigurationModel model = (TaskConfigurationModel) ConfigurationModelFactory.getModel(configuration);
    assertEquals(model.getName(), "foo");
    assertEquals(model.getNamespace(), "tekton");
    assertEquals(model.getKind(), "Task");
    assertTrue(model.getParams().size() == 1);
    assertEquals(model.getParams().get(0).name(), "parm1");
    assertTrue(model.getInputResources().size() == 1);
    assertEquals(model.getInputResources().get(0).name(), "resource1");
    assertEquals(model.getInputResources().get(0).type(), "git");
    assertTrue(model.getOutputResources().size() == 2);
    assertEquals(model.getOutputResources().get(0).name(), "resource1");
    assertEquals(model.getOutputResources().get(0).type(), "image");
    assertEquals(model.getOutputResources().get(1).name(), "resource2");
    assertEquals(model.getOutputResources().get(1).type(), "image");
    assertTrue(model.getWorkspaces().size() == 2);
    assertEquals(model.getWorkspaces().get(0).getName(), "write-allowed");
    assertEquals(model.getWorkspaces().get(1).getName(), "write-disallowed");
}
Also used : TaskConfigurationModel(com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel) Test(org.junit.Test) BaseTest(com.redhat.devtools.intellij.tektoncd.BaseTest)

Example 12 with TaskConfigurationModel

use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel in project intellij-tekton by redhat-developer.

the class TaskConfigurationModelTest method checkEmptyTaskModel.

@Test
public void checkEmptyTaskModel() throws IOException {
    String configuration = load("task1.yaml");
    TaskConfigurationModel model = (TaskConfigurationModel) ConfigurationModelFactory.getModel(configuration);
    assertEquals(model.getName(), "foo");
    assertEquals(model.getNamespace(), "tekton");
    assertEquals(model.getKind(), "Task");
    assertTrue(model.getParams().isEmpty());
    assertTrue(model.getInputResources().isEmpty());
    assertTrue(model.getOutputResources().isEmpty());
    assertTrue(model.getWorkspaces().isEmpty());
}
Also used : TaskConfigurationModel(com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel) Test(org.junit.Test) BaseTest(com.redhat.devtools.intellij.tektoncd.BaseTest)

Aggregations

TaskConfigurationModel (com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel)12 BaseTest (com.redhat.devtools.intellij.tektoncd.BaseTest)9 Test (org.junit.Test)9 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 YAMLMapper (com.fasterxml.jackson.dataformat.yaml.YAMLMapper)2 Input (com.redhat.devtools.intellij.tektoncd.tkn.component.field.Input)2 Output (com.redhat.devtools.intellij.tektoncd.tkn.component.field.Output)2 Workspace (com.redhat.devtools.intellij.tektoncd.tkn.component.field.Workspace)2 ConfigurationModel (com.redhat.devtools.intellij.tektoncd.utils.model.ConfigurationModel)2 PipelineConfigurationModel (com.redhat.devtools.intellij.tektoncd.utils.model.resources.PipelineConfigurationModel)2 IOException (java.io.IOException)2 List (java.util.List)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 WRITE_DOC_START_MARKER (com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature.WRITE_DOC_START_MARKER)1 InspectionManager (com.intellij.codeInspection.InspectionManager)1 LocalQuickFix (com.intellij.codeInspection.LocalQuickFix)1 ProblemDescriptor (com.intellij.codeInspection.ProblemDescriptor)1