Ejemplo n.º 1
0
  @Test
  public void testCountryReferenceControl() {

    baseEntityService.deleteAll(CountryVO.class.getName());
    baseEntityService.deleteAll(CurrencyVO.class.getName());

    DictionaryEditorModuleTestUI<CurrencyVO> currencyEditor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.CURRENCY.CURRENCY_EDITOR);
    currencyEditor
        .getControl(MangoDemoDictionaryModel.CURRENCY.CURRENCY_EDITOR.CURRENCY_NAME)
        .setValue("AA");
    currencyEditor
        .getControl(MangoDemoDictionaryModel.CURRENCY.CURRENCY_EDITOR.CURRENCY_ISO_CODE)
        .setValue("AAA");
    currencyEditor.save();
    currencyEditor.assertHasNoErrors();

    currencyEditor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.CURRENCY.CURRENCY_EDITOR);
    currencyEditor
        .getControl(MangoDemoDictionaryModel.CURRENCY.CURRENCY_EDITOR.CURRENCY_NAME)
        .setValue("AB");
    currencyEditor
        .getControl(MangoDemoDictionaryModel.CURRENCY.CURRENCY_EDITOR.CURRENCY_ISO_CODE)
        .setValue("ABB");
    currencyEditor.save();
    currencyEditor.assertHasNoErrors();

    DictionaryEditorModuleTestUI<CountryVO> countryEditor =
        MangoClientSyncWebTest.getInstance()
            .openEditor(MangoDemoDictionaryModel.COUNTRY.COUNTRY_EDITOR);
    countryEditor
        .getControl(MangoDemoDictionaryModel.COUNTRY.COUNTRY_EDITOR.COUNTRY_ISO_CODE2)
        .setValue("BB");
    countryEditor
        .getControl(MangoDemoDictionaryModel.COUNTRY.COUNTRY_EDITOR.COUNTRY_ISO_CODE3)
        .setValue("BBB");
    countryEditor
        .getControl(MangoDemoDictionaryModel.COUNTRY.COUNTRY_EDITOR.COUNTRY_NAME)
        .setValue("BBBB");

    ReferenceTestControl<CurrencyVO> currencyControl =
        countryEditor.getControl(MangoDemoDictionaryModel.COUNTRY.COUNTRY_EDITOR.COUNTRY_CURRENCY);
    currencyControl.enterValue("a");
    currencyControl.assertHasSuggestions(2);

    currencyControl.enterValue("aa");
    currencyControl.assertHasSuggestions(1);
  }
Ejemplo n.º 2
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());

  }