Search in sources :

Example 6 with DataSourceDef

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();
}
Also used : DriverDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo) DataSourceDef(org.kie.workbench.common.screens.datasource.management.model.DataSourceDef) DriverDef(org.kie.workbench.common.screens.datasource.management.model.DriverDef) DataSourceDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo) Before(org.junit.Before)

Example 7 with DataSourceDef

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");
}
Also used : DataSourceDef(org.kie.workbench.common.screens.datasource.management.model.DataSourceDef) DataSourceDefEditorContent(org.kie.workbench.common.screens.datasource.management.model.DataSourceDefEditorContent) Before(org.junit.Before)

Example 8 with DataSourceDef

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());
}
Also used : DataSourceDef(org.kie.workbench.common.screens.datasource.management.model.DataSourceDef)

Example 9 with DataSourceDef

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());
}
Also used : Path(org.uberfire.backend.vfs.Path) DriverDefInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDefInfo) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Command(org.uberfire.mvp.Command) ArrayList(java.util.ArrayList) DataSourceDef(org.kie.workbench.common.screens.datasource.management.model.DataSourceDef) ClientValidationServiceMock(org.kie.workbench.common.screens.datasource.management.client.util.ClientValidationServiceMock) Before(org.junit.Before)

Example 10 with DataSourceDef

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"));
}
Also used : DataSourceDef(org.kie.workbench.common.screens.datasource.management.model.DataSourceDef) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Aggregations

DataSourceDef (org.kie.workbench.common.screens.datasource.management.model.DataSourceDef)14 Before (org.junit.Before)4 DataSourceDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo)4 DriverDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo)3 ArrayList (java.util.ArrayList)2 ClientValidationServiceMock (org.kie.workbench.common.screens.datasource.management.client.util.ClientValidationServiceMock)2 DataSourceDefEditorContent (org.kie.workbench.common.screens.datasource.management.model.DataSourceDefEditorContent)2 DataSourceDefInfo (org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo)2 DriverDef (org.kie.workbench.common.screens.datasource.management.model.DriverDef)2 HashMap (java.util.HashMap)1 WildflyDataSourceDef (org.kie.workbench.common.screens.datasource.management.backend.integration.wildfly.WildflyDataSourceDef)1 TestDriver (org.kie.workbench.common.screens.datasource.management.backend.service.TestDriver)1 DataSourceDefEditorHelper (org.kie.workbench.common.screens.datasource.management.client.editor.datasource.DataSourceDefEditorHelper)1 DataSourceDefMainPanel (org.kie.workbench.common.screens.datasource.management.client.editor.datasource.DataSourceDefMainPanel)1 DeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DeploymentInfo)1 DriverDefInfo (org.kie.workbench.common.screens.datasource.management.model.DriverDefInfo)1 Path (org.uberfire.backend.vfs.Path)1 Pair (org.uberfire.commons.data.Pair)1 Command (org.uberfire.mvp.Command)1 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)1