use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class FindViewControllerNGTest method testGetCurrentBasicReplaceParameters.
/**
* Test of getCurrentBasicReplaceParameters method, of class
* FindViewController.
*/
@Test
public void testGetCurrentBasicReplaceParameters() {
System.out.println("getCurrentBasicReplaceParameters");
final FindViewTopComponent findViewTopComponent = mock(FindViewTopComponent.class);
FindViewController instance = FindViewController.getDefault().init(findViewTopComponent);
// Check getting getCurrentBasicReplaceParamters returns the default
// when it has not been set
BasicFindReplaceParameters defaultParameters = new BasicFindReplaceParameters();
instance.updateBasicReplaceParameters(defaultParameters);
assertEquals(instance.getCurrentBasicReplaceParameters(), defaultParameters);
// Check getting getCurrentBasicReplaceParamters returns the parameters it has been set to
// it has been set to when it has not been set
instance.updateBasicReplaceParameters(parameters2);
assertEquals(instance.getCurrentBasicReplaceParameters(), parameters2);
}
use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class FindViewControllerNGTest method testUpdateBasicFindParameters.
/**
* Test of updateBasicFindParameters method, of class FindViewController.
*/
@Test
public void testUpdateBasicFindParameters() {
System.out.println("updateBasicFindParameters");
FindViewController instance = FindViewController.getDefault();
List<Attribute> attributeList = new ArrayList<>();
BasicFindReplaceParameters parameters = new BasicFindReplaceParameters("equal", "", GraphElementType.GRAPH.VERTEX, attributeList, true, false, false, false, false, false, false, false, false);
instance.updateBasicFindParameters(parameters);
BasicFindReplaceParameters result = instance.getCurrentBasicFindParameters();
// The object is copied in the updateBasicFindParameters function
// This will cause a direct comparison of the object to be false
assertEquals(result, parameters);
BasicFindReplaceParameters parameters2 = new BasicFindReplaceParameters("notEqual", "", GraphElementType.GRAPH.VERTEX, attributeList, true, false, false, false, false, false, false, false, false);
assertNotEquals(result, parameters2);
// TODO review the generated test code and remove the default call to fail.
}
use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class FindViewTopComponentNGTest method setupGraph.
private void setupGraph() {
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
graphMap.put(graph.getId(), graph);
try {
WritableGraph wg = graph.getWritableGraph("", true);
final int stateId = FindViewConcept.MetaAttribute.FINDVIEW_STATE.ensure(wg);
ArrayList<Attribute> attributeList = new ArrayList<>();
BasicFindReplaceParameters parameters = new BasicFindReplaceParameters("label name", "", GraphElementType.GRAPH.VERTEX, attributeList, true, false, false, false, false, false, false, false, false);
FindResultsList foundResult = new FindResultsList(2, parameters, graph.getId());
wg.setObjectValue(stateId, 0, foundResult);
wg.commit();
} catch (final InterruptedException ex) {
Exceptions.printStackTrace(ex);
Thread.currentThread().interrupt();
}
}
use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class BasicFindTabNGTest method testUpdateBasicFindParamters.
/**
* This test should test the updateBasicFindParamters function. It should
* take all the UI element selections by the user and update the
* basicFindParameters in the controller. To check this works the
* controllers parameters should be the same as the UI elements.
*/
@Test
public void testUpdateBasicFindParamters() {
System.out.println("updateBasicFindParamters");
final BasicFindReplaceParameters controlllerParameters = FindViewController.getDefault().getCurrentBasicFindParameters();
basicFindTab.lookForChoiceBox.getSelectionModel().select(0);
basicFindTab.getFindTextField().setText("test");
final GraphElementType elementType = GraphElementType.getValue(basicFindTab.lookForChoiceBox.getSelectionModel().getSelectedItem());
basicFindTab.currentSelectionChoiceBox.getSelectionModel().select(0);
/**
* Call the updateBasicFindParamters function. Check that each of the
* javaFX elements passes their corresponding data correctly to the
* controllers basicFindParamters
*/
basicFindTab.updateBasicFindParamters();
/**
* All parameters should equal the current value of the basicFindTabs
* elements
*/
assertEquals(controlllerParameters.getFindString(), basicFindTab.getFindTextField().getText());
assertEquals(controlllerParameters.getReplaceString(), "");
assertEquals(controlllerParameters.getGraphElement(), elementType);
assertEquals(controlllerParameters.getAttributeList(), basicFindTab.getMatchingAttributeList(elementType));
assertEquals(controlllerParameters.isStandardText(), basicFindTab.standardRadioBtn.isSelected());
assertEquals(controlllerParameters.isRegEx(), basicFindTab.regExBtn.isSelected());
assertEquals(controlllerParameters.isIgnoreCase(), basicFindTab.ignoreCaseCB.isSelected());
/**
* All 4 should be false as currentSelectionChoiceBox is set to select
* index 0 which is "Ignore"
*/
assertEquals(controlllerParameters.isFindIn(), false);
assertEquals(controlllerParameters.isAddTo(), false);
assertEquals(controlllerParameters.isRemoveFrom(), false);
assertEquals(controlllerParameters.isReplaceIn(), false);
assertEquals(controlllerParameters.isSearchAllGraphs(), basicFindTab.searchAllGraphs.isSelected());
}
use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class ReplaceTabNGTest method testUpdateBasicReplaceParamters.
/**
* Test of updateBasicReplaceParamters method, of class ReplaceTab.
*/
@Test
public void testUpdateBasicReplaceParamters() {
System.out.println("updateBasicReplaceParamters");
final BasicFindReplaceParameters controlllerParameters = FindViewController.getDefault().getCurrentBasicReplaceParameters();
replaceTab.lookForChoiceBox.getSelectionModel().select(0);
replaceTab.getFindTextField().setText("test");
replaceTab.getReplaceTextField().setText("replace");
final GraphElementType elementType = GraphElementType.getValue(replaceTab.lookForChoiceBox.getSelectionModel().getSelectedItem());
replaceTab.currentSelectionChoiceBox.getSelectionModel().select(0);
/**
* Call the updateBasicFindParamters function. Check that each of the
* javaFX elements passes their corresponding data correctly to the
* controllers basicFindParamters
*/
replaceTab.updateBasicReplaceParamters();
/**
* All parameters should equal the current value of the basicFindTabs
* elements
*/
assertEquals(controlllerParameters.getFindString(), replaceTab.getFindTextField().getText());
assertEquals(controlllerParameters.getReplaceString(), replaceTab.getReplaceTextField().getText());
assertEquals(controlllerParameters.getGraphElement(), elementType);
assertEquals(controlllerParameters.getAttributeList(), replaceTab.getMatchingAttributeList(elementType));
assertEquals(controlllerParameters.isStandardText(), replaceTab.standardRadioBtn.isSelected());
assertEquals(controlllerParameters.isRegEx(), replaceTab.regExBtn.isSelected());
assertEquals(controlllerParameters.isIgnoreCase(), replaceTab.ignoreCaseCB.isSelected());
/**
* All 4 should be false as currentSelectionChoiceBox is set to select
* index 0 which is "Ignore"
*/
assertEquals(controlllerParameters.isFindIn(), false);
assertEquals(controlllerParameters.isAddTo(), false);
assertEquals(controlllerParameters.isRemoveFrom(), false);
assertEquals(controlllerParameters.isReplaceIn(), false);
assertEquals(controlllerParameters.isSearchAllGraphs(), replaceTab.searchAllGraphs.isSelected());
// TODO review the generated test code and remove the default call to fail.
}
Aggregations