ONOS-1680: Close InputStream explictly to delete the opened file reliably.
Change-Id: Iae1a57da007eb50bdf024f4acb73aebb96de7888
Showing
1 changed file
with
4 additions
and
0 deletions
... | @@ -72,6 +72,7 @@ public class ApplicationArchiveTest { | ... | @@ -72,6 +72,7 @@ public class ApplicationArchiveTest { |
72 | InputStream stream = getClass().getResourceAsStream("app.zip"); | 72 | InputStream stream = getClass().getResourceAsStream("app.zip"); |
73 | ApplicationDescription app = aar.saveApplication(stream); | 73 | ApplicationDescription app = aar.saveApplication(stream); |
74 | validate(app); | 74 | validate(app); |
75 | + stream.close(); | ||
75 | } | 76 | } |
76 | 77 | ||
77 | @Test | 78 | @Test |
... | @@ -79,6 +80,7 @@ public class ApplicationArchiveTest { | ... | @@ -79,6 +80,7 @@ public class ApplicationArchiveTest { |
79 | InputStream stream = getClass().getResourceAsStream("app.xml"); | 80 | InputStream stream = getClass().getResourceAsStream("app.xml"); |
80 | ApplicationDescription app = aar.saveApplication(stream); | 81 | ApplicationDescription app = aar.saveApplication(stream); |
81 | validate(app); | 82 | validate(app); |
83 | + stream.close(); | ||
82 | } | 84 | } |
83 | 85 | ||
84 | @Test | 86 | @Test |
... | @@ -110,6 +112,7 @@ public class ApplicationArchiveTest { | ... | @@ -110,6 +112,7 @@ public class ApplicationArchiveTest { |
110 | byte[] orig = ByteStreams.toByteArray(getClass().getResourceAsStream("app.zip")); | 112 | byte[] orig = ByteStreams.toByteArray(getClass().getResourceAsStream("app.zip")); |
111 | byte[] loaded = ByteStreams.toByteArray(stream); | 113 | byte[] loaded = ByteStreams.toByteArray(stream); |
112 | assertArrayEquals("incorrect stream", orig, loaded); | 114 | assertArrayEquals("incorrect stream", orig, loaded); |
115 | + stream.close(); | ||
113 | } | 116 | } |
114 | 117 | ||
115 | @Test | 118 | @Test |
... | @@ -119,6 +122,7 @@ public class ApplicationArchiveTest { | ... | @@ -119,6 +122,7 @@ public class ApplicationArchiveTest { |
119 | byte[] orig = ByteStreams.toByteArray(getClass().getResourceAsStream("app.xml")); | 122 | byte[] orig = ByteStreams.toByteArray(getClass().getResourceAsStream("app.xml")); |
120 | byte[] loaded = ByteStreams.toByteArray(stream); | 123 | byte[] loaded = ByteStreams.toByteArray(stream); |
121 | assertArrayEquals("incorrect stream", orig, loaded); | 124 | assertArrayEquals("incorrect stream", orig, loaded); |
125 | + stream.close(); | ||
122 | } | 126 | } |
123 | 127 | ||
124 | @Test | 128 | @Test | ... | ... |
-
Please register or login to post a comment