use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel in project intellij-tekton by redhat-developer.
the class TaskConfigurationModelTest method checkTaskModelWithOutputResources.
@Test
public void checkTaskModelWithOutputResources() throws IOException {
String configuration = load("task9.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().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().isEmpty());
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel in project intellij-tekton by redhat-developer.
the class YAMLBuilderTest method checkTaskRunCreatedWithTaskConfigurationModelWithoutWorkspace.
@Test
public void checkTaskRunCreatedWithTaskConfigurationModelWithoutWorkspace() throws IOException {
String content = load("task5.yaml");
TaskConfigurationModel model = new TaskConfigurationModel(content);
ObjectNode taskRunNode = YAMLBuilder.createTaskRun(model);
assertEquals(taskRunNode.get("apiVersion").asText(), "tekton.dev/v1beta1");
assertEquals(taskRunNode.get("kind").asText(), "TaskRun");
assertEquals(taskRunNode.get("metadata").get("generateName").asText(), "foo-");
assertEquals(taskRunNode.get("spec").get("taskRef").get("name").asText(), "foo");
assertTrue(taskRunNode.get("spec").has("serviceAccountName"));
assertEquals(taskRunNode.get("spec").get("serviceAccountName").asText(), "");
assertFalse(taskRunNode.get("spec").has("serviceAccountNames"));
assertTrue(taskRunNode.get("spec").has("params"));
assertFalse(taskRunNode.get("spec").has("resources"));
assertFalse(taskRunNode.get("spec").has("workspaces"));
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel in project intellij-tekton by redhat-developer.
the class ConfigurationModelFactoryTest method checkTaskModelIsReturned.
@Test
public void checkTaskModelIsReturned() throws IOException {
String configuration = load("task1.yaml");
ConfigurationModel model = ConfigurationModelFactory.getModel(configuration);
assertTrue(model instanceof TaskConfigurationModel);
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel in project intellij-tekton by redhat-developer.
the class TaskConfigurationModelTest method checkTaskModelWithParams.
@Test
public void checkTaskModelWithParams() throws IOException {
String configuration = load("task2.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().isEmpty());
assertTrue(model.getOutputResources().isEmpty());
assertTrue(model.getWorkspaces().isEmpty());
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.TaskConfigurationModel in project intellij-tekton by redhat-developer.
the class TaskConfigurationModelTest method checkTaskModelWithInputResources.
@Test
public void checkTaskModelWithInputResources() throws IOException {
String configuration = load("task7.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().size() == 2);
assertEquals(model.getInputResources().get(0).name(), "resource1");
assertEquals(model.getInputResources().get(0).type(), "git");
assertEquals(model.getInputResources().get(1).name(), "resource2");
assertEquals(model.getInputResources().get(1).type(), "git");
assertTrue(model.getOutputResources().isEmpty());
assertTrue(model.getWorkspaces().isEmpty());
}
Aggregations