Search in sources :

Example 1 with WatchHandler

use of com.redhat.devtools.intellij.tektoncd.utils.WatchHandler in project intellij-tekton by redhat-developer.

the class TektonTreeStructureTest method before.

@Before
public void before() throws Exception {
    this.project = mock(Project.class);
    this.structure = mock(TektonTreeStructure.class, org.mockito.Mockito.CALLS_REAL_METHODS);
    this.root = spy(new TektonRootNode(project));
    this.tkn = mock(Tkn.class);
    when(root.getTkn()).thenReturn(tkn);
    this.parent = new NamespaceNode(root, "parent");
    Field rootField = TektonTreeStructure.class.getDeclaredField("root");
    rootField.setAccessible(true);
    rootField.set(structure, root);
    config = createConfig("cluster", "namespace", "token", "user");
    Field configField = TektonTreeStructure.class.getDeclaredField("config");
    configField.setAccessible(true);
    configField.set(structure, config);
    this.configWatcher = mock(ConfigWatcher.class);
    this.tknCliFactory = mock(TknCliFactory.class);
    this.metadata1 = new ObjectMeta();
    this.metadata1.setName("test1");
    this.metadata2 = new ObjectMeta();
    this.metadata2.setName("test2");
    this.metadata3 = new ObjectMeta();
    this.metadata3.setName("test3");
    this.watchHandler = mock(WatchHandler.class);
    when(tkn.getWatchHandler()).thenReturn(watchHandler);
    when(watchHandler.canBeWatched(any())).thenReturn(false);
}
Also used : Project(com.intellij.openapi.project.Project) Field(java.lang.reflect.Field) ObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta) ConfigWatcher(com.redhat.devtools.intellij.common.utils.ConfigWatcher) Tkn(com.redhat.devtools.intellij.tektoncd.tkn.Tkn) TknCliFactory(com.redhat.devtools.intellij.tektoncd.tkn.TknCliFactory) WatchHandler(com.redhat.devtools.intellij.tektoncd.utils.WatchHandler) Before(org.junit.Before)

Aggregations

Project (com.intellij.openapi.project.Project)1 ConfigWatcher (com.redhat.devtools.intellij.common.utils.ConfigWatcher)1 Tkn (com.redhat.devtools.intellij.tektoncd.tkn.Tkn)1 TknCliFactory (com.redhat.devtools.intellij.tektoncd.tkn.TknCliFactory)1 WatchHandler (com.redhat.devtools.intellij.tektoncd.utils.WatchHandler)1 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)1 Field (java.lang.reflect.Field)1 Before (org.junit.Before)1