From jbossws-commits at lists.jboss.org Wed Jan 21 03:15:08 2015 Content-Type: multipart/mixed; boundary="===============0636097062611450458==" MIME-Version: 1.0 From: jbossws-commits at lists.jboss.org To: jbossws-commits at lists.jboss.org Subject: [jbossws-commits] JBossWS SVN: r19397 - stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test. Date: Wed, 21 Jan 2015 03:15:07 -0500 Message-ID: <201501210815.t0L8F7Qi006509@svn01.web.mwc.hst.phx2.redhat.com> --===============0636097062611450458== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jim.ma Date: 2015-01-21 03:15:07 -0500 (Wed, 21 Jan 2015) New Revision: 19397 Added: stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss= /wsf/test/IgnoreContainer.java Log: Add junit TestRule class to ignore tests for specified containers Added: stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/j= boss/wsf/test/IgnoreContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jbos= s/wsf/test/IgnoreContainer.java (rev 0) +++ stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jbos= s/wsf/test/IgnoreContainer.java 2015-01-21 08:15:07 UTC (rev 19397) @@ -0,0 +1,80 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2012, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.wsf.test; + +import java.util.Arrays; + +import org.junit.Assume; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + * TestRule class to ignore test for the specified container. You can use = this class to ignore = + * test when the container is the specified ones: + *
+ * public class IgnoreContainerTest {
+ *  @Rule
+ *  public IgnoreContainer rule =3D new IgnoreContainer("wildfly900", "wil=
dfly800");
+ *  @Test
+ *  public void testFoo() throws Exception {
+ *  }
+ * }
+ * 
+ * @author Jim Ma + * + */ +public class IgnoreContainer implements TestRule +{ + + private String[] ignoredContainers; + + public IgnoreContainer(String... containers) + { + this.ignoredContainers =3D containers; + } + + @Override + public Statement apply(final Statement base, final Description descript= ion) + { + return new Statement() { + boolean ignored =3D false; + + @Override + public void evaluate() throws Throwable + { + base.evaluate(); + for (String container : ignoredContainers) + { + if (JBossWSTestHelper.getIntegrationTarget().startsWith(con= tainer)) + { + ignored =3D true; + break; + } + } + //Check if ignore this test + Assume.assumeFalse(description.getClassName() + " is excluded = for container: " + Arrays.toString(ignoredContainers), ignored); + } + }; + } + +} Property changes on: stack/cxf/branches/arquillian/modules/test-utils/src/m= ain/java/org/jboss/wsf/test/IgnoreContainer.java ___________________________________________________________________ Added: svn:keywords + Rev Date Added: svn:eol-style + native --===============0636097062611450458==--