Fix failing test with DB2

This commit is contained in:
mposolda 2016-02-03 12:29:22 +01:00
parent 60f9f73c4c
commit bae3ce4aab
3 changed files with 8 additions and 3 deletions

View file

@ -744,6 +744,9 @@ public class RealmAdapter implements RealmModel {
@Override @Override
public ClientModel addClient(String id, String clientId) { public ClientModel addClient(String id, String clientId) {
if (clientId == null) {
clientId = id;
}
ClientEntity entity = new ClientEntity(); ClientEntity entity = new ClientEntity();
entity.setId(id); entity.setId(id);
entity.setClientId(clientId); entity.setClientId(clientId);

View file

@ -853,6 +853,11 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
clientEntity.setStandardFlowEnabled(true); clientEntity.setStandardFlowEnabled(true);
getMongoStore().insertEntity(clientEntity, invocationContext); getMongoStore().insertEntity(clientEntity, invocationContext);
if (clientId == null) {
clientEntity.setClientId(clientEntity.getId());
getMongoStore().updateEntity(clientEntity, invocationContext);
}
final ClientModel model = new ClientAdapter(session, this, clientEntity, invocationContext); final ClientModel model = new ClientAdapter(session, this, clientEntity, invocationContext);
session.getKeycloakSessionFactory().publish(new ClientCreationEvent() { session.getKeycloakSessionFactory().publish(new ClientCreationEvent() {
@Override @Override

View file

@ -51,9 +51,6 @@ public abstract class AbstractClientRegistrationProvider implements ClientRegist
try { try {
ClientModel clientModel = RepresentationToModel.createClient(session, session.getContext().getRealm(), client, true); ClientModel clientModel = RepresentationToModel.createClient(session, session.getContext().getRealm(), client, true);
if (client.getClientId() == null) {
clientModel.setClientId(clientModel.getId());
}
client = ModelToRepresentation.toRepresentation(clientModel); client = ModelToRepresentation.toRepresentation(clientModel);