/*
 * Copyright 2013 Harald Wellmann.
 *
 * 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.ops4j.pax.cdi.test.karaf.weld;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.ops4j.pax.cdi.test.karaf.RegressionConfiguration.PAX_CDI_FEATURES;
import static org.ops4j.pax.cdi.test.karaf.RegressionConfiguration.SAMPLE1;
import static org.ops4j.pax.cdi.test.karaf.RegressionConfiguration.regressionDefaults;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;

import javax.inject.Inject;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.cdi.sample1.IceCreamService;
import org.ops4j.pax.cdi.spi.CdiContainerFactory;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;

@RunWith(PaxExam.class)
public class PaxCdiWeldTest {

    @Inject
    private CdiContainerFactory factory;

    @Inject
    private IceCreamService iceCreamService;

    @Configuration
    public Option[] config() {
        return options( 
            regressionDefaults(),
            features(PAX_CDI_FEATURES, "pax-cdi-weld"),
            SAMPLE1);
    }

    @Test
    public void test() throws Exception {
        assertThat(factory, is(notNullValue()));
        assertThat(iceCreamService, is(notNullValue()));
    }
}

@@ -650,140 +650,105 @@
 ort 
-static org.hamcrest.CoreMatchers.is;%0Aimport static org.hamcrest.CoreMatchers.notNullValue;%0Aimport static org.junit.Assert.assertThat
+org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.ops4j.pax.cdi.sample1.IceCreamService
 ;%0Aim
@@ -744,39 +744,32 @@
 Service;%0Aimport 
-static 
 org.ops4j.pax.cd
@@ -774,59 +774,31 @@
 cdi.
-test.karaf.RegressionConfiguration.PAX_CDI_FEATURES
+spi.CdiContainerFactory
 ;%0Aim
@@ -794,39 +794,32 @@
 Factory;%0Aimport 
-static 
 org.ops4j.pax.cd
@@ -820,33 +820,13 @@
 pax.
-cdi.test.karaf.Regression
+exam.
 Conf
@@ -838,16 +838,8 @@
 tion
-.SAMPLE1
 ;%0Aim
@@ -835,39 +835,32 @@
 uration;%0Aimport 
-static 
 org.ops4j.pax.cd
@@ -861,65 +861,19 @@
 pax.
-cdi.test.karaf.RegressionConfiguration.regressionDefaults
+exam.Option
 ;%0Aim
@@ -869,39 +869,32 @@
 .Option;%0Aimport 
-static 
 org.ops4j.pax.ex
@@ -900,27 +900,21 @@
 xam.
-CoreOptions.options
+junit.PaxExam
 ;%0Aim
@@ -922,15 +922,8 @@
 ort 
-static 
 org.
@@ -941,240 +941,190 @@
 xam.
-karaf.options.KarafDistributionOption.features;%0A%0Aimport javax.inject.Inject;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.ops4j.pax.cdi.sample1.IceCreamService;%0Aimport org.ops4j.pax.cdi.spi.CdiContainerFactory
+util.Filter;%0A%0Aimport javax.inject.Inject;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.hamcrest.CoreMatchers.notNullValue;%0Aimport static org.junit.Assert.assertThat
 ;%0Aim
@@ -1120,32 +1120,39 @@
 ertThat;%0Aimport 
+static 
 org.ops4j.pax.ex
@@ -1141,37 +1141,57 @@
 c org.ops4j.pax.
-exam.
+cdi.test.karaf.Regression
 Configuration;%0Ai
@@ -1179,32 +1179,34 @@
 ionConfiguration
+.*
 ;%0Aimport org.ops
@@ -1190,32 +1190,39 @@
 ation.*;%0Aimport 
+static 
 org.ops4j.pax.ex
@@ -1216,38 +1216,51 @@
 .ops4j.pax.exam.
+Core
 Option
+s.options
 ;%0Aimport org.ops
@@ -1244,32 +1244,39 @@
 options;%0Aimport 
+static 
 org.ops4j.pax.ex
@@ -1278,29 +1278,62 @@
 ax.exam.
-junit.PaxExam
+karaf.options.KarafDistributionOption.features
 ;%0A%0A@RunW
@@ -1440,32 +1440,74 @@
 y;%0A%0A    @Inject%0A
+    @Filter(value = %22(flavour=hazelnut)%22)%0A
     private IceC
@@ -1554,20 +1554,16 @@
 guration
-%0A   
  public 
@@ -1609,22 +1609,8 @@
 ons(
- %0A            
 regr
@@ -1626,28 +1626,16 @@
 aults(),
-%0A           
  feature
@@ -1674,20 +1674,8 @@
 d%22),
-%0A           
  SAM
@@ -1697,20 +1697,16 @@
    @Test
-%0A   
  public 
@@ -1838,20 +1838,86 @@
 lValue()));%0A
+        assertThat(iceCreamService.getFlavour(), is(%22Hazelnut%22));%0A
     %7D%0A%7D%0A

Use annotation Pax Exam @Filter to get the filtered OSGI Service