Search in sources :

Example 6 with AdvancedSearchParameters

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());
}
Also used : AdvancedSearchParameters(au.gov.asd.tac.constellation.views.find2.components.advanced.utilities.AdvancedSearchParameters) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) Test(org.testng.annotations.Test)

Example 7 with AdvancedSearchParameters

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);
}
Also used : FindCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues) IconCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.IconCriteriaValues) ZonedDateTime(java.time.ZonedDateTime) ColourCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.ColourCriteriaValues) BooleanCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.BooleanCriteriaValues) DateTimeCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.DateTimeCriteriaValues) FloatCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FloatCriteriaValues) Test(org.testng.annotations.Test)

Aggregations

FindCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues)6 AdvancedSearchParameters (au.gov.asd.tac.constellation.views.find2.components.advanced.utilities.AdvancedSearchParameters)5 Test (org.testng.annotations.Test)4 BooleanCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.BooleanCriteriaValues)3 ColourCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.ColourCriteriaValues)3 DateTimeCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.DateTimeCriteriaValues)3 FloatCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FloatCriteriaValues)3 IconCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.IconCriteriaValues)3 StringCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.StringCriteriaValues)3 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)2 ArrayList (java.util.ArrayList)2 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)1 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)1 FindResult (au.gov.asd.tac.constellation.views.find2.utilities.FindResult)1 FindResultsList (au.gov.asd.tac.constellation.views.find2.utilities.FindResultsList)1 ZonedDateTime (java.time.ZonedDateTime)1 HashSet (java.util.HashSet)1