NIFI-11049 Fixed flaky PutDropboxTest, attribute description corrected

This closes #6850.

Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
This commit is contained in:
krisztina-zsihovszki 2023-01-16 10:34:29 +01:00 committed by Peter Turcsanyi
parent b107ae1f8c
commit b7071cbb04
No known key found for this signature in database
GPG Key ID: 55A813F1C3E553DC
2 changed files with 5 additions and 11 deletions

View File

@ -30,11 +30,11 @@ public class DropboxAttributes {
public static final String SIZE_DESC = "The size of the file";
public static final String TIMESTAMP = "dropbox.timestamp";
public static final String TIMESTAMP_DESC = "The server modified time, when the file was uploaded to Dropbox";
public static final String TIMESTAMP_DESC = "The server modified time of the file";
public static final String REVISION = "dropbox.revision";
public static final String REVISION_DESC = "Revision of the file";
public static final String ERROR_MESSAGE = "error.message";
public static final String ERROR_MESSAGE_DESC = "The error message returned by Dropbox when the fetch of a file fails";
public static final String ERROR_MESSAGE_DESC = "The error message returned by Dropbox";
}

View File

@ -23,6 +23,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.nifi.processors.dropbox.DropboxAttributes.ERROR_MESSAGE;
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@ -44,7 +45,6 @@ import com.dropbox.core.v2.files.UploadWriteFailed;
import com.dropbox.core.v2.files.WriteError;
import com.dropbox.core.v2.files.WriteMode;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -255,18 +255,12 @@ public class PutDropboxTest extends AbstractDropboxTest {
.thenReturn(mockUploadSessionAppendV2Uploader);
//finish session: 30 - 8 - 2 * 8 = 6 bytes uploaded
CommitInfo commitInfo = CommitInfo.newBuilder(getPath(TEST_FOLDER , FILENAME_1))
.withMode(WriteMode.ADD)
.withStrictConflict(true)
.withClientModified(new Date(mockFlowFile.getEntryDate()))
.build();
when(mockDbxUserFilesRequest
.uploadSessionFinish(any(UploadSessionCursor.class), eq(commitInfo)))
.uploadSessionFinish(any(UploadSessionCursor.class), any(CommitInfo.class)))
.thenReturn(mockUploadSessionFinishUploader);
when(mockUploadSessionFinishUploader
.uploadAndFinish(any(InputStream.class), eq(6L)))
.uploadAndFinish(any(InputStream.class), anyLong()))
.thenReturn(createFileMetadata(FILE_ID_1, FILENAME_1, TEST_FOLDER, CREATED_TIME));
testRunner.enqueue(mockFlowFile);