use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDef in project kie-wb-common by kiegroup.
the class DataSourceRuntimeManagerTest method setup.
@Before
public void setup() {
when(providerFactory.getDataSourceProvider()).thenReturn(dataSourceProvider);
when(providerFactory.getDriverProvider()).thenReturn(driverProvider);
runtimeManager = new DataSourceRuntimeManagerMock(providerFactory);
dataSourceDef = new DataSourceDef();
dataSourceDef.setUuid(DS1_UUID);
dataSourceDef.setName(DS1_NAME);
dataSourceDef.setDriverUuid(DRIVER1_UUID);
dataSourceDef.setConnectionURL(DS1_CONNECTION_URL);
dataSourceDef.setUser(DS1_USER);
dataSourceDef.setPassword(DS1_PASSWORD);
driverDef = new DriverDef();
driverDef.setUuid(DRIVER1_UUID);
driverDef.setName(DRIVER1_NAME);
driverDef.setDriverClass(DRIVER1_CLASS);
driverDef.setArtifactId(ARTIFACT_ID);
driverDef.setGroupId(GROUP_ID);
driverDef.setVersion(VERSION);
driverDeploymentInfo = new DriverDeploymentInfo();
dataSourceDeploymentInfo = new DataSourceDeploymentInfo();
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDef in project kie-wb-common by kiegroup.
the class DataSourceDefEditorServiceTest method setup.
@Before
public void setup() {
super.setup();
editorService = new DataSourceDefEditorServiceImpl(runtimeManager, serviceHelper, ioService, moduleService, optionsFactory, pathNamingService, artifactResolver, dataSourceDefQueryService, driverDefService, newDataSourceEvent, updateDataSourceEvent, deleteDataSourceEvent);
dataSourceDef = new DataSourceDef();
dataSourceDef.setUuid("uuid");
dataSourceDef.setName("dataSourceName");
dataSourceDef.setConnectionURL("connectionURL");
dataSourceDef.setUser("user");
dataSourceDef.setPassword("password");
dataSourceDefEditorContent = new DataSourceDefEditorContent();
dataSourceDefEditorContent.setDef(dataSourceDef);
dataSourceDefEditorContent.setModule(module);
originalDataSourceDef = new DataSourceDef();
originalDataSourceDef.setUuid("uuid");
originalDataSourceDef.setName("dataSourceNameOriginal");
originalDataSourceDef.setConnectionURL("connectionURLOriginal");
originalDataSourceDef.setUser("userOriginal");
originalDataSourceDef.setPassword("passwordOriginal");
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDef in project kie-wb-common by kiegroup.
the class NewDataSourceDefWizard method start.
@Override
public void start() {
dataSourceDefPage.clear();
dataSourceDefPage.setComplete(false);
dataSourceDef = new DataSourceDef();
dataSourceDefPage.setDataSourceDef(dataSourceDef);
dataSourceDefPage.setModule(module);
dataSourceDefPage.loadDrivers(getLoadDriversSuccessCommand(), getLoadDriversFailureCommand());
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDef 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.model.DataSourceDef in project kie-wb-common by kiegroup.
the class NewDataSourceWizardTest method testCreate.
/**
* Emulates a sequence of valid data entering and the wizard completion.
*/
private void testCreate(final Module module) {
when(path.toString()).thenReturn("target_data_source_path");
when(translationService.format(eq(DataSourceManagementConstants.NewDataSourceDefWizard_DataSourceCreatedMessage), anyVararg())).thenReturn("OkMessage");
if (module != null) {
when(editorService.create(any(DataSourceDef.class), eq(module))).thenReturn(path);
dataSourceDefWizard.setModule(module);
} else {
when(editorService.createGlobal(any(DataSourceDef.class))).thenReturn(path);
}
dataSourceDefWizard.start();
// emulates the completion of the wizard page
completeValidDefPage();
// emulates the user pressing the finish button
dataSourceDefWizard.complete();
DataSourceDef expectedDataSourceDef = new DataSourceDef();
expectedDataSourceDef.setName(NAME);
expectedDataSourceDef.setConnectionURL(CONNECTION_URL);
expectedDataSourceDef.setUser(USER);
expectedDataSourceDef.setPassword(PASSWORD);
expectedDataSourceDef.setDriverUuid(DRIVER_UUID);
if (module != null) {
verify(editorService, times(1)).create(expectedDataSourceDef, module);
} else {
verify(editorService, times(1)).createGlobal(expectedDataSourceDef);
}
verify(notificationEvent, times(1)).fire(new NotificationEvent("OkMessage"));
}
Aggregations