/*
 * Licensed 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.karaf.itests.features;

import org.apache.karaf.itests.KarafTestSupport;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;

@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class Spring42FeaturesTest extends KarafTestSupport {
    

    @Test
    public void installSpringFeature() throws Exception {
        installAssertAndUninstallFeature("spring", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringAspectsFeature() throws Exception {
        installAssertAndUninstallFeature("spring-aspects", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringInstrumentFeature() throws Exception {
        installAssertAndUninstallFeature("spring-instrument", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringJdbcFeature() throws Exception {
        installAssertAndUninstallFeature("spring-jdbc", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringJmsFeature() throws Exception {
        installAssertAndUninstallFeature("spring-jms", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringTestFeature() throws Exception {
        installAssertAndUninstallFeature("spring-test", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringOrmFeature() throws Exception {
        installAssertAndUninstallFeature("spring-orm", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringOxmFeature() throws Exception {
        installAssertAndUninstallFeature("spring-oxm", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringTxFeature() throws Exception {
        installAssertAndUninstallFeature("spring-tx", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringWebFeature() throws Exception {
        installAssertAndUninstallFeature("spring-web", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringWebPortletFeature() throws Exception {
        installAssertAndUninstallFeature("spring-web-portlet", System.getProperty("spring42.version"));
    }

    @Test
    public void installSpringWebSocketFeature() throws Exception {
        installAssertAndUninstallFeature("spring-websocket", System.getProperty("spring42.version"));
    }

}

@@ -706,16 +706,129 @@
 nWith;%0A%0A
+import org.ops4j.pax.exam.Configuration;%0Aimport org.ops4j.pax.exam.MavenUtils;%0Aimport org.ops4j.pax.exam.Option;%0A
 import o
@@ -970,16 +970,192 @@
 Class;%0A%0A
+import java.util.Arrays;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0A%0Aimport static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;%0A%0A
 @RunWith
@@ -1268,20 +1268,1000 @@
 pport %7B%0A
+%0A
     
+@Configuration%0A    public Option%5B%5D config() %7B%0A        String version = MavenUtils.getArtifactVersion(%22org.apache.karaf%22, %22apache-karaf%22);%0A        List%3COption%3E result = new LinkedList%3C%3E(Arrays.asList(super.config()));%0A        result.add(editConfigurationFilePut(%22etc/org.apache.karaf.features.cfg%22, %22featuresRepositories%22,%0A                %22mvn:org.apache.karaf.features/framework/%22 + version + %22/xml/features, %22 +%0A                        %22mvn:org.apache.karaf.features/spring/%22 + version + %22/xml/features, %22 +%0A                        %22mvn:org.apache.karaf.features/spring-legacy/%22 + version + %22/xml/features, %22 +%0A                        %22mvn:org.apache.karaf.features/enterprise/%22 + version + %22/xml/features, %22 +%0A                        %22mvn:org.apache.karaf.features/enterprise-legacy/%22 + version + %22/xml/features, %22 +%0A                        %22mvn:org.apache.karaf.features/standard/%22 + version + %22/xml/features%22));%0A        return result.toArray(new Option%5Bresult.size()%5D);%0A    %7D
 %0A%0A    @T

Fix Spring 4.2.x features itest