use of org.drools.workbench.screens.guided.dtable.client.editor.menu.ViewMenuBuilder in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorMenusTest method setup.
@Before
public void setup() {
when(alertsButtonMenuItemBuilder.build()).thenReturn(alertsButtonMenuItem);
when(modeller.getView()).thenReturn(modellerView);
when(versionRecordManager.newSaveMenuItem(any(Command.class))).thenReturn(saveMenuItem);
when(versionRecordManager.buildMenu()).thenReturn(versionManagerMenuItem);
when(ts.getTranslation(any(String.class))).thenAnswer(invocation -> invocation.getArguments()[0]);
when(menuItemViewProducer.select(any(Annotation.class))).thenAnswer((o) -> {
final Annotation a = (Annotation) o.getArguments()[0];
if (a.annotationType().equals(MenuItemHeader.class)) {
return menuItemViewHeaderProducer;
} else if (a.annotationType().equals(MenuItemWithIcon.class)) {
return menuItemViewWithIconProducer;
} else if (a.annotationType().equals(MenuItemDivider.class)) {
return menuItemViewDividerProducer;
}
throw new IllegalArgumentException("Unexpected MenuItemView");
});
when(menuItemViewHeaderProducer.get()).thenReturn(mock(MenuItemHeaderView.class));
when(menuItemViewDividerProducer.get()).thenReturn(mock(MenuItemDividerView.class));
when(menuItemViewWithIconProducer.get()).thenReturn(menuItemWithIconView);
when(menuItemWithIconView.getElement()).thenReturn(mock(HTMLElement.class));
this.dtServiceCaller = new CallerMock<>(dtService);
this.versionServiceCaller = new CallerMock<>(versionService);
this.menuItemFactory = new MenuItemFactory(menuItemViewProducer);
this.editMenuBuilder = new EditMenuBuilder(clipboard, ts, menuItemFactory, popoverUtils);
this.editMenuBuilder.setup();
this.insertMenuBuilder = new InsertMenuBuilder(ts, menuItemFactory, wizardManagedInstance);
this.insertMenuBuilder.setup();
this.insertMenuBuilder.setModeller(modeller);
this.viewMenuBuilder = new ViewMenuBuilder(ts, menuItemFactory);
this.viewMenuBuilder.setup();
this.viewMenuBuilder.setModeller(modeller);
this.radarMenuBuilder = new RadarMenuBuilder(radarMenuView);
this.radarMenuBuilder.setup();
final GuidedDecisionTableEditorPresenter wrapped = new GuidedDecisionTableEditorPresenter(view, dtServiceCaller, notification, decisionTableSelectedEvent, validationPopup, resourceType, editMenuBuilder, viewMenuBuilder, insertMenuBuilder, radarMenuBuilder, modeller, beanManager, placeManager, columnsPage, saveAndRenameCommandBuilder, alertsButtonMenuItemBuilder) {
@Override
protected Command getSaveAndRenameCommand() {
return mock(Command.class);
}
};
wrapped.setKieEditorWrapperView(kieEditorWrapperView);
wrapped.setOverviewWidget(overviewWidget);
wrapped.setSavePopUpPresenter(savePopUpPresenter);
wrapped.setImportsWidget(importsWidget);
wrapped.setNotificationEvent(notificationEvent);
wrapped.setChangeTitleEvent(changeTitleEvent);
wrapped.setWorkbenchContext(workbenchContext);
wrapped.setVersionRecordManager(versionRecordManager);
wrapped.setRegisteredDocumentsMenuBuilder(registeredDocumentsMenuBuilder);
wrapped.setFileMenuBuilder(fileMenuBuilder);
wrapped.setFileNameValidator(fileNameValidator);
this.presenter = spy(wrapped);
when(workbenchContext.getActiveOrganizationalUnit()).thenReturn(Optional.empty());
when(workbenchContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
presenter.init();
presenter.setupMenuBar();
}
Aggregations