Search in sources :

Example 11 with Selection

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

the class TestSelection method testCreateDummy.

@Test
public void testCreateDummy() {
    Selection selectionRet = NavajoFactory.getInstance().createDummySelection();
    Assert.assertEquals("___DUMMY_ELEMENT___", selectionRet.getValue());
}
Also used : Selection(com.dexels.navajo.document.Selection) Test(org.junit.Test)

Example 12 with Selection

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

the class TestSelection method testIsSelectedWithObject3.

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

Example 13 with Selection

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

the class TestSelection method testGetName.

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

Example 14 with Selection

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

the class TestProperty method tesGetAllSelections.

@Test
public void tesGetAllSelections() {
    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.getAllSelections().iterator();
    int count = 3;
    Set<String> set = new HashSet<>();
    while (iter.hasNext()) {
        Selection s = iter.next();
        set.add(s.getName());
        if ((s.getName().equals("firstselection") || s.getName().equals("thirdselection") || s.getName().equals("secondselection")))
            count--;
    }
    Assert.assertEquals(3, set.size());
    Assert.assertEquals(0, count);
}
Also used : Selection(com.dexels.navajo.document.Selection) Property(com.dexels.navajo.document.Property) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 15 with Selection

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

the class TestProperty method tesGetSelection.

@Test
public void tesGetSelection() {
    Property testSelectionProp = NavajoFactory.getInstance().createProperty(testDoc, "testselectionproperty", "+", "mydesc", Property.DIR_IN);
    Selection s = NavajoFactory.getInstance().createSelection(testDoc, "myselection", "0", true);
    testSelectionProp.addSelection(s);
    Selection s1 = testSelectionProp.getSelection("myselection");
    Assert.assertNotNull(s1);
    Assert.assertEquals(s1.getName(), s.getName());
    Assert.assertEquals(s1.isSelected(), s.isSelected());
    Assert.assertEquals(s1.getValue(), s.getValue());
    s1 = testSelectionProp.getSelection("myselection2");
    Assert.assertNotNull(s1);
    Assert.assertEquals(Selection.DUMMY_SELECTION, s1.getName());
}
Also used : Selection(com.dexels.navajo.document.Selection) Property(com.dexels.navajo.document.Property) 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