示例#1
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());

  }