use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.PipelineConfigurationModel in project intellij-tekton by redhat-developer.
the class TaskReferencesInspector method checkFile.
@Nullable
@Override
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
ConfigurationModel model = getTektonModelFromFile(file);
if (model == null) {
return ProblemDescriptor.EMPTY_ARRAY;
}
List<PsiElement> tasKNotFoundPsiElements = new ArrayList<>();
if (model instanceof PipelineConfigurationModel) {
List<String> tasksOnCluster = getTasksOnCluster(file.getProject(), model.getNamespace());
tasKNotFoundPsiElements = findTaskElementsNotFoundOnCluster(file, tasksOnCluster);
}
return tasKNotFoundPsiElements.stream().map(item -> manager.createProblemDescriptor(item, item, "No task named " + StringHelper.getUnquotedValueFromPsi(item) + " found on cluster.", ProblemHighlightType.GENERIC_ERROR, isOnTheFly)).toArray(ProblemDescriptor[]::new);
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.PipelineConfigurationModel in project intellij-tekton by redhat-developer.
the class ConfigurationModelFactoryTest method checkPipelineModelIsReturned.
@Test
public void checkPipelineModelIsReturned() throws IOException {
String configuration = load("pipeline1.yaml");
ConfigurationModel model = ConfigurationModelFactory.getModel(configuration);
assertTrue(model instanceof PipelineConfigurationModel);
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.PipelineConfigurationModel in project intellij-tekton by redhat-developer.
the class PipelineConfigurationModelTest method checkPipelineModelWithInputResources.
@Test
public void checkPipelineModelWithInputResources() throws IOException {
String configuration = load("pipeline4.yaml");
PipelineConfigurationModel model = (PipelineConfigurationModel) ConfigurationModelFactory.getModel(configuration);
assertEquals(model.getName(), "foo");
assertEquals(model.getNamespace(), "tekton");
assertEquals(model.getKind(), "Pipeline");
assertTrue(model.getParams().isEmpty());
assertTrue(model.getInputResources().size() == 1);
assertEquals(model.getInputResources().get(0).name(), "resource1");
assertEquals(model.getInputResources().get(0).type(), "git");
assertTrue(model.getOutputResources().isEmpty());
assertTrue(model.getWorkspaces().isEmpty());
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.PipelineConfigurationModel in project intellij-tekton by redhat-developer.
the class PipelineConfigurationModelTest method checkEmptyPipelineModel.
@Test
public void checkEmptyPipelineModel() throws IOException {
String configuration = load("pipeline1.yaml");
PipelineConfigurationModel model = (PipelineConfigurationModel) ConfigurationModelFactory.getModel(configuration);
assertEquals(model.getName(), "foo");
assertEquals(model.getNamespace(), "tekton");
assertEquals(model.getKind(), "Pipeline");
assertTrue(model.getParams().isEmpty());
assertTrue(model.getInputResources().isEmpty());
assertTrue(model.getOutputResources().isEmpty());
assertTrue(model.getWorkspaces().isEmpty());
}
use of com.redhat.devtools.intellij.tektoncd.utils.model.resources.PipelineConfigurationModel in project intellij-tekton by redhat-developer.
the class PipelineConfigurationModelTest method checkPipelineModelWithParams.
@Test
public void checkPipelineModelWithParams() throws IOException {
String configuration = load("pipeline3.yaml");
PipelineConfigurationModel model = (PipelineConfigurationModel) ConfigurationModelFactory.getModel(configuration);
assertEquals(model.getName(), "foo");
assertEquals(model.getNamespace(), "tekton");
assertEquals(model.getKind(), "Pipeline");
assertTrue(model.getParams().size() == 1);
assertEquals(model.getParams().get(0).name(), "param1");
assertTrue(model.getInputResources().isEmpty());
assertTrue(model.getOutputResources().isEmpty());
assertTrue(model.getWorkspaces().isEmpty());
}
Aggregations