All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.SlingVersionResolver.hbs Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.sling.testing.paxexam;

import java.util.HashMap;
import java.util.Map;

import org.ops4j.pax.exam.MavenUtils;
import org.ops4j.pax.exam.options.MavenUrlReference.VersionResolver;

/**
 * NOTE: This file is generated from Sling's Karaf Features
 */
public class SlingVersionResolver implements VersionResolver {

    private final Map versions = new HashMap<>();

    public static final String SLING_GROUP_ID = "org.apache.sling";

    public SlingVersionResolver() {
        versions.put("org.apache.commons:commons-lang3", "3.9");
        versions.put("org.apache.httpcomponents:httpclient-osgi", "4.5.8");
        versions.put("org.apache.httpcomponents:httpcore-osgi", "4.4.11");
        versions.put("org.apache.servicemix.specs:org.apache.servicemix.specs.annotation-api-1.3", "1.3_1");
        versions.put("org.apache.servicemix.specs:org.apache.servicemix.specs.activation-api-1.1", "2.9.0");
        versions.put("org.apache.servicemix.specs:org.apache.servicemix.specs.stax-api-1.2", "1.2_1");
        versions.put("org.apache.servicemix.specs:org.apache.servicemix.specs.jaxb-api-2.2", "2.9.0");
        versions.put("org.apache.servicemix.bundles:org.apache.servicemix.bundles.jaxb-impl", "2.2.11_1");
        versions.put("org.apache.servicemix.bundles:org.apache.servicemix.bundles.tagsoup", "1.2.1_1");
        versions.put("org.apache.sling:org.apache.sling.scripting.jsp-api", "1.0.0");
        versions.put("org.apache.sling:org.apache.sling.scripting.el-api", "1.0.0");
        versions.put("org.apache.felix:org.apache.felix.configadmin", "1.9.14");
        versions.put("org.apache.felix:org.apache.felix.eventadmin", "1.5.0");
        versions.put("org.apache.felix:org.apache.felix.http.jetty", "4.0.8");
        versions.put("org.apache.felix:org.apache.felix.http.servlet-api", "1.1.2");
        versions.put("org.apache.felix:org.apache.felix.http.whiteboard", "4.0.0");
        versions.put("org.apache.felix:org.apache.felix.webconsole.plugins.ds", "2.1.0");
        versions.put("org.apache.aries:org.apache.aries.util", "1.1.3");
        versions.put("org.apache.aries.jmx:org.apache.aries.jmx.api", "1.1.5");
        versions.put("org.apache.aries.jmx:org.apache.aries.jmx.core", "1.1.8");
        versions.put("org.apache.aries.jmx:org.apache.aries.jmx.whiteboard", "1.2.0");
        versions.put("org.apache.aries.spifly:org.apache.aries.spifly.dynamic.bundle", "1.2.1");
        versions.put("org.apache.felix:org.apache.felix.inventory", "1.0.6");
        versions.put("org.apache.felix:org.apache.felix.metatype", "1.2.2");
        versions.put("org.apache.felix:org.apache.felix.scr", "2.1.16");
        versions.put("org.apache.felix:org.apache.felix.webconsole", "4.3.12");
        versions.put("org.awaitility:awaitility", "4.0.0");
        versions.put("org.codehaus.groovy:groovy", "2.5.0");
        versions.put("org.codehaus.groovy:groovy-json", "2.5.0");
        versions.put("org.codehaus.groovy:groovy-xml", "2.5.0");
        versions.put("org.hamcrest:hamcrest", "2.1");
        versions.put("org.ops4j.base:ops4j-base-lang", "1.5.0");
        versions.put("org.ops4j.base:ops4j-base-util-property", "1.5.0");
        versions.put("org.ops4j.pax.swissbox:pax-swissbox-bnd", "1.8.3");
        versions.put("org.ops4j.pax.swissbox:pax-swissbox-property", "1.8.3");
        versions.put("org.ops4j.pax.url:pax-url-classpath", "2.6.1");
        versions.put("org.ops4j.pax.url:pax-url-commons", "2.6.1");
        versions.put("org.ops4j.pax.url:pax-url-wrap", "2.6.1");
        versions.put("org.ops4j.pax.tinybundles:tinybundles", "3.0.0");
        versions.put("org.osgi:org.osgi.util.function", "1.1.0");
        versions.put("org.osgi:org.osgi.util.promise", "1.1.0");
        versions.put("org.ow2.asm:asm", "7.1");
        versions.put("org.rnorth.duct-tape:duct-tape", "1.0.8");
        versions.put("org.slf4j:slf4j-api", "1.7.26");
        versions.put("org.slf4j:jcl-over-slf4j", "1.7.26");
        versions.put("org.testcontainers:testcontainers", "1.11.3");
        versions.put("ch.qos.logback:logback-core", "1.2.3");
        versions.put("ch.qos.logback:logback-classic", "1.2.3");
        versions.put("biz.aQute.bnd:biz.aQute.bndlib", "3.5.0");
        versions.put("biz.aQute.bnd:bndlib", "2.4.0");
        versions.put("io.rest-assured:json-path", "4.0.0");
        versions.put("io.rest-assured:rest-assured", "4.0.0");
        versions.put("io.rest-assured:rest-assured-common", "4.0.0");
        versions.put("io.rest-assured:xml-path", "4.0.0");{{#each bundles}}
        versions.put("{{groupId}}:{{artifactId}}", "{{version}}");{{/each}}
    }

    private String key(final String groupId, final String artifactId) {
        return String.format("%s:%s", groupId, artifactId);
    }

    public String setVersion(final String groupId, final String artifactId, final String version) {
        return versions.put(key(groupId, artifactId), version);
    }

    public String setVersionFromProject(final String groupId, final String artifactId) {
        final String version = MavenUtils.getArtifactVersion(groupId, artifactId);
        return versions.put(key(groupId, artifactId), version);
    }

    @Override
    public String getVersion(final String groupId, final String artifactId) {
        return versions.get(key(groupId, artifactId));
    }

    public static int getJavaVersion() {
        final String version = System.getProperty("java.specification.version");
        try {
            if (version.contains(".")) {
                return Integer.parseInt(version.split("\\.")[1]);
            } else {
                return Integer.parseInt(version);
            }
        } catch (NumberFormatException e) {
            return 0;
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy