use of au.gov.asd.tac.constellation.views.find2.components.advanced.utilities.AdvancedSearchParameters in project constellation by constellation-app.
the class AdvancedFindTabNGTest method testUpdateAdvancedSearchParameters.
/**
* Test of updateAdvancedSearchParameters method, of class AdvancedFindTab.
*/
@Test
public void testUpdateAdvancedSearchParameters() {
System.out.println("updateAdvancedSearchParameters");
final AdvancedSearchParameters controlllerParameters = FindViewController.getDefault().getCurrentAdvancedSearchParameters();
final GraphElementType elementType = GraphElementType.VERTEX;
/**
* Call the updateBasicFindParamters function. Check that each of the
* javaFX elements passes their corresponding data correctly to the
* controllers basicFindParamters
*/
advancedTab.updateAdvancedSearchParameters(elementType);
/**
* All parameters should equal the current value of the advancedFindTabs
* elements
*/
assertEquals(controlllerParameters.getCriteriaValuesList().size(), advancedTab.getCorrespondingCriteriaList(elementType).size());
assertEquals(controlllerParameters.getGraphElementType(), elementType);
assertEquals(controlllerParameters.getAllOrAny(), advancedTab.getMatchCriteriaChoiceBox().getSelectionModel().getSelectedItem());
assertEquals(controlllerParameters.getCurrentSelection(), advancedTab.getCurrentSelectionChoiceBox().getSelectionModel().getSelectedItem());
assertEquals(controlllerParameters.isSearchAllGraphs(), advancedTab.getSearchAllGraphs().isPressed());
}
use of au.gov.asd.tac.constellation.views.find2.components.advanced.utilities.AdvancedSearchParameters in project constellation by constellation-app.
the class AdvancedSearchParametersNGTest method testEquals.
/**
* Test of equals method, of class AdvancedSearchParameters.
*/
@Test
public void testEquals() {
System.out.println("equals");
populateCriteriaLists();
paramatersOne = new AdvancedSearchParameters(criteriaValuesListOne, GraphElementType.VERTEX, "Any", "Ignore", false);
paramatersTwo = new AdvancedSearchParameters();
paramatersTwo.copyParameters(paramatersOne);
boolean result = paramatersOne.equals(paramatersTwo);
assertEquals(result, true);
paramatersTwo = new AdvancedSearchParameters(criteriaValuesListTwo, GraphElementType.VERTEX, "All", "Ignore", true);
result = paramatersOne.equals(paramatersTwo);
assertEquals(result, false);
// float , colour, boolean, zoned datetime, icon
FindCriteriaValues valueOne = new FloatCriteriaValues("float", "x", "Is", 1);
FindCriteriaValues valueTwo = new FloatCriteriaValues("float", "x", "Is", 6);
criteriaValuesListOne.clear();
criteriaValuesListTwo.clear();
criteriaValuesListOne.add(valueOne);
criteriaValuesListTwo.add(valueTwo);
paramatersOne = new AdvancedSearchParameters(criteriaValuesListOne, GraphElementType.VERTEX, "Any", "Ignore", false);
paramatersTwo = new AdvancedSearchParameters(criteriaValuesListTwo, GraphElementType.VERTEX, "Any", "Ignore", false);
result = paramatersOne.equals(paramatersTwo);
assertEquals(result, false);
valueOne = new BooleanCriteriaValues("boolean", "dim", "Is", true);
valueTwo = new BooleanCriteriaValues("boolean", "dim", "Is", false);
criteriaValuesListOne.clear();
criteriaValuesListTwo.clear();
criteriaValuesListOne.add(valueOne);
criteriaValuesListTwo.add(valueTwo);
paramatersOne = new AdvancedSearchParameters(criteriaValuesListOne, GraphElementType.VERTEX, "Any", "Ignore", false);
paramatersTwo = new AdvancedSearchParameters(criteriaValuesListTwo, GraphElementType.VERTEX, "Any", "Ignore", false);
result = paramatersOne.equals(paramatersTwo);
assertEquals(result, false);
valueOne = new ColourCriteriaValues("color", "color", "Is", ConstellationColor.BLUE);
valueTwo = new ColourCriteriaValues("color", "color", "Is", ConstellationColor.GREEN);
criteriaValuesListOne.clear();
criteriaValuesListTwo.clear();
criteriaValuesListOne.add(valueOne);
criteriaValuesListTwo.add(valueTwo);
paramatersOne = new AdvancedSearchParameters(criteriaValuesListOne, GraphElementType.VERTEX, "Any", "Ignore", false);
paramatersTwo = new AdvancedSearchParameters(criteriaValuesListTwo, GraphElementType.VERTEX, "Any", "Ignore", false);
result = paramatersOne.equals(paramatersTwo);
assertEquals(result, false);
valueOne = new IconCriteriaValues("icon", "background_icon", "Is", IconManager.getIcon("Flag.Australia"));
valueTwo = new IconCriteriaValues("icon", "background_icon", "Is", IconManager.getIcon("Flag.England"));
criteriaValuesListOne.clear();
criteriaValuesListTwo.clear();
criteriaValuesListOne.add(valueOne);
criteriaValuesListTwo.add(valueTwo);
paramatersOne = new AdvancedSearchParameters(criteriaValuesListOne, GraphElementType.VERTEX, "Any", "Ignore", false);
paramatersTwo = new AdvancedSearchParameters(criteriaValuesListTwo, GraphElementType.VERTEX, "Any", "Ignore", false);
result = paramatersOne.equals(paramatersTwo);
assertEquals(result, false);
ZonedDateTime testTimeOne = ZonedDateTime.now();
ZonedDateTime testTimeTwo = ZonedDateTime.now().plusHours(2);
valueOne = new DateTimeCriteriaValues("datetime", "DateTime", "Occured On", formatDateTime(testTimeOne));
valueTwo = new DateTimeCriteriaValues("datetime", "DateTime", "Occured On", formatDateTime(testTimeTwo));
criteriaValuesListOne.clear();
criteriaValuesListTwo.clear();
criteriaValuesListOne.add(valueOne);
criteriaValuesListTwo.add(valueTwo);
paramatersOne = new AdvancedSearchParameters(criteriaValuesListOne, GraphElementType.TRANSACTION, "Any", "Ignore", false);
paramatersTwo = new AdvancedSearchParameters(criteriaValuesListTwo, GraphElementType.TRANSACTION, "Any", "Ignore", false);
result = paramatersOne.equals(paramatersTwo);
assertEquals(result, false);
}
Aggregations