Skip to content

Commit

Permalink
enabling back tests.
Browse files Browse the repository at this point in the history
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21357 71c3de6d-444a-0410-be80-ed276b4c234a
  • Loading branch information
kohsuke committed Sep 2, 2009
1 parent 9d2866b commit 0888b48
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
12 changes: 0 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ THE SOFTWARE.

<build>
<plugins>
<!--
I haven't figured out how to run those tests from Maven
(the problem is that when I fork another process
I need to somehow compute the right classpath), so
excluded from Maven run for now.
-->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/hudson/remoting/BinarySafeStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public void test1() throws IOException {
o.close();

InputStream in = BinarySafeStream.wrap(new ByteArrayInputStream(buf.toByteArray()));
for (int i = 0; i < data.length; i++) {
for (byte b : data) {
int ch = in.read();
assertEquals(data[i], ch);
assertEquals(b, ch);
}
assertEquals(-1,in.read());
}
Expand Down Expand Up @@ -152,7 +152,7 @@ private void randomCopy(Random r, InputStream in, OutputStream out, boolean rand
int ch = in.read();
if(dump)
System.out.println("read1("+ch+')');
assert ch>=0;
assertTrue(255>=ch && ch>=-1); // make sure the range is [-1,255]
if(ch==-1)
return;
out.write(ch);
Expand Down
18 changes: 17 additions & 1 deletion src/test/java/hudson/remoting/ChannelRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.net.URLClassLoader;
import java.net.URL;

/**
* Hides the logic of starting/stopping a channel for test.
Expand Down Expand Up @@ -113,7 +116,9 @@ static class Fork implements ChannelRunner {
public Channel start() throws Exception {
System.out.println("forking a new process");
// proc = Runtime.getRuntime().exec("java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000 hudson.remoting.Launcher");
proc = Runtime.getRuntime().exec("java hudson.remoting.Launcher");


proc = Runtime.getRuntime().exec("java -cp "+getClasspath()+" hudson.remoting.Launcher");

copier = new Copier("copier",proc.getErrorStream(),System.err);
copier.start();
Expand All @@ -139,5 +144,16 @@ public void stop(Channel channel) throws Exception {
public String getName() {
return "fork";
}

public String getClasspath() {
// this assumes we run in Maven
StringBuilder buf = new StringBuilder();
URLClassLoader ucl = (URLClassLoader)getClass().getClassLoader();
for (URL url : ucl.getURLs()) {
if (buf.length()>0) buf.append(File.pathSeparatorChar);
buf.append(url.getPath()); // assume all of them are file URLs
}
return buf.toString();
}
}
}
3 changes: 2 additions & 1 deletion src/test/java/hudson/remoting/ChannelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
public class ChannelTest extends RmiTestBase {
public void testCapability() {
assertTrue(channel.remoteCapability.supportsMultiClassLoaderRPC());
// for now this is disabled
assertTrue(!channel.remoteCapability.supportsMultiClassLoaderRPC());
}
}

0 comments on commit 0888b48

Please sign in to comment.