Example #1
0
  @Test
  public void testDictionary1TextControl1() {

    DictionaryEditorModuleTestUI<Entity1VO> editor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1);
    TextTestControl control =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.TEXTCONTROL1);
    control.enterValue("abc");
    editor.save();

    editor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1);
    control =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.TEXTCONTROL1);
    control.enterValue("def");
    editor.save();

    DictionarySearchModuleTestUI<Entity1VO> search =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_SEARCH1);
    search.execute();
    search.assertSearchResults(2);

    TextTestControl filterTextControl1 =
        search.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1
                .DICTIONARY_SEARCH1
                .DICTIONARY_FILTER1
                .TEXTCONTROL1);
    filterTextControl1.enterValue("abc");

    // filter should not show errors
    filterTextControl1.enterValue("");
    filterTextControl1.assertHasNoErrors();

    filterTextControl1.enterValue("abc");
    search.execute();
    search.assertSearchResults(1);
    assertEquals("abc", search.getResultRow(0).getVO().getStringDatatype1());

    // test case insensitive search for text controls
    filterTextControl1.enterValue("ABC");
    search.execute();
    search.assertSearchResults(1);
    assertEquals("abc", search.getResultRow(0).getVO().getStringDatatype1());

    // test partial search for text controls
    filterTextControl1.enterValue("ab");
    search.execute();
    search.assertSearchResults(1);
    assertEquals("abc", search.getResultRow(0).getVO().getStringDatatype1());
  }
Example #2
0
  @Test
  public void testDictionary1EnumerationControl1() {

    DictionaryEditorModuleTestUI<Entity1VO> editor = createTestDictionaryEditor1();
    EnumerationTestControl<ENUMERATION1> control =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.ENUMERATIONCONTROL1);

    assertEquals(2, control.getEnumerationMap().size());

    Iterator<Map.Entry<String, String>> iterator =
        control.getEnumerationMap().entrySet().iterator();

    Map.Entry<String, String> entry1 = iterator.next();
    Map.Entry<String, String> entry2 = iterator.next();

    assertEquals("ENUMERATIONVALUE1", entry1.getKey().toString());
    assertEquals("ENUMERATIONVALUE1", entry1.getValue());
    assertEquals("ENUMERATIONVALUE2", entry2.getKey());
    assertEquals("Value2", entry2.getValue());

    control.enterValue("ENUMERATIONVALUE1");
    editor.save();

    editor = createTestDictionaryEditor1();
    control =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.ENUMERATIONCONTROL1);
    control.enterValue("ENUMERATIONVALUE2");
    editor.save();

    DictionarySearchModuleTestUI<Entity1VO> search =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_SEARCH1);
    search.execute();
    search.assertSearchResults(2);

    control =
        search.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1
                .DICTIONARY_SEARCH1
                .DICTIONARY_FILTER1
                .ENUMERATIONCONTROL1);
    control.enterValue("ENUMERATIONVALUE2");
    search.execute();
    search.assertSearchResults(1);
    assertEquals(
        "ENUMERATIONVALUE2", search.getResultRow(0).getVO().getEnumeration1Datatype().toString());

    editor = search.openEditor(0);
    control =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.ENUMERATIONCONTROL1);
    assertEquals("Value2", control.getValueString());
  }
Example #3
0
  @Test
  public void testDictionary1BooleanControl1() {

    // create true value
    DictionaryEditorModuleTestUI<Entity1VO> editor = createTestDictionaryEditor1();
    BooleanTestControl control =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.BOOLEAN_CONTROL1);
    control.uncheck();
    editor.save();

    // create false value
    editor = createTestDictionaryEditor1();
    control =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.BOOLEAN_CONTROL1);
    control.check();
    editor.save();

    // search all
    DictionarySearchModuleTestUI<Entity1VO> search =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_SEARCH1);
    search.execute();
    search.assertSearchResults(2);

    // search false
    control =
        search.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1
                .DICTIONARY_SEARCH1
                .DICTIONARY_FILTER1
                .BOOLEAN_CONTROL1);
    control.uncheck();
    search.execute();
    search.assertSearchResults(1);

    // search true
    control =
        search.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1
                .DICTIONARY_SEARCH1
                .DICTIONARY_FILTER1
                .BOOLEAN_CONTROL1);
    control.check();
    search.execute();
    search.assertSearchResults(1);

    editor = search.openEditor(0);
    control =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.BOOLEAN_CONTROL1);
    assertEquals("true", control.getValueString());
  }
