File tree 4 files changed +19
-0
lines changed
main/kotlin/dev/androidx/ci
test/kotlin/dev/androidx/ci/fake
4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -265,6 +265,11 @@ internal interface BlobVisitor {
265
265
val fileName: String
266
266
get() = gcsPath.path.substringAfterLast(' /' )
267
267
268
+ /* *
269
+ * The size of the blob
270
+ */
271
+ val size: Long
272
+
268
273
/* *
269
274
* Opens the input stream to the blob. You must make sure to close it after using it.
270
275
*/
@@ -288,4 +293,6 @@ private class BlobVisitorImpl(
288
293
override fun toString (): String {
289
294
return " Blob($gcsPath )"
290
295
}
296
+
297
+ override val size: Long = blob.size
291
298
}
Original file line number Diff line number Diff line change @@ -238,6 +238,11 @@ interface TestRunnerService {
238
238
* Creates an [InputStream] for the file. Note that you must close it after using.
239
239
*/
240
240
fun openInputStream (): InputStream
241
+
242
+ /* *
243
+ * Size of the file.
244
+ */
245
+ val size: Long
241
246
}
242
247
243
248
/* *
Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ internal class TestRunnerServiceImpl internal constructor(
347
347
private val blobVisitor : BlobVisitor
348
348
) : TestRunnerService.ResultFileResource {
349
349
override val gcsPath = blobVisitor.gcsPath
350
+ override val size = blobVisitor.size
350
351
override fun openInputStream (): InputStream = blobVisitor.obtainInputStream()
351
352
override fun toString (): String {
352
353
return " ResultFile('$gcsPath ')"
Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ internal class FakeGoogleCloudApi(
57
57
get() = entry.key.path.substringAfter(gcsPath.path).trimStart(' /' )
58
58
override val gcsPath: GcsPath
59
59
get() = entry.key
60
+ override val size: Long
61
+ get() = artifacts[gcsPath]?.size?.toLong() ? : 0
62
+
60
63
override fun obtainInputStream (): InputStream {
61
64
return entry.value.inputStream()
62
65
}
@@ -71,6 +74,9 @@ internal class FakeGoogleCloudApi(
71
74
get() = " "
72
75
override val gcsPath: GcsPath
73
76
get() = gcsPath
77
+ override val size: Long
78
+ get() = artifacts[gcsPath]?.size?.toLong() ? : 0
79
+
74
80
override fun obtainInputStream (): InputStream {
75
81
return artifacts[gcsPath]?.inputStream() ? : InputStream .nullInputStream()
76
82
}
You can’t perform that action at this time.
0 commit comments