org.jboss.arquillian.container.spi.ConfigurationException Java Examples

The following examples show how to use org.jboss.arquillian.container.spi.ConfigurationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileUtils.java    From arquillian-container-chameleon with Apache License 2.0 6 votes vote down vote up
public static InputStream loadConfiguration(String resourceName, boolean isDefault) {
    InputStream stream = loadResource(resourceName);
    if (stream == null) {
        if (isDefault) {
            throw new IllegalStateException(
                "Could not find built-in configuration as file nor classloader resource: " + resourceName + ". " +
                    "Make sure that this file exists in classpath resource or in the project folder.");
        } else {
            throw new ConfigurationException(
                "Could not locate configured containerConfigurationFile as file" +
                    " nor classloader resource: " + resourceName);
        }
    }

    return stream;
}
 
Example #2
Source File: Target.java    From arquillian-container-chameleon with Apache License 2.0 6 votes vote down vote up
public static Target from(String source) {
    Target target = new Target();

    String[] sections = source.split(":");
    if (sections.length < 2 || sections.length > 3) {
        throw new ConfigurationException("Wrong target format [" + source + "] server:version:type");
    }
    target.server = sections[0].toLowerCase();
    target.version = sections[1];
    if (sections.length > 2) {
        for (Type type : Type.values()) {
            if (sections[2].toLowerCase().contains(type.name().toLowerCase())) {
                target.type = type;
                break;
            }
        }
        if (target.type == null) {
            throw new ConfigurationException(
                "Unknown target type " + sections[2] + ". Supported " + Target.Type.values());
        }
    } else {
        target.type = Type.Default;
    }
    return target;
}
 
Example #3
Source File: ChameleonConfiguration.java    From arquillian-container-chameleon with Apache License 2.0 6 votes vote down vote up
public void validate() throws ConfigurationException {
    if (chameleonTarget == null) {
        throw new ConfigurationException("chameleonTarget must be provided in format server:version:type");
    }

    // Trigger possible Exception case during File/Resource load
    getChameleonContainerConfigurationFileStream();

    File resolveCache = getChameleonResolveCacheFolder();
    if (!resolveCache.exists()) {
        if (!resolveCache.mkdirs()) {
            throw new ConfigurationException("Could not create all resolve cache folders: " + resolveCache);
        }
    }

    // Try to parse to 'trigger' ConfigurationException
    getParsedTarget();
}
 
Example #4
Source File: KeycloakOnUndertowConfiguration.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
    super.validate();

    int basePort = getBindHttpPort();
    int newPort = basePort + bindHttpPortOffset;
    setBindHttpPort(newPort);

    int baseHttpsPort = getBindHttpsPort();
    int newHttpsPort = baseHttpsPort + bindHttpsPortOffset;
    setBindHttpsPort(newHttpsPort);

    log.info("KeycloakOnUndertow will listen for http on port: " + newPort + " and for https on port: " + newHttpsPort);
    
    if (this.keycloakConfigPropertyOverrides != null) {
        try {
            TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {};
            this.keycloakConfigPropertyOverridesMap = JsonSerialization.sysPropertiesAwareMapper.readValue(this.keycloakConfigPropertyOverrides, typeRef);
        } catch (IOException ex) {
            throw new ConfigurationException(ex);
        }
    }

    // TODO validate workerThreads
    
}
 
Example #5
Source File: KeycloakQuarkusConfiguration.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
    int basePort = getBindHttpPort();
    int newPort = basePort + bindHttpPortOffset;
    setBindHttpPort(newPort);

    int baseHttpsPort = getBindHttpsPort();
    int newHttpsPort = baseHttpsPort + bindHttpsPortOffset;
    setBindHttpsPort(newHttpsPort);

    log.info("Keycloak will listen for http on port: " + newPort + " and for https on port: " + newHttpsPort);

    if (this.keycloakConfigPropertyOverrides != null) {
        try {
            TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {};
            this.keycloakConfigPropertyOverridesMap = JsonSerialization.sysPropertiesAwareMapper.readValue(this.keycloakConfigPropertyOverrides, typeRef);
        } catch (IOException ex) {
            throw new ConfigurationException(ex);
        }
    }
}
 
