use of org.jboss.arquillian.container.impl.ContainerCreationException in project keycloak by keycloak.
the class Registry method create.
@Override
public Container create(ContainerDef definition, ServiceLoader loader) {
Validate.notNull(definition, "Definition must be specified");
try {
logger.log(Level.FINE, "Registering container: {0}", definition.getContainerName());
@SuppressWarnings("rawtypes") Collection<DeployableContainer> containerAdapters = loader.all(DeployableContainer.class);
DeployableContainer<?> dcService = null;
if (containerAdapters.size() == 1) {
// just one container on cp
dcService = containerAdapters.iterator().next();
} else {
Container domainContainer = domainContainer(loader, definition);
if (domainContainer != null) {
return domainContainer;
}
if (dcService == null) {
dcService = getContainerAdapter(getAdapterImplClassValue(definition), containerAdapters);
}
if (dcService == null) {
throw new ConfigurationException("Unable to get container adapter from Arquillian configuration.");
}
}
// before a Container is added to a collection of containers, inject into its injection point
return addContainer(injector.inject(new ContainerImpl(definition.getContainerName(), dcService, definition)));
} catch (ConfigurationException e) {
throw new ContainerCreationException("Could not create Container " + definition.getContainerName(), e);
}
}
Aggregations