/** * Creates a data source in the Wildfly server. * @param dataSourceDef Data source definition to be created. * @param jndi jndi name to be use the Wildly server to bound the data source in the jndi context. * @return returns the deployment information for the created data source. * @throws Exception exceptions may be thrown if the data source couldn't be created. */ private DataSourceDeploymentInfo deploy(final DataSourceDef dataSourceDef, final String jndi, String deploymentId) throws Exception { DriverDeploymentInfo driverDeploymentInfo = driverProvider.getDeploymentInfo(dataSourceDef.getDriverUuid()); if (driverDeploymentInfo == null) { throw new Exception("Required driver: " + dataSourceDef.getDriverUuid() + " is not deployed."); } WildflyDataSourceDef wfDataSourceDef = buildWFDataSource(deploymentId, jndi, dataSourceDef, driverDeploymentInfo.getDriverDeploymentId()); dataSourceMgmtClient.createDataSource(wfDataSourceDef); return new DataSourceDeploymentInfo(deploymentId, true, dataSourceDef.getUuid(), jndi, false); }
jndi = internalDef.getJndi(); deploymentInfo = new DataSourceDeploymentInfo(internalDef.getName(), managed, uuid,
@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(); }
deploymentInfo = new DataSourceDeploymentInfo( DS3_DEPLOYMENT_ID, true, DS3_UUID, false );