Example #6
Source File: UndertowAppServerConfiguration.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
    super.validate();

    int basePort = getBindHttpPort();
    int newPort = basePort + bindHttpPortOffset;
    setBindHttpPort(newPort);
    log.info("App server undertow will listen on port: " + newPort);
}
 
Example #7
Source File: DaemonContainerConfigurationBase.java    From thorntail with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.jboss.arquillian.container.spi.client.container.ContainerConfiguration#validate()
 */
@Override
public void validate() throws ConfigurationException {
    if (host == null || host.length() == 0) {
        this.host = "localhost";
    }
    if (port == null || port.length() == 0) {
        this.port = "12345";
    }
}
 
Example #8
Source File: SimpleUndertowLoadBalancerConfiguration.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
    super.validate();

    try {
        SimpleUndertowLoadBalancer.parseNodes(nodes);
    } catch (Exception e) {
        throw new ConfigurationException(e);
    }

    setBindHttpPort(getBindHttpPort() + bindHttpPortOffset);
    setBindHttpsPort(getBindHttpsPort() + bindHttpsPortOffset);
    log.info("SimpleUndertowLoadBalancer will listen on ports: " + getBindHttpPort() + " " + getBindHttpsPort());

}
 
Example #9
Source File: DaemonContainerConfigurationBase.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.jboss.arquillian.container.spi.client.container.ContainerConfiguration#validate()
 */
@Override
public void validate() throws ConfigurationException {
    if (host == null || host.length() == 0) {
        this.host = "localhost";
    }
    if (port == null || port.length() == 0) {
        this.port = "12345";
    }
}
 
Example #10
Source File: ConfigurationTestCase.java    From arquillian-container-chameleon with Apache License 2.0 5 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailOnMissingContainerFile() throws Exception {
    ChameleonConfiguration configuration = new ChameleonConfiguration();
    configuration.setChameleonContainerConfigurationFile("MISSING");
    configuration.setChameleonTarget("wildfly:8.2.0.Final:managed");
    configuration.validate();
}
 
Example #11
Source File: FurnaceContainerConfiguration.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void validate() throws ConfigurationException
{
   if (Strings.isNullOrEmpty(classifier))
   {
      throw new ConfigurationException("Classifier should not be null or empty");
   }
}
 
Example #12
Source File: Registry.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example #13
Source File: JettyAppServerConfiguration.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
    setBindHttpPort(bindHttpPort + bindHttpPortOffset);
    setBindHttpsPort(bindHttpsPort + bindHttpsPortOffset);
}
 
Example #14
Source File: ManagedSEContainerConfiguration.java    From camel-spring-boot with Apache License 2.0 4 votes vote down vote up
public void validate() throws ConfigurationException {
}
 
Example #15
Source File: OpenEJBConfiguration.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
    // no-op
}
 
Example #16
Source File: TomEEConfiguration.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void validate() throws ConfigurationException {
}
 
Example #17
Source File: ConfigurationTestCase.java    From arquillian-container-chameleon with Apache License 2.0 4 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailOnMissingContainerType() throws Exception {
    ChameleonConfiguration configuration = new ChameleonConfiguration();
    configuration.setChameleonTarget("wildfly:8.2.0.Final:UNKNOWN");
    configuration.validate();
}
 
Example #18
Source File: MeecrowaveConfiguration.java    From openwebbeans-meecrowave with Apache License 2.0 4 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
    // no-op
}
 
Example #19
Source File: PiranhaServerLoadableExtension.java    From piranha with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
    postConstruct();
}
 
Example #20
Source File: QuarkusConfiguration.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public void validate() throws ConfigurationException {
}