Repository: deltaspike
Updated Branches:
  refs/heads/deltaspike-1.8.x a360578bd -> 8a131ed14


DELTASPIKE-1319 additional tests for labeled alternatives


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/8a131ed1
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/8a131ed1
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/8a131ed1

Branch: refs/heads/deltaspike-1.8.x
Commit: 8a131ed14c3c51da13d1fce56892e2c1edfe8053
Parents: a360578
Author: gpetracek <gpetra...@apache.org>
Authored: Mon Apr 16 21:27:15 2018 +0200
Committer: gpetracek <gpetra...@apache.org>
Committed: Mon Apr 16 22:26:32 2018 +0200

----------------------------------------------------------------------
 .../testcontrol/uc017/DefaultServiceTest.java   | 44 +++++++++++++++++
 .../uc017/DefaultTestServiceProducer.java       | 40 ++++++++++++++++
 .../testcontrol/uc017/LabeledServiceTest.java   | 50 ++++++++++++++++++++
 .../uc017/LabeledTestServiceProducer.java       | 41 ++++++++++++++++
 .../test/testcontrol/uc017/TestService.java     | 24 ++++++++++
 .../testcontrol/uc018/DefaultServiceTest.java   | 44 +++++++++++++++++
 .../uc018/DefaultTestServiceProducer.java       | 38 +++++++++++++++
 .../uc018/InterceptedDefaultTestService.java    | 35 ++++++++++++++
 .../uc018/InterceptedLabeledTestService.java    | 35 ++++++++++++++
 .../uc018/InterceptedTestService.java           | 24 ++++++++++
 .../uc018/InterceptedTestServiceProducer.java   | 24 ++++++++++
 .../testcontrol/uc018/LabeledServiceTest.java   | 50 ++++++++++++++++++++
 .../uc018/LabeledTestServiceProducer.java       | 40 ++++++++++++++++
 .../testcontrol/uc018/TestServiceQualifier.java | 38 +++++++++++++++
 .../uc018/TestUpperCaseInterceptor.java         | 31 ++++++++++++
 .../TestUpperCaseInterceptorImplementation.java | 41 ++++++++++++++++
 .../META-INF/apache-deltaspike.properties       |  3 ++
 .../impl/src/test/resources/META-INF/beans.xml  |  1 +
 18 files changed, 603 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultServiceTest.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultServiceTest.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultServiceTest.java
