Search in sources :

Example 1 with FindViewTopComponent

use of au.gov.asd.tac.constellation.views.find2.FindViewTopComponent in project constellation by constellation-app.

the class BasicFindPluginNGTest method getAttributes.

/**
 * Used to convert the string variant of attributes to the Attribute object
 *
 * @return the list of Attribute objects
 */
private ArrayList<Attribute> getAttributes() {
    final FindViewTopComponent findViewTopComponent = mock(FindViewTopComponent.class);
    FindViewController instance = FindViewController.getDefault().init(findViewTopComponent);
    final GraphManager gm = Mockito.mock(GraphManager.class);
    when(gm.getAllGraphs()).thenReturn(graphMap);
    ArrayList<Attribute> attributes = new ArrayList<>();
    try (MockedStatic<GraphManager> mockedStatic = Mockito.mockStatic(GraphManager.class)) {
        mockedStatic.when(() -> GraphManager.getDefault()).thenReturn(gm);
        GraphElementType type = GraphElementType.VERTEX;
        List<String> result = instance.populateAttributes(type, attributes, Long.MIN_VALUE);
        ReadableGraph rg = graph.getReadableGraph();
        for (int i = 0; i < result.size(); i++) {
            int attributeInt = rg.getAttribute(type, result.get(i));
            GraphAttribute ga = new GraphAttribute(rg, attributeInt);
            if (ga.getAttributeType().equals("string")) {
                attributes.add(new GraphAttribute(rg, attributeInt));
                System.out.println(attributes.get(i).getName() + " = attribute name");
            }
        }
        rg.close();
    }
    return attributes;
}
Also used : ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) GraphManager(au.gov.asd.tac.constellation.graph.manager.GraphManager) Attribute(au.gov.asd.tac.constellation.graph.Attribute) GraphAttribute(au.gov.asd.tac.constellation.graph.GraphAttribute) GraphAttribute(au.gov.asd.tac.constellation.graph.GraphAttribute) ArrayList(java.util.ArrayList) FindViewTopComponent(au.gov.asd.tac.constellation.views.find2.FindViewTopComponent) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) FindViewController(au.gov.asd.tac.constellation.views.find2.FindViewController)

Example 2 with FindViewTopComponent

use of au.gov.asd.tac.constellation.views.find2.FindViewTopComponent in project constellation by constellation-app.

the class ReplacePluginNGTest method getAttributes.

/**
 * Used to convert the string variant of attributes to the Attribute object
 *
 * @return the list of Attribute objects
 */
private ArrayList<Attribute> getAttributes() {
    final FindViewTopComponent findViewTopComponent = mock(FindViewTopComponent.class);
    FindViewController instance = FindViewController.getDefault().init(findViewTopComponent);
    final GraphManager gm = Mockito.mock(GraphManager.class);
    when(gm.getAllGraphs()).thenReturn(graphMap);
    ArrayList<Attribute> attributes = new ArrayList<>();
    try (MockedStatic<GraphManager> mockedStatic = Mockito.mockStatic(GraphManager.class)) {
        mockedStatic.when(() -> GraphManager.getDefault()).thenReturn(gm);
        GraphElementType type = GraphElementType.VERTEX;
        List<String> result = instance.populateAttributes(type, attributes, Long.MIN_VALUE);
        ReadableGraph rg = graph.getReadableGraph();
        for (int i = 0; i < result.size(); i++) {
            int attributeInt = rg.getAttribute(type, result.get(i));
            GraphAttribute ga = new GraphAttribute(rg, attributeInt);
            if (ga.getAttributeType().equals("string")) {
                attributes.add(new GraphAttribute(rg, attributeInt));
            }
        }
        rg.close();
    }
    return attributes;
}
Also used : ReadableGraph(au.gov.asd.tac.constellation.graph.ReadableGraph) GraphManager(au.gov.asd.tac.constellation.graph.manager.GraphManager) Attribute(au.gov.asd.tac.constellation.graph.Attribute) GraphAttribute(au.gov.asd.tac.constellation.graph.GraphAttribute) GraphAttribute(au.gov.asd.tac.constellation.graph.GraphAttribute) ArrayList(java.util.ArrayList) FindViewTopComponent(au.gov.asd.tac.constellation.views.find2.FindViewTopComponent) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) FindViewController(au.gov.asd.tac.constellation.views.find2.FindViewController)

Example 3 with FindViewTopComponent

use of au.gov.asd.tac.constellation.views.find2.FindViewTopComponent in project constellation by constellation-app.

the class BooleanCriteriaPanelNGTest method setUpMethod.

