@Test(groups = "unit", dataProvider = "bool1", dataProviderClass = TestNGDataProviders.class) public void upload(final boolean shouldCommit) throws RemoteException { handleShouldCommit(shouldCommit); allowUpload(); mockObjects.replay(); final InputStream inputStream = new ByteArrayInputStream("moo".getBytes()); final UploadCallback callback = service.upload(fileId, gridId); mockObjects.verifyAndReset(); final long length = 3L; EasyMock.expect(accessProvider.putFile(EasyMock.eq(fileId), EasyMock.same(inputStream))) .andReturn(length); expectFinalizeAndReplay(shouldCommit, length); callback.onUpload(inputStream); mockObjects.verifyAndReset(); }
public void handleUpload(final String fileKey, final InputStream inputStream) { final UploadCallback uploadCallback = (UploadCallback) fileMap.remove(fileKey); uploadCallback.onUpload(inputStream); }