Search in sources :

Example 66 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestProperty method tesGetAllSelectedSelections.

@Test
public void tesGetAllSelectedSelections() {
    Property testSelectionProp = NavajoFactory.getInstance().createProperty(testDoc, "testselectionproperty", "+", "", Property.DIR_IN);
    Selection s1 = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", true);
    Selection s2 = NavajoFactory.getInstance().createSelection(testDoc, "secondselection", "1", false);
    Selection s3 = NavajoFactory.getInstance().createSelection(testDoc, "thirdselection", "2", true);
    testSelectionProp.addSelection(s1);
    testSelectionProp.addSelection(s2);
    testSelectionProp.addSelection(s3);
    Iterator<Selection> iter = testSelectionProp.getAllSelectedSelections().iterator();
    int count = 0;
    while (iter.hasNext()) {
        Selection s = iter.next();
        count++;
        Assert.assertTrue((s.getName().equals("firstselection") || s.getName().equals("thirdselection")));
        Assert.assertTrue(!s.getName().equals("secondselection"));
    }
    Assert.assertEquals(2, count);
}
Also used : Selection(com.dexels.navajo.document.Selection) Property(com.dexels.navajo.document.Property) Test(org.junit.Test)

Example 67 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestProperty method tesAddSelection.

@Test
public void tesAddSelection() {
    Property testSelectionProp = NavajoFactory.getInstance().createProperty(testDoc, "testselectionproperty", "+", "", Property.DIR_IN);
    Selection s1 = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", true);
    testSelectionProp.addSelection(s1);
    Selection s2 = testSelectionProp.getSelection("firstselection");
    Assert.assertNotNull(s2);
    Assert.assertEquals(s2.isSelected(), s1.isSelected());
    Assert.assertEquals(s2.getName(), s1.getName());
    Assert.assertEquals(s2.getValue(), s1.getValue());
    Selection s3 = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "1", false);
    testSelectionProp.addSelection(s3);
    s2 = testSelectionProp.getSelection("firstselection");
    Assert.assertNotNull(s2);
    Assert.assertEquals(s2.isSelected(), s3.isSelected());
    Assert.assertEquals(s2.getName(), s3.getName());
    Assert.assertEquals(s2.getValue(), s3.getValue());
}
Also used : Selection(com.dexels.navajo.document.Selection) Property(com.dexels.navajo.document.Property) Test(org.junit.Test)

Example 68 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestSelection method testGetValue.

@Test
public void testGetValue() {
    Selection selectionRet = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", true);
    Assert.assertEquals(selectionRet.getValue(), "0");
}
Also used : Selection(com.dexels.navajo.document.Selection) Test(org.junit.Test)

Example 69 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestSelection method testIsSelectedWithInteger1.

@Test
public void testIsSelectedWithInteger1() {
    Selection selectionRet = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", 0);
    selectionRet.setValue("1");
    Assert.assertTrue(!selectionRet.isSelected());
}
Also used : Selection(com.dexels.navajo.document.Selection) Test(org.junit.Test)

Example 70 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestSelection method testIsSelectedWithObject2.

@Test
public void testIsSelectedWithObject2() {
    Selection selectionRet = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", Integer.valueOf(11));
    selectionRet.setValue("1");
    Assert.assertTrue(selectionRet.isSelected());
}
Also used : Selection(com.dexels.navajo.document.Selection) Test(org.junit.Test)

Aggregations

Selection (com.dexels.navajo.document.Selection)78 Property (com.dexels.navajo.document.Property)36 Test (org.junit.Test)32 Message (com.dexels.navajo.document.Message)24 Navajo (com.dexels.navajo.document.Navajo)21 Access (com.dexels.navajo.script.api.Access)14 ImmutableMessage (com.dexels.immutable.api.ImmutableMessage)13 ContextExpression (com.dexels.navajo.expression.api.ContextExpression)12 TipiLink (com.dexels.navajo.expression.api.TipiLink)12 MappableTreeNode (com.dexels.navajo.script.api.MappableTreeNode)12 ArrayList (java.util.ArrayList)12 Optional (java.util.Optional)12 Operand (com.dexels.navajo.document.Operand)11 TMLExpressionException (com.dexels.navajo.expression.api.TMLExpressionException)11 List (java.util.List)8 NavajoException (com.dexels.navajo.document.NavajoException)6 UserException (com.dexels.navajo.script.api.UserException)4 Binary (com.dexels.navajo.document.types.Binary)3 FunctionClassification (com.dexels.navajo.expression.api.FunctionClassification)3 StringTokenizer (java.util.StringTokenizer)3