use of org.kie.workbench.common.screens.datasource.management.client.util.ClientValidationServiceMock in project kie-wb-common by kiegroup.
the class DriverDefEditorHelperTest method setup.
@Before
public void setup() {
clientValidationService = new ClientValidationServiceMock();
editorHelper = new DriverDefEditorHelper(translationService, clientValidationService);
editorHelper.setHandler(handler);
editorHelper.init(mainPanel);
driverDef = new DriverDef();
editorHelper.setDriverDef(driverDef);
verify(mainPanel, times(1)).clear();
verify(mainPanel, times(1)).setName(driverDef.getName());
verify(mainPanel, times(1)).setDriverClass(driverDef.getDriverClass());
verify(mainPanel, times(1)).setGroupId(driverDef.getGroupId());
verify(mainPanel, times(1)).setArtifactId(driverDef.getArtifactId());
verify(mainPanel, times(1)).setVersion(driverDef.getVersion());
}
use of org.kie.workbench.common.screens.datasource.management.client.util.ClientValidationServiceMock in project kie-wb-common by kiegroup.
the class DriverDefEditorTest method setup.
@Before
public void setup() {
mainPanel = new DriverDefMainPanel(mainPanelView);
clientValidationService = new ClientValidationServiceMock();
editorHelper = new DriverDefEditorHelper(translationService, clientValidationService);
editorServiceCaller = new CallerMock<>(editorService);
dataSourceManagerClientCaller = new CallerMock<>(dataSourceManagerClient);
editor = new DriverDefEditor(view, mainPanel, editorHelper, popupsUtil, placeManager, type, savePopupPresenter, deletePopUpPresenter, editorServiceCaller, dataSourceManagerClientCaller) {
{
this.versionRecordManager = DriverDefEditorTest.this.versionRecordManager;
this.menuBuilder = mock(BasicFileMenuBuilder.class);
}
};
verify(view, times(1)).init(editor);
verify(view, times(1)).setContent(mainPanel);
}
use of org.kie.workbench.common.screens.datasource.management.client.util.ClientValidationServiceMock in project kie-wb-common by kiegroup.
the class DataSourceWizardTestBase method setup.
/**
* Initializes the services, the wizard pages, and drivers information.
*/
protected void setup() {
// initialize the services
editorServiceCaller = new CallerMock<>(editorService);
queryServiceCaller = new CallerMock<>(queryService);
// initialize the wizard page
mainPanel = new DataSourceDefMainPanel(mainPanelView);
dataSourceDef = new DataSourceDef();
editorHelper = new DataSourceDefEditorHelper(translationService, editorServiceCaller, queryServiceCaller, new ClientValidationServiceMock(), popupsUtil);
defPage = new DataSourceDefPage(view, mainPanel, editorHelper, statusChangeEvent);
defPage.setDataSourceDef(dataSourceDef);
// prepare the drivers info
drivers = new ArrayList<>();
drivers.add(driver1);
drivers.add(driver2);
options = new ArrayList<>();
options.add(new Pair("Driver1.name", DRIVER_UUID));
options.add(new Pair("Driver2.name", DRIVER_UUID_2));
when(driver1.getName()).thenReturn("Driver1.name");
when(driver1.getUuid()).thenReturn(DRIVER_UUID);
when(driver2.getName()).thenReturn("Driver2.name");
when(driver2.getUuid()).thenReturn(DRIVER_UUID_2);
// emulates the service returning the requested drivers.
when(queryService.findModuleDrivers(path)).thenReturn(drivers);
when(queryService.findGlobalDrivers()).thenReturn(drivers);
}
use of org.kie.workbench.common.screens.datasource.management.client.util.ClientValidationServiceMock in project kie-wb-common by kiegroup.
the class DataSourceDefEditorHelperTest method setup.
@Before
public void setup() {
clientValidationService = new ClientValidationServiceMock();
editorServiceCaller = new CallerMock<>(editorService);
queryServiceCaller = new CallerMock<>(queryService);
when(driverDefInfo.getUuid()).thenReturn(DRIVER_UUID);
when(driverDefInfo.getName()).thenReturn("DriverName");
List<DriverDefInfo> drivers = new ArrayList<>();
drivers.add(driverDefInfo);
when(queryService.findGlobalDrivers()).thenReturn(drivers);
when(queryService.findModuleDrivers(any(Path.class))).thenReturn(drivers);
editorHelper = new DataSourceDefEditorHelper(translationService, editorServiceCaller, queryServiceCaller, clientValidationService, popupsUtil);
editorHelper.setHandler(handler);
editorHelper.init(mainPanel);
editorHelper.loadDrivers(new Command() {
@Override
public void execute() {
// do nothing
}
}, new ParameterizedCommand<Throwable>() {
@Override
public void execute(Throwable parameter) {
// do nothing
}
});
dataSourceDef = new DataSourceDef();
editorHelper.setDataSourceDef(dataSourceDef);
verify(mainPanel, times(1)).clear();
verify(mainPanel, times(1)).setName(dataSourceDef.getName());
verify(mainPanel, times(1)).setConnectionURL(dataSourceDef.getConnectionURL());
verify(mainPanel, times(1)).setUser(dataSourceDef.getUser());
verify(mainPanel, times(1)).setPassword(dataSourceDef.getPassword());
verify(mainPanel, times(1)).setDriver(dataSourceDef.getDriverUuid());
}
use of org.kie.workbench.common.screens.datasource.management.client.util.ClientValidationServiceMock in project kie-wb-common by kiegroup.
the class DataSourceDefEditorTest method setup.
@Before
public void setup() {
drivers = new ArrayList<>();
drivers.add(driver1);
drivers.add(driver2);
when(driver1.getName()).thenReturn("Driver1.name");
when(driver1.getUuid()).thenReturn(DRIVER_UUID);
when(driver2.getName()).thenReturn("Driver2.name");
when(driver2.getUuid()).thenReturn(DRIVER_UUID_2);
options = new ArrayList<>();
options.add(new Pair("Driver1.name", DRIVER_UUID));
options.add(new Pair("Driver2.name", DRIVER_UUID_2));
mainPanel = new DataSourceDefMainPanel(mainPanelView);
clientValidationService = new ClientValidationServiceMock();
editorServiceCaller = new CallerMock<>(editorService);
queryServiceCaller = new CallerMock<>(queryService);
editorHelper = new DataSourceDefEditorHelper(translationService, editorServiceCaller, queryServiceCaller, clientValidationService, popupsUtil);
editor = new DataSourceDefEditor(view, mainPanel, editorHelper, dbStructureExplorer, popupsUtil, placeManager, type, savePopupPresenter, deletePopUpPresenter, editorServiceCaller, dataSourceManagerClientCaller) {
{
this.versionRecordManager = DataSourceDefEditorTest.this.versionRecordManager;
this.menuBuilder = mock(BasicFileMenuBuilder.class);
}
};
editor.init();
verify(view, times(1)).init(editor);
verify(view, times(1)).setContent(mainPanel);
}
Aggregations