Skip to content

Commit

Permalink
Provider has no label
Browse files Browse the repository at this point in the history
  • Loading branch information
alicefuzier committed Nov 2, 2018
1 parent 542e8e9 commit a5927cb
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 20 deletions.
Expand Up @@ -4,9 +4,8 @@ import io.circe.generic.extras.JsonKey
import uk.ac.wellcome.platform.archive.common.progress.models.StorageProvider

case class DisplayProvider(id: String,
label: String,
@JsonKey("type") ontologyType: String = "Provider")
object DisplayProvider {
def apply(provider: StorageProvider): DisplayProvider =
DisplayProvider(id = provider.id, label = provider.label)
DisplayProvider(id = provider.id)
}
Expand Up @@ -8,7 +8,7 @@ object StorageLocation {
StorageLocation(StorageProvider(displayLocation.provider), ObjectLocation(displayLocation.bucket, displayLocation.path))
}

case class StorageProvider(id: String, label: String)
case class StorageProvider(id: String)
object StorageProvider {
def apply(displayProvider: DisplayProvider): StorageProvider = StorageProvider(displayProvider.id, displayProvider.label)
def apply(displayProvider: DisplayProvider): StorageProvider = StorageProvider(displayProvider.id)
}
Expand Up @@ -24,7 +24,7 @@ class DisplayIngestTest extends FunSpec with Matchers with RandomThings {
val bagId = randomBagId
val progress: Progress = Progress(
id,
StorageLocation(StorageProvider("s3", "Amazon S3"), ObjectLocation("bukkit", "key.txt")),
StorageLocation(StorageProvider("s3"), ObjectLocation("bukkit", "key.txt")),
Namespace(spaceId),
Some(Callback(new URI(callbackUrl))),
Progress.Processing,
Expand Down
Expand Up @@ -12,7 +12,7 @@ import uk.ac.wellcome.storage.ObjectLocation
trait ProgressGenerators extends RandomThings {

val storageLocation = StorageLocation(
StorageProvider(randomAlphanumeric(), randomAlphanumeric()),
StorageProvider(randomAlphanumeric()),
ObjectLocation(randomAlphanumeric(), randomAlphanumeric()))

def createProgress(): Progress = createProgressWith()
Expand Down
Expand Up @@ -40,7 +40,7 @@ class ProgressTest

progress.id shouldBe a[UUID]
progress.sourceLocation shouldBe StorageLocation(
StorageProvider(displayProvider.id, displayProvider.label),
StorageProvider(displayProvider.id),
ObjectLocation(bucket, path))
progress.callback shouldBe Some(
Callback(URI.create(progressCreateRequest.callback.get.url)))
Expand Down
Expand Up @@ -77,7 +77,7 @@ class NotifierFeatureTest
.withRequestBody(equalToJson(toJson(ResponseDisplayIngest(
progress.id,
DisplayLocation(
DisplayProvider(progress.sourceLocation.provider.id, progress.sourceLocation.provider.label),
DisplayProvider(progress.sourceLocation.provider.id),
progress.sourceLocation.location.namespace,
progress.sourceLocation.location.key),
progress.callback.map(DisplayCallback(_)),
Expand Down Expand Up @@ -136,7 +136,7 @@ class NotifierFeatureTest
.withRequestBody(equalToJson(toJson(ResponseDisplayIngest(
progress.id,
DisplayLocation(
DisplayProvider(progress.sourceLocation.provider.id, progress.sourceLocation.provider.label),
DisplayProvider(progress.sourceLocation.provider.id),
progress.sourceLocation.location.namespace,
progress.sourceLocation.location.key),
progress.callback.map(DisplayCallback(_)),
Expand Down
Expand Up @@ -53,7 +53,7 @@ class ProgressHttpFeatureTest
getT[ResponseDisplayIngest](result.entity) shouldBe ResponseDisplayIngest(
progress.id,
DisplayLocation(
DisplayProvider(progress.sourceLocation.provider.id, progress.sourceLocation.provider.label),
DisplayProvider(progress.sourceLocation.provider.id),
progress.sourceLocation.location.namespace, progress.sourceLocation.location.key),
progress.callback.map(DisplayCallback(_)),
DisplayIngestType("create"),
Expand Down Expand Up @@ -204,7 +204,7 @@ class ProgressHttpFeatureTest
assertTableOnlyHasItem(
Progress(
id,
StorageLocation(StorageProvider("s3", "Amazon S3"), ObjectLocation("bucket", "key.txt")),
StorageLocation(StorageProvider("s3"), ObjectLocation("bucket", "key.txt")),
Namespace(storageSpace.id),
Some(Callback(testCallbackUri, Callback.Pending)),
Progress.Initialised,
Expand Down
Expand Up @@ -37,7 +37,7 @@ object StorageManifestFactory extends Logging {
info = bagInfo,
manifest = fileManifest,
accessLocation = StorageLocation(
StorageProvider("aws-s3-ia", "AWS S3 - Infrequent Access"),
StorageProvider("aws-s3-ia"),
ObjectLocation(
archiveComplete.bagLocation.storageNamespace,
s"${archiveComplete.bagLocation.storagePath}/${archiveComplete.bagLocation.bagPath.value}")
Expand Down
Expand Up @@ -28,8 +28,7 @@ trait StorageManifestAssertions extends Inside with Matchers {
bagDigestFiles should have size filesNumber

provider shouldBe StorageProvider(
id = "aws-s3-ia",
label = "AWS S3 - Infrequent Access")
id = "aws-s3-ia")

actualNamespace shouldBe expectedNamespace
actualPath shouldBe expectedPath
Expand Down
Expand Up @@ -49,14 +49,13 @@ class RegistrarHttpFeatureTest
val path = "path"
val bucket = "bucket"
val providerId = "provider-id"
val providerLabel = "provider label"
val storageManifest = StorageManifest(
space = space,
info = bagInfo,
manifest =
FileManifest(ChecksumAlgorithm(checksumAlgorithm), Nil),
StorageLocation(
StorageProvider(providerId, providerLabel),
StorageProvider(providerId),
ObjectLocation(bucket, path)),
Instant.now
)
Expand Down Expand Up @@ -93,7 +92,6 @@ class RegistrarHttpFeatureTest
DisplayLocation(
DisplayProvider(
actualProviderId,
actualProviderLabel,
"Provider"),
actualBucket,
actualPath,
Expand All @@ -110,7 +108,6 @@ class RegistrarHttpFeatureTest

actualChecksumAlgorithm shouldBe checksumAlgorithm
actualProviderId shouldBe providerId
actualProviderLabel shouldBe providerLabel
actualBucket shouldBe bucket
actualPath shouldBe path

Expand All @@ -137,14 +134,13 @@ class RegistrarHttpFeatureTest
val path = "path"
val bucket = "bucket"
val providerId = "provider-id"
val providerLabel = "provider label"
val storageManifest = StorageManifest(
space = space,
info = bagInfo,
manifest =
FileManifest(ChecksumAlgorithm(checksumAlgorithm), Nil),
StorageLocation(
StorageProvider(providerId, providerLabel),
StorageProvider(providerId),
ObjectLocation(bucket, path)),
Instant.now
)
Expand Down

0 comments on commit a5927cb

Please sign in to comment.