use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDef in project kie-wb-common by kiegroup.
the class DataSourceDefEditorTest method createContent.
private DataSourceDefEditorContent createContent() {
DataSourceDefEditorContent content = new DataSourceDefEditorContent();
content.setDef(new DataSourceDef());
content.getDef().setName(NAME);
content.getDef().setDriverUuid(DRIVER_UUID);
content.getDef().setConnectionURL(CONNECTION_URL);
content.getDef().setUser(USER);
content.getDef().setPassword(PASSWORD);
return content;
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDef 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.model.DataSourceDef in project kie-wb-common by kiegroup.
the class WildflyDataSourceProvider method getDeployments.
/**
* Gets the list of data source definitions for the currently defined data sources in the Wildfly server.
* @return list with the definitions for the defined data sources.
* @throws Exception exceptions may be thrown if e.g. communication with the Wildfly server fails, etc.
*/
@Override
public List<DataSourceDef> getDeployments() throws Exception {
List<WildflyDataSourceDef> dataSources;
List<DataSourceDef> dataSourceDefs = new ArrayList<>();
DataSourceDef dataSourceDef;
String dataSourceUuid;
String driverUuid;
dataSources = dataSourceMgmtClient.getDataSources();
for (WildflyDataSourceDef internalDef : dataSources) {
dataSourceDef = new DataSourceDef();
try {
dataSourceUuid = DeploymentIdGenerator.extractUuid(internalDef.getName());
} catch (Exception e) {
dataSourceUuid = internalDef.getName();
}
try {
driverUuid = DeploymentIdGenerator.extractUuid(internalDef.getDriverName());
} catch (Exception e) {
driverUuid = internalDef.getDriverName();
}
dataSourceDef.setUuid(dataSourceUuid);
dataSourceDef.setName(internalDef.getName());
dataSourceDef.setConnectionURL(internalDef.getConnectionURL());
dataSourceDef.setDriverUuid(driverUuid);
dataSourceDef.setUser(internalDef.getUser());
dataSourceDef.setPassword(internalDef.getPassword());
dataSourceDefs.add(dataSourceDef);
}
return dataSourceDefs;
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDef in project kie-wb-common by kiegroup.
the class DataSourceDefQueryServiceImpl method findGlobalDataSources.
@Override
public Collection<DataSourceDefInfo> findGlobalDataSources(boolean includeUnManaged) {
Collection<DataSourceDefInfo> result = resolveDataSources(serviceHelper.getGlobalDataSourcesContext());
if (includeUnManaged) {
Map<String, DataSourceDefInfo> managedDataSources = new HashMap<>();
for (DataSourceDefInfo dataSourceDefInfo : result) {
managedDataSources.put(dataSourceDefInfo.getUuid(), dataSourceDefInfo);
}
try {
List<DataSourceDef> allDeployments = providerFactory.getDataSourceProvider().getDeployments();
DeploymentInfo deploymentInfo;
for (DataSourceDef dataSourceDef : allDeployments) {
deploymentInfo = runtimeManager.getDataSourceDeploymentInfo(dataSourceDef.getUuid());
if (!managedDataSources.containsKey(dataSourceDef.getUuid()) && (deploymentInfo != null && !deploymentInfo.isManaged())) {
result.add(new DataSourceDefInfo(dataSourceDef.getUuid(), dataSourceDef.getName(), runtimeManager.getDataSourceDeploymentInfo(dataSourceDef.getUuid())));
}
}
} catch (Exception e) {
logger.warn("It was not possible to read all deployed data sources. ", e);
}
}
return result;
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDef in project kie-wb-common by kiegroup.
the class DataSourceProviderBaseTest method setup.
protected void setup() throws Exception {
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);
}
Aggregations