Search in sources :

Example 26 with Callback

use of org.uberfire.client.callbacks.Callback in project drools-wb by kiegroup.

the class EnumLoaderUtilitiesTest method checkEmptyDefinition.

@Test
public void checkEmptyDefinition() {
    final Callback<Map<String, String>> callback = (result) -> assertTrue(result.isEmpty());
    enumLoaderUtilities.getEnums(new DropDownData(), callback, presenter, onFetchCommand, onFetchCompleteCommand);
    assertNoInteractions();
}
Also used : GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) EnumDropdownService(org.kie.workbench.common.services.shared.enums.EnumDropdownService) CallerMock(org.uberfire.mocks.CallerMock) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Mockito.spy(org.mockito.Mockito.spy) Mockito.verify(org.mockito.Mockito.verify) Mockito.never(org.mockito.Mockito.never) MockitoJUnitRunner(org.mockito.runners.MockitoJUnitRunner) Callback(org.uberfire.client.callbacks.Callback) Assert.assertFalse(org.junit.Assert.assertFalse) Map(java.util.Map) Caller(org.jboss.errai.common.client.api.Caller) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Mockito.any(org.mockito.Mockito.any) DropDownData(org.kie.soup.project.datamodel.oracle.DropDownData) Path(org.uberfire.backend.vfs.Path) Command(org.uberfire.mvp.Command) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) DropDownData(org.kie.soup.project.datamodel.oracle.DropDownData) Map(java.util.Map) Test(org.junit.Test)

Example 27 with Callback

use of org.uberfire.client.callbacks.Callback in project drools-wb by kiegroup.

the class ColumnDefinitionFactoryTest method knownColumnType_ActionSetFieldCol52.

@Test
@SuppressWarnings("unchecked")
public void knownColumnType_ActionSetFieldCol52() {
    final BaseColumn column = new ActionSetFieldCol52();
    final Callback<String> callback = mock(Callback.class);
    columnDefinitionFactory.generateColumnDefinition(dtPresenter, column, callback);
    verify(actionSetFieldCol52DefinitionBuilder, times(1)).generateDefinition(eq(dtPresenter), eq(column), any(Callback.class));
    verify(callback, times(1)).callback(any(String.class));
}
Also used : Callback(org.uberfire.client.callbacks.Callback) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) Test(org.junit.Test)

Example 28 with Callback

use of org.uberfire.client.callbacks.Callback in project drools-wb by kiegroup.

the class ColumnDefinitionFactoryTest method knownColumnType_ActionRetractFactCol52.

@Test
@SuppressWarnings("unchecked")
public void knownColumnType_ActionRetractFactCol52() {
    final BaseColumn column = new ActionRetractFactCol52();
    final Callback<String> callback = mock(Callback.class);
    columnDefinitionFactory.generateColumnDefinition(dtPresenter, column, callback);
    verify(actionRetractFactCol52DefinitionBuilder, times(1)).generateDefinition(eq(dtPresenter), eq(column), any(Callback.class));
    verify(callback, times(1)).callback(any(String.class));
}
Also used : Callback(org.uberfire.client.callbacks.Callback) ActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) Test(org.junit.Test)

Example 29 with Callback

use of org.uberfire.client.callbacks.Callback in project drools-wb by kiegroup.

the class CallbackFactoryTest method makeOnCreationCallbackListBoxSingleSelect.

@Test
@SuppressWarnings("unchecked")
public void makeOnCreationCallbackListBoxSingleSelect() {
    setupMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS, false);
    final Callback callback = CallbackFactory.makeOnCreationCallback(factory, cell, enumLookups);
    callback.callback(multiValueDOMElement);
    verifyMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS);
    verify(multiValueWidget, never()).setVisibleItemCount(anyInt());
}
Also used : Callback(org.uberfire.client.callbacks.Callback) Test(org.junit.Test)

Example 30 with Callback

use of org.uberfire.client.callbacks.Callback in project drools-wb by kiegroup.

the class CallbackFactoryTest method makeOnCreationCallbackListBoxMultipleSelect.

@Test
@SuppressWarnings("unchecked")
public void makeOnCreationCallbackListBoxMultipleSelect() {
    setupMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS, true);
    final Callback callback = CallbackFactory.makeOnCreationCallback(factory, cell, enumLookups);
    callback.callback(multiValueDOMElement);
    verifyMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS);
    verify(multiValueWidget).setVisibleItemCount(eq(CallbackFactory.MAX_VISIBLE_ROWS));
}
Also used : Callback(org.uberfire.client.callbacks.Callback) Test(org.junit.Test)

Aggregations

Callback (org.uberfire.client.callbacks.Callback)31 Test (org.junit.Test)21 List (java.util.List)7 ArrayList (java.util.ArrayList)6 Map (java.util.Map)6 HashMap (java.util.HashMap)4 Before (org.junit.Before)4 Path (org.uberfire.backend.vfs.Path)4 SortedMap (java.util.SortedMap)3 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)3 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)3 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)3 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)3 AbstractScenarioSimulationEditorTest (org.drools.workbench.screens.scenariosimulation.client.editor.AbstractScenarioSimulationEditorTest)3 Caller (org.jboss.errai.common.client.api.Caller)3 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)3 Assert.assertEquals (org.junit.Assert.assertEquals)3 Assert.assertFalse (org.junit.Assert.assertFalse)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 RunWith (org.junit.runner.RunWith)3