Search in sources :

Example 16 with PluginExecution

use of au.gov.asd.tac.constellation.plugins.PluginExecution in project constellation by constellation-app.

the class ActiveTableReferenceNGTest method updateVisibleColumnsAdd.

@Test
public void updateVisibleColumnsAdd() {
    try (MockedStatic<PluginExecution> pluginExecutionMockedStatic = Mockito.mockStatic(PluginExecution.class)) {
        final Graph graph = mock(Graph.class);
        final Attribute attribute = mock(Attribute.class);
        final PluginExecution pluginExecution = mock(PluginExecution.class);
        final List<Tuple<String, Attribute>> paramColumnAttributes = List.of(Tuple.create("paramAttr", attribute));
        final List<Tuple<String, Attribute>> stateColumnAttributes = List.of(Tuple.create("stateAttr", attribute), Tuple.create("paramAttr", attribute));
        final TableViewState tableViewState = new TableViewState();
        tableViewState.setColumnAttributes(stateColumnAttributes);
        pluginExecutionMockedStatic.when(() -> PluginExecution.withPlugin(any(Plugin.class))).thenAnswer(executeUpdateStatePlugin(pluginExecution, tableViewState, List.of(Tuple.create("stateAttr", attribute), Tuple.create("paramAttr", attribute), Tuple.create("paramAttr", attribute))));
        activeTableReference.updateVisibleColumns(graph, tableViewState, paramColumnAttributes, UpdateMethod.ADD);
        verify(pluginExecution).executeLater(graph);
    }
}
Also used : PluginExecution(au.gov.asd.tac.constellation.plugins.PluginExecution) Graph(au.gov.asd.tac.constellation.graph.Graph) Attribute(au.gov.asd.tac.constellation.graph.Attribute) TableViewState(au.gov.asd.tac.constellation.views.tableview.state.TableViewState) Tuple(au.gov.asd.tac.constellation.utilities.datastructure.Tuple) Plugin(au.gov.asd.tac.constellation.plugins.Plugin) UpdateStatePlugin(au.gov.asd.tac.constellation.views.tableview.plugins.UpdateStatePlugin) Test(org.testng.annotations.Test)

Example 17 with PluginExecution

use of au.gov.asd.tac.constellation.plugins.PluginExecution in project constellation by constellation-app.

the class ActiveTableReferenceNGTest method updateVisibleColumnsReplace.

@Test
public void updateVisibleColumnsReplace() {
    try (MockedStatic<PluginExecution> pluginExecutionMockedStatic = Mockito.mockStatic(PluginExecution.class)) {
        final Graph graph = mock(Graph.class);
        final Attribute attribute = mock(Attribute.class);
        final PluginExecution pluginExecution = mock(PluginExecution.class);
        final List<Tuple<String, Attribute>> paramColumnAttributes = List.of(Tuple.create("paramAttr", attribute));
        final List<Tuple<String, Attribute>> stateColumnAttributes = List.of(Tuple.create("stateAttr1", attribute), Tuple.create("stateAttr2", attribute));
        final TableViewState tableViewState = new TableViewState();
        tableViewState.setColumnAttributes(stateColumnAttributes);
        pluginExecutionMockedStatic.when(() -> PluginExecution.withPlugin(any(Plugin.class))).thenAnswer(executeUpdateStatePlugin(pluginExecution, tableViewState, List.of(Tuple.create("paramAttr", attribute))));
        activeTableReference.updateVisibleColumns(graph, tableViewState, paramColumnAttributes, UpdateMethod.REPLACE);
        verify(pluginExecution).executeLater(graph);
    }
}
Also used : PluginExecution(au.gov.asd.tac.constellation.plugins.PluginExecution) Graph(au.gov.asd.tac.constellation.graph.Graph) Attribute(au.gov.asd.tac.constellation.graph.Attribute) TableViewState(au.gov.asd.tac.constellation.views.tableview.state.TableViewState) Tuple(au.gov.asd.tac.constellation.utilities.datastructure.Tuple) Plugin(au.gov.asd.tac.constellation.plugins.Plugin) UpdateStatePlugin(au.gov.asd.tac.constellation.views.tableview.plugins.UpdateStatePlugin) Test(org.testng.annotations.Test)

Aggregations

PluginExecution (au.gov.asd.tac.constellation.plugins.PluginExecution)17 Graph (au.gov.asd.tac.constellation.graph.Graph)11 Test (org.testng.annotations.Test)11 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)9 TableViewState (au.gov.asd.tac.constellation.views.tableview.state.TableViewState)8 UpdateStatePlugin (au.gov.asd.tac.constellation.views.tableview.plugins.UpdateStatePlugin)7 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)4 GraphManager (au.gov.asd.tac.constellation.graph.manager.GraphManager)4 ActionEvent (javafx.event.ActionEvent)4 Attribute (au.gov.asd.tac.constellation.graph.Attribute)3 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)3 Tuple (au.gov.asd.tac.constellation.utilities.datastructure.Tuple)3 ObservableList (javafx.collections.ObservableList)3 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)2 DualGraph (au.gov.asd.tac.constellation.graph.locking.DualGraph)2 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)2 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)2 SimplePlugin (au.gov.asd.tac.constellation.plugins.templates.SimplePlugin)2 FileChooser (au.gov.asd.tac.constellation.utilities.gui.filechooser.FileChooser)2 ExportMenuItemActionHandler (au.gov.asd.tac.constellation.views.tableview.components.ExportMenu.ExportMenuItemActionHandler)2