Fixing tests so that when run on a CI within jetty itself,

This commit is contained in:
Joakim Erdfelt 2012-01-20 11:12:26 -07:00
parent 80ffe47e7e
commit 3f172067c4
2 changed files with 7 additions and 11 deletions

View File

@ -34,8 +34,8 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>junit</artifactId> <artifactId>jetty-test-helper</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -13,12 +13,13 @@
package org.eclipse.jetty.start; package org.eclipse.jetty.start;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.util.List; import java.util.List;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -34,18 +35,13 @@ public class MainTest
@Before @Before
public void setUp() throws Exception public void setUp() throws Exception
{ {
System.setProperty("jetty.home",this.getClass().getResource("/jetty.home").getFile()); File testJettyHome = MavenTestingUtils.getTestResourceDir("jetty.home");
System.setProperty("jetty.home",testJettyHome.getAbsolutePath());
} }
/**
* Test method for {@link org.eclipse.jetty.start.StartIniParser#loadStartIni(java.lang.String)}.
* @throws IOException
*/
@Test @Test
public void testLoadStartIni() throws IOException public void testLoadStartIni() throws IOException
{ {
URL startIni = this.getClass().getResource("/jetty.home/");
System.setProperty("jetty.home",startIni.getFile());
Main main = new Main(); Main main = new Main();
List<String> args = main.parseStartIniFiles(); List<String> args = main.parseStartIniFiles();
assertEquals("Expected 5 uncommented lines in start.ini",9,args.size()); assertEquals("Expected 5 uncommented lines in start.ini",9,args.size());