Example #4
0
  @Test
  public void testDictionary1DateControl1() {

    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
    String date1 = df.format(new Date(2014, 8, 28));
    String date2 = df.format(new Date(2015, 9, 29));

    // create 1
    DictionaryEditorModuleTestUI<Entity1VO> editor = createDemoDictionary1Editor1();
    DateTestControl control =
        editor.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_EDITOR1.TABFOLDER1.TAB1.DATE_CONTROL1);
    control.enterValue("a");
    control.assertHasErrorWithText("'a' is not a valid date");
    control.enterValue(date1);
    editor.save();

    // create 2
    editor = createDemoDictionary1Editor1();
    control =
        editor.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_EDITOR1.TABFOLDER1.TAB1.DATE_CONTROL1);
    control.enterValue(date2);
    editor.save();

    // search all
    DictionarySearchModuleTestUI<Entity1VO> search =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1);
    search.execute();
    search.assertSearchResults(2);

    // search 1
    control =
        search.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1.DEMO_FILTER1.DATE_CONTROL1);
    control.enterValue(date1);
    search.execute();
    search.assertSearchResults(1);

    // search 2
    control =
        search.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1.DEMO_FILTER1.DATE_CONTROL1);
    control.enterValue(date2);
    search.execute();
    search.assertSearchResults(1);

    editor = search.openEditor(0);
    control =
        editor.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_EDITOR1.TABFOLDER1.TAB1.DATE_CONTROL1);
    assertEquals(date2, control.getValueString());
  }
Example #5
0
  @Test
  public void testBaseTableHookRowColor() {

    MangoDemoDictionaryModel.COUNTRY.COUNTRY_SEARCH.COUNTRY_RESULT.setTableHook(
        new BaseTableHook<CountryVO>() {
          @Override
          public String getStyleName(CountryVO tableRow) {
            if (tableRow.getCountryIsoCode2().equals("DE")) {
              return "style1";
            } else {
              return super.getStyleName(tableRow);
            }
          }
        });

    DictionaryEditorModuleTestUI<CountryVO> editor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.COUNTRY.COUNTRY_EDITOR);
    TextTestControl control =
        editor.getControl(MangoDemoDictionaryModel.COUNTRY.COUNTRY_EDITOR.COUNTRY_ISO_CODE2);
    control.enterValue("DE");
    editor.save();

    DictionarySearchModuleTestUI<Entity2VO> search =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.COUNTRY.COUNTRY_SEARCH);
    search.execute();
    search.assertSearchResults(1);

    assertEquals("style1", search.getResultRow(0).getStyleNames());
  }
Example #6
0
  @Test
  public void testDemoDictionary2TextControl2() {

    final AtomicBoolean called = new AtomicBoolean(false);

    MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_SEARCH2.addSearchHook(
        new BaseSearchHook<Entity2VO>() {

          @Override
          public SelectQuery<Entity2VO> beforeSearch(SelectQuery<Entity2VO> selectQuery) {
            called.set(true);
            return super.beforeSearch(selectQuery);
          }
        });

    DictionaryEditorModuleTestUI<Entity2VO> editor2 =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2);
    TextTestControl textControl2 =
        editor2.getControl(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2.TEXT_CONTROL2);
    textControl2.enterValue("abc");
    editor2.save();

    DictionarySearchModuleTestUI<Entity2VO> search2 =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_SEARCH2);
    search2.execute();
    search2.assertSearchResults(1);
    editor2 = search2.openEditor(0);
    textControl2 =
        editor2.getControl(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2.TEXT_CONTROL2);
    textControl2.assertValue("abc");

    await().untilAtomic(called, equalTo(true));
  }
