Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SB-24793 feat: Assessment archived data:: getArchivalBlobUrl method implementation #116

Merged
merged 6 commits into from
Oct 26, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -748,4 +748,20 @@ object CommonUtil {
connProperties.setProperty("password", pass)
connProperties
}

def getBlobUrl(store: String, filePath: String, bucket:String): String = {
store match {
case "local" =>
filePath
case "azure" =>
getAzureFile(bucket,filePath)
case "s3" =>
getS3File(bucket, filePath)
// $COVERAGE-OFF$ for azure testing
case "gcp" =>
//TODO - Need to support the GCP As well.
throw new Exception("gcp is currently not supported.")
// $COVERAGE-ON$
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,16 @@ class TestCommonUtil extends BaseSpec {
val copiedFile = fileUtil.copy("src/test/resources/sample_telemetry.log", "src/test/resources/sample_telemetry.json", sc.hadoopConfiguration)
sc.textFile(copiedFile, 1).count() should be (7437)
fileUtil.delete(sc.hadoopConfiguration, copiedFile)


val localUrl = CommonUtil.getBlobUrl("local", "src/test/resources/batch-001/2021-21-*.csv.gz", "local")
localUrl should be ("src/test/resources/batch-001/2021-21-*.csv.gz")

val azureUrl = CommonUtil.getBlobUrl("azure", "report/archival-data/batch-001/2021-21-*.csv.gz", "telemetry-data-store")
azureUrl should be ("wasb://[email protected]/report/archival-data/batch-001/2021-21-*.csv.gz")

val s3Url = CommonUtil.getBlobUrl("s3", "report/archival-data/batch-001/2021-21-*.csv.gz", "telemetry-data-store")
s3Url should be ("s3n://telemetry-data-store/report/archival-data/batch-001/2021-21-*.csv.gz")

sc.stop()
}

Expand Down