Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerjroach committed Mar 22, 2024
1 parent 7d17677 commit a2887b5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ import com.amplifyframework.testutils.FileAssert
import com.amplifyframework.testutils.random.RandomTempFile
import com.amplifyframework.testutils.sync.SynchronousAuth
import com.amplifyframework.testutils.sync.SynchronousStorage
import java.io.File
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.BeforeClass
import org.junit.Test
import java.io.File
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference

/**
* Instrumentation test for operational work on download.
Expand All @@ -67,7 +66,7 @@ class AWSS3StoragePathDownloadTest {
private val LARGE_FILE_NAME = "large-${System.currentTimeMillis()}"
private val LARGE_FILE_PATH = StoragePath.fromString("public/$LARGE_FILE_NAME")
private val SMALL_FILE_NAME = "small-${System.currentTimeMillis()}"
private val SMALL_FILE_PATH = StoragePath.fromString("public/$SMALL_FILE_NAME")
private val SMALL_FILE_PATH = StoragePath.fromString("public/$SMALL_FILE_NAME")

lateinit var storageCategory: StorageCategory
lateinit var synchronousStorage: SynchronousStorage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ internal fun StoragePath.toS3ServiceKey(authCredentialsProvider: AuthCredentials
}

return stringPath
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ internal class AWSS3StoragePathUploadFileOperation @JvmOverloads internal constr
onProgress: Consumer<StorageTransferProgress>? = null,
onSuccess: Consumer<StorageUploadFileResult>? = null,
onError: Consumer<StorageException>? = null
) : StorageUploadFileOperation<AWSS3StoragePathUploadRequest<File>>(request, transferId, onProgress, onSuccess, onError) {
) : StorageUploadFileOperation<AWSS3StoragePathUploadRequest<File>>(
request,
transferId,
onProgress,
onSuccess,
onError
) {

private var serviceKey: String? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ class StoragePathTest {

assertEquals(expectedString, path.resolvePath("123"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class AWSS3StoragePathDownloadFileOperationTest {
fun `success identityId storage path`() {
// GIVEN
coEvery { authCredentialsProvider.getIdentityId() } returns "123"
val path = StoragePath.fromIdentityId { "protected/${it}/picture.jpg" }
val path = StoragePath.fromIdentityId { "protected/$it/picture.jpg" }
val tempFile = File.createTempFile("new", "file.tmp")
val expectedServiceKey = "protected/123/picture.jpg"
val request = AWSS3StoragePathDownloadFileRequest(
Expand Down Expand Up @@ -123,7 +123,7 @@ class AWSS3StoragePathDownloadFileOperationTest {
fun `invalid storage path fails with invalid path`() {
// GIVEN
coEvery { authCredentialsProvider.getIdentityId() } returns "123"
val path = StoragePath.fromIdentityId { "/protected/${it}/picture.jpg" }
val path = StoragePath.fromIdentityId { "/protected/$it/picture.jpg" }
val tempFile = File.createTempFile("new", "file.tmp")
val request = AWSS3StoragePathDownloadFileRequest(
path,
Expand Down Expand Up @@ -156,7 +156,7 @@ class AWSS3StoragePathDownloadFileOperationTest {
// GIVEN
val expectedException = Exception("test")
coEvery { authCredentialsProvider.getIdentityId() } throws expectedException
val path = StoragePath.fromIdentityId { "protected/${it}/picture.jpg" }
val path = StoragePath.fromIdentityId { "protected/$it/picture.jpg" }
val tempFile = File.createTempFile("new", "file.tmp")
val request = AWSS3StoragePathDownloadFileRequest(
path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class AWSS3StoragePathUploadFileOperationTest {
fun `success identityId storage path`() {
// GIVEN
coEvery { authCredentialsProvider.getIdentityId() } returns "123"
val path = StoragePath.fromIdentityId { "protected/${it}/picture.jpg" }
val path = StoragePath.fromIdentityId { "protected/$it/picture.jpg" }
val tempFile = File.createTempFile("new", "file.tmp")
val expectedServiceKey = "protected/123/picture.jpg"
val request = AWSS3StoragePathUploadRequest(
Expand Down Expand Up @@ -132,7 +132,7 @@ class AWSS3StoragePathUploadFileOperationTest {
fun `invalid storage path fails with invalid path`() {
// GIVEN
coEvery { authCredentialsProvider.getIdentityId() } returns "123"
val path = StoragePath.fromIdentityId { "/protected/${it}/picture.jpg" }
val path = StoragePath.fromIdentityId { "/protected/$it/picture.jpg" }
val tempFile = File.createTempFile("new", "file.tmp")
val request = AWSS3StoragePathUploadRequest(
path,
Expand All @@ -153,7 +153,6 @@ class AWSS3StoragePathUploadFileOperationTest {
onError
)


// WHEN
awsS3StorageUploadFileOperation.start()

Expand All @@ -169,7 +168,7 @@ class AWSS3StoragePathUploadFileOperationTest {
// GIVEN
val expectedException = Exception("test")
coEvery { authCredentialsProvider.getIdentityId() } throws expectedException
val path = StoragePath.fromIdentityId { "protected/${it}/picture.jpg" }
val path = StoragePath.fromIdentityId { "protected/$it/picture.jpg" }
val tempFile = File.createTempFile("new", "file.tmp")
val request = AWSS3StoragePathUploadRequest(
path,
Expand Down

0 comments on commit a2887b5

Please sign in to comment.