[jboss-cvs] JBossAS SVN: r111218 - branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 20 04:10:07 EDT 2011
Author: rsvoboda at redhat.com
Date: 2011-04-20 04:10:07 -0400 (Wed, 20 Apr 2011)
New Revision: 111218
Modified:
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ProbeTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/RunTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ScriptsTestBase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ShutdownTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/TwiddleTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsclientTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsprovideTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WstoolsTestCase.java
Log:
JBQA-4571 - tests to verify taht IPv4 is forced in .sh and .bat files
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ProbeTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ProbeTestCase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ProbeTestCase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -23,10 +23,6 @@
package org.jboss.test.scripts.test;
import java.io.File ;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.jboss.test.JBossTestSetup ;
/**
* Unit tests of probe.sh and probe.bat.
@@ -65,7 +61,20 @@
System.out.println("Working directory: " + getBinDir()) ;
System.out.println("Dist directory: " + getDistDir()) ;
}
-
+
+ /**
+ * Tests if IPv4 is forced to be used
+ */
+ public void testIPv4() {
+ String suffix = isWindows() ? ".bat" : ".sh";
+ String ipv4Text = "-Djava.net.preferIPv4Stack=true";
+ File file = new File(getBinDir() + FS + "probe" + suffix);
+
+ if (!fileContainsText(file, ipv4Text)) {
+ fail("File " + file.getAbsolutePath() + " doesn't contain '" + ipv4Text + "' text");
+ }
+ }
+
/**
* Tests probe "help" command
*
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/RunTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/RunTestCase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/RunTestCase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -93,7 +93,20 @@
System.out.println("Log directory: " + getLogDir()) ;
System.out.println("Server config: " + getServerConfig()) ;
}
-
+
+ /**
+ * Tests if IPv4 is forced to be used
+ */
+ public void testIPv4() {
+ String suffix = isWindows() ? ".bat" : ".sh";
+ String ipv4Text = "-Djava.net.preferIPv4Stack=true";
+ File file = new File(getBinDir() + FS + "run" + suffix);
+
+ if (!fileContainsText(file, ipv4Text)) {
+ fail("File " + file.getAbsolutePath() + " doesn't contain '" + ipv4Text + "' text");
+ }
+ }
+
/**
* Tests run "help" command (no args)
*
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ScriptsTestBase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ScriptsTestBase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ScriptsTestBase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -21,6 +21,9 @@
*/
package org.jboss.test.scripts.test;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
import java.io.IOException ;
import java.net.URL ;
@@ -392,4 +395,33 @@
catch(InterruptedException e) {
}
}
+
+ /**
+ * Checks if File contains specified text.
+ *
+ * @param text
+ * @param file
+ * @return true if file contains specified text
+ */
+ protected boolean fileContainsText(File file, String text) {
+ boolean containText = false;
+ try {
+ BufferedReader input = new BufferedReader(new FileReader(file));
+ try {
+ String line = null;
+ while ((line = input.readLine()) != null) {
+ if (line.contains(text)) {
+ containText = true;
+ break;
+ }
+ }
+ } finally {
+ input.close();
+ }
+ } catch (Exception ex) {
+ fail("Exception " + ex.getMessage());
+ }
+
+ return containText;
+ }
}
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ShutdownTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ShutdownTestCase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/ShutdownTestCase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -87,7 +87,20 @@
System.out.println("Log directory: " + getLogDir()) ;
System.out.println("Server config: " + getServerConfig()) ;
}
-
+
+ /**
+ * Tests if IPv4 is forced to be used
+ */
+ public void testIPv4() {
+ String suffix = isWindows() ? ".bat" : ".sh";
+ String ipv4Text = "-Djava.net.preferIPv4Stack=true";
+ File file = new File(getBinDir() + FS + "shutdown" + suffix);
+
+ if (!fileContainsText(file, ipv4Text)) {
+ fail("File " + file.getAbsolutePath() + " doesn't contain '" + ipv4Text + "' text");
+ }
+ }
+
/**
* Tests run "help" command (no args)
*
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/TwiddleTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/TwiddleTestCase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/TwiddleTestCase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -53,7 +53,20 @@
System.out.println("Working directory: " + getBinDir()) ;
System.out.println("Dist directory: " + getDistDir()) ;
}
-
+
+ /**
+ * Tests if IPv4 is forced to be used
+ */
+ public void testIPv4() {
+ String suffix = isWindows() ? ".bat" : ".sh";
+ String ipv4Text = "-Djava.net.preferIPv4Stack=true";
+ File file = new File(getBinDir() + FS + "twiddle" + suffix);
+
+ if (!fileContainsText(file, ipv4Text)) {
+ fail("File " + file.getAbsolutePath() + " doesn't contain '" + ipv4Text + "' text");
+ }
+ }
+
/**
* Tests twiddle "help" command (no args)
*
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsclientTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsclientTestCase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsclientTestCase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -62,6 +62,19 @@
}
/**
+ * Tests if IPv4 is forced to be used
+ */
+ public void testIPv4() {
+ String suffix = isWindows() ? ".bat" : ".sh";
+ String ipv4Text = "-Djava.net.preferIPv4Stack=true";
+ File file = new File(getBinDir() + FS + "wsrunclient" + suffix);
+
+ if (!fileContainsText(file, ipv4Text)) {
+ fail("File " + file.getAbsolutePath() + " doesn't contain '" + ipv4Text + "' text");
+ }
+ }
+
+ /**
* Tests run "help" command (no args)
*
* @throws Exception
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsconsumeTestCase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -58,6 +58,19 @@
}
/**
+ * Tests if IPv4 is forced to be used
+ */
+ public void testIPv4() {
+ String suffix = isWindows() ? ".bat" : ".sh";
+ String ipv4Text = "-Djava.net.preferIPv4Stack=true";
+ File file = new File(getBinDir() + FS + "wsconsume" + suffix);
+
+ if (!fileContainsText(file, ipv4Text)) {
+ fail("File " + file.getAbsolutePath() + " doesn't contain '" + ipv4Text + "' text");
+ }
+ }
+
+ /**
* Tests run "help" command (no args)
*
* @throws Exception
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsprovideTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsprovideTestCase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WsprovideTestCase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -58,6 +58,19 @@
}
/**
+ * Tests if IPv4 is forced to be used
+ */
+ public void testIPv4() {
+ String suffix = isWindows() ? ".bat" : ".sh";
+ String ipv4Text = "-Djava.net.preferIPv4Stack=true";
+ File file = new File(getBinDir() + FS + "wsprovide" + suffix);
+
+ if (!fileContainsText(file, ipv4Text)) {
+ fail("File " + file.getAbsolutePath() + " doesn't contain '" + ipv4Text + "' text");
+ }
+ }
+
+ /**
* Tests run "help" command (no args)
*
* @throws Exception
Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WstoolsTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WstoolsTestCase.java 2011-04-20 07:44:42 UTC (rev 111217)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/scripts/test/WstoolsTestCase.java 2011-04-20 08:10:07 UTC (rev 111218)
@@ -59,6 +59,20 @@
}
/**
+ * Tests if IPv4 is forced to be used
+ */
+ public void testIPv4() {
+ String suffix = isWindows() ? ".bat" : ".sh";
+ String ipv4Text = "-Djava.net.preferIPv4Stack=true";
+ File file = new File(getBinDir() + FS + "wstools" + suffix);
+
+ if (!fileContainsText(file, ipv4Text)) {
+ fail("File " + file.getAbsolutePath() + " doesn't contain '" + ipv4Text + "' text");
+ }
+ }
+
+
+ /**
* Tests run "help" command (no args)
*
* @throws Exception
More information about the jboss-cvs-commits
mailing list