Search in sources :

Example 11 with DriverDeploymentInfo

use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.

the class DriverProviderBaseTest method testDeployDriver.

@Test
public void testDeployDriver() throws Exception {
    // the driver is deployed
    deployDriver(driverDef1);
    // then the deployment info should be returned.
    DriverDeploymentInfo deploymentInfo = driverProvider.getDeploymentInfo(driverDef1.getUuid());
    assertNotNull(deploymentInfo);
    assertTrue(deploymentInfo.isManaged());
}
Also used : DriverDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo) Test(org.junit.Test)

Example 12 with DriverDeploymentInfo

use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.

the class WildflyDriverProviderTest method testDeployDriver.

/**
 * Tests a driver deployment.
 */
@Test
public void testDeployDriver() throws Exception {
    super.testDeployDriver();
    // the driver should have been deployed by using the management client.
    verify(managementClient, times(1)).deploy(DRIVER1_DEPLOYMENT_ID, driver1Uri);
    DriverDeploymentInfo expectedDeploymentInfo = new DriverDeploymentInfo(DRIVER1_DEPLOYMENT_ID, DRIVER1_DEPLOYMENT_ID, true, DRIVER1_UUID, DRIVER1_CLASS);
    DriverDeploymentInfo deploymentInfo = driverProvider.getDeploymentInfo(driverDef1.getUuid());
    assertEquals(expectedDeploymentInfo, deploymentInfo);
}
Also used : DriverDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo) DriverProviderBaseTest(org.kie.workbench.common.screens.datasource.management.backend.core.DriverProviderBaseTest) Test(org.junit.Test)

Example 13 with DriverDeploymentInfo

use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.

the class WildflyDriverProviderTest method testDriverResync.

/**
 * Tests the resync of a driver.
 */
@Test
public void testDriverResync() throws Exception {
    when(managementClient.getDeployedDrivers()).thenReturn(wfDrivers);
    DriverDeploymentInfo deploymentInfo = driverProvider.getDeploymentInfo(DRIVER1_UUID);
    // the deployment exists by construction but is not managed.
    assertNotNull(deploymentInfo);
    assertFalse(deploymentInfo.isManaged());
    driverProvider.resync(driverDef1, deploymentInfo);
    deploymentInfo = driverProvider.getDeploymentInfo(DRIVER1_UUID);
    // after the resync operation the should have been tagged as managed.
    assertNotNull(deploymentInfo);
    assertTrue(deploymentInfo.isManaged());
}
Also used : DriverDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo) DriverProviderBaseTest(org.kie.workbench.common.screens.datasource.management.backend.core.DriverProviderBaseTest) Test(org.junit.Test)

Example 14 with DriverDeploymentInfo

use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.

the class DataSourceDefQueryServiceImpl method createDriverInfo.

private DriverDefInfo createDriverInfo(final org.uberfire.java.nio.file.Path path) {
    String content = ioService.readAllString(path);
    DriverDef driverDef = DriverDefSerializer.deserialize(content);
    DriverDeploymentInfo deploymentInfo = null;
    try {
        deploymentInfo = runtimeManager.getDriverDeploymentInfo(driverDef.getUuid());
    } catch (Exception e) {
        logger.warn("It was not possible to read deployment info when building DriverDefInfo for driver: " + driverDef.getUuid(), e);
    }
    return new DriverDefInfo(driverDef.getUuid(), driverDef.getName(), Paths.convert(path), deploymentInfo);
}
Also used : DriverDefInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDefInfo) DriverDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo) DriverDef(org.kie.workbench.common.screens.datasource.management.model.DriverDef)

Example 15 with DriverDeploymentInfo

use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.

the class DataSourceRuntimeManagerImpl method getDriverDeploymentInfo.

@Override
public synchronized DriverDeploymentInfo getDriverDeploymentInfo(String uuid) throws Exception {
    try {
        DriverDeploymentInfo deploymentInfo = driverProvider.getDeploymentInfo(uuid);
        if (deploymentInfo != null && driverDeploymentCache.get(deploymentInfo) != null) {
            DriverDeploymentInfo updatedInfo = new DriverDeploymentInfo(deploymentInfo.getDeploymentId(), deploymentInfo.getDriverDeploymentId(), deploymentInfo.isManaged(), deploymentInfo.getUuid(), deploymentInfo.getDriverClass());
            updatedInfo.getDependants().addAll(driverDeploymentCache.get(deploymentInfo).getDependants());
            deploymentInfo = updatedInfo;
        }
        return deploymentInfo;
    } catch (Exception e) {
        logger.error("It was not possible to read the deploymentInfo for driver: " + uuid);
        throw e;
    }
}
Also used : DriverDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo)

Aggregations

DriverDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo)21 Test (org.junit.Test)8 DataSourceDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo)4 DriverProviderBaseTest (org.kie.workbench.common.screens.datasource.management.backend.core.DriverProviderBaseTest)3 URI (java.net.URI)2 ExpectedException (org.junit.rules.ExpectedException)2 DataSourceDef (org.kie.workbench.common.screens.datasource.management.model.DataSourceDef)2 DriverDef (org.kie.workbench.common.screens.datasource.management.model.DriverDef)2 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 WildflyDataSourceDef (org.kie.workbench.common.screens.datasource.management.backend.integration.wildfly.WildflyDataSourceDef)1 WildflyDriverDef (org.kie.workbench.common.screens.datasource.management.backend.integration.wildfly.WildflyDriverDef)1 DriverDefInfo (org.kie.workbench.common.screens.datasource.management.model.DriverDefInfo)1