Skip to content

Commit

Permalink
Fixed spotless and adding checksum
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Scherzinger <[email protected]>
  • Loading branch information
AndyScherzinger committed Jan 29, 2024
1 parent c6b4721 commit 682489e
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,63 +76,63 @@ abstract class FileUploaderIT : AbstractOnServerIT() {

/**
* uploads a file, overwrites it with an empty one, check if overwritten
*/
/** disabled, flaky test
* @Test
* fun testKeepLocalAndOverwriteRemote() {
* val file = getDummyFile("chunkedFile.txt")
* val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)
*
* assertTrue(
* UploadFileOperation(
* uploadsStorageManager,
* connectivityServiceMock,
* powerManagementServiceMock,
* user,
* null,
* ocUpload,
* FileUploader.NameCollisionPolicy.DEFAULT,
* FileUploader.LOCAL_BEHAVIOUR_COPY,
* targetContext,
* false,
* false
* )
* .setRemoteFolderToBeCreated()
* .execute(client, storageManager)
* .isSuccess
* )
*
* val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
* assertTrue(result.isSuccess)
*
* assertEquals(file.length(), (result.data[0] as RemoteFile).length)
*
* val ocUpload2 = OCUpload(getDummyFile("empty.txt").absolutePath, "/testFile.txt", account.name)
*
* assertTrue(
* UploadFileOperation(
* uploadsStorageManager,
* connectivityServiceMock,
* powerManagementServiceMock,
* user,
* null,
* ocUpload2,
* FileUploader.NameCollisionPolicy.OVERWRITE,
* FileUploader.LOCAL_BEHAVIOUR_COPY,
* targetContext,
* false,
* false
* )
* .execute(client, storageManager)
* .isSuccess
* )
*
* val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
* assertTrue(result2.isSuccess)
*
* assertEquals(0, (result2.data[0] as RemoteFile).length)
* }
* deactivated flaky test
*/
fun testKeepLocalAndOverwriteRemote() {
val file = getDummyFile("chunkedFile.txt")
val ocUpload = OCUpload(file.absolutePath, "/testFile.txt", account.name)

assertTrue(
UploadFileOperation(
uploadsStorageManager,
connectivityServiceMock,
powerManagementServiceMock,
user,
null,
ocUpload,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false
)
.setRemoteFolderToBeCreated()
.execute(client, storageManager)
.isSuccess
)

val result = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result.isSuccess)

assertEquals(file.length(), (result.data[0] as RemoteFile).length)

val ocUpload2 = OCUpload(getDummyFile("empty.txt").absolutePath, "/testFile.txt", account.name)

assertTrue(
UploadFileOperation(
uploadsStorageManager,
connectivityServiceMock,
powerManagementServiceMock,
user,
null,
ocUpload2,
FileUploader.NameCollisionPolicy.OVERWRITE,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false
)
.execute(client, storageManager)
.isSuccess
)

val result2 = ReadFileRemoteOperation("/testFile.txt").execute(client)
assertTrue(result2.isSuccess)

assertEquals(0, (result2.data[0] as RemoteFile).length)
}


/**
* uploads a file, overwrites it with an empty one, check if overwritten
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
val file1 = rootDir.createFile(type1, name1)!!

// check assumptions
/* FIXME: mimeType */
// FIXME: mimeType
file1.assertRegularFile(name1, 0L, null, rootDir)
file1.assertRecentlyModified()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
Expand Down Expand Up @@ -48,7 +47,7 @@ internal class AvatarTestFragment : Fragment() {
}

