@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)); }
@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()); }