Example #7
0
  @Test
  public void testDictionary1EnumerationControlWithouEntityAttrbiute() {

    final AtomicBoolean called = new AtomicBoolean(false);

    MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1.addSearchHook(
        new BaseSearchHook<Entity1VO>() {

          @Override
          public SelectQuery<Entity1VO> beforeSearch(SelectQuery<Entity1VO> selectQuery) {

            assertEquals(
                ENUMERATION1.ENUMERATIONVALUE1,
                selectQuery
                    .getData()
                    .get(
                        MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1.DEMO_FILTER1
                            .ENUMERATION_CONTROL1_WITHOUT_ATTRIBUTE.getFullQualifiedName()));

            called.set(true);

            return super.beforeSearch(selectQuery);
          }
        });

    DictionarySearchModuleTestUI<Entity1VO> search =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1);

    EnumerationTestControl<ENUMERATION1> control =
        search.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1
                .DEMO_SEARCH1
                .DEMO_FILTER1
                .ENUMERATION_CONTROL1_WITHOUT_ATTRIBUTE);
    control.setValue(ENUMERATION1.ENUMERATIONVALUE1);
    assertEquals(ENUMERATION1.ENUMERATIONVALUE1, control.getValue());

    search.execute();

    await().untilAtomic(called, equalTo(true));
  }
Example #8
0
  @Test
  public void testDictionary1ControlGroup1MultiFilter() {

    DictionaryEditorModuleTestUI<Entity1VO> editor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1);
    TextTestControl control1 =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.TEXTCONTROL1);
    TextTestControl control2 =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.TEXTCONTROL2);
    control1.enterValue("abc");
    control2.enterValue("cba");
    editor.save();

    editor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1);
    control1 =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.TEXTCONTROL1);
    control2 =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.TEXTCONTROL2);
    control1.enterValue("abd");
    control2.enterValue("dba");
    editor.save();

    editor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1);
    control1 =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.TEXTCONTROL1);
    control2 =
        editor.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_EDITOR1.TEXTCONTROL2);
    control1.enterValue("abe");
    control2.enterValue("abc");
    editor.save();

    DictionarySearchModuleTestUI<Entity1VO> search =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.TEST_DICTIONARY1.DICTIONARY_SEARCH1);
    search.execute();
    search.assertSearchResults(3);

    TextTestControl filterControl1 =
        search.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1
                .DICTIONARY_SEARCH1
                .DICTIONARY_FILTER1
                .TEXTCONTROL1);
    filterControl1.enterValue("abc");
    search.execute();
    search.assertSearchResults(1);
    assertEquals("abc", search.getResultRow(0).getVO().getStringDatatype1());

    filterControl1 =
        search.getControl(
            MangoDemoDictionaryModel.TEST_DICTIONARY1
                .DICTIONARY_SEARCH1
                .DICTIONARY_FILTER1
                .TEXTCONTROL1);
    filterControl1.enterValue("");
    search.execute();
    search.assertSearchResults(3);

    ControlGroupTestControl filterGroupControlTest =
        search.getGroupControlTest(
            MangoDemoDictionaryModel.TEST_DICTIONARY1
                .DICTIONARY_SEARCH1
                .DICTIONARY_FILTER1
                .CONTROL_GROUP1);
    filterGroupControlTest.enterValue("abc");

    search.execute();

    assertEquals(
        1,
        search.getModule().getDictionarySearch().getDictionaryResult().getHighlightTexts().size());
    assertEquals(
        "abc",
        search
            .getModule()
            .getDictionarySearch()
            .getDictionaryResult()
            .getHighlightTexts()
            .iterator()
            .next());

    search.assertSearchResults(2);

    filterGroupControlTest.enterValue("");
    search.execute();
    search.assertSearchResults(3);
  }