fun addAvatar(name: String, avatarRadius: Float, width: Int, targetContext: Context) {
val margin = padding
val margin = PADDING
val imageView = ImageView(targetContext)
imageView.setImageDrawable(TextDrawable.createNamedAvatar(name, avatarRadius))

Expand All @@ -61,7 +60,7 @@ internal class AvatarTestFragment : Fragment() {
}

fun addBitmap(bitmap: Bitmap, width: Int, list: Int, targetContext: Context) {
val margin = padding
val margin = PADDING
val imageView = ImageView(targetContext)
imageView.setImageBitmap(bitmap)

Expand All @@ -78,6 +77,6 @@ internal class AvatarTestFragment : Fragment() {
}

companion object {
private const val padding = 10
private const val PADDING = 10
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ class TrashbinLocalRepository(private val testCase: TrashbinActivityIT.TestCase)
"image/png",
"/trashbin/test.png",
"subFolder/test.png",
1395847838, // random date
1395847908 // random date
// random date
1395847838,
// random date
1395847908
)
)
files.add(
Expand All @@ -61,8 +63,10 @@ class TrashbinLocalRepository(private val testCase: TrashbinActivityIT.TestCase)
"image/jpeg",
"/trashbin/image.jpg",
"image.jpg",
1395841858, // random date
1395837858 // random date
// random date
1395841858,
// random date
1395837858
)
)
files.add(
Expand All @@ -71,8 +75,10 @@ class TrashbinLocalRepository(private val testCase: TrashbinActivityIT.TestCase)
"DIR",
"/trashbin/folder/",
"folder",
1395347858, // random date
1395849858 // random date
// random date
1395347858,
// random date
1395849858
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ class EncryptionUtilsV2IT : AbstractIT() {
mimeType = MimeType.JPEG
},
EncryptionUtils.generateIV(),
EncryptionUtils.generateUid(), // random string, not real tag
// random string, not real tag
EncryptionUtils.generateUid(),
EncryptionUtils.generateKey(),
metadataFile,
storageManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ abstract class NextcloudDatabase : RoomDatabase() {

companion object {
const val FIRST_ROOM_DB_VERSION = 65
private var INSTANCE: NextcloudDatabase? = null
private var instance: NextcloudDatabase? = null

@JvmStatic
@Suppress("DeprecatedCallableAddReplaceWith")
Expand All @@ -93,8 +93,8 @@ abstract class NextcloudDatabase : RoomDatabase() {

@JvmStatic
fun getInstance(context: Context, clock: Clock): NextcloudDatabase {
if (INSTANCE == null) {
INSTANCE = Room
if (instance == null) {
instance = Room
.databaseBuilder(context, NextcloudDatabase::class.java, ProviderMeta.DB_NAME)
.allowMainThreadQueries()
.addLegacyMigrations(clock, context)
Expand All @@ -103,7 +103,7 @@ abstract class NextcloudDatabase : RoomDatabase() {
.fallbackToDestructiveMigration()
.build()
}
return INSTANCE!!
return instance!!
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ class GeneratePdfFromImagesWork(
user,
arrayOf(pdfPath),
arrayOf(uploadPath),
FileUploadWorker.LOCAL_BEHAVIOUR_DELETE, // MIME type will be detected from file name
// MIME type will be detected from file name
FileUploadWorker.LOCAL_BEHAVIOUR_DELETE,
true,
UploadFileOperation.CREATED_BY_USER,
false,
Expand Down
2 changes: 1 addition & 1 deletion gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<ignored-key id="3D12CA2AC19F3181" reason="Key couldn't be downloaded from any key server"/>
<ignored-key id="991EFB94DB91127D" reason="Key couldn't be downloaded from any key server"/>
<ignored-key id="F13D3E721D56BD54" reason="Key couldn't be downloaded from any key server"/>
<ignored-key id="56E73BA9A0B592D0" reason="Key couldn't be downloaded from any key server"/>
<ignored-key id="3D002DBC5EA9615F" reason="Key couldn't be downloaded from any key server"/>
<ignored-key id="56E73BA9A0B592D0" reason="Key couldn't be downloaded from any key server"/>
</ignored-keys>
<trusted-keys>
<trusted-key id="015479E1055341431B4545AB72475FD306B9CAB7" group="com.googlecode.javaewah" name="JavaEWAH" version="1.2.3"/>
Expand Down

0 comments on commit 682489e

Please sign in to comment.