From b7071cbb04c54340cd39372e8a024542a1f6974a Mon Sep 17 00:00:00 2001 From: krisztina-zsihovszki Date: Mon, 16 Jan 2023 10:34:29 +0100 Subject: [PATCH] NIFI-11049 Fixed flaky PutDropboxTest, attribute description corrected This closes #6850. Signed-off-by: Peter Turcsanyi --- .../nifi/processors/dropbox/DropboxAttributes.java | 4 ++-- .../nifi/processors/dropbox/PutDropboxTest.java | 12 +++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/DropboxAttributes.java b/nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/DropboxAttributes.java index 29d9e4410c..895161cd53 100644 --- a/nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/DropboxAttributes.java +++ b/nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/main/java/org/apache/nifi/processors/dropbox/DropboxAttributes.java @@ -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"; } diff --git a/nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/test/java/org/apache/nifi/processors/dropbox/PutDropboxTest.java b/nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/test/java/org/apache/nifi/processors/dropbox/PutDropboxTest.java index 05e4c2b05f..3cca255760 100644 --- a/nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/test/java/org/apache/nifi/processors/dropbox/PutDropboxTest.java +++ b/nifi-nar-bundles/nifi-dropbox-bundle/nifi-dropbox-processors/src/test/java/org/apache/nifi/processors/dropbox/PutDropboxTest.java @@ -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);