Fixes #308865 (Update test suite to JUnit4 - Module jetty-start).
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1633 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
4171777536
commit
9b9cdd45fd
|
@ -9,6 +9,7 @@ jetty-7.1.0.RC1-SNAPSHOT
|
||||||
+ 310918 Synchronize content exchange
|
+ 310918 Synchronize content exchange
|
||||||
+ 311154 Use Appendable in preference to StringBuilder/StringBuffer in APIs
|
+ 311154 Use Appendable in preference to StringBuilder/StringBuffer in APIs
|
||||||
+ 297104 HTTP CONNECT does not work correct with SSL destinations
|
+ 297104 HTTP CONNECT does not work correct with SSL destinations
|
||||||
|
+ 308865 Update test suite to JUnit4 - Module jetty-start
|
||||||
|
|
||||||
jetty-7.1.0.RC0 27 April 2010
|
jetty-7.1.0.RC0 27 April 2010
|
||||||
+ 294563 Websocket client connection
|
+ 294563 Websocket client connection
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit4-version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -25,24 +25,22 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ConfigTest extends TestCase
|
public class ConfigTest
|
||||||
{
|
{
|
||||||
private File jettyHomeDir;
|
|
||||||
private File resourcesDir;
|
|
||||||
|
|
||||||
private void assertEquals(String msg, Classpath expected, Classpath actual)
|
private void assertEquals(String msg, Classpath expected, Classpath actual)
|
||||||
{
|
{
|
||||||
assertNotNull(msg + " : expected classpath should not be null",expected);
|
Assert.assertNotNull(msg + " : expected classpath should not be null",expected);
|
||||||
assertNotNull(msg + " : actual classpath should not be null",actual);
|
Assert.assertNotNull(msg + " : actual classpath should not be null",actual);
|
||||||
assertTrue(msg + " : expected should have an entry",expected.count() >= 1);
|
Assert.assertTrue(msg + " : expected should have an entry",expected.count() >= 1);
|
||||||
assertTrue(msg + " : actual should have an entry",actual.count() >= 1);
|
Assert.assertTrue(msg + " : actual should have an entry",actual.count() >= 1);
|
||||||
if (expected.count() != actual.count())
|
if (expected.count() != actual.count())
|
||||||
{
|
{
|
||||||
expected.dump(System.err);
|
expected.dump(System.err);
|
||||||
actual.dump(System.err);
|
actual.dump(System.err);
|
||||||
assertEquals(msg + " : count",expected.count(),actual.count());
|
Assert.assertEquals(msg + " : count",expected.count(),actual.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<File> actualEntries = Arrays.asList(actual.getElements());
|
List<File> actualEntries = Arrays.asList(actual.getElements());
|
||||||
|
@ -58,18 +56,18 @@ public class ConfigTest extends TestCase
|
||||||
{
|
{
|
||||||
expected.dump(System.err);
|
expected.dump(System.err);
|
||||||
actual.dump(System.err);
|
actual.dump(System.err);
|
||||||
assertEquals(msg + ": entry [" + i + "]",expectedEntries.get(i),actualEntries.get(i));
|
Assert.assertEquals(msg + ": entry [" + i + "]",expectedEntries.get(i),actualEntries.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertEquals(String msg, Collection<String> expected, Collection<String> actual)
|
private void assertEquals(String msg, Collection<String> expected, Collection<String> actual)
|
||||||
{
|
{
|
||||||
assertTrue(msg + " : expected should have an entry",expected.size() >= 1);
|
Assert.assertTrue(msg + " : expected should have an entry",expected.size() >= 1);
|
||||||
assertEquals(msg + " : size",expected.size(),actual.size());
|
Assert.assertEquals(msg + " : size",expected.size(),actual.size());
|
||||||
for (String expectedVal : expected)
|
for (String expectedVal : expected)
|
||||||
{
|
{
|
||||||
assertTrue(msg + " : should contain <" + expectedVal + ">",actual.contains(expectedVal));
|
Assert.assertTrue(msg + " : should contain <" + expectedVal + ">",actual.contains(expectedVal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,12 +79,7 @@ public class ConfigTest extends TestCase
|
||||||
|
|
||||||
private File getJettyHomeDir()
|
private File getJettyHomeDir()
|
||||||
{
|
{
|
||||||
if (jettyHomeDir == null)
|
return new File(getTestResourcesDir(),"jetty.home");
|
||||||
{
|
|
||||||
jettyHomeDir = new File(getTestResourcesDir(),"jetty.home");
|
|
||||||
}
|
|
||||||
|
|
||||||
return jettyHomeDir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTestableJettyHome()
|
private String getTestableJettyHome()
|
||||||
|
@ -96,19 +89,15 @@ public class ConfigTest extends TestCase
|
||||||
|
|
||||||
private File getTestResourcesDir()
|
private File getTestResourcesDir()
|
||||||
{
|
{
|
||||||
if (resourcesDir == null)
|
File src = new File(System.getProperty("user.dir"),"src");
|
||||||
{
|
File test = new File(src,"test");
|
||||||
File src = new File(System.getProperty("user.dir"),"src");
|
return new File(test,"resources");
|
||||||
File test = new File(src,"test");
|
|
||||||
resourcesDir = new File(test,"resources");
|
|
||||||
}
|
|
||||||
|
|
||||||
return resourcesDir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT "/=" for assign canonical path
|
* Test for SUBJECT "/=" for assign canonical path
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectAssignCanonicalPath() throws IOException
|
public void testSubjectAssignCanonicalPath() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -117,12 +106,13 @@ public class ConfigTest extends TestCase
|
||||||
Config cfg = new Config();
|
Config cfg = new Config();
|
||||||
cfg.parse(buf);
|
cfg.parse(buf);
|
||||||
|
|
||||||
assertEquals(getTestResourcesDir().getCanonicalPath(),cfg.getProperty("test.resources.dir"));
|
Assert.assertEquals(getTestResourcesDir().getCanonicalPath(),cfg.getProperty("test.resources.dir"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT "~=" for assigning Start Properties
|
* Test for SUBJECT "~=" for assigning Start Properties
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectAssignStartProperty() throws IOException
|
public void testSubjectAssignStartProperty() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -132,13 +122,14 @@ public class ConfigTest extends TestCase
|
||||||
Config options = new Config();
|
Config options = new Config();
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
assertEquals("foo",options.getProperty("test.jetty.start.text"));
|
Assert.assertEquals("foo",options.getProperty("test.jetty.start.text"));
|
||||||
assertEquals("Eatagramovabits",options.getProperty("test.jetty.start.quote"));
|
Assert.assertEquals("Eatagramovabits",options.getProperty("test.jetty.start.quote"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT "=" for assigning System Properties
|
* Test for SUBJECT "=" for assigning System Properties
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectAssignSystemProperty() throws IOException
|
public void testSubjectAssignSystemProperty() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -148,13 +139,14 @@ public class ConfigTest extends TestCase
|
||||||
Config options = new Config();
|
Config options = new Config();
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
assertEquals("foo",System.getProperty("test.jetty.start.text"));
|
Assert.assertEquals("foo",System.getProperty("test.jetty.start.text"));
|
||||||
assertEquals("Eatagramovabits",System.getProperty("test.jetty.start.quote"));
|
Assert.assertEquals("Eatagramovabits",System.getProperty("test.jetty.start.quote"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with "/**", all jar and zip components in dir (deep, recursive)
|
* Test for SUBJECT ending with "/**", all jar and zip components in dir (deep, recursive)
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectComponentDirDeep() throws IOException
|
public void testSubjectComponentDirDeep() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -191,9 +183,10 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Components (Deep)",expected,actual);
|
assertEquals("Components (Deep)",expected,actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with "/*", all jar and zip components in dir (shallow, no recursion)
|
* Test for SUBJECT ending with "/*", all jar and zip components in dir (shallow, no recursion)
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectComponentDirShallow() throws IOException
|
public void testSubjectComponentDirShallow() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -225,9 +218,10 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Components (Shallow)",expected,actual);
|
assertEquals("Components (Shallow)",expected,actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with ".class", a Main Class
|
* Test for SUBJECT ending with ".class", a Main Class
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectMainClass() throws IOException
|
public void testSubjectMainClass() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -236,12 +230,13 @@ public class ConfigTest extends TestCase
|
||||||
Config options = new Config();
|
Config options = new Config();
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
assertEquals("org.eclipse.jetty.xml.XmlConfiguration",options.getMainClassname());
|
Assert.assertEquals("org.eclipse.jetty.xml.XmlConfiguration",options.getMainClassname());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with ".class", a Main Class
|
* Test for SUBJECT ending with ".class", a Main Class
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectMainClassConditionalPropertySet() throws IOException
|
public void testSubjectMainClassConditionalPropertySet() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -252,12 +247,13 @@ public class ConfigTest extends TestCase
|
||||||
options.setProperty("start.class","net.company.server.Start");
|
options.setProperty("start.class","net.company.server.Start");
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
assertEquals("net.company.server.Start",options.getMainClassname());
|
Assert.assertEquals("net.company.server.Start",options.getMainClassname());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with ".class", a Main Class
|
* Test for SUBJECT ending with ".class", a Main Class
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectMainClassConditionalPropertyUnset() throws IOException
|
public void testSubjectMainClassConditionalPropertyUnset() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -268,12 +264,13 @@ public class ConfigTest extends TestCase
|
||||||
// The "start.class" property is unset.
|
// The "start.class" property is unset.
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
assertEquals("org.eclipse.jetty.xml.XmlConfiguration",options.getMainClassname());
|
Assert.assertEquals("org.eclipse.jetty.xml.XmlConfiguration",options.getMainClassname());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with "/", a simple Classpath Entry
|
* Test for SUBJECT ending with "/", a simple Classpath Entry
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectSimpleComponent() throws IOException
|
public void testSubjectSimpleComponent() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -293,9 +290,10 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Simple Component",expected,actual);
|
assertEquals("Simple Component",expected,actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with "/", a simple Classpath Entry
|
* Test for SUBJECT ending with "/", a simple Classpath Entry
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectSimpleComponentMultiple() throws IOException
|
public void testSubjectSimpleComponentMultiple() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -317,9 +315,10 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Simple Component",expected,actual);
|
assertEquals("Simple Component",expected,actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with "/", a simple Classpath Entry
|
* Test for SUBJECT ending with "/", a simple Classpath Entry
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectSimpleComponentNotExists() throws IOException
|
public void testSubjectSimpleComponentNotExists() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -340,9 +339,10 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Simple Component",expected,actual);
|
assertEquals("Simple Component",expected,actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with ".xml", an XML Configuration File
|
* Test for SUBJECT ending with ".xml", an XML Configuration File
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectXmlConfigAlt() throws IOException
|
public void testSubjectXmlConfigAlt() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -359,13 +359,14 @@ public class ConfigTest extends TestCase
|
||||||
|
|
||||||
List<String> actual = options.getXmlConfigs();
|
List<String> actual = options.getXmlConfigs();
|
||||||
String expected = new File("src/test/resources/test-alt.xml").getAbsolutePath();
|
String expected = new File("src/test/resources/test-alt.xml").getAbsolutePath();
|
||||||
assertEquals("XmlConfig.size",1,actual.size());
|
Assert.assertEquals("XmlConfig.size",1,actual.size());
|
||||||
assertEquals(expected,actual.get(0));
|
Assert.assertEquals(expected,actual.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with ".xml", an XML Configuration File
|
* Test for SUBJECT ending with ".xml", an XML Configuration File
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectXmlConfigDefault() throws IOException
|
public void testSubjectXmlConfigDefault() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -380,13 +381,14 @@ public class ConfigTest extends TestCase
|
||||||
|
|
||||||
List<String> actual = options.getXmlConfigs();
|
List<String> actual = options.getXmlConfigs();
|
||||||
String expected = getJettyEtcFile("test-jetty.xml");
|
String expected = getJettyEtcFile("test-jetty.xml");
|
||||||
assertEquals("XmlConfig.size",1,actual.size());
|
Assert.assertEquals("XmlConfig.size",1,actual.size());
|
||||||
assertEquals(expected,actual.get(0));
|
Assert.assertEquals(expected,actual.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test for SUBJECT ending with ".xml", an XML Configuration File.
|
* Test for SUBJECT ending with ".xml", an XML Configuration File.
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSubjectXmlConfigMultiple() throws IOException
|
public void testSubjectXmlConfigMultiple() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -409,9 +411,10 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Multiple XML Configs",expected,actual);
|
assertEquals("Multiple XML Configs",expected,actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test Section Handling
|
* Test Section Handling
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSectionClasspathSingle() throws IOException
|
public void testSectionClasspathSingle() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -426,12 +429,12 @@ public class ConfigTest extends TestCase
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
Classpath defaultClasspath = options.getClasspath();
|
Classpath defaultClasspath = options.getClasspath();
|
||||||
assertNotNull("Default Classpath should not be null",defaultClasspath);
|
Assert.assertNotNull("Default Classpath should not be null",defaultClasspath);
|
||||||
Classpath foocp = options.getSectionClasspath("Foo");
|
Classpath foocp = options.getSectionClasspath("Foo");
|
||||||
assertNull("Foo Classpath should not exist",foocp);
|
Assert.assertNull("Foo Classpath should not exist",foocp);
|
||||||
|
|
||||||
Classpath allcp = options.getSectionClasspath("All");
|
Classpath allcp = options.getSectionClasspath("All");
|
||||||
assertNotNull("Classpath section 'All' should exist",allcp);
|
Assert.assertNotNull("Classpath section 'All' should exist",allcp);
|
||||||
|
|
||||||
File lib = new File(getJettyHomeDir(),"lib");
|
File lib = new File(getJettyHomeDir(),"lib");
|
||||||
|
|
||||||
|
@ -442,9 +445,10 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Single Classpath Section",expected,allcp);
|
assertEquals("Single Classpath Section",expected,allcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test Section Handling
|
* Test Section Handling
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSectionClasspathAvailable() throws IOException
|
public void testSectionClasspathAvailable() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -459,12 +463,12 @@ public class ConfigTest extends TestCase
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
Classpath defaultClasspath = options.getClasspath();
|
Classpath defaultClasspath = options.getClasspath();
|
||||||
assertNotNull("Default Classpath should not be null",defaultClasspath);
|
Assert.assertNotNull("Default Classpath should not be null",defaultClasspath);
|
||||||
Classpath foocp = options.getSectionClasspath("Foo");
|
Classpath foocp = options.getSectionClasspath("Foo");
|
||||||
assertNull("Foo Classpath should not exist",foocp);
|
Assert.assertNull("Foo Classpath should not exist",foocp);
|
||||||
|
|
||||||
Classpath allcp = options.getSectionClasspath("All");
|
Classpath allcp = options.getSectionClasspath("All");
|
||||||
assertNotNull("Classpath section 'All' should exist",allcp);
|
Assert.assertNotNull("Classpath section 'All' should exist",allcp);
|
||||||
|
|
||||||
File lib = new File(getJettyHomeDir(),"lib");
|
File lib = new File(getJettyHomeDir(),"lib");
|
||||||
|
|
||||||
|
@ -475,9 +479,10 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Single Classpath Section",expected,allcp);
|
assertEquals("Single Classpath Section",expected,allcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Test Section Handling, with multiple defined sections.
|
* Test Section Handling, with multiple defined sections.
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testSectionClasspathMultiples() throws IOException
|
public void testSectionClasspathMultiples() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -506,10 +511,10 @@ public class ConfigTest extends TestCase
|
||||||
cfg.parse(buf);
|
cfg.parse(buf);
|
||||||
|
|
||||||
Classpath defaultClasspath = cfg.getClasspath();
|
Classpath defaultClasspath = cfg.getClasspath();
|
||||||
assertNotNull("Default Classpath should not be null",defaultClasspath);
|
Assert.assertNotNull("Default Classpath should not be null",defaultClasspath);
|
||||||
|
|
||||||
Classpath foocp = cfg.getSectionClasspath("Foo");
|
Classpath foocp = cfg.getSectionClasspath("Foo");
|
||||||
assertNull("Foo Classpath should not exist",foocp);
|
Assert.assertNull("Foo Classpath should not exist",foocp);
|
||||||
|
|
||||||
// Test if entire section list can be fetched
|
// Test if entire section list can be fetched
|
||||||
Set<String> sections = cfg.getSectionIds();
|
Set<String> sections = cfg.getSectionIds();
|
||||||
|
@ -527,7 +532,7 @@ public class ConfigTest extends TestCase
|
||||||
|
|
||||||
// Test fetch of specific section by name works
|
// Test fetch of specific section by name works
|
||||||
Classpath cpAll = cfg.getSectionClasspath("All");
|
Classpath cpAll = cfg.getSectionClasspath("All");
|
||||||
assertNotNull("Classpath section 'All' should exist",cpAll);
|
Assert.assertNotNull("Classpath section 'All' should exist",cpAll);
|
||||||
|
|
||||||
File lib = new File(getJettyHomeDir(),"lib");
|
File lib = new File(getJettyHomeDir(),"lib");
|
||||||
|
|
||||||
|
@ -563,8 +568,7 @@ public class ConfigTest extends TestCase
|
||||||
assertEquals("Classpath combined 'server,logging'",expectedCombined,cpCombined);
|
assertEquals("Classpath combined 'server,logging'",expectedCombined,cpCombined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
|
||||||
public void testDynamicSection() throws IOException
|
public void testDynamicSection() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -577,27 +581,26 @@ public class ConfigTest extends TestCase
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
Classpath defaultClasspath = options.getClasspath();
|
Classpath defaultClasspath = options.getClasspath();
|
||||||
assertNotNull("Default Classpath should not be null",defaultClasspath);
|
Assert.assertNotNull("Default Classpath should not be null",defaultClasspath);
|
||||||
Classpath foocp = options.getSectionClasspath("foo");
|
Classpath foocp = options.getSectionClasspath("foo");
|
||||||
assertNotNull("Foo Classpath should not exist",foocp);
|
Assert.assertNotNull("Foo Classpath should not exist",foocp);
|
||||||
|
|
||||||
Classpath allcp = options.getSectionClasspath("All");
|
Classpath allcp = options.getSectionClasspath("All");
|
||||||
assertNotNull("Classpath section 'All' should exist",allcp);
|
Assert.assertNotNull("Classpath section 'All' should exist",allcp);
|
||||||
|
|
||||||
Classpath extcp = options.getSectionClasspath("ext");
|
Classpath extcp = options.getSectionClasspath("ext");
|
||||||
assertNotNull("Classpath section 'ext' should exist", extcp);
|
Assert.assertNotNull("Classpath section 'ext' should exist", extcp);
|
||||||
|
|
||||||
assertEquals("Deep Classpath Section",0,foocp.count());
|
Assert.assertEquals("Deep Classpath Section",0,foocp.count());
|
||||||
|
|
||||||
Classpath expected = new Classpath();
|
|
||||||
File lib = new File(getJettyHomeDir(),"lib");
|
File lib = new File(getJettyHomeDir(),"lib");
|
||||||
File ext = new File(lib, "ext");
|
File ext = new File(lib, "ext");
|
||||||
expected = new Classpath();
|
Classpath expected = new Classpath();
|
||||||
expected.addComponent(new File(ext,"custom-impl.jar"));
|
expected.addComponent(new File(ext,"custom-impl.jar"));
|
||||||
assertEquals("Single Classpath Section",expected,extcp);
|
assertEquals("Single Classpath Section",expected,extcp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDeepDynamicSection() throws IOException
|
public void testDeepDynamicSection() throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
@ -611,15 +614,15 @@ public class ConfigTest extends TestCase
|
||||||
options.parse(buf);
|
options.parse(buf);
|
||||||
|
|
||||||
Classpath defaultClasspath = options.getClasspath();
|
Classpath defaultClasspath = options.getClasspath();
|
||||||
assertNotNull("Default Classpath should not be null",defaultClasspath);
|
Assert.assertNotNull("Default Classpath should not be null",defaultClasspath);
|
||||||
Classpath foocp = options.getSectionClasspath("foo");
|
Classpath foocp = options.getSectionClasspath("foo");
|
||||||
assertNotNull("Foo Classpath should not exist",foocp);
|
Assert.assertNotNull("Foo Classpath should not exist",foocp);
|
||||||
|
|
||||||
Classpath allcp = options.getSectionClasspath("All");
|
Classpath allcp = options.getSectionClasspath("All");
|
||||||
assertNotNull("Classpath section 'All' should exist",allcp);
|
Assert.assertNotNull("Classpath section 'All' should exist",allcp);
|
||||||
|
|
||||||
Classpath extcp = options.getSectionClasspath("ext");
|
Classpath extcp = options.getSectionClasspath("ext");
|
||||||
assertNotNull("Classpath section 'ext' should exist", extcp);
|
Assert.assertNotNull("Classpath section 'ext' should exist", extcp);
|
||||||
|
|
||||||
File lib = new File(getJettyHomeDir(),"lib");
|
File lib = new File(getJettyHomeDir(),"lib");
|
||||||
|
|
||||||
|
@ -633,6 +636,5 @@ public class ConfigTest extends TestCase
|
||||||
expected = new Classpath();
|
expected = new Classpath();
|
||||||
expected.addComponent(new File(ext,"custom-impl.jar"));
|
expected.addComponent(new File(ext,"custom-impl.jar"));
|
||||||
assertEquals("Single Classpath Section",expected,extcp);
|
assertEquals("Single Classpath Section",expected,extcp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,21 @@
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
package org.eclipse.jetty.start;
|
package org.eclipse.jetty.start;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class VersionTest extends TestCase
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
public class VersionTest
|
||||||
{
|
{
|
||||||
|
@Test
|
||||||
public void testDefaultVersion()
|
public void testDefaultVersion()
|
||||||
{
|
{
|
||||||
Version version = new Version();
|
Version version = new Version();
|
||||||
|
|
||||||
assertEquals("Default version difference to 0.0.0",0,version.compare(new Version("0.0.0")));
|
assertEquals("Default version difference to 0.0.0",0,version.compare(new Version("0.0.0")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testNewerVersion() {
|
public void testNewerVersion() {
|
||||||
assertIsNewer("0.0.0", "0.0.1");
|
assertIsNewer("0.0.0", "0.0.1");
|
||||||
assertIsNewer("0.1.0", "0.1.1");
|
assertIsNewer("0.1.0", "0.1.1");
|
||||||
|
@ -33,6 +37,7 @@ public class VersionTest extends TestCase
|
||||||
// assertIsNewer("1.6.0_12", "1.6.0_16"); // JDK version spec?
|
// assertIsNewer("1.6.0_12", "1.6.0_16"); // JDK version spec?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testOlderVersion() {
|
public void testOlderVersion() {
|
||||||
assertIsOlder("0.0.1", "0.0.0");
|
assertIsOlder("0.0.1", "0.0.0");
|
||||||
assertIsOlder("0.1.1", "0.1.0");
|
assertIsOlder("0.1.1", "0.1.0");
|
||||||
|
@ -43,7 +48,6 @@ public class VersionTest extends TestCase
|
||||||
{
|
{
|
||||||
Version vbase = new Version(basever);
|
Version vbase = new Version(basever);
|
||||||
Version vtest = new Version(testver);
|
Version vtest = new Version(testver);
|
||||||
|
|
||||||
assertTrue("Version [" + testver + "] should be older than [" + basever + "]",
|
assertTrue("Version [" + testver + "] should be older than [" + basever + "]",
|
||||||
vtest.compare(vbase) == -1);
|
vtest.compare(vbase) == -1);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +56,6 @@ public class VersionTest extends TestCase
|
||||||
{
|
{
|
||||||
Version vbase = new Version(basever);
|
Version vbase = new Version(basever);
|
||||||
Version vtest = new Version(testver);
|
Version vtest = new Version(testver);
|
||||||
|
|
||||||
assertTrue("Version [" + testver + "] should be newer than [" + basever + "]",
|
assertTrue("Version [" + testver + "] should be newer than [" + basever + "]",
|
||||||
vtest.compare(vbase) == 1);
|
vtest.compare(vbase) == 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue