|
10 | 10 | import org.codehaus.plexus.archiver.Archiver; |
11 | 11 | import org.codehaus.plexus.archiver.UnArchiver; |
12 | 12 | import org.codehaus.plexus.archiver.util.DefaultArchivedFileSet; |
| 13 | +import org.codehaus.plexus.components.io.attributes.Java7Reflector; |
13 | 14 | import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributeUtils; |
14 | 15 | import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes; |
15 | 16 | import org.codehaus.plexus.util.FileUtils; |
@@ -138,8 +139,10 @@ public void testUseAttributesFromTarArchiveInputInTarArchiverOutput() |
138 | 139 | PlexusIoResourceAttributes fileAttributes = |
139 | 140 | PlexusIoResourceAttributeUtils.getFileAttributes( new File( tempTarDir, tempFile.getName() ) ); |
140 | 141 |
|
141 | | - assertEquals( "This test will fail if your umask is not X2X (or more)", |
142 | | - "644", fileAttributes.getOctalModeString() ); |
| 142 | + final String expected = Java7Reflector.isJava7() ? "660" : "644"; |
| 143 | + |
| 144 | + assertEquals( "This test will fail if your umask is not X2X (or more)", |
| 145 | + expected, fileAttributes.getOctalModeString() ); |
143 | 146 | } |
144 | 147 |
|
145 | 148 | public void testUseDetectedFileAttributes() |
@@ -199,8 +202,10 @@ public void testUseDetectedFileAttributes() |
199 | 202 |
|
200 | 203 | fileAttributes = PlexusIoResourceAttributeUtils.getFileAttributes( new File( tempTarDir, tempFile.getName() ) ); |
201 | 204 |
|
202 | | - assertEquals( "This test will fail if your umask is not X2X (or more)", |
203 | | - "444", fileAttributes.getOctalModeString() ); |
| 205 | + final String expected = Java7Reflector.isJava7() ? "440" : "444"; |
| 206 | + |
| 207 | + assertEquals( "This test will fail if your umask is not X2X (or more)", |
| 208 | + expected, fileAttributes.getOctalModeString() ); |
204 | 209 | } |
205 | 210 |
|
206 | 211 | private boolean checkForWindows() |
@@ -262,8 +267,10 @@ public void testOverrideDetectedFileAttributes() |
262 | 267 | PlexusIoResourceAttributes fileAttributes = |
263 | 268 | PlexusIoResourceAttributeUtils.getFileAttributes( new File( tempTarDir, tempFile.getName() ) ); |
264 | 269 |
|
265 | | - assertEquals( "This test will fail if your umask is not X2X (or more)", |
266 | | - "644", fileAttributes.getOctalModeString() ); |
| 270 | + final String expected = Java7Reflector.isJava7() ? "660" : "644"; |
| 271 | + |
| 272 | + assertEquals( "This test will fail if your umask is not X2X (or more)", |
| 273 | + expected, fileAttributes.getOctalModeString() ); |
267 | 274 | } |
268 | 275 |
|
269 | 276 | public void testOverrideDetectedFileAttributesUsingFileMode() |
@@ -320,8 +327,9 @@ public void testOverrideDetectedFileAttributesUsingFileMode() |
320 | 327 | PlexusIoResourceAttributes fileAttributes = |
321 | 328 | PlexusIoResourceAttributeUtils.getFileAttributes( new File( tempTarDir, tempFile.getName() ) ); |
322 | 329 |
|
323 | | - assertEquals( "This test will fail if your umask is not X2X (or more)", |
324 | | - "644", fileAttributes.getOctalModeString() ); |
| 330 | + final String expected = Java7Reflector.isJava7() ? "660" : "644"; |
| 331 | + assertEquals( "This test will fail if your umask is not X2X (or more)", |
| 332 | + expected, fileAttributes.getOctalModeString() ); |
325 | 333 | } |
326 | 334 |
|
327 | 335 | } |
0 commit comments