/** * Gets the deployment information about a driver definition. * @param uuid the driver definition identifier. * @return the deployment information for the driver definition of null if the driver wasn't deployed. * @throws Exception exceptions may be thrown if e.g. communication with the Wildfly server fails, etc. */ @Override public DriverDeploymentInfo getDeploymentInfo(final String uuid) throws Exception { String deploymentId = DeploymentIdGenerator.generateDeploymentId(uuid); DriverDeploymentInfo result; if ((result = managedDrivers.get(deploymentId)) == null) { for (DriverDeploymentInfo deploymentInfo : getDeploymentsInfo()) { if (uuid.equals(deploymentInfo.getUuid())) { result = deploymentInfo; break; } } } return result; }
@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; } }
@Before public void setup() { setupChangeHandler(); when(serviceHelper.getDefRegistry()).thenReturn(defRegistry); when(moduleService.resolveModule(path)).thenReturn(module); when(sessionInfo.getId()).thenReturn(SESSION_ID); when(sessionInfo.getIdentity()).thenReturn(identity); when(identity.getIdentifier()).thenReturn(IDENTIFIER); dataSourceDef = new DataSourceDef(); dataSourceDef.setUuid("uuid"); dataSourceDef.setName("dataSourceName"); dataSourceDef.setConnectionURL("connectionURL"); dataSourceDef.setUser("user"); dataSourceDef.setPassword("password"); driverDef = new DriverDef(); driverDef.setUuid("uuid"); driverDef.setName("driverName"); driverDef.setDriverClass(TestDriver.class.getName()); driverDef.setGroupId("groupId"); driverDef.setArtifactId("artifactId"); driverDef.setVersion("version"); when(registeredDataSourceDef.getUuid()).thenReturn("registeredDataSourceUuid"); when(registeredDataSourceDeploymentInfo.getUuid()).thenReturn("registeredDataSourceUuid"); when(originalDataSourceDef.getUuid()).thenReturn("originalDataSourceUuid"); when(originalDatasourceDeploymentInfo.getUuid()).thenReturn("originalDataSourceUuid"); when(registeredDriverDef.getUuid()).thenReturn("registeredDriverDefUuid"); when(registeredDriverDeploymentInfo.getUuid()).thenReturn("registeredDriverDefUuid"); when(originalDriverDef.getUuid()).thenReturn("originalDriverDefUuid"); when(originalDriverDeploymentInfo.getUuid()).thenReturn("originalDriverDefUuid"); }