Skip to content

Commit d76b88a

Browse files
committed
o Added more test cases of the plexus manifest class
1 parent 963148d commit d76b88a

File tree

5 files changed

+57
-9
lines changed

5 files changed

+57
-9
lines changed

src/test/java/org/codehaus/plexus/archiver/jar/ManifestTest.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
*
1818
*/
1919

20-
import org.codehaus.plexus.PlexusTestCase;
21-
2220
import java.io.FileReader;
2321
import java.io.IOException;
24-
import java.util.Enumeration;
25-
import java.io.StringWriter;
2622
import java.io.PrintWriter;
23+
import java.io.StringWriter;
24+
import java.util.Enumeration;
25+
import org.codehaus.plexus.PlexusTestCase;
2726

2827
/**
2928
* @author Emmanuel Venisse
@@ -134,24 +133,33 @@ public void testAttributeLongLineWrite()
134133
attr.setValue( longLineOfChars );
135134
attr.write( new PrintWriter( writer ) );
136135
writer.flush();
137-
assertEquals( "should be multiline",
136+
assertEquals( "should be multiline",
138137
"test: 123456789 123456789 123456789 123456789 123456789 123456789 1234" + Manifest.EOL +
139138
" 56789 123456789 123456789 123456789 " + Manifest.EOL,
140139
writer.toString() );
141140
}
142-
141+
142+
143+
public void testDualClassPath()
144+
throws ManifestException, IOException
145+
{
146+
Manifest manifest = getManifest( "src/test/resources/manifests/manifestWithDualClassPath.mf" );
147+
final Manifest.Attribute attribute = manifest.getMainSection().getAttribute( "Class-Path" );
148+
assertEquals( "../config/ classes12.jar baz", attribute.getValue() );
149+
}
150+
143151
public void testAttributeMultiLineValue()
144152
throws Exception
145153
{
146-
checkMultiLineAttribute(
154+
checkMultiLineAttribute(
147155
"123456789" + Manifest.EOL + "123456789",
148156
"123456789" + Manifest.EOL + " 123456789" + Manifest.EOL );
149157
}
150158

151159
public void testAttributeDifferentLineEndings()
152160
throws Exception
153161
{
154-
checkMultiLineAttribute(
162+
checkMultiLineAttribute(
155163
"\tA\rB\n\t C\r\n \tD\n\r",
156164
"\tA" + Manifest.EOL +
157165
" B" + Manifest.EOL +
@@ -174,7 +182,7 @@ public void checkMultiLineAttribute( String in, String expected )
174182
// so in case of failure you can see what went wrong.
175183
System.err.println( "String: " + dumpString( writer.toString() ) );
176184

177-
assertEquals( "should be indented multiline",
185+
assertEquals( "should be indented multiline",
178186
"test: " + expected, writer.toString() );
179187
}
180188

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Manifest-Version: 1.0
2+
From: Jack
3+
Bar: 001
4+
5+
Name: Fudz
6+
Bar: 002
7+
8+
Name: Redz
9+
Baz: 002
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Manifest-Version: 1.0
2+
From: Jack
3+
Bar: 001
4+
5+
Name: Fudz
6+
Bar: 003
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Manifest-Version: 1.0
2+
Class-Path: ../config/
3+
classes12.jar
4+
bc4jct.jar
5+
bc4jdomorcl.jar
6+
bc4jmt.jar
7+
commons-beanutils-bean-collections.jar
8+
commons-beanutils-core.jar
9+
commons-beanutils.jar
10+
commons-codec-1.3.jar
11+
commons-collections-3.1.jar
12+
commons-configuration-1.2.jar
13+
commons-digester.jar
14+
commons-lang-2.0.jar
15+
commons-logging.jar
16+
htbclnt.jar
17+
areallylongjarfilethatisnotentirelyrealbutstillaverylongname.jar
18+
j2ee/home/oc4jclient.jar
19+
From: Jack
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Manifest-Version: 1.0
2+
Class-Path: ../config/
3+
classes12.jar
4+
From: Jack
5+
Ape: Fud
6+
Class-Path: baz

0 commit comments

Comments
 (0)