Author: pete.muir(a)jboss.org
Date: 2010-01-22 11:46:19 -0500 (Fri, 22 Jan 2010)
New Revision: 5598
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/WebProfileMethodSelector.java
Log:
port CDITCK-85 to trunk
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/WebProfileMethodSelector.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/WebProfileMethodSelector.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/WebProfileMethodSelector.java 2010-01-22
16:46:19 UTC (rev 5598)
@@ -0,0 +1,45 @@
+package org.jboss.jsr299.tck.impl;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.IMethodSelector;
+import org.testng.IMethodSelectorContext;
+import org.testng.ITestNGMethod;
+
+public class WebProfileMethodSelector implements IMethodSelector
+{
+
+ private static final long serialVersionUID = 4868366080536037160L;
+
+ public boolean includeMethod(IMethodSelectorContext ctx, ITestNGMethod method, boolean
isTestMethod)
+ {
+ return isWar(method.getMethod().getDeclaringClass()) &&
!isFullProfileOnly(method.getGroups());
+ }
+
+ public void setTestMethods(List<ITestNGMethod> arg0)
+ {
+ // No-op, not needed
+ }
+
+ private static boolean isWar(Class<?> declaringClass)
+ {
+ if (declaringClass.isAnnotationPresent(Packaging.class))
+ {
+ return
declaringClass.getAnnotation(Packaging.class).value().equals(PackagingType.WAR);
+ }
+ else
+ {
+ // WAR is default
+ return true;
+ }
+ }
+
+ private boolean isFullProfileOnly(String[] groups)
+ {
+ return Arrays.asList(groups).contains("javaee-full");
+ }
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/impl/WebProfileMethodSelector.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Show replies by date