@Test public void shouldInvokeGetConnectionWithoutParametersWhenConnectionPropertiesAreSupportedAndUsernameNotSet() throws Exception { given(config.getUsername()).willReturn(null); given(config.getDataSourceType()).willReturn(XQueryDataSourceType.MARKLOGIC); factory.getConnection(dataSource); verify(dataSource).getConnection(); }
public XQConnection getConnection(XQDataSource dataSource) throws Exception { XQConnection connection; if (config.getDataSourceType().connectionPropertiesAreSupported() && config.getUsername() != null && config.getUsername().length() > 0) { connection = dataSource.getConnection(config.getUsername(), config.getPassword()); } else { connection = dataSource.getConnection(); } return connection; }
ConnectionFactory { public XQConnection getConnection(XQDataSource dataSource) throws Exception { XQConnection connection; if (config.getDataSourceType().connectionPropertiesAreSupported() && config.getUsername() != null && config.getUsername().length() > 0) { connection = dataSource.getConnection(config.getUsername(), config.getPassword()); } else { connection = dataSource.getConnection(); } return connection; } }
ConnectionFactory { public XQConnection getConnection(XQDataSource dataSource) throws Exception { XQConnection connection; if (config.getDataSourceType().connectionPropertiesAreSupported() && config.getUsername() != null && config.getUsername().length() > 0) { connection = dataSource.getConnection(config.getUsername(), config.getPassword()); } else { connection = dataSource.getConnection(); } return connection; } ConnectionFactory(XQueryRunConfig config); }
ConnectionFactory { public XQConnection getConnection(XQDataSource dataSource) throws Exception { XQConnection connection; if (config.getDataSourceType().connectionPropertiesAreSupported() && config.getUsername() != null && config.getUsername().length() > 0) { connection = dataSource.getConnection(config.getUsername(), config.getPassword()); } else { connection = dataSource.getConnection(); } return connection; } ConnectionFactory(XQueryRunConfig config); XQConnection getConnection(XQDataSource dataSource); }
ConnectionFactory { public XQConnection getConnection(XQDataSource dataSource) throws Exception { XQConnection connection; if (config.getDataSourceType().connectionPropertiesAreSupported() && config.getUsername() != null && config.getUsername().length() > 0) { connection = dataSource.getConnection(config.getUsername(), config.getPassword()); } else { connection = dataSource.getConnection(); } return connection; } ConnectionFactory(XQueryRunConfig config); XQConnection getConnection(XQDataSource dataSource);  }