コード例 #1
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));
  }
コード例 #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());
  }
コード例 #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());
  }
コード例 #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());
  }
コード例 #5
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());
  }