Пример #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());
  }
Пример #2
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());
  }
Пример #3
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());
  }
Пример #4
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);
  }