Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
a395679b
Commit
a395679b
authored
Jun 22, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix JarURLConnectionTests on Windows
Closes gh-6109
parent
13ceea5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
JarURLConnectionTests.java
...pringframework/boot/loader/jar/JarURLConnectionTests.java
+16
-10
No files found.
spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/JarURLConnectionTests.java
View file @
a395679b
...
@@ -52,30 +52,28 @@ public class JarURLConnectionTests {
...
@@ -52,30 +52,28 @@ public class JarURLConnectionTests {
@Test
@Test
public
void
connectionToRootUsingAbsoluteUrl
()
throws
Exception
{
public
void
connectionToRootUsingAbsoluteUrl
()
throws
Exception
{
URL
absoluteUrl
=
new
URL
(
URL
absoluteUrl
=
new
URL
(
"jar:file:"
+
getAbsolutePath
()
+
"!/"
);
"jar:file:"
+
this
.
rootJarFile
.
getAbsoluteFile
()
+
"!/"
);
assertThat
(
new
JarURLConnection
(
absoluteUrl
,
this
.
jarFile
).
getContent
())
assertThat
(
new
JarURLConnection
(
absoluteUrl
,
this
.
jarFile
).
getContent
())
.
isSameAs
(
this
.
jarFile
);
.
isSameAs
(
this
.
jarFile
);
}
}
@Test
@Test
public
void
connectionToRootUsingRelativeUrl
()
throws
Exception
{
public
void
connectionToRootUsingRelativeUrl
()
throws
Exception
{
URL
relativeUrl
=
new
URL
(
"jar:file:"
+
this
.
rootJarFile
+
"!/"
);
URL
relativeUrl
=
new
URL
(
"jar:file:"
+
getRelativePath
()
+
"!/"
);
assertThat
(
new
JarURLConnection
(
relativeUrl
,
this
.
jarFile
).
getContent
())
assertThat
(
new
JarURLConnection
(
relativeUrl
,
this
.
jarFile
).
getContent
())
.
isSameAs
(
this
.
jarFile
);
.
isSameAs
(
this
.
jarFile
);
}
}
@Test
@Test
public
void
connectionToEntryUsingAbsoluteUrl
()
throws
Exception
{
public
void
connectionToEntryUsingAbsoluteUrl
()
throws
Exception
{
URL
absoluteUrl
=
new
URL
(
URL
absoluteUrl
=
new
URL
(
"jar:file:"
+
getAbsolutePath
()
+
"!/1.dat"
);
"jar:file:"
+
this
.
rootJarFile
.
getAbsoluteFile
()
+
"!/1.dat"
);
assertThat
(
new
JarURLConnection
(
absoluteUrl
,
this
.
jarFile
).
getInputStream
())
assertThat
(
new
JarURLConnection
(
absoluteUrl
,
this
.
jarFile
).
getInputStream
())
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
1
}));
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
1
}));
}
}
@Test
@Test
public
void
connectionToEntryUsingRelativeUrl
()
throws
Exception
{
public
void
connectionToEntryUsingRelativeUrl
()
throws
Exception
{
URL
relativeUrl
=
new
URL
(
"jar:file:"
+
this
.
rootJarFile
+
"!/1.dat"
);
URL
relativeUrl
=
new
URL
(
"jar:file:"
+
getRelativePath
()
+
"!/1.dat"
);
assertThat
(
new
JarURLConnection
(
relativeUrl
,
this
.
jarFile
).
getInputStream
())
assertThat
(
new
JarURLConnection
(
relativeUrl
,
this
.
jarFile
).
getInputStream
())
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
1
}));
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
1
}));
}
}
...
@@ -83,8 +81,7 @@ public class JarURLConnectionTests {
...
@@ -83,8 +81,7 @@ public class JarURLConnectionTests {
@Test
@Test
public
void
connectionToEntryUsingAbsoluteUrlWithFileColonSlashSlashPrefix
()
public
void
connectionToEntryUsingAbsoluteUrlWithFileColonSlashSlashPrefix
()
throws
Exception
{
throws
Exception
{
URL
absoluteUrl
=
new
URL
(
URL
absoluteUrl
=
new
URL
(
"jar:file:/"
+
getAbsolutePath
()
+
"!/1.dat"
);
"jar:file:/"
+
this
.
rootJarFile
.
getAbsoluteFile
()
+
"!/1.dat"
);
assertThat
(
new
JarURLConnection
(
absoluteUrl
,
this
.
jarFile
).
getInputStream
())
assertThat
(
new
JarURLConnection
(
absoluteUrl
,
this
.
jarFile
).
getInputStream
())
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
1
}));
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
1
}));
}
}
...
@@ -92,16 +89,25 @@ public class JarURLConnectionTests {
...
@@ -92,16 +89,25 @@ public class JarURLConnectionTests {
@Test
@Test
public
void
connectionToEntryUsingAbsoluteUrlForNestedEntry
()
throws
Exception
{
public
void
connectionToEntryUsingAbsoluteUrlForNestedEntry
()
throws
Exception
{
URL
absoluteUrl
=
new
URL
(
URL
absoluteUrl
=
new
URL
(
"jar:file:"
+
this
.
rootJarFile
.
getAbsoluteFile
()
+
"!/nested.jar!/3.dat"
);
"jar:file:"
+
getAbsolutePath
()
+
"!/nested.jar!/3.dat"
);
assertThat
(
new
JarURLConnection
(
absoluteUrl
,
this
.
jarFile
).
getInputStream
())
assertThat
(
new
JarURLConnection
(
absoluteUrl
,
this
.
jarFile
).
getInputStream
())
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
3
}));
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
3
}));
}
}
@Test
@Test
public
void
connectionToEntryUsingRelativeUrlForNestedEntry
()
throws
Exception
{
public
void
connectionToEntryUsingRelativeUrlForNestedEntry
()
throws
Exception
{
URL
relativeUrl
=
new
URL
(
"jar:file:"
+
this
.
rootJarFile
+
"!/nested.jar!/3.dat"
);
URL
relativeUrl
=
new
URL
(
"jar:file:"
+
getRelativePath
()
+
"!/nested.jar!/3.dat"
);
assertThat
(
new
JarURLConnection
(
relativeUrl
,
this
.
jarFile
).
getInputStream
())
assertThat
(
new
JarURLConnection
(
relativeUrl
,
this
.
jarFile
).
getInputStream
())
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
3
}));
.
hasSameContentAs
(
new
ByteArrayInputStream
(
new
byte
[]
{
3
}));
}
}
private
String
getAbsolutePath
()
{
return
this
.
rootJarFile
.
getAbsolutePath
().
replace
(
'\\'
,
'/'
);
}
private
String
getRelativePath
()
{
return
this
.
rootJarFile
.
getPath
().
replace
(
'\\'
,
'/'
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment