Search in sources :

Example 1 with SimpleRecursionInterceptor

use of org.codehaus.plexus.interpolation.SimpleRecursionInterceptor in project indy by Commonjava.

the class AbstractKojiIT method initTestConfig.

@Override
protected void initTestConfig(CoreServerFixture fixture) throws IOException {
    super.initTestConfig(fixture);
    withNewClient((client) -> {
        try {
            File clientKeyCertPem = getClientKeyCertPem(client);
            File serverCertsPem = getServerCertsPem(client);
            Properties properties = System.getProperties();
            properties.setProperty("client.pem", clientKeyCertPem.getAbsolutePath());
            properties.setProperty("server.pem", serverCertsPem.getAbsolutePath());
            properties.setProperty("hub.url", formatSSLUrl("kojihub"));
            properties.setProperty("storage.url", formatSSLUrl("kojifiles"));
            properties.setProperty("extra.config", getKojiExtraConfig());
            StringSearchInterpolator ssi = new StringSearchInterpolator();
            ssi.addValueSource(new PropertiesBasedValueSource(properties));
            RecursionInterceptor ri = new SimpleRecursionInterceptor();
            String kojiConf = readTestResource("test-koji.conf");
            try {
                kojiConf = ssi.interpolate(kojiConf, ri);
            } catch (InterpolationException e) {
                e.printStackTrace();
                fail("Interpolation of test koji.conf failed!");
            }
            writeConfigFile("conf.d/koji.conf", kojiConf);
        } catch (IOException e) {
            e.printStackTrace();
            fail("Cannot setup SSL config files for Koji.");
        }
    });
}
Also used : StringSearchInterpolator(org.codehaus.plexus.interpolation.StringSearchInterpolator) SimpleRecursionInterceptor(org.codehaus.plexus.interpolation.SimpleRecursionInterceptor) RecursionInterceptor(org.codehaus.plexus.interpolation.RecursionInterceptor) SimpleRecursionInterceptor(org.codehaus.plexus.interpolation.SimpleRecursionInterceptor) InterpolationException(org.codehaus.plexus.interpolation.InterpolationException) IOException(java.io.IOException) Properties(java.util.Properties) File(java.io.File) PropertiesBasedValueSource(org.codehaus.plexus.interpolation.PropertiesBasedValueSource)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 Properties (java.util.Properties)1 InterpolationException (org.codehaus.plexus.interpolation.InterpolationException)1 PropertiesBasedValueSource (org.codehaus.plexus.interpolation.PropertiesBasedValueSource)1 RecursionInterceptor (org.codehaus.plexus.interpolation.RecursionInterceptor)1 SimpleRecursionInterceptor (org.codehaus.plexus.interpolation.SimpleRecursionInterceptor)1 StringSearchInterpolator (org.codehaus.plexus.interpolation.StringSearchInterpolator)1