Example #9
0
  @Test
  public void testDictionary1IntegerControl1() {

    // create 1
    DictionaryEditorModuleTestUI<Entity1VO> editor = createDemoDictionary1Editor1();
    IntegerTestControl control =
        editor.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1
                .DEMO_EDITOR1
                .TABFOLDER1
                .TAB1
                .INTEGER_CONTROL1);
    control.enterValue("a");
    control.assertHasErrorWithText("'a' is not a valid integer");
    control.enterValue("1");
    editor.save();

    // create 2
    editor = createDemoDictionary1Editor1();
    control =
        editor.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1
                .DEMO_EDITOR1
                .TABFOLDER1
                .TAB1
                .INTEGER_CONTROL1);
    control.enterValue("2");
    editor.save();

    // search all
    DictionarySearchModuleTestUI<Entity1VO> search =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1);
    search.execute();
    search.assertSearchResults(2);

    // search 1
    control =
        search.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1.DEMO_FILTER1.INTEGER_CONTROL1);
    control.enterValue("1");
    search.execute();
    search.assertSearchResults(1);

    // search 2
    control =
        search.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1.DEMO_FILTER1.INTEGER_CONTROL1);
    control.enterValue("2");
    search.execute();
    search.assertSearchResults(1);

    editor = search.openEditor(0);
    control =
        editor.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1
                .DEMO_EDITOR1
                .TABFOLDER1
                .TAB1
                .INTEGER_CONTROL1);
    assertEquals("2", control.getValueString());
  }
Example #10
0
  @Test
  public void testDemoDictionary1ReferenceControl1() {

    DictionaryEditorModuleTestUI<Entity2VO> editor2 =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2);
    TextTestControl textControl2 =
        editor2.getControl(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2.TEXT_CONTROL2);
    textControl2.enterValue("abc");
    editor2.save();

    editor2 =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2);
    textControl2 =
        editor2.getControl(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2.TEXT_CONTROL2);
    textControl2.enterValue("def");
    editor2.save();

    editor2 =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2);
    textControl2 =
        editor2.getControl(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2.TEXT_CONTROL2);
    textControl2.enterValue("xxx");
    editor2.save();

    editor2 =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2);
    textControl2 =
        editor2.getControl(MangoDemoDictionaryModel.DEMO_DICTIONARY2.DEMO_EDITOR2.TEXT_CONTROL2);
    textControl2.enterValue("xyz");
    editor2.save();

    // dictionary1 (ghi)
    DictionaryEditorModuleTestUI<Entity1VO> editor1 =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_EDITOR1);
    TextTestControl textControl1 =
        editor1.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_EDITOR1.TABFOLDER1.TAB1.TEXT_CONTROL1);
    textControl1.enterValue("ghi");

    ReferenceTestControl<Entity2VO> referenceControl1 =
        editor1.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1
                .DEMO_EDITOR1
                .TABFOLDER1
                .TAB1
                .REFERENCE_CONTROL1);

    referenceControl1.enterValue("x");
    referenceControl1.assertHasSuggestions(2);

    referenceControl1.enterValue("1234");
    referenceControl1.leaveControl();
    referenceControl1.assertHasErrorWithText("'1234' could not be found");
    referenceControl1.enterValue("ab");
    editor1.save();
    referenceControl1.assertValueString("abc");

    // dictionary1 (jkl)
    editor1 =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_EDITOR1);
    textControl1 =
        editor1.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_EDITOR1.TABFOLDER1.TAB1.TEXT_CONTROL1);
    textControl1.enterValue("jkl");

    referenceControl1 =
        editor1.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1
                .DEMO_EDITOR1
                .TABFOLDER1
                .TAB1
                .REFERENCE_CONTROL1);
    referenceControl1.enterValue("def");
    editor1.save();
    referenceControl1.assertValueString("def");

    // search dictionary1
    DictionarySearchModuleTestUI<Entity1VO> search1 =
        MangoClientSyncWebTest.getInstance()
            .openSearch(MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1);
    referenceControl1 =
        search1.getControl(
            MangoDemoDictionaryModel.DEMO_DICTIONARY1.DEMO_SEARCH1.DEMO_FILTER1.REFERENCE_CONTROL1);
    referenceControl1.enterValue("abc");
    search1.execute();
    search1.assertSearchResults(1);

    // remove reference
    referenceControl1.enterValue("");
    search1.execute();
    search1.assertSearchResults(2);

    // assertEquals("abc",
    // search.getResultRow(0).getVO().getStringDatatype1());

  }