@BeforeMethod
public void setUpMethod() throws Exception {
    findViewTopComponent = mock(FindViewTopComponent.class);
    spyTopComponent = spy(findViewTopComponent);
    findViewPane = mock(FindViewPane.class);
    findViewTabs = mock(FindViewTabs.class);
    FindViewController.getDefault();
    basicFindTab = mock(BasicFindTab.class);
    replaceTab = mock(ReplaceTab.class);
    when(findViewTabs.getParentComponent()).thenReturn(findViewPane);
    when(findViewPane.getTabs()).thenReturn(findViewTabs);
    when(findViewTabs.getBasicFindTab()).thenReturn(basicFindTab);
    when(findViewTabs.getReplaceTab()).thenReturn(replaceTab);
    when(findViewTabs.getAdvancedFindTab()).thenReturn(advancedTab);
    advancedTab = new AdvancedFindTab(findViewTabs);
}
Also used : ReplaceTab(au.gov.asd.tac.constellation.views.find2.components.ReplaceTab) AdvancedFindTab(au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab) FindViewTabs(au.gov.asd.tac.constellation.views.find2.components.FindViewTabs) BasicFindTab(au.gov.asd.tac.constellation.views.find2.components.BasicFindTab) FindViewTopComponent(au.gov.asd.tac.constellation.views.find2.FindViewTopComponent) FindViewPane(au.gov.asd.tac.constellation.views.find2.components.FindViewPane) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with FindViewTopComponent

use of au.gov.asd.tac.constellation.views.find2.FindViewTopComponent in project constellation by constellation-app.

the class FloatCriteriaPanelNGTest method setUpMethod.

@BeforeMethod
public void setUpMethod() throws Exception {
    findViewTopComponent = mock(FindViewTopComponent.class);
    spyTopComponent = spy(findViewTopComponent);
    findViewPane = mock(FindViewPane.class);
    findViewTabs = mock(FindViewTabs.class);
    FindViewController.getDefault();
    basicFindTab = mock(BasicFindTab.class);
    replaceTab = mock(ReplaceTab.class);
    when(findViewTabs.getParentComponent()).thenReturn(findViewPane);
    when(findViewPane.getTabs()).thenReturn(findViewTabs);
    when(findViewTabs.getBasicFindTab()).thenReturn(basicFindTab);
    when(findViewTabs.getReplaceTab()).thenReturn(replaceTab);
    when(findViewTabs.getAdvancedFindTab()).thenReturn(advancedTab);
    advancedTab = new AdvancedFindTab(findViewTabs);
}
Also used : ReplaceTab(au.gov.asd.tac.constellation.views.find2.components.ReplaceTab) AdvancedFindTab(au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab) FindViewTabs(au.gov.asd.tac.constellation.views.find2.components.FindViewTabs) BasicFindTab(au.gov.asd.tac.constellation.views.find2.components.BasicFindTab) FindViewTopComponent(au.gov.asd.tac.constellation.views.find2.FindViewTopComponent) FindViewPane(au.gov.asd.tac.constellation.views.find2.components.FindViewPane) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 5 with FindViewTopComponent

use of au.gov.asd.tac.constellation.views.find2.FindViewTopComponent in project constellation by constellation-app.

the class StringCriteriaPanelNGTest method setUpMethod.

@BeforeMethod
public void setUpMethod() throws Exception {
    findViewTopComponent = mock(FindViewTopComponent.class);
    spyTopComponent = spy(findViewTopComponent);
    findViewPane = mock(FindViewPane.class);
    findViewTabs = mock(FindViewTabs.class);
    FindViewController.getDefault();
    basicFindTab = mock(BasicFindTab.class);
    replaceTab = mock(ReplaceTab.class);
    when(findViewTabs.getParentComponent()).thenReturn(findViewPane);
    when(findViewPane.getTabs()).thenReturn(findViewTabs);
    when(findViewTabs.getBasicFindTab()).thenReturn(basicFindTab);
    when(findViewTabs.getReplaceTab()).thenReturn(replaceTab);
    when(findViewTabs.getAdvancedFindTab()).thenReturn(advancedTab);
    advancedTab = new AdvancedFindTab(findViewTabs);
}
Also used : ReplaceTab(au.gov.asd.tac.constellation.views.find2.components.ReplaceTab) AdvancedFindTab(au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab) FindViewTabs(au.gov.asd.tac.constellation.views.find2.components.FindViewTabs) BasicFindTab(au.gov.asd.tac.constellation.views.find2.components.BasicFindTab) FindViewTopComponent(au.gov.asd.tac.constellation.views.find2.FindViewTopComponent) FindViewPane(au.gov.asd.tac.constellation.views.find2.components.FindViewPane) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

FindViewTopComponent (au.gov.asd.tac.constellation.views.find2.FindViewTopComponent)6 AdvancedFindTab (au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab)4 BasicFindTab (au.gov.asd.tac.constellation.views.find2.components.BasicFindTab)4 FindViewPane (au.gov.asd.tac.constellation.views.find2.components.FindViewPane)4 FindViewTabs (au.gov.asd.tac.constellation.views.find2.components.FindViewTabs)4 ReplaceTab (au.gov.asd.tac.constellation.views.find2.components.ReplaceTab)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 Attribute (au.gov.asd.tac.constellation.graph.Attribute)2 GraphAttribute (au.gov.asd.tac.constellation.graph.GraphAttribute)2 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)2 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)2 GraphManager (au.gov.asd.tac.constellation.graph.manager.GraphManager)2 FindViewController (au.gov.asd.tac.constellation.views.find2.FindViewController)2 BasicFindReplaceParameters (au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters)2 ArrayList (java.util.ArrayList)2 Test (org.testng.annotations.Test)2