Author: jim.ma
Date: 2015-04-16 05:44:59 -0400 (Thu, 16 Apr 2015)
New Revision: 19641
Added:
stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/IgnoreEnv.java
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws981/JBWS981TestCase.java
Log:
Ignore test for ipv6
Added: stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/IgnoreEnv.java
===================================================================
--- stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/IgnoreEnv.java
(rev 0)
+++
stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/IgnoreEnv.java 2015-04-16
09:44:59 UTC (rev 19641)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2015, 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 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 some specific system property setting.
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class IgnoreEnv implements TestRule {
+
+ public static final IgnoreEnv IPV6 = new
IgnoreEnv("java.net.preferIPv6Addresses", "true");
+ public static final IgnoreEnv IPV4 = new
IgnoreEnv("java.net.preferIPv4Stack", "true");
+ private String key;
+ private String value;
+ public IgnoreEnv(String key) {
+ this(key, null);
+ }
+
+ public IgnoreEnv(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ public Statement apply(final Statement base, final Description description) {
+ return new Statement() {
+ boolean ignored = false;
+
+ @Override
+ public void evaluate() throws Throwable {
+
+ if (value != null) {
+ if (System.getProperty(key) != null &&
value.equals(System.getProperty(key))) {
+ ignored = true;
+ }
+ } else {
+ if (System.getProperty(key) != null) {
+ ignored = true;
+ }
+ }
+ Assume.assumeFalse(description.getClassName() + " is excluded for
system env (" + key + ")", ignored);
+ }
+ };
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/test-utils/src/main/java/org/jboss/wsf/test/IgnoreEnv.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws981/JBWS981TestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws981/JBWS981TestCase.java 2015-04-16
09:02:29 UTC (rev 19640)
+++
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws981/JBWS981TestCase.java 2015-04-16
09:44:59 UTC (rev 19641)
@@ -32,7 +32,9 @@
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.wsf.test.IgnoreEnv;
import org.jboss.wsf.test.JBossWSTest;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,6 +47,9 @@
@RunWith(Arquillian.class)
public class JBWS981TestCase extends JBossWSTest
{
+ //Ignore this test for ipv6; it requires host setting in /etc/hosts [::1 localhost]
+ @Rule
+ public IgnoreEnv rule = IgnoreEnv.IPV6;
@ArquillianResource
private URL baseURL;