@@ -62,32 +62,33 @@ public void testWrite() throws Exception {
62
62
final PathAttributes folderAttributes = new GraphAttributesFinderFeature (session , fileid ).find (folder );
63
63
final String folderEtag = folderAttributes .getETag ();
64
64
final long folderTimestamp = folderAttributes .getModificationDate ();
65
- final byte [] content = RandomUtils .nextBytes (5 * 1024 * 1024 );
65
+ final byte [] sourceContent = RandomUtils .nextBytes (5 * 1024 * 1024 );
66
66
final TransferStatus status = new TransferStatus ();
67
- status .setLength (content .length );
67
+ status .setLength (sourceContent .length );
68
68
final Path file = new Path (folder , new AlphanumericRandomStringService ().random (), EnumSet .of (Path .Type .file ));
69
69
final String id = new GraphTouchFeature (session , fileid ).touch (file , new TransferStatus ()).attributes ().getFileId ();
70
70
final StatusOutputStream <DriveItem .Metadata > out = feature .write (file , status , new DisabledConnectionCallback ());
71
- new StreamCopier (status , status ).transfer (new ByteArrayInputStream (content ), out );
71
+ new StreamCopier (status , status ).transfer (new ByteArrayInputStream (sourceContent ), out );
72
72
assertNotNull (out .getStatus ());
73
73
assertTrue (status .isComplete ());
74
74
assertNotSame (PathAttributes .EMPTY , status .getResponse ());
75
75
assertEquals (Protocol .DirectoryTimestamp .explicit , session .getHost ().getProtocol ().getDirectoryTimestamp ());
76
76
assertEquals (folderEtag , new GraphAttributesFinderFeature (session , fileid ).find (folder ).getETag ());
77
77
assertEquals (folderTimestamp , new GraphAttributesFinderFeature (session , fileid ).find (folder ).getModificationDate ());
78
78
assertTrue (new DefaultFindFeature (session ).find (file ));
79
- final byte [] compare = new byte [content .length ];
80
- final InputStream stream = new GraphReadFeature (session , fileid ).read (file , new TransferStatus ().setLength (content .length ), new DisabledConnectionCallback ());
79
+ final byte [] compare = new byte [sourceContent .length ];
80
+ final InputStream stream = new GraphReadFeature (session , fileid ).read (file , new TransferStatus ().setLength (sourceContent .length ), new DisabledConnectionCallback ());
81
81
IOUtils .readFully (stream , compare );
82
82
stream .close ();
83
- assertArrayEquals (content , compare );
83
+ assertArrayEquals (sourceContent , compare );
84
84
final Path copy = new Path (file );
85
85
copy .attributes ().setCustom (Collections .emptyMap ());
86
86
assertEquals (id , fileid .getFileId (copy ));
87
87
// Overwrite
88
88
final StatusOutputStream <DriveItem .Metadata > overwrite = feature .write (file , status .setExists (true ), new DisabledConnectionCallback ());
89
89
assertNotNull (overwrite );
90
- assertEquals (content .length , IOUtils .copyLarge (new ByteArrayInputStream (content ), overwrite ));
90
+ final byte [] overwriteContent = RandomUtils .nextBytes (5 * 1024 * 1024 );
91
+ assertEquals (overwriteContent .length , IOUtils .copyLarge (new ByteArrayInputStream (overwriteContent ), overwrite ));
91
92
overwrite .close ();
92
93
final PathAttributes overwriteAttr = new GraphAttributesFinderFeature (session , fileid ).toAttributes (overwrite .getStatus ());
93
94
assertEquals (overwriteAttr , new GraphAttributesFinderFeature (session , fileid ).find (file ));
0 commit comments