new file mode 100644
index 0000000..9fa7a40
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultServiceTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc017;
+
+import org.apache.deltaspike.test.category.SeCategory;
+import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+//Usually NOT needed! Currently only needed due to our arquillian-setup
+@Category(SeCategory.class)
+
+@RunWith(CdiTestRunner.class)
+public class DefaultServiceTest
+{
+    @Inject
+    private TestService testService;
+
+    @Test
+    public void defaultValue()
+    {
+        Assert.assertEquals("default-result", testService.getValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultTestServiceProducer.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultTestServiceProducer.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultTestServiceProducer.java
new file mode 100644
index 0000000..ce3be60
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/DefaultTestServiceProducer.java
@@ -0,0 +1,40 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc017;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+@ApplicationScoped
+public class DefaultTestServiceProducer
+{
+    @Produces
+    @ApplicationScoped
+    protected TestService testService()
+    {
+        return new TestService()
+        {
+            @Override
+            public String getValue()
+            {
+                return "default-result";
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledServiceTest.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledServiceTest.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledServiceTest.java
new file mode 100644
index 0000000..1222ad2
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledServiceTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc017;
+
+import org.apache.deltaspike.test.category.SeCategory;
+import org.apache.deltaspike.testcontrol.api.TestControl;
+import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+//Usually NOT needed! Currently only needed due to our arquillian-setup
+@Category(SeCategory.class)
+
+@RunWith(CdiTestRunner.class)
+@TestControl(activeAlternativeLabel = LabeledServiceTest.Label.class)
+public class LabeledServiceTest
+{
+    @Inject
+    private TestService testService;
+
+    @Test
+    public void labeledValue()
+    {
+        Assert.assertEquals("labeled-result", testService.getValue());
+    }
+
+    class Label implements TestControl.Label
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledTestServiceProducer.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledTestServiceProducer.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledTestServiceProducer.java
new file mode 100644
index 0000000..0434408
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/LabeledTestServiceProducer.java
@@ -0,0 +1,41 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc017;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
+
+@Alternative
+public class LabeledTestServiceProducer extends DefaultTestServiceProducer
+{
+    @Produces
+    @ApplicationScoped
+    protected TestService testService()
+    {
+        return new TestService()
+        {
+            @Override
+            public String getValue()
+            {
+                return "labeled-result";
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/TestService.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/TestService.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/TestService.java
new file mode 100644
index 0000000..d46527d
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc017/TestService.java
@@ -0,0 +1,24 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc017;
+
+public interface TestService
+{
+    String getValue();
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultServiceTest.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultServiceTest.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultServiceTest.java
new file mode 100644
index 0000000..b530ab9
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultServiceTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import org.apache.deltaspike.test.category.SeCategory;
+import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+//Usually NOT needed! Currently only needed due to our arquillian-setup
+@Category(SeCategory.class)
+
+@RunWith(CdiTestRunner.class)
+public class DefaultServiceTest
+{
+    @Inject
+    private InterceptedTestService interceptedTestService;
+
+    @Test
+    public void defaultValue()
+    {
+        Assert.assertEquals("DEFAULT-RESULT", 
interceptedTestService.getValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultTestServiceProducer.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultTestServiceProducer.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultTestServiceProducer.java
new file mode 100644
index 0000000..8deb763
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/DefaultTestServiceProducer.java
@@ -0,0 +1,38 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+
+import static 
org.apache.deltaspike.test.testcontrol.uc018.TestServiceQualifier.Mode.DEFAULT;
+
+@ApplicationScoped
+public class DefaultTestServiceProducer implements 
InterceptedTestServiceProducer
+{
+    @Produces
+    @Default //optional
+    @Dependent
+    public InterceptedTestService 
createInterceptedTestService(@TestServiceQualifier(DEFAULT) 
InterceptedTestService interceptedTestService)
+    {
+        return interceptedTestService; //the exposed result is an intercepted 
instance
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedDefaultTestService.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedDefaultTestService.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedDefaultTestService.java
new file mode 100644
index 0000000..455718d
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedDefaultTestService.java
@@ -0,0 +1,35 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import static 
org.apache.deltaspike.test.testcontrol.uc018.TestServiceQualifier.Mode.DEFAULT;
+
+@ApplicationScoped
+@TestUpperCaseInterceptor
+@TestServiceQualifier(DEFAULT)
+public class InterceptedDefaultTestService implements InterceptedTestService
+{
+    @Override
+    public String getValue()
+    {
+        return "default-result";
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedLabeledTestService.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedLabeledTestService.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedLabeledTestService.java
new file mode 100644
index 0000000..a7cfcb6
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedLabeledTestService.java
@@ -0,0 +1,35 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import static 
org.apache.deltaspike.test.testcontrol.uc018.TestServiceQualifier.Mode.LABELED;
+
+@ApplicationScoped
+@TestUpperCaseInterceptor
+@TestServiceQualifier(LABELED)
+public class InterceptedLabeledTestService implements InterceptedTestService
+{
+    @Override
+    public String getValue()
+    {
+        return "labeled-result";
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestService.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestService.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestService.java
new file mode 100644
index 0000000..95f15ea
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestService.java
@@ -0,0 +1,24 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+public interface InterceptedTestService
+{
+    String getValue();
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestServiceProducer.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestServiceProducer.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestServiceProducer.java
new file mode 100644
index 0000000..c672055
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/InterceptedTestServiceProducer.java
@@ -0,0 +1,24 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+public interface InterceptedTestServiceProducer
+{
+    InterceptedTestService createInterceptedTestService(InterceptedTestService 
interceptedTestService);
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledServiceTest.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledServiceTest.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledServiceTest.java
new file mode 100644
index 0000000..5b30781
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledServiceTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import org.apache.deltaspike.test.category.SeCategory;
+import org.apache.deltaspike.testcontrol.api.TestControl;
+import org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+//Usually NOT needed! Currently only needed due to our arquillian-setup
+@Category(SeCategory.class)
+
+@RunWith(CdiTestRunner.class)
+@TestControl(activeAlternativeLabel = LabeledServiceTest.Label.class)
+public class LabeledServiceTest
+{
+    @Inject
+    private InterceptedTestService interceptedTestService;
+
+    @Test
+    public void labeledValue()
+    {
+        Assert.assertEquals("LABELED-RESULT", 
interceptedTestService.getValue());
+    }
+
+    class Label implements TestControl.Label
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledTestServiceProducer.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledTestServiceProducer.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledTestServiceProducer.java
new file mode 100644
index 0000000..6002dc2
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/LabeledTestServiceProducer.java
@@ -0,0 +1,40 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+
+import static 
org.apache.deltaspike.test.testcontrol.uc018.TestServiceQualifier.Mode.LABELED;
+
+@Alternative
+@ApplicationScoped
+public class LabeledTestServiceProducer implements 
InterceptedTestServiceProducer
+{
+    @Produces
+    @Default //optional
+    @Dependent
+    public InterceptedTestService 
createInterceptedTestService(@TestServiceQualifier(LABELED) 
InterceptedTestService interceptedTestService)
+    {
+        return interceptedTestService; //the exposed result is an intercepted 
instance
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestServiceQualifier.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestServiceQualifier.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestServiceQualifier.java
new file mode 100644
index 0000000..ed7d7cc
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestServiceQualifier.java
@@ -0,0 +1,38 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.*;
+
+@Qualifier
+@Documented
+@Inherited
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.TYPE, ElementType.PARAMETER })
+public @interface TestServiceQualifier
+{
+    Mode value();
+
+    enum Mode
+    {
+        DEFAULT, LABELED
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptor.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptor.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptor.java
new file mode 100644
index 0000000..5c61985
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptor.java
@@ -0,0 +1,31 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.*;
+
+@InterceptorBinding
+@Documented
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.TYPE, ElementType.METHOD })
+public @interface TestUpperCaseInterceptor
+{
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptorImplementation.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptorImplementation.java
 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptorImplementation.java
new file mode 100644
index 0000000..426451f
--- /dev/null
+++ 
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc018/TestUpperCaseInterceptorImplementation.java
@@ -0,0 +1,41 @@
+/*
+ * 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.deltaspike.test.testcontrol.uc018;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+
+@TestUpperCaseInterceptor
+@Interceptor
+public class TestUpperCaseInterceptorImplementation implements Serializable
+{
+    @AroundInvoke
+    public Object executeInTransaction(InvocationContext invocationContext) 
throws Exception
+    {
+        Object result = invocationContext.proceed();
+
+        if (result instanceof String)
+        {
+            return ((String) result).toUpperCase();
+        }
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties
 
b/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties
index 64820bf..357e2b6 100644
--- 
a/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties
+++ 
b/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties
@@ -28,3 +28,6 @@ 
labeledAlternatives[y].org.apache.deltaspike.test.testcontrol.uc014.TestService=
 
 
globalAlternatives.org.apache.deltaspike.test.testcontrol.uc015.TestService=org.apache.deltaspike.test.testcontrol.uc015.GlobalAlternativeTestService
 
labeledAlternatives[lbl].org.apache.deltaspike.test.testcontrol.uc015.TestService=org.apache.deltaspike.test.testcontrol.uc015.LabeledTestService
+
+labeledAlternatives[label].org.apache.deltaspike.test.testcontrol.uc017.DefaultTestServiceProducer=org.apache.deltaspike.test.testcontrol.uc017.LabeledTestServiceProducer
+labeledAlternatives[label].org.apache.deltaspike.test.testcontrol.uc018.InterceptedTestServiceProducer=org.apache.deltaspike.test.testcontrol.uc018.LabeledTestServiceProducer

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8a131ed1/deltaspike/modules/test-control/impl/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/test-control/impl/src/test/resources/META-INF/beans.xml 
b/deltaspike/modules/test-control/impl/src/test/resources/META-INF/beans.xml
index 2b5d7ba..d1b25a7 100644
--- a/deltaspike/modules/test-control/impl/src/test/resources/META-INF/beans.xml
+++ b/deltaspike/modules/test-control/impl/src/test/resources/META-INF/beans.xml
@@ -23,6 +23,7 @@
     <interceptors>
         
<class>org.apache.deltaspike.test.testcontrol.uc011.TestInterceptorImplementation</class>
         
<class>org.apache.deltaspike.test.testcontrol.mock.uc015.TestInterceptorImplementation</class>
+        
<class>org.apache.deltaspike.test.testcontrol.uc018.TestUpperCaseInterceptorImplementation</class>
     </interceptors>
 
     <alternatives>

Reply via email to