Skip to content

provide missing configuration in DatabaseClientFactory.Bean #1020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,7 @@ static public class Bean implements Serializable {
public Bean() {
super();
}


/**
* Returns the host for clients created with a
Expand Down Expand Up @@ -1442,7 +1443,6 @@ public void setConnectionType(DatabaseClient.ConnectionType connectionType) {
this.connectionType = connectionType;
}


/**
* Returns the registry for associating
* IO representation classes with handle factories.
Expand Down Expand Up @@ -1475,10 +1475,9 @@ public void registerDefaultHandles() {
* The client accesses the database by means of a REST server.
* @return a new client for making database requests
*/
public DatabaseClient newClient() {
public DatabaseClient newClient() {
DatabaseClientImpl client = (DatabaseClientImpl) DatabaseClientFactory.newClient(
host, port, database,
makeSecurityContext(user, password, authentication, context, verifier),
host, port, database, (securityContext!=null? securityContext:makeSecurityContext(user, password, authentication, context, verifier)),
connectionType);
client.setHandleRegistry(getHandleRegistry().copy());
return client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void testBuiltinReadWrite()

@Test
public void testSearch() throws JAXBException {
DatabaseClientFactory.Bean clientFactoryBean = makeClientFactory();
DatabaseClientFactory.Bean clientFactoryBean = makeClientBeanFactory();

clientFactoryBean.getHandleRegistry().register(
JAXBHandle.newFactory(Product.class)
Expand Down Expand Up @@ -389,6 +389,16 @@ private DatabaseClientFactory.Bean makeClientFactory() {
clientFactoryBean.setAuthentication(Authentication.DIGEST);
return clientFactoryBean;
}

private DatabaseClientFactory.Bean makeClientBeanFactory() {
DatabaseClientFactory.Bean clientFactoryBean = new DatabaseClientFactory.Bean();
DatabaseClientFactory.DigestAuthContext clientFactoryContext = new DatabaseClientFactory.DigestAuthContext(Common.USER, Common.PASS);
clientFactoryBean.setHost(Common.HOST);
clientFactoryBean.setPort(Common.PORT);
clientFactoryBean.setSecurityContext(clientFactoryContext);
return clientFactoryBean;
}


static public class BufferHandle
extends BaseHandle<String, String>
Expand Down