Search in sources :

Example 1 with LanguageRecognizer

use of com.redhat.devtools.alizer.api.LanguageRecognizer in project jbosstools-openshift by jbosstools.

the class LanguageRecognizerTest method checkLanguageRecognizerOnEmptyFolder.

@Test
public void checkLanguageRecognizerOnEmptyFolder() throws IOException {
    LanguageRecognizer recognize = new RecognizerFactory().createLanguageRecognizer();
    List<Language> languages = recognize.analyze(folder.newFolder().getAbsolutePath());
    assertTrue(languages.isEmpty());
}
Also used : LanguageRecognizer(com.redhat.devtools.alizer.api.LanguageRecognizer) Language(com.redhat.devtools.alizer.api.Language) RecognizerFactory(com.redhat.devtools.alizer.api.RecognizerFactory) Test(org.junit.Test)

Example 2 with LanguageRecognizer

use of com.redhat.devtools.alizer.api.LanguageRecognizer in project intellij-tekton by redhat-developer.

the class HubModelTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    watch = mock(Watch.class);
    when(tkn.getNamespace()).thenReturn("namespace");
    when(tkn.watchPipelines(anyString(), any())).thenReturn(watch);
    when(tkn.watchTasks(anyString(), any())).thenReturn(watch);
    when(tkn.watchClusterTasks(any())).thenReturn(watch);
    pipelinesNode = mock(PipelinesNode.class);
    clusterTasksNode = mock(ClusterTasksNode.class);
    recognizerFactory = mock(RecognizerFactory.class);
    languageRecognizer = mock(LanguageRecognizer.class);
    when(recognizerFactory.createLanguageRecognizer()).thenReturn(languageRecognizer);
    languageJAVA = new Language("java", Collections.emptyList(), 1.0, true);
    languageUnknown = new Language("Unknown", Collections.emptyList(), 1.0, false);
    resourceApi = mock(ResourceApi.class);
    resourceDataJAVA = mock(ResourceData.class);
    resourceVersionDataJAVA = mock(ResourceVersionData.class);
    when(resourceDataJAVA.getName()).thenReturn("java");
    when(resourceDataJAVA.getKind()).thenReturn(KIND_TASK);
    when(resourceDataJAVA.getLatestVersion()).thenReturn(resourceVersionDataJAVA);
    when(resourceVersionDataJAVA.getVersion()).thenReturn("v1");
    resourceDataGO = mock(ResourceData.class);
    resourceVersionDataGO = mock(ResourceVersionData.class);
    when(resourceDataGO.getName()).thenReturn("go");
    when(resourceDataGO.getKind()).thenReturn(KIND_TASK);
    when(resourceDataGO.getLatestVersion()).thenReturn(resourceVersionDataGO);
    when(resourceVersionDataGO.getVersion()).thenReturn("v1");
    resourceDataNET = mock(ResourceData.class);
    resourceVersionDataNET = mock(ResourceVersionData.class);
    when(resourceDataNET.getName()).thenReturn("net");
    when(resourceDataNET.getKind()).thenReturn(KIND_PIPELINE);
    when(resourceDataNET.getLatestVersion()).thenReturn(resourceVersionDataNET);
    when(resourceVersionDataNET.getVersion()).thenReturn("v1");
    when(project.getBasePath()).thenReturn(".");
    resources = new Resources();
    resources.addDataItem(resourceDataJAVA);
    resources.addDataItem(resourceDataGO);
}
Also used : PipelinesNode(com.redhat.devtools.intellij.tektoncd.tree.PipelinesNode) ResourceApi(com.redhat.devtools.intellij.tektoncd.hub.api.ResourceApi) ResourceData(com.redhat.devtools.intellij.tektoncd.hub.model.ResourceData) LanguageRecognizer(com.redhat.devtools.alizer.api.LanguageRecognizer) Language(com.redhat.devtools.alizer.api.Language) ResourceVersionData(com.redhat.devtools.intellij.tektoncd.hub.model.ResourceVersionData) Watch(io.fabric8.kubernetes.client.Watch) RecognizerFactory(com.redhat.devtools.alizer.api.RecognizerFactory) Resources(com.redhat.devtools.intellij.tektoncd.hub.model.Resources) ClusterTasksNode(com.redhat.devtools.intellij.tektoncd.tree.ClusterTasksNode) Before(org.junit.Before)

Aggregations

Language (com.redhat.devtools.alizer.api.Language)2 LanguageRecognizer (com.redhat.devtools.alizer.api.LanguageRecognizer)2 RecognizerFactory (com.redhat.devtools.alizer.api.RecognizerFactory)2 ResourceApi (com.redhat.devtools.intellij.tektoncd.hub.api.ResourceApi)1 ResourceData (com.redhat.devtools.intellij.tektoncd.hub.model.ResourceData)1 ResourceVersionData (com.redhat.devtools.intellij.tektoncd.hub.model.ResourceVersionData)1 Resources (com.redhat.devtools.intellij.tektoncd.hub.model.Resources)1 ClusterTasksNode (com.redhat.devtools.intellij.tektoncd.tree.ClusterTasksNode)1 PipelinesNode (com.redhat.devtools.intellij.tektoncd.tree.PipelinesNode)1 Watch (io.fabric8.kubernetes.client.Watch)1 Before (org.junit.Before)1 Test (org.junit.Test)1