/** Tests a data source un-deployment. */ @Test public void testUnDeployDataSource() throws Exception { super.testUnDeployDataSource(); // additional check // the data source should have been deleted from the WF server by using the management client. ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class); verify(managementClient, times(1)).deleteDataSource(argumentCaptor.capture()); assertEquals(DS1_DEPLOYMENT_ID, argumentCaptor.getValue()); }
@Override public void testDeployDataSource() throws Exception { super.testDeployDataSource(); // additional check // expected WF data source definition that should be created in the WF server. WildflyDataSourceDef wfDataSource = new WildflyDataSourceDef(); wfDataSource.setName(DeploymentIdGenerator.generateDeploymentId(dataSourceDef)); wfDataSource.setConnectionURL(dataSourceDef.getConnectionURL()); wfDataSource.setUser(dataSourceDef.getUser()); wfDataSource.setPassword(dataSourceDef.getPassword()); wfDataSource.setDriverName(DRIVER1_DEPLOYMENT_ID); wfDataSource.setJndi(JndiNameGenerator.generateJNDIName(dataSourceDef)); // the expected WF data source definition should have been created in the WF server. ArgumentCaptor<WildflyDataSourceDef> argumentCaptor = ArgumentCaptor.forClass(WildflyDataSourceDef.class); verify(managementClient, times(1)).createDataSource(argumentCaptor.capture()); if (!areTheSame(wfDataSource, argumentCaptor.getValue())) { fail("Data source definition wasn't properly created in the WF server: " + wfDataSource); } }
@Before public void setup() throws Exception { super.setup(); driverProvider = wfDriverProvider; dataSourceProvider = new WildflyDataSourceProvider(wfDriverProvider) { @Override protected Object jndiLookupDataSource(String jndi) { return sqlDataSource; } @Override protected String generateRandomUUID() { return RANDOM_UUID; } }; ((WildflyDataSourceProvider) dataSourceProvider).setDataSourceMgmtClient(managementClient); wfDataSources = createWFDataSources(); }