File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed
main/kotlin/dev/androidx/ci
test/kotlin/dev/androidx/ci/fake Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -265,6 +265,11 @@ internal interface BlobVisitor {
265265 val fileName: String
266266 get() = gcsPath.path.substringAfterLast(' /' )
267267
268+ /* *
269+ * The size of the blob
270+ */
271+ val size: Long
272+
268273 /* *
269274 * Opens the input stream to the blob. You must make sure to close it after using it.
270275 */
@@ -288,4 +293,6 @@ private class BlobVisitorImpl(
288293 override fun toString (): String {
289294 return " Blob($gcsPath )"
290295 }
296+
297+ override val size: Long = blob.size
291298}
Original file line number Diff line number Diff line change @@ -238,6 +238,11 @@ interface TestRunnerService {
238238 * Creates an [InputStream] for the file. Note that you must close it after using.
239239 */
240240 fun openInputStream (): InputStream
241+
242+ /* *
243+ * Size of the file.
244+ */
245+ val size: Long
241246 }
242247
243248 /* *
Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ internal class TestRunnerServiceImpl internal constructor(
347347 private val blobVisitor : BlobVisitor
348348 ) : TestRunnerService.ResultFileResource {
349349 override val gcsPath = blobVisitor.gcsPath
350+ override val size = blobVisitor.size
350351 override fun openInputStream (): InputStream = blobVisitor.obtainInputStream()
351352 override fun toString (): String {
352353 return " ResultFile('$gcsPath ')"
Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ internal class FakeGoogleCloudApi(
5757 get() = entry.key.path.substringAfter(gcsPath.path).trimStart(' /' )
5858 override val gcsPath: GcsPath
5959 get() = entry.key
60+ override val size: Long
61+ get() = artifacts[gcsPath]?.size?.toLong() ? : 0
62+
6063 override fun obtainInputStream (): InputStream {
6164 return entry.value.inputStream()
6265 }
@@ -71,6 +74,9 @@ internal class FakeGoogleCloudApi(
7174 get() = " "
7275 override val gcsPath: GcsPath
7376 get() = gcsPath
77+ override val size: Long
78+ get() = artifacts[gcsPath]?.size?.toLong() ? : 0
79+
7480 override fun obtainInputStream (): InputStream {
7581 return artifacts[gcsPath]?.inputStream() ? : InputStream .nullInputStream()
7682 }
You can’t perform that action at this time.
0 commit comments