use of com.google.gwt.event.shared.EventBus in project activityinfo by bedatadriven.
the class OfflineStore method getCachedMetadata.
/**
* Try to load a cached FormSchema from the offline store.
*/
public Observable<FormMetadata> getCachedMetadata(ResourceId formId) {
Observable<FormClass> schema = new ObservableTask<>(new SchemaQuery(database, formId), new FormChangeWatcher(eventBus, change -> change.isFormChanged(formId)));
Observable<FormMetadataObject> metadata = new ObservableTask<>(new MetadataQuery(database, formId), new FormChangeWatcher(eventBus, change -> change.isFormChanged(formId)));
return Observable.transform(schema, metadata, (s, m) -> FormMetadata.of(m.getVersion(), s, m.getPermissions()));
}
use of com.google.gwt.event.shared.EventBus in project drools-wb by kiegroup.
the class BaseSynchronizerTest method setup.
@Before
public void setup() {
// Setup model related classes
model = new GuidedDecisionTable52();
uiModel = new GuidedDecisionTableUiModel(modelSynchronizer);
incrementalDataModelServiceCaller = new CallerMock<>(incrementalDataModelService);
final BRLRuleModel rm = new BRLRuleModel(model);
final CellUtilities cellUtilities = new CellUtilities();
final ColumnUtilities columnUtilities = new ColumnUtilities(model, oracle);
final DependentEnumsUtilities enumsUtilities = new DependentEnumsUtilities(model, oracle);
final GridWidgetCellFactory gridWidgetCellFactory = new GridWidgetCellFactoryImpl();
// Setup mocks
final GuidedDecisionTableModellerView.Presenter modellerPresenter = mock(GuidedDecisionTableModellerView.Presenter.class);
final GuidedDecisionTableModellerView modellerView = mock(GuidedDecisionTableModellerView.class);
final GridLayer gridLayer = mock(GridLayer.class);
final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);
final GuidedDecisionTableView.Presenter dtablePresenter = mock(GuidedDecisionTableView.Presenter.class);
final EventBus eventBus = mock(EventBus.class);
when(dtablePresenter.getModellerPresenter()).thenReturn(modellerPresenter);
when(modellerPresenter.getView()).thenReturn(modellerView);
when(modellerView.getGridLayerView()).thenReturn(gridLayer);
when(gridLayer.getDomElementContainer()).thenReturn(domElementContainer);
when(domElementContainer.iterator()).thenReturn(mock(Iterator.class));
// Setup column converters
final List<BaseColumnConverter> converters = getConverters();
gridWidgetColumnFactory.setConverters(converters);
gridWidgetColumnFactory.initialise(model, oracle, columnUtilities, dtablePresenter);
// Setup synchronizers
final List<Synchronizer<? extends MetaData, ? extends MetaData, ? extends MetaData, ? extends MetaData, ? extends MetaData>> synchronizers = getSynchronizers();
modelSynchronizer.setSynchronizers(synchronizers);
modelSynchronizer.initialise(model, uiModel, cellUtilities, columnUtilities, enumsUtilities, gridWidgetCellFactory, gridWidgetColumnFactory, view, rm, eventBus, editable);
// Dummy columns for Row number, rule name and Description
uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new RowNumberCol52(), readOnly, view));
uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new RuleNameColumn(), readOnly, view));
uiModel.appendColumn(gridWidgetColumnFactory.convertColumn(new DescriptionCol52(), readOnly, view));
ApplicationPreferences.setUp(new HashMap<String, String>() {
{
put(ApplicationPreferences.DATE_FORMAT, "dd-MM-yyyy");
}
});
}
use of com.google.gwt.event.shared.EventBus in project drools-wb by kiegroup.
the class AbstractScenarioSimulationProducerTest method getEventBus.
@Test
public void getEventBus() {
EventBus retrieved = abstractScenarioSimulationProducer.getEventBus();
assertNotNull(retrieved);
assertEquals(retrieved, eventBusMock);
verify(eventBusProducerMock, times(1)).getEventBus();
}
use of com.google.gwt.event.shared.EventBus in project drools-wb by kiegroup.
the class EventBusProducerTest method getEventBus.
@Test
public void getEventBus() {
final EventBus retrieved = eventBusProducer.getEventBus();
assertNotNull(retrieved);
}
use of com.google.gwt.event.shared.EventBus in project drools-wb by kiegroup.
the class ActionValueEditorTest method testGetDropDownData.
@Test
public void testGetDropDownData() throws Exception {
final AsyncPackageDataModelOracle oracle = mock(AsyncPackageDataModelOracle.class);
final String factType = "Car";
final String factField = "color";
final ActionFieldValue value = new ActionFieldValue() {
{
setField(factField);
}
};
final ActionFieldValue[] values = new ActionFieldValue[0];
final RuleModeller modeller = mock(RuleModeller.class);
doReturn(oracle).when(modeller).getDataModelOracle();
final EventBus eventBus = mock(EventBus.class);
final String variableType = DataType.TYPE_STRING;
final boolean readOnly = false;
actionValueEditor = new ActionValueEditor(factType, value, values, modeller, eventBus, variableType, readOnly);
// reset oracle due to calls in ActionValueEditor constructor
reset(oracle);
actionValueEditor.getDropDownData();
final Map<String, String> fieldValues = new HashMap<>();
verify(oracle).getEnums(eq(factType), eq(factField), eq(fieldValues));
}
Aggregations