From 5468ba79d55ed2c132611915fcdb4abbe1b6c0bc Mon Sep 17 00:00:00 2001 From: Daniel Bell Date: Tue, 21 Nov 2023 15:33:13 +0100 Subject: [PATCH 1/6] Use fromValue --- .../ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala index 933ffbd5af..15e5b9b204 100644 --- a/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala +++ b/delta/app/src/main/scala/ch/epfl/bluebrain/nexus/delta/wiring/DeltaModule.scala @@ -101,7 +101,7 @@ class DeltaModule(appCfg: AppConfig, config: Config)(implicit classLoader: Class .merge(otherCtxResolutions.toSeq: _*) } - make[JsonLdApi].from { () => + make[JsonLdApi].fromValue { new JsonLdJavaApi(appCfg.jsonLdApi) } From 4dcef089679976983bbeaaf25df4081d48438587 Mon Sep 17 00:00:00 2001 From: Daniel Bell Date: Tue, 21 Nov 2023 15:33:39 +0100 Subject: [PATCH 2/6] Use FS2 in test classpath resource loading --- build.sbt | 3 + .../utils/ClasspathResourceLoader.scala | 60 ++++++++++++------- ...cala => ClasspathResourceLoaderSpec.scala} | 2 +- .../delta/rdf/shacl/ShaclShapesGraph.scala | 17 ++++-- 4 files changed, 55 insertions(+), 27 deletions(-) rename delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/{ClasspathResourceUtilsSpec.scala => ClasspathResourceLoaderSpec.scala} (95%) diff --git a/build.sbt b/build.sbt index 33200416cf..7d951581b4 100755 --- a/build.sbt +++ b/build.sbt @@ -205,6 +205,9 @@ lazy val kernel = project caffeine, catsCore, catsRetry, + catsEffect, + fs2, + fs2io, circeCore, circeParser, handleBars, diff --git a/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoader.scala b/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoader.scala index 4f7bfbd3fb..0288a8741e 100644 --- a/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoader.scala +++ b/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoader.scala @@ -1,23 +1,28 @@ package ch.epfl.bluebrain.nexus.delta.kernel.utils -import cats.effect.IO +import cats.effect.{IO, Resource} +import cats.implicits.catsSyntaxMonadError import ch.epfl.bluebrain.nexus.delta.kernel.utils.ClasspathResourceError.{InvalidJson, InvalidJsonObject, ResourcePathNotFound} import ch.epfl.bluebrain.nexus.delta.kernel.utils.ClasspathResourceLoader.handleBars import com.github.jknack.handlebars.{EscapingStrategy, Handlebars} +import fs2.text import io.circe.parser.parse import io.circe.{Json, JsonObject} -import java.io.InputStream +import java.io.{IOException, InputStream} import java.util.Properties -import scala.io.{Codec, Source} import scala.jdk.CollectionConverters._ class ClasspathResourceLoader private (classLoader: ClassLoader) { - final def absolutePath(resourcePath: String): IO[String] = - IO.fromOption(Option(getClass.getResource(resourcePath)) orElse Option(classLoader.getResource(resourcePath)))( - ResourcePathNotFound(resourcePath) - ).map(_.getPath) + final def absolutePath(resourcePath: String): IO[String] = { + IO.blocking( + Option(getClass.getResource(resourcePath)) + .orElse(Option(classLoader.getResource(resourcePath))) + .toRight(ResourcePathNotFound(resourcePath)) + ).rethrow + .map(_.getPath) + } /** * Loads the content of the argument classpath resource as an [[InputStream]]. @@ -28,12 +33,15 @@ class ClasspathResourceLoader private (classLoader: ClassLoader) { * the content of the referenced resource as an [[InputStream]] or a [[ClasspathResourceError]] when the resource * is not found */ - def streamOf(resourcePath: String): IO[InputStream] = - IO.defer { - lazy val fromClass = Option(getClass.getResourceAsStream(resourcePath)) - val fromClassLoader = Option(classLoader.getResourceAsStream(resourcePath)) - IO.fromOption(fromClass orElse fromClassLoader)(ResourcePathNotFound(resourcePath)) - } + def streamOf(resourcePath: String): Resource[IO, InputStream] = { + Resource.make[IO, InputStream] { + IO.blocking { + Option(getClass.getResourceAsStream(resourcePath)) + .orElse(Option(classLoader.getResourceAsStream(resourcePath))) + .toRight(ResourcePathNotFound(resourcePath)) + }.rethrow + } { is => IO.blocking(is.close()) } + } /** * Loads the content of the argument classpath resource as a string and replaces all the key matches of the @@ -48,11 +56,12 @@ class ClasspathResourceLoader private (classLoader: ClassLoader) { final def contentOf( resourcePath: String, attributes: (String, Any)* - ): IO[String] = + ): IO[String] = { resourceAsTextFrom(resourcePath).map { case text if attributes.isEmpty => text case text => handleBars.compileInline(text).apply(attributes.toMap.asJava) } + } /** * Loads the content of the argument classpath resource as a java Properties and transforms it into a Map of key @@ -65,10 +74,12 @@ class ClasspathResourceLoader private (classLoader: ClassLoader) { * is not found */ final def propertiesOf(resourcePath: String): IO[Map[String, String]] = - streamOf(resourcePath).map { is => - val props = new Properties() - props.load(is) - props.asScala.toMap + streamOf(resourcePath).use { is => + IO.blocking { + val props = new Properties() + props.load(is) + props.asScala.toMap + } } /** @@ -106,8 +117,17 @@ class ClasspathResourceLoader private (classLoader: ClassLoader) { jsonObj <- IO.fromOption(json.asObject)(InvalidJsonObject(resourcePath)) } yield jsonObj - private def resourceAsTextFrom(resourcePath: String): IO[String] = - streamOf(resourcePath).map(is => Source.fromInputStream(is)(Codec.UTF8).mkString) + private def resourceAsTextFrom(resourcePath: String): IO[String] = { + fs2.io + .readClassLoaderResource[IO](resourcePath, classLoader = classLoader) + .through(text.utf8.decode) + .compile + .string + .adaptError { + case e: IOException if Option(e.getMessage).exists(_.endsWith("not found")) => + ResourcePathNotFound(resourcePath) + } + } } object ClasspathResourceLoader { diff --git a/delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceUtilsSpec.scala b/delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoaderSpec.scala similarity index 95% rename from delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceUtilsSpec.scala rename to delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoaderSpec.scala index 45a5670bb3..ad51d4d77f 100644 --- a/delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceUtilsSpec.scala +++ b/delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoaderSpec.scala @@ -9,7 +9,7 @@ import org.scalatest.concurrent.ScalaFutures import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike -class ClasspathResourceUtilsSpec extends AnyWordSpecLike with Matchers with ScalaFutures { +class ClasspathResourceLoaderSpec extends AnyWordSpecLike with Matchers with ScalaFutures { private val loader: ClasspathResourceLoader = ClasspathResourceLoader() private def accept[A](io: IO[A]): A = diff --git a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclShapesGraph.scala b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclShapesGraph.scala index 35b6538dd5..106d96ec0c 100644 --- a/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclShapesGraph.scala +++ b/delta/rdf/src/main/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ShaclShapesGraph.scala @@ -12,6 +12,7 @@ import org.topbraid.shacl.engine.ShapesGraph import org.topbraid.shacl.util.SHACLUtil import org.topbraid.shacl.validation.ValidationUtil +import java.io.InputStream import java.net.URI /** @@ -31,12 +32,16 @@ object ShaclShapesGraph { def shaclShaclShapes: IO[ShaclShapesGraph] = loader .streamOf("shacl-shacl.ttl") - .map { is => - val model = ModelFactory - .createModelForGraph(createDefaultGraph()) - .read(is, "http://www.w3.org/ns/shacl-shacl#", FileUtils.langTurtle) - validateAndRegister(model) - } + .use(readModel) + .map(model => validateAndRegister(model)) + + private def readModel(is: InputStream) = { + IO.blocking { + ModelFactory + .createModelForGraph(createDefaultGraph()) + .read(is, "http://www.w3.org/ns/shacl-shacl#", FileUtils.langTurtle) + } + } /** * Creates a [[ShaclShapesGraph]] initializing and registering the required validation components from the passed From 7efb5d00ef58a07ccb15c9971da1442748c1acc4 Mon Sep 17 00:00:00 2001 From: Daniel Bell Date: Tue, 21 Nov 2023 15:54:46 +0100 Subject: [PATCH 3/6] Remove unnecessary dependencies --- build.sbt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.sbt b/build.sbt index 7d951581b4..57a296f04f 100755 --- a/build.sbt +++ b/build.sbt @@ -261,8 +261,6 @@ lazy val sourcingPsql = project circeParser, classgraph, distageCore, - fs2, - fs2io, munit % Test, catsEffectLaws % Test, logback % Test @@ -319,7 +317,6 @@ lazy val sdk = project circeLiteral, circeGenericExtras, distageCore, - fs2, akkaTestKitTyped % Test, akkaHttpTestKit % Test, munit % Test, @@ -795,7 +792,6 @@ lazy val tests = project akkaStream, circeOptics, circeGenericExtras, - fs2, logback, akkaTestKit % Test, akkaHttpTestKit % Test, From 40d4388b91539b9119739727c6837c4abcfbbf0d Mon Sep 17 00:00:00 2001 From: Daniel Bell Date: Tue, 21 Nov 2023 18:12:10 +0100 Subject: [PATCH 4/6] Add aliases for test running --- build.sbt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 57a296f04f..8c52266f2c 100755 --- a/build.sbt +++ b/build.sbt @@ -1051,14 +1051,22 @@ val staticAnalysis = addCommandAlias("static-analysis", staticAnalysis) -def unitTestsWithCoverageCommandsForModules(modules: List[String]) = { +def runTestsWithCoverageCommandsForModules(modules: List[String]) = { ";coverage" + modules.map(module => s";$module/test").mkString + modules.map(module => s";$module/coverageReport").mkString } -addCommandAlias("core-unit-tests-with-coverage", unitTestsWithCoverageCommandsForModules(coreModules)) -addCommandAlias("app-unit-tests-with-coverage", unitTestsWithCoverageCommandsForModules(List("app"))) -addCommandAlias("plugins-unit-tests-with-coverage", unitTestsWithCoverageCommandsForModules(List("plugins"))) +def runTestsCommandsForModules(modules: List[String]) = { + modules.map(module => s";$module/test").mkString +} + +addCommandAlias("core-unit-tests", runTestsCommandsForModules(coreModules)) +addCommandAlias("core-unit-tests-with-coverage", runTestsWithCoverageCommandsForModules(coreModules)) +addCommandAlias("app-unit-tests", runTestsCommandsForModules(List("app"))) +addCommandAlias("app-unit-tests-with-coverage", runTestsWithCoverageCommandsForModules(List("app"))) +addCommandAlias("plugins-unit-tests", runTestsCommandsForModules(List("plugins"))) +addCommandAlias("plugins-unit-tests-with-coverage", runTestsWithCoverageCommandsForModules(List("plugins"))) +addCommandAlias("integration-tests", runTestsCommandsForModules(List("tests"))) // This option allows distage 1.0.10 to run on JDK 17+ val cglibFix = "--add-opens=java.base/java.lang=ALL-UNNAMED" From 3a71e95c31a228d1ae834490bcfe9dd2e8d4ec21 Mon Sep 17 00:00:00 2001 From: Daniel Bell Date: Tue, 21 Nov 2023 18:12:38 +0100 Subject: [PATCH 5/6] Simplify class loading --- .../nexus/delta/routes/AclsRoutesSpec.scala | 4 +- .../nexus/delta/routes/EventsRoutesSpec.scala | 6 +-- .../delta/routes/IdentitiesRoutesSpec.scala | 4 +- .../routes/OrganizationsRoutesSpec.scala | 8 +-- .../delta/routes/ProjectsRoutesSpec.scala | 30 +++++------ .../nexus/delta/routes/RealmsRoutesSpec.scala | 6 +-- .../delta/routes/ResolversRoutesSpec.scala | 26 ++++----- .../delta/routes/ResourcesRoutesSpec.scala | 30 +++++------ .../routes/ResourcesTrialRoutesSpec.scala | 2 +- .../delta/routes/SchemasRoutesSpec.scala | 20 +++---- .../utils/ClasspathResourceLoader.scala | 17 ++---- .../utils/ClasspathResourceLoaderSpec.scala | 6 +-- .../model/ArchiveSerializationSuite.scala | 2 +- .../delta/plugins/blazegraph/Fixtures.scala | 4 +- .../client/BlazegraphClientSpec.scala | 4 +- .../BlazegraphViewsSerializationSuite.scala | 4 +- .../BlazegraphViewsIndexingRoutesSpec.scala | 6 +-- .../routes/BlazegraphViewsRoutesSpec.scala | 2 +- .../plugins/compositeviews/Fixtures.scala | 4 +- .../CompositeViewsSerializationSuite.scala | 2 +- .../CompositeViewsIndexingRoutesSpec.scala | 6 +-- .../plugins/elasticsearch/Fixtures.scala | 6 +-- .../GraphResourceToDocumentSuite.scala | 2 +- .../ElasticSearchViewSerializationSuite.scala | 6 +-- .../ElasticSearchIndexingRoutesSpec.scala | 6 +-- .../routes/ElasticSearchViewsRoutesSpec.scala | 22 ++++---- .../RemoteContextResolutionFixture.scala | 6 +-- .../files/model/FileSerializationSuite.scala | 2 +- .../files/routes/FilesRoutesSpec.scala | 28 +++++----- .../model/StorageSerializationSuite.scala | 6 +-- .../storages/routes/StoragesRoutesSpec.scala | 22 ++++---- .../nexus/delta/rdf/graph/GraphSpec.scala | 4 +- .../rdf/jsonld/CompactedJsonLdSpec.scala | 6 +-- .../rdf/jsonld/ExpandedJsonLdCursorSpec.scala | 2 +- .../delta/rdf/jsonld/ExpandedJsonLdSpec.scala | 4 +- .../jsonld/context/JsonLdContextSpec.scala | 14 ++--- .../context/RemoteContextResolutionSpec.scala | 2 +- .../jsonld/decoder/JsonLdDecoderSpec.scala | 8 +-- .../rdf/shacl/ValidationReportSpec.scala | 4 +- .../nexus/delta/sdk/SerializationSuite.scala | 2 +- .../acls/model/AclSerializationSuite.scala | 2 +- .../sdk/directives/DeltaDirectivesSpec.scala | 2 +- .../sdk/directives/ResponseToJsonLdSpec.scala | 4 +- .../model/OrganizationRejectionsSpec.scala | 8 +-- .../OrganizationSerializationSuite.scala | 2 +- .../model/PermissionsRejectionSpec.scala | 4 +- .../model/PermissionsSerializationSuite.scala | 2 +- .../projects/model/ProjectRejectionSpec.scala | 8 +-- .../model/ProjectSerializationSuite.scala | 2 +- .../model/RealmSerializationSuite.scala | 2 +- .../realms/model/RealmsRejectionSpec.scala | 4 +- .../ResolverContextResolutionSuite.scala | 2 +- .../sdk/resolvers/ResolversImplSpec.scala | 4 +- .../model/ResolverSerializationSuite.scala | 6 +-- .../resolvers/model/ResolverValueSpec.scala | 14 ++--- .../model/ResourceSerializationSuite.scala | 4 +- .../model/SchemaSerializationSuite.scala | 14 ++--- .../nexus/delta/sdk/utils/RouteFixtures.scala | 4 +- .../nexus/delta/sourcing/Transactors.scala | 2 +- .../storage/routes/AppInfoRoutesSpec.scala | 2 +- .../routes/StorageDirectivesSpec.scala | 2 +- .../storage/routes/StorageRoutesSpec.scala | 32 +++++------ .../nexus/tests/BaseIntegrationSpec.scala | 2 +- .../nexus/tests/ElasticsearchDsl.scala | 2 +- .../bluebrain/nexus/tests/KeycloakDsl.scala | 2 +- .../bluebrain/nexus/tests/SchemaPayload.scala | 4 +- .../nexus/tests/admin/AdminDsl.scala | 8 +-- .../nexus/tests/admin/OrgsSpec.scala | 4 +- .../nexus/tests/admin/ProjectsSpec.scala | 6 +-- .../nexus/tests/builders/SchemaPayloads.scala | 6 +-- .../bluebrain/nexus/tests/iam/AclDsl.scala | 10 ++-- .../nexus/tests/iam/IdentitiesSpec.scala | 2 +- .../nexus/tests/iam/PermissionDsl.scala | 2 +- .../nexus/tests/iam/PermissionsSpec.scala | 8 +-- .../nexus/tests/iam/RealmsSpec.scala | 20 +++---- .../nexus/tests/iam/UserPermissionsSpec.scala | 2 +- .../nexus/tests/kg/AggregationsSpec.scala | 14 ++--- .../nexus/tests/kg/ArchiveSpec.scala | 26 ++++----- .../kg/CompositeViewsLifeCycleSpec.scala | 2 +- .../nexus/tests/kg/CompositeViewsSpec.scala | 30 +++++------ .../nexus/tests/kg/DiskStorageSpec.scala | 12 ++--- .../tests/kg/ElasticSearchViewsDsl.scala | 2 +- .../tests/kg/ElasticSearchViewsSpec.scala | 46 ++++++++-------- .../bluebrain/nexus/tests/kg/EventsSpec.scala | 8 +-- .../nexus/tests/kg/GraphAnalyticsSpec.scala | 24 ++++----- .../epfl/bluebrain/nexus/tests/kg/KgDsl.scala | 6 +-- .../nexus/tests/kg/ListingsSpec.scala | 22 ++++---- .../nexus/tests/kg/MultiFetchSpec.scala | 6 +-- .../nexus/tests/kg/ProjectsDeletionSpec.scala | 4 +- .../nexus/tests/kg/RemoteStorageSpec.scala | 16 +++--- .../nexus/tests/kg/ResourcesSpec.scala | 16 +++--- .../nexus/tests/kg/S3StorageSpec.scala | 14 ++--- .../nexus/tests/kg/SchemasSpec.scala | 14 ++--- .../nexus/tests/kg/SearchAccessSpec.scala | 12 ++--- .../tests/kg/SearchConfigIndexingSpec.scala | 54 +++++++++---------- .../nexus/tests/kg/SparqlViewsSpec.scala | 46 ++++++++-------- .../nexus/tests/kg/StorageSpec.scala | 10 ++-- .../nexus/tests/kg/SupervisionSpec.scala | 14 ++--- .../tests/resources/SimpleResource.scala | 10 ++-- 99 files changed, 475 insertions(+), 482 deletions(-) diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/AclsRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/AclsRoutesSpec.scala index 88f3d8b40b..a4e6180462 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/AclsRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/AclsRoutesSpec.scala @@ -79,8 +79,8 @@ class AclsRoutesSpec extends BaseRouteSpec { val meta = aclMetadata(acl.address, rev, createdBy = user, updatedBy = user).removeKeys(keywords.context) aclJson(acl) deepMerge meta } - jsonContentOf("/acls/acls-route-response.json", "total" -> total) deepMerge - Json.obj("_results" -> Json.fromValues(results)) + jsonContentOf("acls/acls-route-response.json", "total" -> total) deepMerge + Json.obj("_results" -> Json.fromValues(results)) } private val identities = IdentitiesDummy(caller) diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/EventsRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/EventsRoutesSpec.scala index 5f2e3bd2f8..30d7e0ddf8 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/EventsRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/EventsRoutesSpec.scala @@ -166,14 +166,14 @@ class EventsRoutesSpec extends BaseRouteSpec with IOFromMap { "get the events stream for all events" in { Get("/v1/events") ~> asAlice ~> routes ~> check { mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(5).strip shouldEqual contentOf("/events/eventstream-0-5.txt").strip + chunksStream.asString(5).strip shouldEqual contentOf("events/eventstream-0-5.txt").strip } } "get the acl events" in { Get("/v1/acl/events") ~> asAlice ~> routes ~> check { mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(2).strip shouldEqual contentOf("/events/acl-events.txt").strip + chunksStream.asString(2).strip shouldEqual contentOf("events/acl-events.txt").strip } } @@ -186,7 +186,7 @@ class EventsRoutesSpec extends BaseRouteSpec with IOFromMap { forAll(endpoints) { endpoint => Get(endpoint) ~> `Last-Event-ID`("3") ~> asAlice ~> routes ~> check { mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(1).strip shouldEqual contentOf("/events/project-events.txt").strip + chunksStream.asString(1).strip shouldEqual contentOf("events/project-events.txt").strip } } } diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/IdentitiesRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/IdentitiesRoutesSpec.scala index 45ada0bcb0..56e57c2ab8 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/IdentitiesRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/IdentitiesRoutesSpec.scala @@ -42,14 +42,14 @@ class IdentitiesRoutesSpec extends BaseRouteSpec { "return anonymous" in { Get("/v1/identities") ~> Accept(`*/*`) ~> route ~> check { status shouldEqual StatusCodes.OK - response.asJson should equalIgnoreArrayOrder(jsonContentOf("/identities/anonymous.json")) + response.asJson should equalIgnoreArrayOrder(jsonContentOf("identities/anonymous.json")) } } "return all identities" in { Get("/v1/identities") ~> Accept(`*/*`) ~> addCredentials(OAuth2BearerToken("alice")) ~> route ~> check { status shouldEqual StatusCodes.OK - response.asJson should equalIgnoreArrayOrder(jsonContentOf("/identities/alice.json")) + response.asJson should equalIgnoreArrayOrder(jsonContentOf("identities/alice.json")) } } } diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/OrganizationsRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/OrganizationsRoutesSpec.scala index 76d23a9660..3d2ba9b260 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/OrganizationsRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/OrganizationsRoutesSpec.scala @@ -61,7 +61,7 @@ class OrganizationsRoutesSpec extends BaseRouteSpec with IOFromMap { private val org1CreatedMeta = orgMetadata(org1.label, fixedUuid) private val org1Created = jsonContentOf( - "/organizations/org-resource.json", + "organizations/org-resource.json", "label" -> org1.label.value, "uuid" -> fixedUuid.toString, "description" -> org1.description.value @@ -74,7 +74,7 @@ class OrganizationsRoutesSpec extends BaseRouteSpec with IOFromMap { private val org2CreatedMeta = orgMetadata(org2.label, fixedUuid, createdBy = alice, updatedBy = alice) private val org2Created = jsonContentOf( - "/organizations/org-resource.json", + "organizations/org-resource.json", "label" -> org2.label.value, "uuid" -> fixedUuid.toString ).removeKeys("description") deepMerge org2CreatedMeta.removeKeys("@context") @@ -154,14 +154,14 @@ class OrganizationsRoutesSpec extends BaseRouteSpec with IOFromMap { Put("/v1/orgs/org1", input.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict - response.asJson shouldEqual jsonContentOf("/organizations/already-exists.json", "org" -> org1.label.value) + response.asJson shouldEqual jsonContentOf("organizations/already-exists.json", "org" -> org1.label.value) } } "fail fetching an organization by label and rev when rev is invalid" in { Get("/v1/orgs/org1?rev=4") ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/revision-not-found.json", "provided" -> 4, "current" -> 2) + response.asJson shouldEqual jsonContentOf("errors/revision-not-found.json", "provided" -> 4, "current" -> 2) } } diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ProjectsRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ProjectsRoutesSpec.scala index e9dcdb94ea..dcaf9a30b8 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ProjectsRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ProjectsRoutesSpec.scala @@ -114,12 +114,12 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { val base = "https://localhost/base/" val vocab = "https://localhost/voc/" - val payload = jsonContentOf("/projects/create.json", "description" -> desc, "base" -> base, "vocab" -> vocab) + val payload = jsonContentOf("projects/create.json", "description" -> desc, "base" -> base, "vocab" -> vocab) val payloadUpdated = - jsonContentOf("/projects/create.json", "description" -> "New description", "base" -> base, "vocab" -> vocab) + jsonContentOf("projects/create.json", "description" -> "New description", "base" -> base, "vocab" -> vocab) - val anotherPayload = jsonContentOf("/projects/create.json", "description" -> desc) + val anotherPayload = jsonContentOf("projects/create.json", "description" -> desc) "A project route" should { @@ -177,7 +177,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { Put("/v1/projects/org1/proj", payload.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual jsonContentOf( - "/projects/errors/already-exists.json", + "projects/errors/already-exists.json", "org" -> "org1", "proj" -> "proj" ) @@ -187,7 +187,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { "reject the creation of a project on a deprecated organization" in { Put("/v1/projects/org2/proj3", payload.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/projects/errors/org-deprecated.json") + response.asJson shouldEqual jsonContentOf("projects/errors/org-deprecated.json") } } @@ -226,7 +226,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { Put("/v1/projects/org1/proj?rev=42", payloadUpdated.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson should equalIgnoreArrayOrder( - jsonContentOf("/projects/errors/incorrect-rev.json", "provided" -> 42, "expected" -> 2) + jsonContentOf("projects/errors/incorrect-rev.json", "provided" -> 42, "expected" -> 2) ) } } @@ -252,7 +252,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { "reject the deprecation of a project without rev" in { Delete("/v1/projects/org1/proj") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/missing-query-param.json", "field" -> "rev") + response.asJson shouldEqual jsonContentOf("errors/missing-query-param.json", "field" -> "rev") } } @@ -260,7 +260,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { Delete("/v1/projects/org1/proj?rev=3") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest response.asJson shouldEqual jsonContentOf( - "/projects/errors/project-deprecated.json", + "projects/errors/project-deprecated.json", "org" -> "org1", "proj" -> "proj" ) @@ -268,7 +268,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { } val fetchProjRev2 = jsonContentOf( - "/projects/fetch.json", + "projects/fetch.json", "org" -> "org1", "proj" -> "proj", "orgUuid" -> orgUuid, @@ -282,7 +282,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { ) val fetchProjRev3 = jsonContentOf( - "/projects/fetch.json", + "projects/fetch.json", "org" -> "org1", "proj" -> "proj", "orgUuid" -> orgUuid, @@ -296,7 +296,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { ) val fetchProj2 = jsonContentOf( - "/projects/fetch.json", + "projects/fetch.json", "org" -> "org1", "proj" -> "proj2", "orgUuid" -> orgUuid, @@ -360,7 +360,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { Get("/v1/projects/org1/proj?rev=42") ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual jsonContentOf( - "/errors/revision-not-found.json", + "errors/revision-not-found.json", "provided" -> 42, "current" -> 3 ) @@ -371,7 +371,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { Get(s"/v1/projects/$orgUuid/$projectUuid?rev=42") ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual jsonContentOf( - "/errors/revision-not-found.json", + "errors/revision-not-found.json", "provided" -> 42, "current" -> 3 ) @@ -388,7 +388,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { "fetch an unknown project" in { Get(s"/v1/projects/org1/unknown") ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/projects/errors/project-not-found.json", "proj" -> "org1/unknown") + response.asJson shouldEqual jsonContentOf("projects/errors/project-not-found.json", "proj" -> "org1/unknown") } } @@ -474,7 +474,7 @@ class ProjectsRoutesSpec extends BaseRouteSpec with IOFromMap { aclCheck.append(AclAddress.Root, Anonymous -> Set(resources.read)).accepted Get("/v1/projects/org1/unknown/statistics") ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/projects/errors/project-not-found.json", "proj" -> "org1/unknown") + response.asJson shouldEqual jsonContentOf("projects/errors/project-not-found.json", "proj" -> "org1/unknown") } } diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/RealmsRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/RealmsRoutesSpec.scala index 623d81540b..e476477161 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/RealmsRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/RealmsRoutesSpec.scala @@ -58,7 +58,7 @@ class RealmsRoutesSpec extends BaseRouteSpec with IOFromMap { realmMetadata(gitlab, rev = 2, deprecated = true, createdBy = alice, updatedBy = alice) private val githubCreated = jsonContentOf( - "/realms/realm-resource.json", + "realms/realm-resource.json", "label" -> github.value, "name" -> githubName.value, "openIdConfig" -> githubOpenId, @@ -76,7 +76,7 @@ class RealmsRoutesSpec extends BaseRouteSpec with IOFromMap { githubUpdatedMeta.removeKeys("@context") private val gitlabCreated = jsonContentOf( - "/realms/realm-resource.json", + "realms/realm-resource.json", "label" -> gitlab.value, "name" -> gitlabName.value, "openIdConfig" -> gitlabOpenId, @@ -170,7 +170,7 @@ class RealmsRoutesSpec extends BaseRouteSpec with IOFromMap { "fail fetching a realm by id and rev when rev is invalid" in { Get("/v1/realms/github?rev=4") ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/revision-not-found.json", "provided" -> 4, "current" -> 2) + response.asJson shouldEqual jsonContentOf("errors/revision-not-found.json", "provided" -> 4, "current" -> 2) } } diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResolversRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResolversRoutesSpec.scala index 7990e1df3d..42fc66c647 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResolversRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResolversRoutesSpec.scala @@ -190,7 +190,7 @@ class ResolversRoutesSpec extends BaseRouteSpec { request ~> asAlice ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual jsonContentOf( - "/resolvers/errors/already-exists.json", + "resolvers/errors/already-exists.json", "id" -> id, "projRef" -> project.ref ) @@ -200,18 +200,18 @@ class ResolversRoutesSpec extends BaseRouteSpec { "fail with a 400 if decoding fails" in { forAll( - create("resolver-failed", project.ref, jsonContentOf("/resolvers/no-resolver-type-error.json")) - ++ create("resolver-failed", project.ref, jsonContentOf("/resolvers/two-resolver-types-error.json")) - ++ create("resolver-failed", project.ref, jsonContentOf("/resolvers/unknown-resolver-error.json")) + create("resolver-failed", project.ref, jsonContentOf("resolvers/no-resolver-type-error.json")) + ++ create("resolver-failed", project.ref, jsonContentOf("resolvers/two-resolver-types-error.json")) + ++ create("resolver-failed", project.ref, jsonContentOf("resolvers/unknown-resolver-error.json")) ++ create( "resolver-failed", project.ref, - jsonContentOf("/resolvers/cross-project-no-resolution-error.json") + jsonContentOf("resolvers/cross-project-no-resolution-error.json") ) ++ create( "resolver-failed", project.ref, - jsonContentOf("/resolvers/cross-project-both-resolution-error.json") + jsonContentOf("resolvers/cross-project-both-resolution-error.json") ) ) { case (_, request) => request ~> asAlice ~> routes ~> check { @@ -288,7 +288,7 @@ class ResolversRoutesSpec extends BaseRouteSpec { ) ~> asBob ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual jsonContentOf( - "/resolvers/errors/incorrect-rev.json", + "resolvers/errors/incorrect-rev.json", "provided" -> 5, "expected" -> 2 ) @@ -299,7 +299,7 @@ class ResolversRoutesSpec extends BaseRouteSpec { Put(s"/v1/resolvers/${project.ref}/xxxx?rev=1", inProjectPayload.toEntity) ~> asAlice ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual jsonContentOf( - "/resolvers/errors/not-found.json", + "resolvers/errors/not-found.json", "id" -> (nxv + "xxxx"), "projectRef" -> project.ref ) @@ -377,7 +377,7 @@ class ResolversRoutesSpec extends BaseRouteSpec { Delete(s"/v1/resolvers/${project.ref}/in-project-put?rev=4") ~> asAlice ~> routes ~> check { status shouldEqual StatusCodes.BadRequest response.asJson shouldEqual - jsonContentOf("/resolvers/errors/resolver-deprecated.json", "id" -> (nxv + "in-project-put")) + jsonContentOf("resolvers/errors/resolver-deprecated.json", "id" -> (nxv + "in-project-put")) } } @@ -385,7 +385,7 @@ class ResolversRoutesSpec extends BaseRouteSpec { Delete(s"/v1/resolvers/${project.ref}/in-project-put") ~> asAlice ~> routes ~> check { status shouldEqual StatusCodes.BadRequest response.asJson shouldEqual - jsonContentOf("/errors/missing-query-param.json", "field" -> "rev") + jsonContentOf("errors/missing-query-param.json", "field" -> "rev") } } @@ -396,7 +396,7 @@ class ResolversRoutesSpec extends BaseRouteSpec { ) ~> asBob ~> routes ~> check { status shouldEqual StatusCodes.BadRequest response.asJson shouldEqual jsonContentOf( - "/resolvers/errors/resolver-deprecated.json", + "resolvers/errors/resolver-deprecated.json", "id" -> (nxv + "in-project-put") ) } @@ -618,7 +618,7 @@ class ResolversRoutesSpec extends BaseRouteSpec { Get(s"/v1/resolvers/${project.ref}/xxxx") ~> asBob ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual jsonContentOf( - "/resolvers/errors/not-found.json", + "resolvers/errors/not-found.json", "id" -> (nxv + "xxxx"), "projectRef" -> project.ref ) @@ -629,7 +629,7 @@ class ResolversRoutesSpec extends BaseRouteSpec { Get(s"/v1/resolvers/${project.ref}/in-project-put?rev=10") ~> asBob ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual jsonContentOf( - "/errors/revision-not-found.json", + "errors/revision-not-found.json", "provided" -> 10, "current" -> 5 ) diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesRoutesSpec.scala index ec6913e25a..37f6645f06 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesRoutesSpec.scala @@ -222,7 +222,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Put(s"/v1/resources/myorg/myproject/_/$id", simplePayload(id).toEntity) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual - jsonContentOf("/resources/errors/already-exists.json", "id" -> (nxv + id), "project" -> "myorg/myproject") + jsonContentOf("resources/errors/already-exists.json", "id" -> (nxv + id), "project" -> "myorg/myproject") } } } @@ -234,7 +234,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues payloadFailingSchemaConstraints.toEntity ) ~> asWriter ~> routes ~> check { response.status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/resources/errors/invalid-resource.json") + response.asJson shouldEqual jsonContentOf("resources/errors/invalid-resource.json") } } @@ -244,7 +244,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues payloadWithoutId.toEntity ) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/schemas/errors/invalid-schema-2.json") + response.asJson shouldEqual jsonContentOf("schemas/errors/invalid-schema-2.json") } } @@ -252,7 +252,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Post("/v1/resources/myorg/myproject/_/", payloadWithBlankId.toEntity) ~> asWriter ~> routes ~> check { response.status shouldEqual StatusCodes.BadRequest response.asJson shouldEqual jsonContentOf( - "/resources/errors/blank-id.json" + "resources/errors/blank-id.json" ) } } @@ -261,7 +261,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Post("/v1/resources/myorg/myproject/_/", payloadWithUnderscoreFields.toEntity) ~> asWriter ~> routes ~> check { response.status shouldEqual StatusCodes.BadRequest response.asJson shouldEqual jsonContentOf( - "/resources/errors/underscore-fields.json" + "resources/errors/underscore-fields.json" ) } } @@ -308,7 +308,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Put("/v1/resources/myorg/myproject/_/doesNotExist?rev=1", payload.toEntity) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/resources/errors/not-found.json", "id" -> (nxv + "doesNotExist"), "proj" -> "myorg/myproject") + jsonContentOf("resources/errors/not-found.json", "id" -> (nxv + "doesNotExist"), "proj" -> "myorg/myproject") } } @@ -317,7 +317,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Put(s"/v1/resources/myorg/myproject/_/$id?rev=10", payloadUpdated(id).toEntity) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual - jsonContentOf("/resources/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 1) + jsonContentOf("resources/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 1) } } } @@ -353,7 +353,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Put("/v1/resources/myorg/myproject/_/doesNotExist/refresh", payload.toEntity) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/resources/errors/not-found.json", "id" -> (nxv + "doesNotExist"), "proj" -> "myorg/myproject") + jsonContentOf("resources/errors/not-found.json", "id" -> (nxv + "doesNotExist"), "proj" -> "myorg/myproject") } } @@ -420,7 +420,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Put(s"/v1/resources/myorg/myproject/_/$id/undeprecate?rev=1") ~> asWriter ~> routes ~> check { response.status shouldEqual StatusCodes.BadRequest response.asJson shouldEqual jsonContentOf( - "/resources/errors/resource-not-deprecated.json", + "resources/errors/resource-not-deprecated.json", "id" -> (nxv + id) ) } @@ -440,7 +440,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues givenAResource { id => Delete(s"/v1/resources/myorg/myproject/_/$id") ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/missing-query-param.json", "field" -> "rev") + response.asJson shouldEqual jsonContentOf("errors/missing-query-param.json", "field" -> "rev") } } } @@ -449,7 +449,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues givenADeprecatedResource { id => Delete(s"/v1/resources/myorg/myproject/_/$id?rev=2") ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/resources/errors/resource-deprecated.json", "id" -> (nxv + id)) + response.asJson shouldEqual jsonContentOf("resources/errors/resource-deprecated.json", "id" -> (nxv + id)) } } } @@ -601,7 +601,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Get(endpoint) ~> asReader ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual jsonContentOf( - "/resources/errors/not-found.json", + "resources/errors/not-found.json", "id" -> "https://bluebrain.github.io/nexus/vocabulary/wrongid", "proj" -> "myorg/myproject" ) @@ -689,7 +689,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues givenAResourceWithTag("myTag") { id => Get(s"/v1/resources/myorg/myproject/myschema/$id?tag=myother") ~> asReader ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/tag-not-found.json", "tag" -> "myother") + response.asJson shouldEqual jsonContentOf("errors/tag-not-found.json", "tag" -> "myother") } } } @@ -698,7 +698,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues givenAResourceWithTag("myTag") { id => Get(s"/v1/resources/myorg/myproject/myschema/$id?tag=mytag&rev=1") ~> asReader ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/tag-and-rev-error.json") + response.asJson shouldEqual jsonContentOf("errors/tag-and-rev-error.json") } } } @@ -745,7 +745,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues Delete(s"/v1/resources/myorg/myproject/_/$id/tags/$myTag?rev=1") ~> asWriter ~> routes ~> check { Get(s"/v1/resources/myorg/myproject/_/$id?tag=$myTag") ~> asReader ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/tag-not-found.json", "tag" -> myTag) + response.asJson shouldEqual jsonContentOf("errors/tag-not-found.json", "tag" -> myTag) } } } diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesTrialRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesTrialRoutesSpec.scala index 39835f1d4d..b53e38fe3b 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesTrialRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/ResourcesTrialRoutesSpec.scala @@ -243,7 +243,7 @@ class ResourcesTrialRoutesSpec extends BaseRouteSpec with ResourceInstanceFixtur Get(s"/v1/resources/$projectRef/_/$unknownEncoded/validate") ~> asAlice ~> routes ~> check { response.status shouldEqual StatusCodes.NotFound response.asJson shouldEqual jsonContentOf( - "/resources/errors/not-found.json", + "resources/errors/not-found.json", "id" -> unknownResource.toString, "proj" -> projectRef.toString ) diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/SchemasRoutesSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/SchemasRoutesSpec.scala index 475a308935..0a07558b35 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/SchemasRoutesSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/routes/SchemasRoutesSpec.scala @@ -115,7 +115,7 @@ class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { Put("/v1/schemas/myorg/myproject/myid", payload.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual - jsonContentOf("/schemas/errors/already-exists.json", "id" -> myId, "project" -> "myorg/myproject") + jsonContentOf("schemas/errors/already-exists.json", "id" -> myId, "project" -> "myorg/myproject") } } @@ -125,7 +125,7 @@ class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { payload.removeKeys(keywords.id).replaceKeyWithValue("nodeKind", 42).toEntity ) ~> routes ~> check { response.status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/schemas/errors/invalid-schema.json") + response.asJson shouldEqual jsonContentOf("schemas/errors/invalid-schema.json") } } @@ -155,7 +155,7 @@ class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { Put("/v1/schemas/myorg/myproject/myid10?rev=1", payload.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/schemas/errors/not-found.json", "id" -> (nxv + "myid10"), "proj" -> "myorg/myproject") + jsonContentOf("schemas/errors/not-found.json", "id" -> (nxv + "myid10"), "proj" -> "myorg/myproject") } } @@ -163,7 +163,7 @@ class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { Put("/v1/schemas/myorg/myproject/myid?rev=10", payloadUpdated.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual - jsonContentOf("/schemas/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 3) + jsonContentOf("schemas/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 3) } } @@ -193,7 +193,7 @@ class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { Put("/v1/schemas/myorg/myproject/myid10/refresh", payload.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/schemas/errors/not-found.json", "id" -> (nxv + "myid10"), "proj" -> "myorg/myproject") + jsonContentOf("schemas/errors/not-found.json", "id" -> (nxv + "myid10"), "proj" -> "myorg/myproject") } } @@ -215,14 +215,14 @@ class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { "reject the deprecation of a schema without rev" in { Delete("/v1/schemas/myorg/myproject/myid") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/missing-query-param.json", "field" -> "rev") + response.asJson shouldEqual jsonContentOf("errors/missing-query-param.json", "field" -> "rev") } } "reject the deprecation of a already deprecated schema" in { Delete(s"/v1/schemas/myorg/myproject/myid?rev=6") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/schemas/errors/schema-deprecated.json", "id" -> myId) + response.asJson shouldEqual jsonContentOf("schemas/errors/schema-deprecated.json", "id" -> myId) } } @@ -359,21 +359,21 @@ class SchemasRoutesSpec extends BaseRouteSpec with IOFromMap with CatsIOValues { "fail to fetch resource by the deleted tag" in { Get("/v1/schemas/myorg/myproject/myid2?tag=mytag") ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/tag-not-found.json", "tag" -> "mytag") + response.asJson shouldEqual jsonContentOf("errors/tag-not-found.json", "tag" -> "mytag") } } "return not found if tag not found" in { Get("/v1/schemas/myorg/myproject/myid2?tag=myother") ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/tag-not-found.json", "tag" -> "myother") + response.asJson shouldEqual jsonContentOf("errors/tag-not-found.json", "tag" -> "myother") } } "reject if provided rev and tag simultaneously" in { Get("/v1/schemas/myorg/myproject/myid2?tag=mytag&rev=1") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/tag-and-rev-error.json") + response.asJson shouldEqual jsonContentOf("errors/tag-and-rev-error.json") } } diff --git a/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoader.scala b/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoader.scala index 0288a8741e..85dfcfc8ed 100644 --- a/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoader.scala +++ b/delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoader.scala @@ -1,7 +1,6 @@ package ch.epfl.bluebrain.nexus.delta.kernel.utils import cats.effect.{IO, Resource} -import cats.implicits.catsSyntaxMonadError import ch.epfl.bluebrain.nexus.delta.kernel.utils.ClasspathResourceError.{InvalidJson, InvalidJsonObject, ResourcePathNotFound} import ch.epfl.bluebrain.nexus.delta.kernel.utils.ClasspathResourceLoader.handleBars import com.github.jknack.handlebars.{EscapingStrategy, Handlebars} @@ -17,8 +16,7 @@ class ClasspathResourceLoader private (classLoader: ClassLoader) { final def absolutePath(resourcePath: String): IO[String] = { IO.blocking( - Option(getClass.getResource(resourcePath)) - .orElse(Option(classLoader.getResource(resourcePath))) + Option(classLoader.getResource(resourcePath)) .toRight(ResourcePathNotFound(resourcePath)) ).rethrow .map(_.getPath) @@ -34,13 +32,12 @@ class ClasspathResourceLoader private (classLoader: ClassLoader) { * is not found */ def streamOf(resourcePath: String): Resource[IO, InputStream] = { - Resource.make[IO, InputStream] { + Resource.fromAutoCloseable( IO.blocking { - Option(getClass.getResourceAsStream(resourcePath)) - .orElse(Option(classLoader.getResourceAsStream(resourcePath))) - .toRight(ResourcePathNotFound(resourcePath)) + Option(classLoader.getResourceAsStream(resourcePath)) + .toRight(new IOException(s"Resource '$resourcePath' not found")) }.rethrow - } { is => IO.blocking(is.close()) } + ) } /** @@ -123,10 +120,6 @@ class ClasspathResourceLoader private (classLoader: ClassLoader) { .through(text.utf8.decode) .compile .string - .adaptError { - case e: IOException if Option(e.getMessage).exists(_.endsWith("not found")) => - ResourcePathNotFound(resourcePath) - } } } diff --git a/delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoaderSpec.scala b/delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoaderSpec.scala index ad51d4d77f..d9d8bdf042 100644 --- a/delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoaderSpec.scala +++ b/delta/kernel/src/test/scala/ch/epfl/bluebrain/nexus/delta/kernel/utils/ClasspathResourceLoaderSpec.scala @@ -2,7 +2,7 @@ package ch.epfl.bluebrain.nexus.delta.kernel.utils import cats.effect.IO import cats.effect.unsafe.implicits._ -import ch.epfl.bluebrain.nexus.delta.kernel.utils.ClasspathResourceError.{InvalidJson, InvalidJsonObject, ResourcePathNotFound} +import ch.epfl.bluebrain.nexus.delta.kernel.utils.ClasspathResourceError.{InvalidJson, InvalidJsonObject} import io.circe.syntax._ import io.circe.{Json, JsonObject} import org.scalatest.concurrent.ScalaFutures @@ -58,9 +58,9 @@ class ClasspathResourceLoaderSpec extends AnyWordSpecLike with Matchers with Sca } "fail when resource does not exists" in { - reject(loader.contentOf("resource2.txt", "value" -> "v")) shouldEqual ResourcePathNotFound( + reject(loader.contentOf("resource2.txt", "value" -> "v")).getMessage should (include("not found") and include( "resource2.txt" - ) + )) } } } diff --git a/delta/plugins/archive/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/model/ArchiveSerializationSuite.scala b/delta/plugins/archive/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/model/ArchiveSerializationSuite.scala index 09c5a6f1f6..1a6fb808f5 100644 --- a/delta/plugins/archive/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/model/ArchiveSerializationSuite.scala +++ b/delta/plugins/archive/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/model/ArchiveSerializationSuite.scala @@ -49,7 +49,7 @@ class ArchiveSerializationSuite extends SerializationSuite { subject ) - private val json = jsonContentOf("/archives/database/state.json") + private val json = jsonContentOf("archives/database/state.json") test("Correctly serialize state") { ArchiveState.serializer.codec(state).equalsIgnoreArrayOrder(json) diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/Fixtures.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/Fixtures.scala index b5768c5801..74b2d56ca8 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/Fixtures.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/Fixtures.scala @@ -20,8 +20,8 @@ trait Fixtures { Vocabulary.contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), Vocabulary.contexts.error -> ContextValue.fromFile("contexts/error.json"), Vocabulary.contexts.shacl -> ContextValue.fromFile("contexts/shacl.json"), - Vocabulary.contexts.statistics -> ContextValue.fromFile("/contexts/statistics.json"), - Vocabulary.contexts.offset -> ContextValue.fromFile("/contexts/offset.json"), + Vocabulary.contexts.statistics -> ContextValue.fromFile("contexts/statistics.json"), + Vocabulary.contexts.offset -> ContextValue.fromFile("contexts/offset.json"), Vocabulary.contexts.tags -> ContextValue.fromFile("contexts/tags.json"), Vocabulary.contexts.search -> ContextValue.fromFile("contexts/search.json") ) diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala index cd216efe21..75188addd8 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala @@ -49,13 +49,13 @@ class BlazegraphClientSpec(docker: BlazegraphDocker) private lazy val graphId = endpoint / "graphs" / "myid" private def nTriples(id: String = genString(), label: String = genString(), value: String = genString()) = { - val json = jsonContentOf("/sparql/example.jsonld", "id" -> id, "label" -> label, "value" -> value) + val json = jsonContentOf("sparql/example.jsonld", "id" -> id, "label" -> label, "value" -> value) ExpandedJsonLd(json).accepted.toGraph.flatMap(_.toNTriples).rightValue } private def nTriplesNested(id: String, label: String, name: String, title: String) = { val json = - jsonContentOf("/sparql/example-nested.jsonld", "id" -> id, "label" -> label, "name" -> name, "title" -> title) + jsonContentOf("sparql/example-nested.jsonld", "id" -> id, "label" -> label, "name" -> name, "title" -> title) ExpandedJsonLd(json).accepted.toGraph.flatMap(_.toNTriples).rightValue } diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewsSerializationSuite.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewsSerializationSuite.scala index d7c8ed021e..10f26736a9 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewsSerializationSuite.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/model/BlazegraphViewsSerializationSuite.scala @@ -106,8 +106,8 @@ class BlazegraphViewsSerializationSuite extends SerializationSuite { } private val statesMapping = Map( - (indexingId, indexingValue) -> jsonContentOf("/blazegraph/database/indexing-view-state.json"), - (aggregateId, aggregateValue) -> jsonContentOf("/blazegraph/database/aggregate-view-state.json") + (indexingId, indexingValue) -> jsonContentOf("blazegraph/database/indexing-view-state.json"), + (aggregateId, aggregateValue) -> jsonContentOf("blazegraph/database/aggregate-view-state.json") ).map { case ((id, value), json) => BlazegraphViewState( id, diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsIndexingRoutesSpec.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsIndexingRoutesSpec.scala index 6af0c6e44c..94142eafe8 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsIndexingRoutesSpec.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsIndexingRoutesSpec.scala @@ -182,7 +182,7 @@ class BlazegraphViewsIndexingRoutesSpec extends BlazegraphViewRoutesFixtures wit Get(s"$viewEndpoint/failures/sse") ~> routes ~> check { response.status shouldBe StatusCodes.OK mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(2).strip shouldEqual contentOf("/routes/sse/indexing-failures-1-2.txt") + chunksStream.asString(2).strip shouldEqual contentOf("routes/sse/indexing-failures-1-2.txt") } } @@ -190,7 +190,7 @@ class BlazegraphViewsIndexingRoutesSpec extends BlazegraphViewRoutesFixtures wit Get(s"$viewEndpoint/failures/sse") ~> `Last-Event-ID`("1") ~> routes ~> check { response.status shouldBe StatusCodes.OK mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(3).strip shouldEqual contentOf("/routes/sse/indexing-failure-2.txt") + chunksStream.asString(3).strip shouldEqual contentOf("routes/sse/indexing-failure-2.txt") } } @@ -198,7 +198,7 @@ class BlazegraphViewsIndexingRoutesSpec extends BlazegraphViewRoutesFixtures wit aclCheck.append(AclAddress.Root, Anonymous -> Set(permissions.write)).accepted Get(s"$viewEndpoint/failures") ~> routes ~> check { response.status shouldBe StatusCodes.OK - response.asJson shouldEqual jsonContentOf("/routes/list-indexing-errors.json") + response.asJson shouldEqual jsonContentOf("routes/list-indexing-errors.json") } } diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutesSpec.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutesSpec.scala index 0e6b1edbb6..909fac43a3 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutesSpec.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/routes/BlazegraphViewsRoutesSpec.scala @@ -196,7 +196,7 @@ class BlazegraphViewsRoutesSpec extends BlazegraphViewRoutesFixtures { val queryEntity = HttpEntity(`application/sparql-query`, ByteString(selectQuery.value)) Post("/v1/views/org/proj/indexing-view/sparql", queryEntity) ~> asBob ~> routes ~> check { response.status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/routes/errors/view-deprecated.json", "id" -> indexingViewId) + response.asJson shouldEqual jsonContentOf("routes/errors/view-deprecated.json", "id" -> indexingViewId) } } diff --git a/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/Fixtures.scala b/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/Fixtures.scala index 7f02b3fc00..8f578329fb 100644 --- a/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/Fixtures.scala +++ b/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/Fixtures.scala @@ -20,8 +20,8 @@ trait Fixtures { Vocabulary.contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), Vocabulary.contexts.error -> ContextValue.fromFile("contexts/error.json"), Vocabulary.contexts.shacl -> ContextValue.fromFile("contexts/shacl.json"), - Vocabulary.contexts.statistics -> ContextValue.fromFile("/contexts/statistics.json"), - Vocabulary.contexts.offset -> ContextValue.fromFile("/contexts/offset.json"), + Vocabulary.contexts.statistics -> ContextValue.fromFile("contexts/statistics.json"), + Vocabulary.contexts.offset -> ContextValue.fromFile("contexts/offset.json"), Vocabulary.contexts.tags -> ContextValue.fromFile("contexts/tags.json"), Vocabulary.contexts.search -> ContextValue.fromFile("contexts/search.json") ) diff --git a/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/model/CompositeViewsSerializationSuite.scala b/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/model/CompositeViewsSerializationSuite.scala index 5fe7b05f33..6a1f3181aa 100644 --- a/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/model/CompositeViewsSerializationSuite.scala +++ b/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/model/CompositeViewsSerializationSuite.scala @@ -89,7 +89,7 @@ class CompositeViewsSerializationSuite extends SerializationSuite with Composite updatedBy = subject ) - private val jsonState = jsonContentOf("/composite-views/database/view-state.json") + private val jsonState = jsonContentOf("composite-views/database/view-state.json") private val stateSerializer = CompositeViewState.serializer diff --git a/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/routes/CompositeViewsIndexingRoutesSpec.scala b/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/routes/CompositeViewsIndexingRoutesSpec.scala index bafa892fbc..07c142648e 100644 --- a/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/routes/CompositeViewsIndexingRoutesSpec.scala +++ b/delta/plugins/composite-views/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/compositeviews/routes/CompositeViewsIndexingRoutesSpec.scala @@ -253,7 +253,7 @@ class CompositeViewsIndexingRoutesSpec extends CompositeViewsRoutesFixtures { Get(s"$viewEndpoint/failures/sse") ~> routes ~> check { response.status shouldBe StatusCodes.OK mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(2).strip shouldEqual contentOf("/routes/sse/indexing-failures-1-2.txt") + chunksStream.asString(2).strip shouldEqual contentOf("routes/sse/indexing-failures-1-2.txt") } } @@ -261,7 +261,7 @@ class CompositeViewsIndexingRoutesSpec extends CompositeViewsRoutesFixtures { Get(s"$viewEndpoint/failures/sse") ~> `Last-Event-ID`("1") ~> routes ~> check { response.status shouldBe StatusCodes.OK mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(3).strip shouldEqual contentOf("/routes/sse/indexing-failure-2.txt") + chunksStream.asString(3).strip shouldEqual contentOf("routes/sse/indexing-failure-2.txt") } } @@ -269,7 +269,7 @@ class CompositeViewsIndexingRoutesSpec extends CompositeViewsRoutesFixtures { aclCheck.append(AclAddress.Root, Anonymous -> Set(permissions.write)).accepted Get(s"$viewEndpoint/failures") ~> routes ~> check { response.status shouldBe StatusCodes.OK - response.asJson shouldEqual jsonContentOf("/routes/list-indexing-errors.json") + response.asJson shouldEqual jsonContentOf("routes/list-indexing-errors.json") } } } diff --git a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/Fixtures.scala b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/Fixtures.scala index 53132ac061..973941d5ac 100644 --- a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/Fixtures.scala +++ b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/Fixtures.scala @@ -52,7 +52,7 @@ trait Fixtures { elasticsearch -> ContextValue.fromFile("contexts/elasticsearch.json"), elasticsearchMetadata -> ContextValue.fromFile("contexts/elasticsearch-metadata.json"), contexts.aggregations -> ContextValue.fromFile("contexts/aggregations.json"), - contexts.elasticsearchIndexing -> ContextValue.fromFile("/contexts/elasticsearch-indexing.json"), + contexts.elasticsearchIndexing -> ContextValue.fromFile("contexts/elasticsearch-indexing.json"), contexts.searchMetadata -> listingsMetadataCtx, contexts.indexingMetadata -> indexingMetadataCtx, Vocabulary.contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), @@ -60,8 +60,8 @@ trait Fixtures { Vocabulary.contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), Vocabulary.contexts.error -> ContextValue.fromFile("contexts/error.json"), Vocabulary.contexts.shacl -> ContextValue.fromFile("contexts/shacl.json"), - Vocabulary.contexts.statistics -> ContextValue.fromFile("/contexts/statistics.json"), - Vocabulary.contexts.offset -> ContextValue.fromFile("/contexts/offset.json"), + Vocabulary.contexts.statistics -> ContextValue.fromFile("contexts/statistics.json"), + Vocabulary.contexts.offset -> ContextValue.fromFile("contexts/offset.json"), Vocabulary.contexts.pipeline -> ContextValue.fromFile("contexts/pipeline.json"), Vocabulary.contexts.tags -> ContextValue.fromFile("contexts/tags.json"), Vocabulary.contexts.search -> ContextValue.fromFile("contexts/search.json") diff --git a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/indexing/GraphResourceToDocumentSuite.scala b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/indexing/GraphResourceToDocumentSuite.scala index bdb684493f..b582d336fe 100644 --- a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/indexing/GraphResourceToDocumentSuite.scala +++ b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/indexing/GraphResourceToDocumentSuite.scala @@ -40,7 +40,7 @@ class GraphResourceToDocumentSuite extends CatsEffectSuite with Fixtures with Js private val graph = Graph(expanded).rightValue private val metadataGraph = graph - private val context = ContextValue.fromFile("/contexts/elasticsearch-indexing.json").accepted + private val context = ContextValue.fromFile("contexts/elasticsearch-indexing.json").accepted private val graphResourceToDocument = new GraphResourceToDocument(context, false) diff --git a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/model/ElasticSearchViewSerializationSuite.scala b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/model/ElasticSearchViewSerializationSuite.scala index 4a11454e95..f8b8b584a9 100644 --- a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/model/ElasticSearchViewSerializationSuite.scala +++ b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/model/ElasticSearchViewSerializationSuite.scala @@ -113,9 +113,9 @@ class ElasticSearchViewSerializationSuite extends SerializationSuite { } private val statesMapping = Map( - (indexingId, indexingValue) -> jsonContentOf("/elasticsearch/database/indexing-view-state.json"), - (indexingId, defaultIndexingValue) -> jsonContentOf("/elasticsearch/database/default-indexing-view-state.json"), - (aggregateId, aggregateValue) -> jsonContentOf("/elasticsearch/database/aggregate-view-state.json") + (indexingId, indexingValue) -> jsonContentOf("elasticsearch/database/indexing-view-state.json"), + (indexingId, defaultIndexingValue) -> jsonContentOf("elasticsearch/database/default-indexing-view-state.json"), + (aggregateId, aggregateValue) -> jsonContentOf("elasticsearch/database/aggregate-view-state.json") ).map { case ((id, value), json) => ElasticSearchViewState( id, diff --git a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/routes/ElasticSearchIndexingRoutesSpec.scala b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/routes/ElasticSearchIndexingRoutesSpec.scala index 7e6f8ed959..131d08e9f2 100644 --- a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/routes/ElasticSearchIndexingRoutesSpec.scala +++ b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/routes/ElasticSearchIndexingRoutesSpec.scala @@ -217,7 +217,7 @@ class ElasticSearchIndexingRoutesSpec extends ElasticSearchViewsRoutesFixtures w Get(s"$viewEndpoint/failures/sse") ~> routes ~> check { response.status shouldBe StatusCodes.OK mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(2).strip shouldEqual contentOf("/routes/sse/indexing-failures-1-2.txt") + chunksStream.asString(2).strip shouldEqual contentOf("routes/sse/indexing-failures-1-2.txt") } } @@ -225,7 +225,7 @@ class ElasticSearchIndexingRoutesSpec extends ElasticSearchViewsRoutesFixtures w Get(s"$viewEndpoint/failures/sse") ~> `Last-Event-ID`("1") ~> routes ~> check { response.status shouldBe StatusCodes.OK mediaType shouldBe MediaTypes.`text/event-stream` - chunksStream.asString(3).strip shouldEqual contentOf("/routes/sse/indexing-failure-2.txt") + chunksStream.asString(3).strip shouldEqual contentOf("routes/sse/indexing-failure-2.txt") } } @@ -233,7 +233,7 @@ class ElasticSearchIndexingRoutesSpec extends ElasticSearchViewsRoutesFixtures w aclCheck.append(AclAddress.Root, Anonymous -> Set(esPermissions.write)).accepted Get(s"$viewEndpoint/failures") ~> routes ~> check { response.status shouldBe StatusCodes.OK - response.asJson shouldEqual jsonContentOf("/routes/list-indexing-errors.json") + response.asJson shouldEqual jsonContentOf("routes/list-indexing-errors.json") } } diff --git a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/routes/ElasticSearchViewsRoutesSpec.scala b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/routes/ElasticSearchViewsRoutesSpec.scala index fbedb68810..a308bda304 100644 --- a/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/routes/ElasticSearchViewsRoutesSpec.scala +++ b/delta/plugins/elasticsearch/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/elasticsearch/routes/ElasticSearchViewsRoutesSpec.scala @@ -139,7 +139,7 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with Put("/v1/views/myorg/myproject/myid", payload.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual - jsonContentOf("/routes/errors/already-exists.json", "id" -> myId, "project" -> "myorg/myproject") + jsonContentOf("routes/errors/already-exists.json", "id" -> myId, "project" -> "myorg/myproject") } } @@ -150,7 +150,7 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with ) ~> routes ~> check { status shouldEqual StatusCodes.BadRequest response.asJson shouldEqual - jsonContentOf("/routes/errors/pipe-not-found.json", "id" -> myId, "project" -> "myorg/myproject") + jsonContentOf("routes/errors/pipe-not-found.json", "id" -> myId, "project" -> "myorg/myproject") } } @@ -180,7 +180,7 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with Put("/v1/views/myorg/myproject/myid10?rev=1", payload.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/routes/errors/not-found.json", "id" -> (nxv + "myid10"), "proj" -> "myorg/myproject") + jsonContentOf("routes/errors/not-found.json", "id" -> (nxv + "myid10"), "proj" -> "myorg/myproject") } } @@ -188,7 +188,7 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with Put("/v1/views/myorg/myproject/myid?rev=10", payloadUpdated.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual - jsonContentOf("/routes/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 3) + jsonContentOf("routes/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 3) } } @@ -210,14 +210,14 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with "reject the deprecation of a view without rev" in { Delete("/v1/views/myorg/myproject/myid") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/routes/errors/missing-query-param.json", "field" -> "rev") + response.asJson shouldEqual jsonContentOf("routes/errors/missing-query-param.json", "field" -> "rev") } } "reject the deprecation of a already deprecated view" in { Delete(s"/v1/views/myorg/myproject/myid?rev=4") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/routes/errors/view-deprecated.json", "id" -> myId) + response.asJson shouldEqual jsonContentOf("routes/errors/view-deprecated.json", "id" -> myId) } } @@ -225,7 +225,7 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with val query = json"""{"query": { "match_all": {} } }""" Post("/v1/views/myorg/myproject/myid/_search", query) ~> routes ~> check { response.status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/routes/errors/view-deprecated.json", "id" -> myId) + response.asJson shouldEqual jsonContentOf("routes/errors/view-deprecated.json", "id" -> myId) } } @@ -332,14 +332,14 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with "return not found if tag not found" in { Get("/v1/views/myorg/myproject/myid2?tag=myother") ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/routes/errors/tag-not-found.json", "tag" -> "myother") + response.asJson shouldEqual jsonContentOf("routes/errors/tag-not-found.json", "tag" -> "myother") } } "reject if provided rev and tag simultaneously" in { Get("/v1/views/myorg/myproject/myid2?tag=mytag&rev=1") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/routes/errors/tag-and-rev-error.json") + response.asJson shouldEqual jsonContentOf("routes/errors/tag-and-rev-error.json") } } @@ -370,7 +370,7 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with updatedBy: Subject = Anonymous ): Json = jsonContentOf( - "/routes/elasticsearch-view-write-response.json", + "routes/elasticsearch-view-write-response.json", "project" -> projectRef, "id" -> id, "rev" -> rev, @@ -390,7 +390,7 @@ class ElasticSearchViewsRoutesSpec extends ElasticSearchViewsRoutesFixtures with updatedBy: Subject = Anonymous ): Json = jsonContentOf( - "/routes/elasticsearch-view-read-response.json", + "routes/elasticsearch-view-read-response.json", "project" -> projectRef, "id" -> id, "rev" -> rev, diff --git a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/RemoteContextResolutionFixture.scala b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/RemoteContextResolutionFixture.scala index 0af9add0fe..69cdc2e9d9 100644 --- a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/RemoteContextResolutionFixture.scala +++ b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/RemoteContextResolutionFixture.scala @@ -13,9 +13,9 @@ trait RemoteContextResolutionFixture { implicit val api: JsonLdApi = JsonLdJavaApi.strict implicit val rcr: RemoteContextResolution = RemoteContextResolution.fixedIO( - storageContexts.storages -> ContextValue.fromFile("/contexts/storages.json"), - storageContexts.storagesMetadata -> ContextValue.fromFile("/contexts/storages-metadata.json"), - fileContexts.files -> ContextValue.fromFile("/contexts/files.json"), + storageContexts.storages -> ContextValue.fromFile("contexts/storages.json"), + storageContexts.storagesMetadata -> ContextValue.fromFile("contexts/storages-metadata.json"), + fileContexts.files -> ContextValue.fromFile("contexts/files.json"), Vocabulary.contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), Vocabulary.contexts.error -> ContextValue.fromFile("contexts/error.json"), Vocabulary.contexts.tags -> ContextValue.fromFile("contexts/tags.json"), diff --git a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/model/FileSerializationSuite.scala b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/model/FileSerializationSuite.scala index 3882fd09b2..680e5481eb 100644 --- a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/model/FileSerializationSuite.scala +++ b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/model/FileSerializationSuite.scala @@ -178,7 +178,7 @@ class FileSerializationSuite extends SerializationSuite with StorageFixtures { subject ) - private val jsonState = jsonContentOf("/files/database/file-state.json") + private val jsonState = jsonContentOf("files/database/file-state.json") test(s"Correctly serialize a FileState") { assertEquals(FileState.serializer.codec(state), jsonState) diff --git a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/routes/FilesRoutesSpec.scala b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/routes/FilesRoutesSpec.scala index 97760ad223..cabb839c63 100644 --- a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/routes/FilesRoutesSpec.scala +++ b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/files/routes/FilesRoutesSpec.scala @@ -63,9 +63,9 @@ class FilesRoutesSpec // TODO: sort out how we handle this in tests implicit override def rcr: RemoteContextResolution = RemoteContextResolution.fixedIO( - storageContexts.storages -> ContextValue.fromFile("/contexts/storages.json"), - storageContexts.storagesMetadata -> ContextValue.fromFile("/contexts/storages-metadata.json"), - fileContexts.files -> ContextValue.fromFile("/contexts/files.json"), + storageContexts.storages -> ContextValue.fromFile("contexts/storages.json"), + storageContexts.storagesMetadata -> ContextValue.fromFile("contexts/storages-metadata.json"), + fileContexts.files -> ContextValue.fromFile("contexts/files.json"), Vocabulary.contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), Vocabulary.contexts.error -> ContextValue.fromFile("contexts/error.json"), Vocabulary.contexts.tags -> ContextValue.fromFile("contexts/tags.json"), @@ -255,7 +255,7 @@ class FilesRoutesSpec randomEntity(filename = "large-file.txt", 1100) ) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.PayloadTooLarge - response.asJson shouldEqual jsonContentOf("/files/errors/file-too-large.json") + response.asJson shouldEqual jsonContentOf("files/errors/file-too-large.json") } } @@ -263,7 +263,7 @@ class FilesRoutesSpec Put("/v1/files/org/proj/file2?storage=not-exist", entity()) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/storages/errors/not-found.json", "id" -> (nxv + "not-exist"), "proj" -> projectRef) + jsonContentOf("storages/errors/not-found.json", "id" -> (nxv + "not-exist"), "proj" -> projectRef) } } @@ -320,7 +320,7 @@ class FilesRoutesSpec Put(s"/v1/files/org/proj/$nonExistentFile?rev=1", entity("other.txt")) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/files/errors/not-found.json", "id" -> (nxv + nonExistentFile), "proj" -> "org/proj") + jsonContentOf("files/errors/not-found.json", "id" -> (nxv + nonExistentFile), "proj" -> "org/proj") } } @@ -329,7 +329,7 @@ class FilesRoutesSpec Put(s"/v1/files/org/proj/$id?rev=1&storage=not-exist", entity("other.txt")) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/storages/errors/not-found.json", "id" -> (nxv + "not-exist"), "proj" -> projectRef) + jsonContentOf("storages/errors/not-found.json", "id" -> (nxv + "not-exist"), "proj" -> projectRef) } } } @@ -339,7 +339,7 @@ class FilesRoutesSpec Put(s"/v1/files/org/proj/$id?rev=10", entity("other.txt")) ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual - jsonContentOf("/files/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 1) + jsonContentOf("files/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 1) } } } @@ -366,7 +366,7 @@ class FilesRoutesSpec givenAFile { id => Delete(s"/v1/files/org/proj/$id") ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/missing-query-param.json", "field" -> "rev") + response.asJson shouldEqual jsonContentOf("errors/missing-query-param.json", "field" -> "rev") } } } @@ -375,7 +375,7 @@ class FilesRoutesSpec givenADeprecatedFile { id => Delete(s"/v1/files/org/proj/$id?rev=2") ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/files/errors/file-deprecated.json", "id" -> (nxv + id)) + response.asJson shouldEqual jsonContentOf("files/errors/file-deprecated.json", "id" -> (nxv + id)) } } } @@ -406,7 +406,7 @@ class FilesRoutesSpec givenADeprecatedFile { id => Put(s"/v1/files/org/proj/$id/undeprecate") ~> asWriter ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/missing-query-param.json", "field" -> "rev") + response.asJson shouldEqual jsonContentOf("errors/missing-query-param.json", "field" -> "rev") } } } @@ -573,7 +573,7 @@ class FilesRoutesSpec givenATaggedFile("mytag") { id => Get(s"/v1/files/org/proj/$id?tag=myother") ~> Accept(`application/ld+json`) ~> asReader ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/tag-not-found.json", "tag" -> "myother") + response.asJson shouldEqual jsonContentOf("errors/tag-not-found.json", "tag" -> "myother") } } } @@ -582,7 +582,7 @@ class FilesRoutesSpec givenATaggedFile(tag) { id => Get(s"/v1/files/org/proj/$id?tag=$tag&rev=1") ~> Accept(`application/ld+json`) ~> asReader ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/tag-and-rev-error.json") + response.asJson shouldEqual jsonContentOf("errors/tag-and-rev-error.json") } } } @@ -615,7 +615,7 @@ class FilesRoutesSpec deleteTag(id, tag, 1) Get(s"/v1/files/org/proj/$id?tag=$tag") ~> Accept(`application/ld+json`) ~> asReader ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/tag-not-found.json", "tag" -> "mytag") + response.asJson shouldEqual jsonContentOf("errors/tag-not-found.json", "tag" -> "mytag") } } } diff --git a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/model/StorageSerializationSuite.scala b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/model/StorageSerializationSuite.scala index 3d745713bf..2bebd56d51 100644 --- a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/model/StorageSerializationSuite.scala +++ b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/model/StorageSerializationSuite.scala @@ -83,9 +83,9 @@ class StorageSerializationSuite extends SerializationSuite with StorageFixtures } private val statesMapping = VectorMap( - (dId, diskVal, diskFieldsJson) -> jsonContentOf("/storages/storage-disk-state.json"), - (s3Id, s3Val, s3FieldsJson) -> jsonContentOf("/storages/storage-s3-state.json"), - (rdId, remoteVal, remoteFieldsJson) -> jsonContentOf("/storages/storage-remote-state.json") + (dId, diskVal, diskFieldsJson) -> jsonContentOf("storages/storage-disk-state.json"), + (s3Id, s3Val, s3FieldsJson) -> jsonContentOf("storages/storage-s3-state.json"), + (rdId, remoteVal, remoteFieldsJson) -> jsonContentOf("storages/storage-remote-state.json") ).map { case ((id, value, source), v) => StorageState( id, diff --git a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/routes/StoragesRoutesSpec.scala b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/routes/StoragesRoutesSpec.scala index a0ffa859ff..9552a40967 100644 --- a/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/routes/StoragesRoutesSpec.scala +++ b/delta/plugins/storage/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/routes/StoragesRoutesSpec.scala @@ -45,9 +45,9 @@ class StoragesRoutesSpec extends BaseRouteSpec with StorageFixtures with IOFromM // TODO: sort out how we handle this in tests implicit override def rcr: RemoteContextResolution = RemoteContextResolution.fixedIO( - storageContexts.storages -> ContextValue.fromFile("/contexts/storages.json"), - storageContexts.storagesMetadata -> ContextValue.fromFile("/contexts/storages-metadata.json"), - fileContexts.files -> ContextValue.fromFile("/contexts/files.json"), + storageContexts.storages -> ContextValue.fromFile("contexts/storages.json"), + storageContexts.storagesMetadata -> ContextValue.fromFile("contexts/storages-metadata.json"), + fileContexts.files -> ContextValue.fromFile("contexts/files.json"), Vocabulary.contexts.metadata -> ContextValue.fromFile("contexts/metadata.json"), Vocabulary.contexts.error -> ContextValue.fromFile("contexts/error.json"), Vocabulary.contexts.tags -> ContextValue.fromFile("contexts/tags.json"), @@ -151,7 +151,7 @@ class StoragesRoutesSpec extends BaseRouteSpec with StorageFixtures with IOFromM "reject the creation of a storage which already exists" in { Put("/v1/storages/myorg/myproject/s3-storage", s3FieldsJson.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict - response.asJson shouldEqual jsonContentOf("/storages/errors/already-exists.json", "id" -> s3Id) + response.asJson shouldEqual jsonContentOf("storages/errors/already-exists.json", "id" -> s3Id) } } @@ -181,7 +181,7 @@ class StoragesRoutesSpec extends BaseRouteSpec with StorageFixtures with IOFromM Put("/v1/storages/myorg/myproject/myid10?rev=1", s3FieldsJson.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual - jsonContentOf("/storages/errors/not-found.json", "id" -> (nxv + "myid10"), "proj" -> "myorg/myproject") + jsonContentOf("storages/errors/not-found.json", "id" -> (nxv + "myid10"), "proj" -> "myorg/myproject") } } @@ -189,7 +189,7 @@ class StoragesRoutesSpec extends BaseRouteSpec with StorageFixtures with IOFromM Put("/v1/storages/myorg/myproject/s3-storage?rev=10", s3FieldsJson.toEntity) ~> routes ~> check { status shouldEqual StatusCodes.Conflict response.asJson shouldEqual - jsonContentOf("/storages/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 4) + jsonContentOf("storages/errors/incorrect-rev.json", "provided" -> 10, "expected" -> 4) } } @@ -212,14 +212,14 @@ class StoragesRoutesSpec extends BaseRouteSpec with StorageFixtures with IOFromM "reject the deprecation of a storage without rev" in { Delete("/v1/storages/myorg/myproject/myid") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/missing-query-param.json", "field" -> "rev") + response.asJson shouldEqual jsonContentOf("errors/missing-query-param.json", "field" -> "rev") } } "reject the deprecation of a already deprecated storage" in { Delete(s"/v1/storages/myorg/myproject/s3-storage?rev=5") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/storages/errors/storage-deprecated.json", "id" -> s3Id) + response.asJson shouldEqual jsonContentOf("storages/errors/storage-deprecated.json", "id" -> s3Id) } } @@ -333,14 +333,14 @@ class StoragesRoutesSpec extends BaseRouteSpec with StorageFixtures with IOFromM "return not found if tag not found" in { Get("/v1/storages/myorg/myproject/remote-disk-storage?tag=myother") ~> routes ~> check { status shouldEqual StatusCodes.NotFound - response.asJson shouldEqual jsonContentOf("/errors/tag-not-found.json", "tag" -> "myother") + response.asJson shouldEqual jsonContentOf("errors/tag-not-found.json", "tag" -> "myother") } } "reject if provided rev and tag simultaneously" in { Get("/v1/storages/myorg/myproject/remote-disk-storage?tag=mytag&rev=1") ~> routes ~> check { status shouldEqual StatusCodes.BadRequest - response.asJson shouldEqual jsonContentOf("/errors/tag-and-rev-error.json") + response.asJson shouldEqual jsonContentOf("errors/tag-and-rev-error.json") } } @@ -355,7 +355,7 @@ class StoragesRoutesSpec extends BaseRouteSpec with StorageFixtures with IOFromM Get("/v1/storages/myorg/myproject/unknown/statistics") ~> routes ~> check { status shouldEqual StatusCodes.NotFound response.asJson shouldEqual jsonContentOf( - "/storages/errors/not-found.json", + "storages/errors/not-found.json", "id" -> (nxv + "unknown"), "proj" -> "myorg/myproject" ) diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/graph/GraphSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/graph/GraphSpec.scala index bc34228e87..e6ab800a8b 100644 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/graph/GraphSpec.scala +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/graph/GraphSpec.scala @@ -30,7 +30,7 @@ class GraphSpec extends CatsEffectSpec with GraphHelpers { val graphNoId = Graph(expandedNoId).rightValue val bnodeNoId = bNode(graphNoId) val namedGraph = Graph( - ExpandedJsonLd.expanded(jsonContentOf("/graph/expanded-multiple-roots-namedgraph.json")).rightValue + ExpandedJsonLd.expanded(jsonContentOf("graph/expanded-multiple-roots-namedgraph.json")).rightValue ).rightValue val name = predicate(schema.name) @@ -182,7 +182,7 @@ class GraphSpec extends CatsEffectSpec with GraphHelpers { } "failed to be converted to compacted JSON-LD from a multiple root" in { - val expandedJson = jsonContentOf("/graph/expanded-multiple-roots.json") + val expandedJson = jsonContentOf("graph/expanded-multiple-roots.json") val expanded = ExpandedJsonLd(expandedJson).accepted Graph(expanded).leftValue shouldEqual UnexpectedJsonLd("Expected named graph, but root @id not found") } diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/CompactedJsonLdSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/CompactedJsonLdSpec.scala index 8f18dd8eae..c8a1c07c85 100644 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/CompactedJsonLdSpec.scala +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/CompactedJsonLdSpec.scala @@ -31,21 +31,21 @@ class CompactedJsonLdSpec extends CatsEffectSpec with Fixtures with GraphHelpers } "be constructed from a multi-root json" in { - val input = jsonContentOf("/jsonld/compacted/input-multiple-roots.json") + val input = jsonContentOf("jsonld/compacted/input-multiple-roots.json") CompactedJsonLd(iri, context, input).accepted.json.removeKeys(keywords.context) shouldEqual json"""{"@graph": [{"id": "john-doé", "@type": "Person"}, {"id": "batman", "@type": "schema:Hero"} ] }""" } "be framed from a multi-root json" in { - val input = jsonContentOf("/jsonld/compacted/input-multiple-roots.json") + val input = jsonContentOf("jsonld/compacted/input-multiple-roots.json") CompactedJsonLd.frame(iri, context, input).accepted.json.removeKeys(keywords.context) shouldEqual json"""{"id": "john-doé", "@type": "Person"}""" } "be constructed successfully from a multi-root json when using framing" in { - val input = jsonContentOf("/jsonld/compacted/input-multiple-roots.json") + val input = jsonContentOf("jsonld/compacted/input-multiple-roots.json") val compacted = CompactedJsonLd.frame(iri, context, input).accepted compacted.json.removeKeys(keywords.context) shouldEqual json"""{"id": "john-doé", "@type": "Person"}""" } diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/ExpandedJsonLdCursorSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/ExpandedJsonLdCursorSpec.scala index 1bcbc0972b..aff53184e0 100644 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/ExpandedJsonLdCursorSpec.scala +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/ExpandedJsonLdCursorSpec.scala @@ -9,7 +9,7 @@ import io.circe.CursorOp.{DownArray, DownField} class ExpandedJsonLdCursorSpec extends CatsEffectSpec { "An ExpandedJsonLdCursor" should { - val json = jsonContentOf("/jsonld/decoder/cocktail.json") + val json = jsonContentOf("jsonld/decoder/cocktail.json") val cursor = ExpandedJsonLd.expanded(json).rightValue.cursor val drinks = schema + "drinks" diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/ExpandedJsonLdSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/ExpandedJsonLdSpec.scala index 40fd0ee04e..367ea9759a 100644 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/ExpandedJsonLdSpec.scala +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/ExpandedJsonLdSpec.scala @@ -40,7 +40,7 @@ class ExpandedJsonLdSpec extends CatsEffectSpec with Fixtures with GraphHelpers } "be constructed successfully with remote contexts" in { - val compacted = jsonContentOf("/jsonld/expanded/input-with-remote-context.json") + val compacted = jsonContentOf("jsonld/expanded/input-with-remote-context.json") ExpandedJsonLd(compacted).accepted shouldEqual ExpandedJsonLd.expanded(expectedExpanded).rightValue } @@ -58,7 +58,7 @@ class ExpandedJsonLdSpec extends CatsEffectSpec with Fixtures with GraphHelpers } "be constructed with multiple root objects" in { - val multiRoot = jsonContentOf("/jsonld/expanded/input-multiple-roots.json") + val multiRoot = jsonContentOf("jsonld/expanded/input-multiple-roots.json") val batmanIri = iri"$example/batman" ExpandedJsonLd(multiRoot).accepted.json shouldEqual json"""[{"${keywords.graph}": [ diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/context/JsonLdContextSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/context/JsonLdContextSpec.scala index 4b8a7bce70..544786a393 100644 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/context/JsonLdContextSpec.scala +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/context/JsonLdContextSpec.scala @@ -149,9 +149,9 @@ class JsonLdContextSpec extends CatsEffectSpec with Fixtures { } "merge contexts" in { - val context1 = jsonContentOf("/jsonld/context/context1.json") - val context2 = jsonContentOf("/jsonld/context/context2.json") - val expected = jsonContentOf("/jsonld/context/context12-merged.json") + val context1 = jsonContentOf("jsonld/context/context1.json") + val context2 = jsonContentOf("jsonld/context/context2.json") + val expected = jsonContentOf("jsonld/context/context12-merged.json") context1.addContext(context2) shouldEqual expected val json1 = context1 deepMerge json"""{"@id": "$iri", "age": 30}""" @@ -159,7 +159,7 @@ class JsonLdContextSpec extends CatsEffectSpec with Fixtures { } "merge contexts when one is empty" in { - val context1 = jsonContentOf("/jsonld/context/context1.json") + val context1 = jsonContentOf("jsonld/context/context1.json") val emptyArrCtx = json"""{"@context": []}""" val emptyObjCtx = json"""{"@context": {}}""" context1.addContext(emptyArrCtx) shouldEqual context1 @@ -175,9 +175,9 @@ class JsonLdContextSpec extends CatsEffectSpec with Fixtures { } "merge contexts with arrays" in { - val context1Array = jsonContentOf("/jsonld/context/context1-array.json") - val context2 = jsonContentOf("/jsonld/context/context2.json") - val expected = jsonContentOf("/jsonld/context/context12-merged-array.json") + val context1Array = jsonContentOf("jsonld/context/context1-array.json") + val context2 = jsonContentOf("jsonld/context/context2.json") + val expected = jsonContentOf("jsonld/context/context12-merged-array.json") context1Array.addContext(context2) shouldEqual expected val json1 = context1Array deepMerge json"""{"@id": "$iri", "age": 30}""" diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/context/RemoteContextResolutionSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/context/RemoteContextResolutionSpec.scala index 64e2064332..e4e8aad29c 100644 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/context/RemoteContextResolutionSpec.scala +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/context/RemoteContextResolutionSpec.scala @@ -10,7 +10,7 @@ class RemoteContextResolutionSpec extends CatsEffectSpec with Fixtures { "A remote context resolution" should { - val input = jsonContentOf("/jsonld/context/input-with-remote-context.json") + val input = jsonContentOf("jsonld/context/input-with-remote-context.json") "resolve" in { remoteResolution(input).accepted shouldEqual remoteContexts.map { case (iri, context) => diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/decoder/JsonLdDecoderSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/decoder/JsonLdDecoderSpec.scala index bf82e5a811..0cdaf0be06 100644 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/decoder/JsonLdDecoderSpec.scala +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/jsonld/decoder/JsonLdDecoderSpec.scala @@ -26,9 +26,9 @@ class JsonLdDecoderSpec extends CatsEffectSpec with Fixtures { "A JsonLdDecoder" should { - val json = jsonContentOf("/jsonld/decoder/cocktail.json") + val json = jsonContentOf("jsonld/decoder/cocktail.json") val jsonLd = ExpandedJsonLd(json).accepted - val context = jsonContentOf("/jsonld/decoder/context.json") + val context = jsonContentOf("jsonld/decoder/context.json") val ctx = JsonLdContext(context.topContextValueOrEmpty).accepted implicit val config: Configuration = Configuration.default.copy(context = ctx) implicit val volumeDecoder: JsonLdDecoder[Volume] = deriveConfigJsonLdDecoder[Volume] @@ -63,9 +63,9 @@ class JsonLdDecoderSpec extends CatsEffectSpec with Fixtures { } "fail decoding a relative iri in @id value position" in { - val json = jsonContentOf("/jsonld/decoder/relative-iri.json") + val json = jsonContentOf("jsonld/decoder/relative-iri.json") val jsonLd = ExpandedJsonLd(json).accepted - val context = jsonContentOf("/jsonld/decoder/relative-iri-context.json") + val context = jsonContentOf("jsonld/decoder/relative-iri-context.json") val ctx = JsonLdContext(context.topContextValueOrEmpty).accepted implicit val config: Configuration = Configuration.default.copy(context = ctx) implicit val decoder: JsonLdDecoder[AbsoluteIri] = deriveConfigJsonLdDecoder[AbsoluteIri] diff --git a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidationReportSpec.scala b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidationReportSpec.scala index da391c45b4..f9f55bec15 100644 --- a/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidationReportSpec.scala +++ b/delta/rdf/src/test/scala/ch/epfl/bluebrain/nexus/delta/rdf/shacl/ValidationReportSpec.scala @@ -27,8 +27,8 @@ class ValidationReportSpec extends CatsEffectSpec { } "A ValidationReport" should { - val conforms = jsonContentOf("/shacl/conforms.json") - val failed = jsonContentOf("/shacl/failed.json") + val conforms = jsonContentOf("shacl/conforms.json") + val failed = jsonContentOf("shacl/failed.json") "be constructed correctly when conforms" in { ValidationReport(resource(conforms)).accepted shouldEqual diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/SerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/SerializationSuite.scala index 20ba164392..ca9981f9af 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/SerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/SerializationSuite.scala @@ -39,7 +39,7 @@ abstract class SerializationSuite } def loadEvents(module: String, fileName: String): (Json, JsonObject) = - (jsonContentOf(s"/$module/database/$fileName"), jsonObjectContentOf(s"/$module/sse/$fileName")) + (jsonContentOf(s"$module/database/$fileName"), jsonObjectContentOf(s"$module/sse/$fileName")) private def generateOutput[Id, Value](serializer: Serializer[Id, Value], obtained: Value) = parse(serializer.printer.print(serializer.codec(obtained))) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/acls/model/AclSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/acls/model/AclSerializationSuite.scala index 2b94090de6..149ab7fef5 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/acls/model/AclSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/acls/model/AclSerializationSuite.scala @@ -61,7 +61,7 @@ class AclSerializationSuite extends SerializationSuite { updatedBy = subject ) - private val jsonState = jsonContentOf("/acls/acl-state.json") + private val jsonState = jsonContentOf("acls/acl-state.json") test(s"Correctly serialize an AclState") { assertOutput(AclState.serializer, state, jsonState) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/DeltaDirectivesSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/DeltaDirectivesSpec.scala index 6e8fde378c..59a44ea6bb 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/DeltaDirectivesSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/DeltaDirectivesSpec.scala @@ -70,7 +70,7 @@ class DeltaDirectivesSpec RemoteContextResolution.fixed( SimpleResource.contextIri -> SimpleResource.context, SimpleRejection.contextIri -> SimpleRejection.context, - contexts.error -> jsonContentOf("/contexts/error.json").topContextValueOrEmpty + contexts.error -> jsonContentOf("contexts/error.json").topContextValueOrEmpty ) private val compacted = resource.toCompactedJsonLd.accepted diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/ResponseToJsonLdSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/ResponseToJsonLdSpec.scala index 72b0e10243..d9c42069c5 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/ResponseToJsonLdSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/directives/ResponseToJsonLdSpec.scala @@ -27,7 +27,7 @@ class ResponseToJsonLdSpec extends RouteHelpers with JsonSyntax with RouteConcat RemoteContextResolution.fixed( SimpleResource.contextIri -> SimpleResource.context, SimpleRejection.contextIri -> SimpleRejection.context, - contexts.error -> jsonContentOf("/contexts/error.json").topContextValueOrEmpty + contexts.error -> jsonContentOf("contexts/error.json").topContextValueOrEmpty ) implicit val jo: JsonKeyOrdering = JsonKeyOrdering.default() @@ -39,7 +39,7 @@ class ResponseToJsonLdSpec extends RouteHelpers with JsonSyntax with RouteConcat } private val expectedBlankIdErrorResponse = jsonContentOf( - "/directives/blank-id.json" + "directives/blank-id.json" ) private val FileContents = "hello" diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/organizations/model/OrganizationRejectionsSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/organizations/model/OrganizationRejectionsSpec.scala index 3881a02627..a69468339f 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/organizations/model/OrganizationRejectionsSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/organizations/model/OrganizationRejectionsSpec.scala @@ -16,8 +16,8 @@ class OrganizationRejectionsSpec extends CatsEffectSpec with Fixtures { "be converted to compacted JSON-LD" in { val list = List( - alreadyExists -> jsonContentOf("/organizations/organization-already-exists-compacted.json"), - incorrectRev -> jsonContentOf("/organizations/incorrect-revision-compacted.json") + alreadyExists -> jsonContentOf("organizations/organization-already-exists-compacted.json"), + incorrectRev -> jsonContentOf("organizations/incorrect-revision-compacted.json") ) forAll(list) { case (rejection, json) => rejection.toCompactedJsonLd.accepted.json shouldEqual json.addContext(contexts.error) @@ -26,8 +26,8 @@ class OrganizationRejectionsSpec extends CatsEffectSpec with Fixtures { "be converted to expanded JSON-LD" in { val list = List( - alreadyExists -> jsonContentOf("/organizations/organization-already-exists-expanded.json"), - incorrectRev -> jsonContentOf("/organizations/incorrect-revision-expanded.json") + alreadyExists -> jsonContentOf("organizations/organization-already-exists-expanded.json"), + incorrectRev -> jsonContentOf("organizations/incorrect-revision-expanded.json") ) forAll(list) { case (rejection, json) => rejection.toExpandedJsonLd.accepted.json shouldEqual json diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/organizations/model/OrganizationSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/organizations/model/OrganizationSerializationSuite.scala index 1ba2faf799..3bea62b2d0 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/organizations/model/OrganizationSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/organizations/model/OrganizationSerializationSuite.scala @@ -60,7 +60,7 @@ class OrganizationSerializationSuite extends SerializationSuite { updatedBy = subject ) - private val jsonState = jsonContentOf("/organizations/org-state.json") + private val jsonState = jsonContentOf("organizations/org-state.json") test(s"Correctly serialize an OrganizationState") { assertOutput(OrganizationState.serializer, state, jsonState) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/permissions/model/PermissionsRejectionSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/permissions/model/PermissionsRejectionSpec.scala index 96b1e5212c..a811373ce4 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/permissions/model/PermissionsRejectionSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/permissions/model/PermissionsRejectionSpec.scala @@ -17,7 +17,7 @@ class PermissionsRejectionSpec extends CatsEffectSpec with CirceLiteral with Fix "be converted to compacted JSON-LD" in { val list = List( cannotReplace -> json"""{"@type": "CannotReplaceWithEmptyCollection", "reason": "${cannotReplace.reason}"}""", - incorrectRev -> jsonContentOf("/permissions/incorrect-revision-compacted.json") + incorrectRev -> jsonContentOf("permissions/incorrect-revision-compacted.json") ) forAll(list) { case (rejection, json) => rejection.toCompactedJsonLd.accepted.json shouldEqual json.addContext(contexts.error) @@ -27,7 +27,7 @@ class PermissionsRejectionSpec extends CatsEffectSpec with CirceLiteral with Fix "be converted to expanded JSON-LD" in { val list = List( cannotReplace -> json"""[{"@type": ["${nxv + "CannotReplaceWithEmptyCollection"}"], "${nxv + "reason"}": [{"@value": "${cannotReplace.reason}"} ] } ]""", - incorrectRev -> jsonContentOf("/permissions/incorrect-revision-expanded.json") + incorrectRev -> jsonContentOf("permissions/incorrect-revision-expanded.json") ) forAll(list) { case (rejection, json) => rejection.toExpandedJsonLd.accepted.json shouldEqual json diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/permissions/model/PermissionsSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/permissions/model/PermissionsSerializationSuite.scala index e37f2e3be1..ecb00549f7 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/permissions/model/PermissionsSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/permissions/model/PermissionsSerializationSuite.scala @@ -50,7 +50,7 @@ class PermissionsSerializationSuite extends SerializationSuite { updatedBy = subject ) - private val jsonState = jsonContentOf("/permissions/permissions-state.json") + private val jsonState = jsonContentOf("permissions/permissions-state.json") test(s"Correctly serialize a PermissionsState") { assertOutput(PermissionsState.serializer, state, jsonState) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/model/ProjectRejectionSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/model/ProjectRejectionSpec.scala index be6dedf77a..c09cbff3e9 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/model/ProjectRejectionSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/model/ProjectRejectionSpec.scala @@ -15,8 +15,8 @@ class ProjectRejectionSpec extends CatsEffectSpec with Fixtures { "be converted to compacted JSON-LD" in { val list = List( - alreadyExists -> jsonContentOf("/projects/project-already-exists-compacted.json"), - incorrectRev -> jsonContentOf("/projects/incorrect-revision-compacted.json") + alreadyExists -> jsonContentOf("projects/project-already-exists-compacted.json"), + incorrectRev -> jsonContentOf("projects/incorrect-revision-compacted.json") ) forAll(list) { case (rejection, json) => rejection.toCompactedJsonLd.accepted.json shouldEqual json.addContext(contexts.error) @@ -25,8 +25,8 @@ class ProjectRejectionSpec extends CatsEffectSpec with Fixtures { "be converted to expanded JSON-LD" in { val list = List( - alreadyExists -> jsonContentOf("/projects/project-already-exists-expanded.json"), - incorrectRev -> jsonContentOf("/projects/incorrect-revision-expanded.json") + alreadyExists -> jsonContentOf("projects/project-already-exists-expanded.json"), + incorrectRev -> jsonContentOf("projects/incorrect-revision-expanded.json") ) forAll(list) { case (rejection, json) => rejection.toExpandedJsonLd.accepted.json shouldEqual json diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/model/ProjectSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/model/ProjectSerializationSuite.scala index 93dae4744d..2685b7411e 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/model/ProjectSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/projects/model/ProjectSerializationSuite.scala @@ -129,7 +129,7 @@ class ProjectSerializationSuite extends SerializationSuite { updatedBy = subject ) - private val jsonState = jsonContentOf("/projects/project-state.json") + private val jsonState = jsonContentOf("projects/project-state.json") test(s"Correctly serialize a ProjectState") { assertOutput(ProjectState.serializer, state, jsonState) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/realms/model/RealmSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/realms/model/RealmSerializationSuite.scala index efbcfdc44a..c4735c395f 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/realms/model/RealmSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/realms/model/RealmSerializationSuite.scala @@ -118,7 +118,7 @@ class RealmSerializationSuite extends SerializationSuite { updatedBy = subject ) - private val jsonState = jsonContentOf("/realms/realm-state.json") + private val jsonState = jsonContentOf("realms/realm-state.json") test(s"Correctly serialize an RealmState") { assertOutput(RealmState.serializer, state, jsonState) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/realms/model/RealmsRejectionSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/realms/model/RealmsRejectionSpec.scala index ce99763022..ce1befcddd 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/realms/model/RealmsRejectionSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/realms/model/RealmsRejectionSpec.scala @@ -18,7 +18,7 @@ class RealmsRejectionSpec extends CatsEffectSpec with CirceLiteral with Fixtures "be converted to compacted JSON-LD" in { val list = List( alreadyExists -> json"""{"@type": "RealmAlreadyExists", "reason": "${alreadyExists.reason}"}""", - incorrectRev -> jsonContentOf("/realms/incorrect-revision-compacted.json") + incorrectRev -> jsonContentOf("realms/incorrect-revision-compacted.json") ) forAll(list) { case (rejection, json) => rejection.toCompactedJsonLd.accepted.json shouldEqual json.addContext(contexts.error) @@ -28,7 +28,7 @@ class RealmsRejectionSpec extends CatsEffectSpec with CirceLiteral with Fixtures "be converted to expanded JSON-LD" in { val list = List( alreadyExists -> json"""[{"@type": ["${nxv + "RealmAlreadyExists"}"], "${nxv + "reason"}": [{"@value": "${alreadyExists.reason}"} ] } ]""", - incorrectRev -> jsonContentOf("/realms/incorrect-revision-expanded.json") + incorrectRev -> jsonContentOf("realms/incorrect-revision-expanded.json") ) forAll(list) { case (rejection, json) => rejection.toExpandedJsonLd.accepted.json shouldEqual json diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/ResolverContextResolutionSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/ResolverContextResolutionSuite.scala index 0ce7d22f48..54cd2cb8bc 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/ResolverContextResolutionSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/ResolverContextResolutionSuite.scala @@ -27,7 +27,7 @@ import java.time.Instant class ResolverContextResolutionSuite extends CatsEffectSuite { - private val metadataContext = jsonContentOf("/contexts/metadata.json").topContextValueOrEmpty + private val metadataContext = jsonContentOf("contexts/metadata.json").topContextValueOrEmpty val rcr: RemoteContextResolution = RemoteContextResolution.fixed(contexts.metadata -> metadataContext) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/ResolversImplSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/ResolversImplSpec.scala index c8c7f2f040..f3480b9175 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/ResolversImplSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/ResolversImplSpec.scala @@ -49,8 +49,8 @@ class ResolversImplSpec extends CatsEffectSpec with DoobieScalaTestFixture with private def res: RemoteContextResolution = RemoteContextResolution.fixed( - contexts.resolvers -> jsonContentOf("/contexts/resolvers.json").topContextValueOrEmpty, - contexts.resolversMetadata -> jsonContentOf("/contexts/resolvers-metadata.json").topContextValueOrEmpty + contexts.resolvers -> jsonContentOf("contexts/resolvers.json").topContextValueOrEmpty, + contexts.resolversMetadata -> jsonContentOf("contexts/resolvers-metadata.json").topContextValueOrEmpty ) private val resolverContextResolution: ResolverContextResolution = ResolverContextResolution(res) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/model/ResolverSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/model/ResolverSerializationSuite.scala index 9491e8616e..97ed065aab 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/model/ResolverSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/model/ResolverSerializationSuite.scala @@ -209,9 +209,9 @@ class ResolverSerializationSuite extends SerializationSuite { } private val statesMapping = Map( - inProjectValue -> jsonContentOf("/resolvers/resolver-in-project-state.json"), - crossProjectValue1 -> jsonContentOf("/resolvers/resolver-cross-project-state-1.json"), - crossProjectValue2 -> jsonContentOf("/resolvers/resolver-cross-project-state-2.json") + inProjectValue -> jsonContentOf("resolvers/resolver-in-project-state.json"), + crossProjectValue1 -> jsonContentOf("resolvers/resolver-cross-project-state-1.json"), + crossProjectValue2 -> jsonContentOf("resolvers/resolver-cross-project-state-2.json") ).map { case (k, v) => ResolverState( myId, diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/model/ResolverValueSpec.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/model/ResolverValueSpec.scala index 1189b62260..d3c0392b01 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/model/ResolverValueSpec.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resolvers/model/ResolverValueSpec.scala @@ -20,7 +20,7 @@ class ResolverValueSpec extends CatsEffectSpec with Fixtures { "InProject" should { "be successfully decoded" in { - val json = jsonContentOf("/resolvers/expanded/in-project-resolver.json") + val json = jsonContentOf("resolvers/expanded/in-project-resolver.json") val expanded = ExpandedJsonLd(json).accepted expanded.to[ResolverValue].rightValue shouldEqual InProjectValue( @@ -29,7 +29,7 @@ class ResolverValueSpec extends CatsEffectSpec with Fixtures { } "be successfully decoded when a name and description are defined" in { - val json = jsonContentOf("/resolvers/expanded/in-project-resolver-name-desc.json") + val json = jsonContentOf("resolvers/expanded/in-project-resolver-name-desc.json") val expanded = ExpandedJsonLd(json).accepted expanded.to[ResolverValue].rightValue shouldEqual InProjectValue( @@ -50,8 +50,8 @@ class ResolverValueSpec extends CatsEffectSpec with Fixtures { "be successfully decoded when using provided entities resolution" in { forAll( List( - jsonContentOf("/resolvers/expanded/cross-project-resolver-identities.json"), - jsonContentOf("/resolvers/expanded/cross-project-resolver-identities-no-type.json") + jsonContentOf("resolvers/expanded/cross-project-resolver-identities.json"), + jsonContentOf("resolvers/expanded/cross-project-resolver-identities-no-type.json") ) ) { json => val expanded = ExpandedJsonLd(json).accepted @@ -65,7 +65,7 @@ class ResolverValueSpec extends CatsEffectSpec with Fixtures { } "be successfully decoded when using current caller resolution" in { - val json = jsonContentOf("/resolvers/expanded/cross-project-resolver-use-caller.json") + val json = jsonContentOf("resolvers/expanded/cross-project-resolver-use-caller.json") val expanded = ExpandedJsonLd(json).accepted expanded.to[ResolverValue].rightValue shouldEqual CrossProjectValue( Priority.unsafe(42), @@ -76,7 +76,7 @@ class ResolverValueSpec extends CatsEffectSpec with Fixtures { } "be successfully decoded when using current caller resolution with name and description" in { - val json = jsonContentOf("/resolvers/expanded/cross-project-resolver-use-caller-name-desc.json") + val json = jsonContentOf("resolvers/expanded/cross-project-resolver-use-caller-name-desc.json") val expanded = ExpandedJsonLd(json).accepted expanded.to[ResolverValue].rightValue shouldEqual CrossProjectValue( name, @@ -89,7 +89,7 @@ class ResolverValueSpec extends CatsEffectSpec with Fixtures { } "result in an error when both resolutions are defined" in { - val json = jsonContentOf("/resolvers/expanded/cross-project-resolver-both-error.json") + val json = jsonContentOf("resolvers/expanded/cross-project-resolver-both-error.json") val expanded = ExpandedJsonLd(json).accepted expanded.to[ResolverValue].leftValue shouldEqual ParsingFailure( "Only 'useCurrentCaller' or 'identities' should be defined" diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceSerializationSuite.scala index 958c3cc9d1..ff9f667ad7 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/resources/model/ResourceSerializationSuite.scala @@ -113,8 +113,8 @@ class ResourceSerializationSuite extends SerializationSuite with ResourceInstanc updatedBy = subject ) - private val jsonState = jsonContentOf("/resources/resource-state.json") - private val jsonStateNoRemoteContext = jsonContentOf("/resources/resource-state-no-remote-contexts.json") + private val jsonState = jsonContentOf("resources/resource-state.json") + private val jsonStateNoRemoteContext = jsonContentOf("resources/resource-state-no-remote-contexts.json") test(s"Correctly serialize a ResourceState") { assertOutput(ResourceState.serializer, state, jsonState) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/model/SchemaSerializationSuite.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/model/SchemaSerializationSuite.scala index 1a8a59f5a8..2b12aa9fd9 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/model/SchemaSerializationSuite.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/model/SchemaSerializationSuite.scala @@ -93,12 +93,12 @@ class SchemaSerializationSuite extends SerializationSuite { ) private val schemasMapping = List( - (created, jsonContentOf("/schemas/schema-created.json"), Created), - (updated, jsonContentOf("/schemas/schema-updated.json"), Updated), - (refreshed, jsonContentOf("/schemas/schema-refreshed.json"), Refreshed), - (tagged, jsonContentOf("/schemas/schema-tagged.json"), Tagged), - (tagDeleted, jsonContentOf("/schemas/schema-tag-deleted.json"), TagDeleted), - (deprecated, jsonContentOf("/schemas/schema-deprecated.json"), Deprecated) + (created, jsonContentOf("schemas/schema-created.json"), Created), + (updated, jsonContentOf("schemas/schema-updated.json"), Updated), + (refreshed, jsonContentOf("schemas/schema-refreshed.json"), Refreshed), + (tagged, jsonContentOf("schemas/schema-tagged.json"), Tagged), + (tagDeleted, jsonContentOf("schemas/schema-tag-deleted.json"), TagDeleted), + (deprecated, jsonContentOf("schemas/schema-deprecated.json"), Deprecated) ) schemasMapping.foreach { case (event, json, action) => @@ -142,7 +142,7 @@ class SchemaSerializationSuite extends SerializationSuite { updatedBy = subject ) - private val jsonState = jsonContentOf("/schemas/schema-state.json") + private val jsonState = jsonContentOf("schemas/schema-state.json") test(s"Correctly serialize a SchemaState") { assertOutput(SchemaState.serializer, state, jsonState) diff --git a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/utils/RouteFixtures.scala b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/utils/RouteFixtures.scala index dad3264173..057979d322 100644 --- a/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/utils/RouteFixtures.scala +++ b/delta/sdk/src/test/scala/ch/epfl/bluebrain/nexus/delta/sdk/utils/RouteFixtures.scala @@ -45,8 +45,8 @@ trait RouteFixtures { contexts.statistics -> ContextValue.fromFile("contexts/statistics.json"), contexts.supervision -> ContextValue.fromFile("contexts/supervision.json"), contexts.tags -> ContextValue.fromFile("contexts/tags.json"), - contexts.version -> ContextValue.fromFile("/contexts/version.json"), - contexts.quotas -> ContextValue.fromFile("/contexts/quotas.json") + contexts.version -> ContextValue.fromFile("contexts/version.json"), + contexts.quotas -> ContextValue.fromFile("contexts/quotas.json") ) implicit val ordering: JsonKeyOrdering = diff --git a/delta/sourcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/Transactors.scala b/delta/sourcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/Transactors.scala index 735d5a7b5d..a5bc359c9d 100644 --- a/delta/sourcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/Transactors.scala +++ b/delta/sourcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/Transactors.scala @@ -41,7 +41,7 @@ final case class Transactors( object Transactors { - private val dropScript = "/scripts/postgres/drop/drop-tables.ddl" + private val dropScript = "scripts/postgres/drop/drop-tables.ddl" private val scriptDirectory = "/scripts/postgres/init/" /** diff --git a/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/AppInfoRoutesSpec.scala b/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/AppInfoRoutesSpec.scala index 41d6070112..335a744724 100644 --- a/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/AppInfoRoutesSpec.scala +++ b/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/AppInfoRoutesSpec.scala @@ -26,7 +26,7 @@ class AppInfoRoutesSpec extends CatsEffectSpec with ScalatestRouteTest with Idio Get("/") ~> route ~> check { status shouldEqual OK responseAs[Json] shouldEqual - jsonContentOf("/app-info.json", Map(quote("{version}") -> config.description.version)) + jsonContentOf("app-info.json", Map(quote("{version}") -> config.description.version)) } } } diff --git a/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/StorageDirectivesSpec.scala b/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/StorageDirectivesSpec.scala index e29307fb8d..18bf9536b1 100644 --- a/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/StorageDirectivesSpec.scala +++ b/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/StorageDirectivesSpec.scala @@ -18,7 +18,7 @@ class StorageDirectivesSpec extends CatsEffectSpec with ScalatestRouteTest with def pathInvalidJson(path: Uri.Path): Json = jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "PathInvalid", quote( diff --git a/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/StorageRoutesSpec.scala b/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/StorageRoutesSpec.scala index 47d183a6bf..ddeadf6cae 100644 --- a/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/StorageRoutesSpec.scala +++ b/storage/src/test/scala/ch/epfl/bluebrain/nexus/storage/routes/StorageRoutesSpec.scala @@ -81,7 +81,7 @@ class StorageRoutesSpec status shouldEqual NotFound storages.exists(name) wasCalled once responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "BucketNotFound", quote("{reason}") -> s"The provided bucket '$name' does not exist." @@ -108,7 +108,7 @@ class StorageRoutesSpec Put(s"/v1/buckets/$name/files/path/to/file/") ~> route ~> check { status shouldEqual NotFound responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "BucketNotFound", quote("{reason}") -> s"The provided bucket '$name' does not exist." @@ -125,7 +125,7 @@ class StorageRoutesSpec Put(s"/v1/buckets/$name/files/path/to/file/$filename", multipartForm) ~> route ~> check { status shouldEqual Conflict responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "PathAlreadyExists", quote( @@ -150,7 +150,7 @@ class StorageRoutesSpec Put(s"/v1/buckets/$name/files/path/to/file/$filename", multipartForm) ~> route ~> check { status shouldEqual InternalServerError responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "InternalError", quote("{reason}") -> s"The system experienced an unexpected error, please try again later." @@ -179,7 +179,7 @@ class StorageRoutesSpec Put(s"/v1/buckets/$name/files/path/to/file/$filename", multipartForm) ~> route ~> check { status shouldEqual Created responseAs[Json] shouldEqual jsonContentOf( - "/file-created.json", + "file-created.json", Map( quote("{location}") -> attributes.location.toString, quote("{mediaType}") -> attributes.mediaType.value, @@ -201,10 +201,10 @@ class StorageRoutesSpec "fail when bucket does not exists" in new Ctx { storages.exists(name) shouldReturn BucketDoesNotExist - Put(s"/v1/buckets/$name/files/path/to/myfile.txt", jsonContentOf("/file-link.json")) ~> route ~> check { + Put(s"/v1/buckets/$name/files/path/to/myfile.txt", jsonContentOf("file-link.json")) ~> route ~> check { status shouldEqual NotFound responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "BucketNotFound", quote("{reason}") -> s"The provided bucket '$name' does not exist." @@ -221,12 +221,12 @@ class StorageRoutesSpec storages.moveFile(name, Uri.Path(source), Uri.Path(dest))(BucketExists) shouldReturn IO.raiseError(InternalError("something went wrong")) - val json = jsonContentOf("/file-link.json", Map(quote("{source}") -> source)) + val json = jsonContentOf("file-link.json", Map(quote("{source}") -> source)) Put(s"/v1/buckets/$name/files/$dest", json) ~> route ~> check { status shouldEqual InternalServerError responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "InternalError", quote("{reason}") -> s"The system experienced an unexpected error, please try again later." @@ -242,12 +242,12 @@ class StorageRoutesSpec val source = "../dir" val dest = "dest/dir" - val json = jsonContentOf("/file-link.json", Map(quote("{source}") -> source)) + val json = jsonContentOf("file-link.json", Map(quote("{source}") -> source)) Put(s"/v1/buckets/$name/files/$dest", json) ~> route ~> check { status shouldEqual BadRequest responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "PathInvalid", quote( @@ -266,12 +266,12 @@ class StorageRoutesSpec storages.moveFile(name, Uri.Path(source), Uri.Path(dest))(BucketExists) shouldReturn IO.pure(Right(attributes)) - val json = jsonContentOf("/file-link.json", Map(quote("{source}") -> source)) + val json = jsonContentOf("file-link.json", Map(quote("{source}") -> source)) Put(s"/v1/buckets/$name/files/$dest", json) ~> route ~> check { status shouldEqual OK responseAs[Json] shouldEqual jsonContentOf( - "/file-created.json", + "file-created.json", Map( quote("{location}") -> attributes.location.toString, quote("{mediaType}") -> attributes.mediaType.value, @@ -296,7 +296,7 @@ class StorageRoutesSpec Get(s"/v1/buckets/$name/files/$filename") ~> Accept(`*/*`) ~> route ~> check { status shouldEqual NotFound responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "PathNotFound", quote( @@ -317,7 +317,7 @@ class StorageRoutesSpec Get(s"/v1/buckets/$name/files/$filename") ~> Accept(`*/*`) ~> route ~> check { status shouldEqual NotFound responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "PathNotFound", quote( @@ -369,7 +369,7 @@ class StorageRoutesSpec Get(s"/v1/buckets/$name/attributes/$filename") ~> Accept(`*/*`) ~> route ~> check { status shouldEqual NotFound responseAs[Json] shouldEqual jsonContentOf( - "/error.json", + "error.json", Map( quote("{type}") -> "PathNotFound", quote( diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/BaseIntegrationSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/BaseIntegrationSpec.scala index 7156ce46e4..68129d6871 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/BaseIntegrationSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/BaseIntegrationSpec.scala @@ -161,7 +161,7 @@ trait BaseIntegrationSpec case StatusCodes.NotFound => val body = jsonContentOf( - "/iam/realms/create.json", + "iam/realms/create.json", "realm" -> s"${config.realmSuffix(realm)}" ) for { diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/ElasticsearchDsl.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/ElasticsearchDsl.scala index bd94d55cb1..437436465c 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/ElasticsearchDsl.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/ElasticsearchDsl.scala @@ -32,7 +32,7 @@ class ElasticsearchDsl(implicit def createTemplate(): IO[StatusCode] = { for { - json <- loader.jsonContentOf("/elasticsearch/template.json") + json <- loader.jsonContentOf("elasticsearch/template.json") _ <- logger.info("Creating template for Elasticsearch indices") result <- elasticClient( HttpRequest( diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/KeycloakDsl.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/KeycloakDsl.scala index fab6f65135..c6cb488d53 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/KeycloakDsl.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/KeycloakDsl.scala @@ -49,7 +49,7 @@ class KeycloakDsl(implicit for { _ <- logger.info(s"Creating realm $realm in Keycloak...") json <- loader.jsonContentOf( - "/iam/keycloak/import.json", + "iam/keycloak/import.json", "realm" -> realm.name, "client" -> clientCredentials.id, "client_secret" -> clientCredentials.secret, diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/SchemaPayload.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/SchemaPayload.scala index f3a49fe210..1ec42aab7c 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/SchemaPayload.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/SchemaPayload.scala @@ -8,9 +8,9 @@ object SchemaPayload { private val loader = ClasspathResourceLoader() def loadSimple(targetClass: String = "nxv:TestResource"): IO[Json] = - loader.jsonContentOf("/kg/schemas/simple-schema.json", "targetClass" -> targetClass) + loader.jsonContentOf("kg/schemas/simple-schema.json", "targetClass" -> targetClass) def loadSimpleNoId(targetClass: String = "nxv:TestResource"): IO[Json] = - loader.jsonContentOf("/kg/schemas/simple-schema-no-id.json", "targetClass" -> targetClass) + loader.jsonContentOf("kg/schemas/simple-schema-no-id.json", "targetClass" -> targetClass) } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/AdminDsl.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/AdminDsl.scala index 3a255b6245..3ebcb67f9a 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/AdminDsl.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/AdminDsl.scala @@ -25,7 +25,7 @@ class AdminDsl(cl: HttpClient, config: TestsConfig) private val loader = ClasspathResourceLoader() private def orgPayload(description: String): IO[Json] = - loader.jsonContentOf("/admin/orgs/payload.json", "description" -> description) + loader.jsonContentOf("admin/orgs/payload.json", "description" -> description) private def createOrgRespJson( id: String, @@ -48,7 +48,7 @@ class AdminDsl(cl: HttpClient, config: TestsConfig) "deprecated" -> deprecated.toString, "schema" -> schema ) - loader.jsonContentOf("/admin/org-response.json", resp: _*) + loader.jsonContentOf("admin/org-response.json", resp: _*) } def createProjectRespJson( @@ -75,7 +75,7 @@ class AdminDsl(cl: HttpClient, config: TestsConfig) "markedForDeletion" -> markedForDeletion.toString, "schema" -> schema ) - loader.jsonContentOf("/admin/project-response.json", resp: _*) + loader.jsonContentOf("admin/project-response.json", resp: _*) } private def queryParams(rev: Int) = @@ -159,7 +159,7 @@ class AdminDsl(cl: HttpClient, config: TestsConfig) private[tests] def randomProjectPrefix = genString(1, startPool) + genString(10, pool) def projectPayload( - path: String = "/admin/projects/create.json", + path: String = "admin/projects/create.json", nxv: String = randomProjectPrefix, person: String = randomProjectPrefix, description: String = genString(), diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/OrgsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/OrgsSpec.scala index 2852c8caff..435d5ecd02 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/OrgsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/OrgsSpec.scala @@ -243,14 +243,14 @@ class OrgsSpec extends BaseIntegrationSpec with OpticsValidators { "fail when wrong revision is provided" in { deltaClient.delete[Json](s"/orgs/$id?rev=4", Leela) { (json, response) => response.status shouldEqual StatusCodes.Conflict - json shouldEqual jsonContentOf("/admin/errors/org-incorrect-revision.json") + json shouldEqual jsonContentOf("admin/errors/org-incorrect-revision.json") } } "fail when revision is not provided" in { deltaClient.delete[Json](s"/orgs/$id", Leela) { (json, response) => response.status shouldEqual StatusCodes.BadRequest - json shouldEqual jsonContentOf("/admin/errors/invalid-delete-request.json", "orgId" -> id) + json shouldEqual jsonContentOf("admin/errors/invalid-delete-request.json", "orgId" -> id) } } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala index 976ea0a5a4..1fdbfe2144 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala @@ -258,7 +258,7 @@ class ProjectsSpec extends BaseIntegrationSpec with OpticsValidators { "return empty list if no acl is set" in { deltaClient.get[Json]("/projects", PrincessCarolyn) { (json, response) => response.status shouldEqual StatusCodes.OK - json shouldEqual jsonContentOf("/admin/projects/empty-project-list.json") + json shouldEqual jsonContentOf("admin/projects/empty-project-list.json") } } @@ -273,7 +273,7 @@ class ProjectsSpec extends BaseIntegrationSpec with OpticsValidators { "return an empty list if no project is accessible" in { deltaClient.get[Json]("/projects", PrincessCarolyn) { (json, response) => response.status shouldEqual StatusCodes.OK - json shouldEqual jsonContentOf("/admin/projects/empty-project-list.json") + json shouldEqual jsonContentOf("admin/projects/empty-project-list.json") } } @@ -299,7 +299,7 @@ class ProjectsSpec extends BaseIntegrationSpec with OpticsValidators { Json.arr( ids.map { case (orgId, projectId) => jsonContentOf( - "/admin/projects/listing-item.json", + "admin/projects/listing-item.json", replacements( target, "id" -> s"$orgId/$projectId", diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/builders/SchemaPayloads.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/builders/SchemaPayloads.scala index acb21991b5..e5cefb1dce 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/builders/SchemaPayloads.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/builders/SchemaPayloads.scala @@ -6,14 +6,14 @@ import io.circe.Json object SchemaPayloads { private val loader = ClasspathResourceLoader() def withPowerLevelShape(id: String, maxPowerLevel: Int): IO[Json] = { - loader.jsonContentOf("/kg/schemas/schema-with-power-level.json", "id" -> id, "maxPowerLevel" -> maxPowerLevel) + loader.jsonContentOf("kg/schemas/schema-with-power-level.json", "id" -> id, "maxPowerLevel" -> maxPowerLevel) } def withImportOfPowerLevelShape(id: String, importedSchemaId: String): IO[Json] = { - loader.jsonContentOf("/kg/schemas/schema-that-imports-power-level.json", "id" -> id, "import" -> importedSchemaId) + loader.jsonContentOf("kg/schemas/schema-that-imports-power-level.json", "id" -> id, "import" -> importedSchemaId) } def withMinCount(id: String, minCount: Int): IO[Json] = { - loader.jsonContentOf("/kg/schemas/schema.json", "id" -> id, "minCount" -> minCount) + loader.jsonContentOf("kg/schemas/schema.json", "id" -> id, "minCount" -> minCount) } } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/AclDsl.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/AclDsl.scala index 4c9e44e1ee..5c7d72003c 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/AclDsl.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/AclDsl.scala @@ -37,7 +37,7 @@ class AclDsl(cl: HttpClient) extends CirceUnmarshalling with OptionValues with M def addPermissions(path: String, target: Authenticated, permissions: Set[Permission]): IO[Assertion] = { loader .jsonContentOf( - "/iam/add.json", + "iam/add.json", "realm" -> target.realm.name, "sub" -> target.name, "perms" -> permissions.asJava @@ -51,7 +51,7 @@ class AclDsl(cl: HttpClient) extends CirceUnmarshalling with OptionValues with M def addPermissionsAnonymous(path: String, permissions: Set[Permission]): IO[Assertion] = { loader .jsonContentOf( - "/iam/add_annon.json", + "iam/add_annon.json", "perms" -> permissions.asJava ) .flatMap(addPermissions(path, _, "Anonymous")) @@ -103,7 +103,7 @@ class AclDsl(cl: HttpClient) extends CirceUnmarshalling with OptionValues with M .parTraverse { acl => for { payload <- loader.jsonContentOf( - "/iam/subtract-permissions.json", + "iam/subtract-permissions.json", "realm" -> target.realm.name, "sub" -> target.name, "perms" -> acl.acl.head.permissions.asJava @@ -134,7 +134,7 @@ class AclDsl(cl: HttpClient) extends CirceUnmarshalling with OptionValues with M .parTraverse { acl => for { payload <- loader.jsonContentOf( - "/iam/subtract-permissions-anon.json", + "iam/subtract-permissions-anon.json", "perms" -> acl.acl.head.permissions.asJava ) result <- @@ -172,7 +172,7 @@ class AclDsl(cl: HttpClient) extends CirceUnmarshalling with OptionValues with M ): IO[Assertion] = { for { body <- loader.jsonContentOf( - "/iam/subtract-permissions.json", + "iam/subtract-permissions.json", "realm" -> target.realm.name, "sub" -> target.name, "perms" -> permissions.asJava diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/IdentitiesSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/IdentitiesSpec.scala index 6cd904c28c..051f6c65de 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/IdentitiesSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/IdentitiesSpec.scala @@ -12,7 +12,7 @@ class IdentitiesSpec extends BaseIntegrationSpec { deltaClient.get[Json]("/identities", Identity.ServiceAccount) { (json, response) => response.status shouldEqual StatusCodes.OK json shouldEqual jsonContentOf( - "/iam/identities/response.json", + "iam/identities/response.json", "deltaUri" -> config.deltaUri.toString() ) } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/PermissionDsl.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/PermissionDsl.scala index 333489eb46..a2575e91d5 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/PermissionDsl.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/PermissionDsl.scala @@ -24,7 +24,7 @@ class PermissionDsl(cl: HttpClient) extends CirceUnmarshalling with Matchers { if (!list.toSet.subsetOf(permissions.permissions)) { (for { body <- loader.jsonContentOf( - "/iam/permissions/append.json", + "iam/permissions/append.json", permissionsRepl(list) ) result <- diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/PermissionsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/PermissionsSpec.scala index dd805b2150..fedd39fb75 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/PermissionsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/PermissionsSpec.scala @@ -46,7 +46,7 @@ class PermissionsSpec extends BaseIntegrationSpec { runIO { response.status shouldEqual StatusCodes.OK val body = jsonContentOf( - "/iam/permissions/subtract.json", + "iam/permissions/subtract.json", permissionDsl.permissionsRepl(permission2 :: Nil) ) deltaClient.patch[Json](s"/permissions?rev=${permissions._rev}", body, Identity.ServiceAccount) { @@ -70,7 +70,7 @@ class PermissionsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val body = jsonContentOf( - "/iam/permissions/replace.json", + "iam/permissions/replace.json", permissionDsl.permissionsRepl( Permission.minimalPermissions + permission1 + permission2 ) @@ -95,7 +95,7 @@ class PermissionsSpec extends BaseIntegrationSpec { runIO { response.status shouldEqual StatusCodes.OK val body = jsonContentOf( - "/iam/permissions/subtract.json", + "iam/permissions/subtract.json", permissionDsl.permissionsRepl( Permission.minimalPermissions.take(1) ) @@ -113,7 +113,7 @@ class PermissionsSpec extends BaseIntegrationSpec { runIO { response.status shouldEqual StatusCodes.OK val body = jsonContentOf( - "/iam/permissions/replace.json", + "iam/permissions/replace.json", permissionDsl.permissionsRepl( Permission.minimalPermissions.subsets(1).next() ) diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/RealmsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/RealmsSpec.scala index eeb15e1b5a..3d4d7b864f 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/RealmsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/RealmsSpec.scala @@ -33,13 +33,13 @@ class RealmsSpec extends BaseIntegrationSpec { "create realm" in { val body = jsonContentOf( - "/iam/realms/create.json", + "iam/realms/create.json", "realm" -> testRealmUri ) deltaClient.put[Json](s"/realms/${testRealm.name}", body, Identity.ServiceAccount) { (json, _) => filterRealmKeys(json) shouldEqual jsonContentOf( - "/iam/realms/ref-response.json", + "iam/realms/ref-response.json", "realm" -> testRealmUri, "deltaUri" -> config.deltaUri.toString(), "label" -> testRealm.name, @@ -51,13 +51,13 @@ class RealmsSpec extends BaseIntegrationSpec { "recreate realm" in { val body = jsonContentOf( - "/iam/realms/create.json", + "iam/realms/create.json", "realm" -> testRealmUri ) deltaClient.put[Json](s"/realms/${testRealm.name}?rev=$rev", body, Identity.ServiceAccount) { (json, _) => filterRealmKeys(json) shouldEqual jsonContentOf( - "/iam/realms/ref-response.json", + "iam/realms/ref-response.json", "realm" -> testRealmUri, "deltaUri" -> config.deltaUri.toString(), "label" -> testRealm.name, @@ -71,7 +71,7 @@ class RealmsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/realms/${testRealm.name}", Identity.ServiceAccount) { (json, result) => result.status shouldEqual StatusCodes.OK filterRealmKeys(json) shouldEqual jsonContentOf( - "/iam/realms/fetch-response.json", + "iam/realms/fetch-response.json", "realm" -> testRealmUri, "deltaUri" -> config.deltaUri.toString(), "rev" -> s"${rev + 1}", @@ -83,7 +83,7 @@ class RealmsSpec extends BaseIntegrationSpec { "update realm" in { val body = jsonContentOf( - "/iam/realms/update.json", + "iam/realms/update.json", "realm" -> testRealmUri ) @@ -91,7 +91,7 @@ class RealmsSpec extends BaseIntegrationSpec { (json, result) => result.status shouldEqual StatusCodes.OK filterRealmKeys(json) shouldEqual jsonContentOf( - "/iam/realms/ref-response.json", + "iam/realms/ref-response.json", "realm" -> testRealmUri, "deltaUri" -> config.deltaUri.toString(), "label" -> testRealm.name, @@ -105,7 +105,7 @@ class RealmsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/realms/${testRealm.name}", Identity.ServiceAccount) { (json, result) => result.status shouldEqual StatusCodes.OK filterRealmKeys(json) shouldEqual jsonContentOf( - "/iam/realms/fetch-updated-response.json", + "iam/realms/fetch-updated-response.json", "realm" -> testRealmUri, "deltaUri" -> config.deltaUri.toString(), "rev" -> s"${rev + 2}", @@ -118,7 +118,7 @@ class RealmsSpec extends BaseIntegrationSpec { deltaClient.delete[Json](s"/realms/${testRealm.name}?rev=${rev + 2}", Identity.ServiceAccount) { (json, result) => result.status shouldEqual StatusCodes.OK filterRealmKeys(json) shouldEqual jsonContentOf( - "/iam/realms/ref-response.json", + "iam/realms/ref-response.json", "realm" -> testRealmUri, "deltaUri" -> config.deltaUri.toString(), "label" -> testRealm.name, @@ -132,7 +132,7 @@ class RealmsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/realms/${testRealm.name}", Identity.ServiceAccount) { (json, result) => result.status shouldEqual StatusCodes.OK filterRealmKeys(json) shouldEqual jsonContentOf( - "/iam/realms/fetch-deprecated-response.json", + "iam/realms/fetch-deprecated-response.json", "realm" -> testRealmUri, "deltaUri" -> config.deltaUri.toString(), "rev" -> s"${rev + 3}", diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/UserPermissionsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/UserPermissionsSpec.scala index aff2d17cbf..0d1bec4177 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/UserPermissionsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/iam/UserPermissionsSpec.scala @@ -85,7 +85,7 @@ class UserPermissionsSpec extends BaseIntegrationSpec { pos: Position ) = { val payload = jsonContentOf( - "/kg/storages/disk-perms-parameterised.json", + "kg/storages/disk-perms-parameterised.json", "id" -> id, "read-permission" -> readPermission.value, "write-permission" -> writePermission.value diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/AggregationsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/AggregationsSpec.scala index c086ed4658..e41bd0f422 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/AggregationsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/AggregationsSpec.scala @@ -68,7 +68,7 @@ final class AggregationsSpec extends BaseIntegrationSpec { "aggregate correctly for a user that has project permissions" in eventually { val expected = jsonContentOf( - "/kg/aggregations/project-aggregation.json", + "kg/aggregations/project-aggregation.json", "org" -> org1, "project" -> proj11 ) @@ -80,7 +80,7 @@ final class AggregationsSpec extends BaseIntegrationSpec { "aggregate resolvers" in { val expected = jsonContentOf( - "/kg/aggregations/resolvers-aggregation.json", + "kg/aggregations/resolvers-aggregation.json", "org" -> org1, "project" -> proj11 ) @@ -92,7 +92,7 @@ final class AggregationsSpec extends BaseIntegrationSpec { "aggregate views" in { val expected = jsonContentOf( - "/kg/aggregations/views-aggregation.json", + "kg/aggregations/views-aggregation.json", "org" -> org1, "project" -> proj11 ) @@ -104,7 +104,7 @@ final class AggregationsSpec extends BaseIntegrationSpec { "aggregate schemas" in { val expected = jsonContentOf( - "/kg/aggregations/schemas-aggregation.json", + "kg/aggregations/schemas-aggregation.json", "org" -> org1, "project" -> proj11 ) @@ -116,7 +116,7 @@ final class AggregationsSpec extends BaseIntegrationSpec { "aggregate storages" in { val expected = jsonContentOf( - "/kg/aggregations/storages-aggregation.json", + "kg/aggregations/storages-aggregation.json", "org" -> org1, "project" -> proj11 ) @@ -138,7 +138,7 @@ final class AggregationsSpec extends BaseIntegrationSpec { "aggregate correctly for a user that has " in eventually { val expected = jsonContentOf( - "/kg/aggregations/org-aggregation.json", + "kg/aggregations/org-aggregation.json", "org1" -> org1, "proj11" -> proj11, "proj12" -> proj12 @@ -161,7 +161,7 @@ final class AggregationsSpec extends BaseIntegrationSpec { "aggregate correctly for a user that has permissions on at least one project" in eventually { val expected = jsonContentOf( - "/kg/aggregations/root-aggregation.json", + "kg/aggregations/root-aggregation.json", "org1" -> org1, "org2" -> org2, "proj11" -> proj11, diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ArchiveSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ArchiveSpec.scala index 727719e3c5..0b87991767 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ArchiveSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ArchiveSpec.scala @@ -93,7 +93,7 @@ class ArchiveSpec extends BaseIntegrationSpec with ArchiveHelpers { "creating archives" should { "succeed" in { - val payload = jsonContentOf("/kg/archives/archive.json", "project2" -> fullId2) + val payload = jsonContentOf("kg/archives/archive.json", "project2" -> fullId2) deltaClient.put[Json](s"/archives/$fullId/test-resource:archive", payload, Tweety) { (_, response) => response.status shouldEqual StatusCodes.Created @@ -108,7 +108,7 @@ class ArchiveSpec extends BaseIntegrationSpec with ArchiveHelpers { fileSelf = json.hcursor.downField("_self").as[String].toOption.value response.status shouldEqual StatusCodes.OK } - payload = jsonContentOf("/kg/archives/archive-with-file-self.json", "value" -> fileSelf) + payload = jsonContentOf("kg/archives/archive-with-file-self.json", "value" -> fileSelf) _ <- deltaClient.put[Json](s"/archives/$fullId/$archiveId", payload, Tweety) { (_, response) => response.status shouldEqual StatusCodes.Created } @@ -131,7 +131,7 @@ class ArchiveSpec extends BaseIntegrationSpec with ArchiveHelpers { } "succeed and redirect" in { - val payload = jsonContentOf("/kg/archives/archive.json", "project2" -> fullId2) + val payload = jsonContentOf("kg/archives/archive.json", "project2" -> fullId2) deltaClient.put[String]( s"/archives/$fullId/test-resource:archiveRedirect", @@ -150,25 +150,25 @@ class ArchiveSpec extends BaseIntegrationSpec with ArchiveHelpers { } "fail if payload is wrong" in { - val payload = jsonContentOf("/kg/archives/archive-wrong.json") + val payload = jsonContentOf("kg/archives/archive-wrong.json") deltaClient.put[Json](s"/archives/$fullId/archive2", payload, Tweety) { (json, response) => response.status shouldEqual StatusCodes.BadRequest - filterKey("report")(json) shouldEqual jsonContentOf("/kg/archives/archive-wrong-response.json") + filterKey("report")(json) shouldEqual jsonContentOf("kg/archives/archive-wrong-response.json") } } "fail on wrong path" in { - val wrong1 = jsonContentOf(s"/kg/archives/archive-wrong-path1.json") - val expected1 = jsonContentOf("/kg/archives/archive-path-invalid1.json") + val wrong1 = jsonContentOf(s"kg/archives/archive-wrong-path1.json") + val expected1 = jsonContentOf("kg/archives/archive-path-invalid1.json") for { _ <- deltaClient.put[Json](s"/archives/$fullId/archive2", wrong1, Tweety) { (json, response) => json shouldEqual expected1 response.status shouldEqual StatusCodes.BadRequest } - wrong2 = jsonContentOf(s"/kg/archives/archive-wrong-path2.json") - expected2 = jsonContentOf("/kg/archives/archive-path-invalid2.json") + wrong2 = jsonContentOf(s"kg/archives/archive-wrong-path2.json") + expected2 = jsonContentOf("kg/archives/archive-path-invalid2.json") _ <- deltaClient.put[Json](s"/archives/$fullId/archive2", wrong2, Tweety) { (json, response) => json shouldEqual expected2 response.status shouldEqual StatusCodes.BadRequest @@ -177,8 +177,8 @@ class ArchiveSpec extends BaseIntegrationSpec with ArchiveHelpers { } "fail on path collisions" in { - val wrong = jsonContentOf(s"/kg/archives/archive-path-collision.json") - val expected = jsonContentOf(s"/kg/archives/archive-path-dup.json") + val wrong = jsonContentOf(s"kg/archives/archive-path-collision.json") + val expected = jsonContentOf(s"kg/archives/archive-path-dup.json") deltaClient.put[Json](s"/archives/$fullId/archive2", wrong, Tweety) { (json, response) => json shouldEqual expected @@ -192,7 +192,7 @@ class ArchiveSpec extends BaseIntegrationSpec with ArchiveHelpers { deltaClient.get[Json](s"/archives/$fullId/test-resource:archive", Tweety) { (json, response) => response.status shouldEqual StatusCodes.OK val expected = jsonContentOf( - "/kg/archives/archive-response.json", + "kg/archives/archive-response.json", replacements( Tweety, "project2" -> fullId2, @@ -238,7 +238,7 @@ class ArchiveSpec extends BaseIntegrationSpec with ArchiveHelpers { } "succeed getting archive using query param ignoreNotFound" in { - val payload = jsonContentOf("/kg/archives/archive-not-found.json") + val payload = jsonContentOf("kg/archives/archive-not-found.json") def assertContent(archive: Map[String, ByteString]) = { val actualContent1 = archive.entryAsJson( diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/CompositeViewsLifeCycleSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/CompositeViewsLifeCycleSpec.scala index 878e48fbda..07049ff5cd 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/CompositeViewsLifeCycleSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/CompositeViewsLifeCycleSpec.scala @@ -41,7 +41,7 @@ final class CompositeViewsLifeCycleSpec extends BaseIntegrationSpec { ) ++ includeCrossProjectOpt ++ includeSparqlProjectionOpt IO( jsonContentOf( - "/kg/views/composite/composite-view-lifecycle.json", + "kg/views/composite/composite-view-lifecycle.json", replacements( Jerry, values: _* diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/CompositeViewsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/CompositeViewsSpec.scala index 1fb86be5e8..3eab33591b 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/CompositeViewsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/CompositeViewsSpec.scala @@ -42,7 +42,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { } "succeed if payload is correct" in { - val projectPayload = jsonContentOf("/kg/views/composite/project.json") + val projectPayload = jsonContentOf("kg/views/composite/project.json") for { _ <- adminDsl.createOrganization(orgId, orgId, Jerry) _ <- List( @@ -77,7 +77,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "Uploading data" should { "upload context" in { - val context = jsonContentOf("/kg/views/composite/context.json") + val context = jsonContentOf("kg/views/composite/context.json") List(songsProject, albumsProject, bandsProject).parTraverse { projectId => deltaClient.post[Json](s"/resources/$orgId/$projectId", context, Jerry) { (_, response) => response.status shouldEqual StatusCodes.Created @@ -88,7 +88,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "upload songs" in { root.each.json .getAll( - jsonContentOf("/kg/views/composite/songs1.json") + jsonContentOf("kg/views/composite/songs1.json") ) .parTraverse { song => deltaClient.post[Json](s"/resources/$orgId/$songsProject", song, Jerry) { (_, response) => @@ -100,7 +100,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "upload albums" in { root.each.json .getAll( - jsonContentOf("/kg/views/composite/albums.json") + jsonContentOf("kg/views/composite/albums.json") ) .parTraverse { album => deltaClient.post[Json](s"/resources/$orgId/$albumsProject", album, Jerry) { (_, response) => @@ -112,7 +112,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "upload bands" in { root.each.json .getAll( - jsonContentOf("/kg/views/composite/bands.json") + jsonContentOf("kg/views/composite/bands.json") ) .parTraverse { band => deltaClient.post[Json](s"/resources/$orgId/$bandsProject", band, Jerry) { (_, response) => @@ -126,7 +126,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "create a composite view" in { val view = jsonContentOf( - "/kg/views/composite/composite-view.json", + "kg/views/composite/composite-view.json", replacements( Jerry, "org" -> orgId, @@ -151,7 +151,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "reject creating a composite view with remote source endpoint with a wrong suffix" in { resetAndWait() val view = jsonContentOf( - "/kg/views/composite/composite-view.json", + "kg/views/composite/composite-view.json", replacements( Jerry, "org" -> orgId, @@ -169,7 +169,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "reject creating a composite view with remote source endpoint with a wrong hostname" in { val view = jsonContentOf( - "/kg/views/composite/composite-view.json", + "kg/views/composite/composite-view.json", replacements( Jerry, "org" -> orgId, @@ -205,7 +205,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { (json, response) => response.status shouldEqual StatusCodes.OK val actual = Json.fromValues(hitsSource.getAll(json)) - val expected = jsonContentOf("/kg/views/composite/bands-results1.json") + val expected = jsonContentOf("kg/views/composite/bands-results1.json") actual should equalIgnoreArrayOrder(expected) } } @@ -218,7 +218,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { (json, response) => response.status shouldEqual StatusCodes.OK val actual = Json.fromValues(hitsSource.getAll(json)) - val expected = jsonContentOf("/kg/views/composite/albums-results1.json") + val expected = jsonContentOf("kg/views/composite/albums-results1.json") actual should equalIgnoreArrayOrder(expected) } } @@ -229,7 +229,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "upload more songs" in { root.each.json .getAll( - jsonContentOf("/kg/views/composite/songs2.json") + jsonContentOf("kg/views/composite/songs2.json") ) .parTraverse { song => deltaClient.post[Json](s"/resources/$orgId/$songsProject", song, Jerry) { (_, response) => @@ -247,7 +247,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { (json, response) => response.status shouldEqual StatusCodes.OK val actual = Json.fromValues(hitsSource.getAll(json)) - val expected = jsonContentOf("/kg/views/composite/bands-results2.json") + val expected = jsonContentOf("kg/views/composite/bands-results2.json") actual should equalIgnoreArrayOrder(expected) } } @@ -260,7 +260,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { (json, response) => response.status shouldEqual StatusCodes.OK val actual = Json.fromValues(hitsSource.getAll(json)) - val expected = jsonContentOf("/kg/views/composite/albums-results2.json") + val expected = jsonContentOf("kg/views/composite/albums-results2.json") actual should equalIgnoreArrayOrder(expected) } } @@ -272,7 +272,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { "create a composite view" in { val view = jsonContentOf( - "/kg/views/composite/composite-view-include-context.json", + "kg/views/composite/composite-view-include-context.json", replacements( Jerry, "org" -> orgId, @@ -303,7 +303,7 @@ class CompositeViewsSpec extends BaseIntegrationSpec { (json, response) => response.status shouldEqual StatusCodes.OK val actual = Json.fromValues(hitsSource.getAll(json)) - val expected = jsonContentOf("/kg/views/composite/bands-results2-include-context.json") + val expected = jsonContentOf("kg/views/composite/bands-results2-include-context.json") actual should equalIgnoreArrayOrder(expected) } } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/DiskStorageSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/DiskStorageSpec.scala index bdc4007d7a..f4f3b64d69 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/DiskStorageSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/DiskStorageSpec.scala @@ -20,7 +20,7 @@ class DiskStorageSpec extends StorageSpec { private def storageResponse(project: String, id: String, readPermission: String, writePermission: String) = jsonContentOf( - "/kg/storages/disk-response.json", + "kg/storages/disk-response.json", replacements( Coyote, "id" -> id, @@ -33,8 +33,8 @@ class DiskStorageSpec extends StorageSpec { ) override def createStorages: IO[Assertion] = { - val payload = jsonContentOf("/kg/storages/disk.json") - val payload2 = jsonContentOf("/kg/storages/disk-perms.json") + val payload = jsonContentOf("kg/storages/disk.json") + val payload2 = jsonContentOf("kg/storages/disk-perms.json") for { _ <- deltaClient.post[Json](s"/storages/$projectRef", payload, Coyote) { (_, response) => @@ -64,14 +64,14 @@ class DiskStorageSpec extends StorageSpec { "creating a disk storage" should { "fail creating a DiskStorage on a wrong volume" in { val volume = "/" + genString() - val payload = jsonContentOf("/kg/storages/disk.json") deepMerge + val payload = jsonContentOf("kg/storages/disk.json") deepMerge Json.obj( "@id" -> Json.fromString("https://bluebrain.github.io/nexus/vocabulary/invalid-volume"), "volume" -> Json.fromString(volume) ) deltaClient.post[Json](s"/storages/$projectRef", payload, Coyote) { (json, response) => - json shouldEqual jsonContentOf("/kg/storages/error.json", "volume" -> volume) + json shouldEqual jsonContentOf("kg/storages/error.json", "volume" -> volume) response.status shouldEqual StatusCodes.BadRequest } } @@ -87,7 +87,7 @@ class DiskStorageSpec extends StorageSpec { deltaClient.put[Json](s"/files/$projectRef/linking.png", payload, Coyote) { (json, response) => response.status shouldEqual StatusCodes.BadRequest - json shouldEqual jsonContentOf("/kg/files/linking-notsupported.json", "org" -> orgId, "proj" -> projId) + json shouldEqual jsonContentOf("kg/files/linking-notsupported.json", "org" -> orgId, "proj" -> projId) } } } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ElasticSearchViewsDsl.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ElasticSearchViewsDsl.scala index 9178bdb99a..1192d13cc2 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ElasticSearchViewsDsl.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ElasticSearchViewsDsl.scala @@ -21,7 +21,7 @@ final class ElasticSearchViewsDsl(deltaClient: HttpClient) extends CirceUnmarsha def aggregate(id: String, projectRef: String, identity: Identity, views: (String, String)*): IO[Assertion] = { for { payload <- loader.jsonContentOf( - "/kg/views/elasticsearch/aggregate.json", + "kg/views/elasticsearch/aggregate.json", "views" -> views.map { case ((project, view)) => Map( "project" -> project, diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ElasticSearchViewsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ElasticSearchViewsSpec.scala index d5f7a1807b..233b3d227b 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ElasticSearchViewsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ElasticSearchViewsSpec.scala @@ -53,7 +53,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { projects.parTraverse { project => deltaClient.put[Json]( s"/resources/$project/resource/test-resource:context", - jsonContentOf("/kg/views/context.json"), + jsonContentOf("kg/views/context.json"), ScoobyDoo ) { (_, response) => response.status shouldEqual StatusCodes.Created @@ -62,7 +62,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { } "create elasticsearch views with legacy fields and its pipeline equivalent" in { - List(fullId -> "/kg/views/elasticsearch/legacy-fields.json", fullId2 -> "/kg/views/elasticsearch/pipeline.json") + List(fullId -> "kg/views/elasticsearch/legacy-fields.json", fullId2 -> "kg/views/elasticsearch/pipeline.json") .parTraverse { case (project, file) => deltaClient .put[Json](s"/views/$project/test-resource:cell-view", jsonContentOf(file, "withTag" -> false), ScoobyDoo) { @@ -73,7 +73,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { } "create elasticsearch views filtering on tag with legacy fields and its pipeline equivalent" in { - List(fullId -> "/kg/views/elasticsearch/legacy-fields.json", fullId2 -> "/kg/views/elasticsearch/pipeline.json") + List(fullId -> "kg/views/elasticsearch/legacy-fields.json", fullId2 -> "kg/views/elasticsearch/pipeline.json") .parTraverse { case (project, file) => deltaClient.put[Json]( s"/views/$project/test-resource:cell-view-tagged", @@ -103,7 +103,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { "create people view in project 2" in { deltaClient.put[Json]( s"/views/$fullId2/test-resource:people", - jsonContentOf("/kg/views/elasticsearch/people-view.json"), + jsonContentOf("kg/views/elasticsearch/people-view.json"), ScoobyDoo ) { (_, response) => response.status shouldEqual StatusCodes.Created @@ -116,7 +116,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/views/$project/test-resource:cell-view", ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK val expected = jsonContentOf( - "/kg/views/elasticsearch/indexing-response.json", + "kg/views/elasticsearch/indexing-response.json", replacements( ScoobyDoo, "id" -> id, @@ -147,7 +147,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val expected = jsonContentOf( - "/kg/views/elasticsearch/aggregate-response.json", + "kg/views/elasticsearch/aggregate-response.json", replacements( ScoobyDoo, "id" -> id, @@ -164,7 +164,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { "post instances" in { (1 to 8).toList.parTraverse { i => - val payload = jsonContentOf(s"/kg/views/instances/instance$i.json") + val payload = jsonContentOf(s"kg/views/instances/instance$i.json") val id = `@id`.getOption(payload).value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") val projectId = if (i > 5) fullId2 else fullId @@ -181,7 +181,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { } "post instance without id" in { - val payload = jsonContentOf(s"/kg/views/instances/instance9.json") + val payload = jsonContentOf(s"kg/views/instances/instance9.json") deltaClient.post[Json]( s"/resources/$fullId2/resource?indexing=sync", payload, @@ -212,7 +212,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { ScoobyDoo ) { (json, response) => response.status shouldEqual StatusCodes.BadRequest - json shouldEqual jsonContentOf("/kg/views/elasticsearch/elastic-error.json") + json shouldEqual jsonContentOf("kg/views/elasticsearch/elastic-error.json") } } @@ -226,7 +226,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val index = hits(0)._index.string.getOption(json).value filterKey("took")(json) shouldEqual - jsonContentOf("/kg/views/elasticsearch/search-response.json", "index" -> index) + jsonContentOf("kg/views/elasticsearch/search-response.json", "index" -> index) deltaClient .post[Json](s"/views/$fullId/test-resource:cell-view/_search", matchAll, ScoobyDoo) { (json2, _) => @@ -250,7 +250,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val index = hits(0)._index.string.getOption(json).value filterKey("took")(json) shouldEqual - jsonContentOf("/kg/views/elasticsearch/search-response-2.json", "index" -> index) + jsonContentOf("kg/views/elasticsearch/search-response-2.json", "index" -> index) deltaClient .post[Json](s"/views/$fullId2/test-resource:cell-view/_search", matchAll, ScoobyDoo) { (json2, _) => @@ -287,7 +287,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { val indexes = hits.each._index.string.getAll(json) val toReplace = indexes.zipWithIndex.map { case (value, i) => s"index${i + 1}" -> value } filterKey("took")(json) shouldEqual - jsonContentOf("/kg/views/elasticsearch/search-response-aggregated.json", toReplace: _*) + jsonContentOf("kg/views/elasticsearch/search-response-aggregated.json", toReplace: _*) } } @@ -297,7 +297,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val index = hits(0)._index.string.getOption(json).value filterKey("took")(json) shouldEqual - jsonContentOf("/kg/views/elasticsearch/search-response-2.json", "index" -> index) + jsonContentOf("kg/views/elasticsearch/search-response-2.json", "index" -> index) } } @@ -305,7 +305,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/views/$fullId/test-resource:cell-view/statistics", ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK val expected = jsonContentOf( - "/kg/views/statistics.json", + "kg/views/statistics.json", "total" -> "5", "processed" -> "5", "evaluated" -> "5", @@ -322,7 +322,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val expected = filterNestedKeys("delayInSeconds")( jsonContentOf( - "/kg/views/statistics.json", + "kg/views/statistics.json", "total" -> "0", "processed" -> "0", "evaluated" -> "0", @@ -336,7 +336,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { "tag resources" in { (1 to 5).toList.parTraverse { i => - val payload = jsonContentOf(s"/kg/views/instances/instance$i.json") + val payload = jsonContentOf(s"kg/views/instances/instance$i.json") val id = `@id`.getOption(payload).value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") deltaClient.post[Json]( @@ -363,7 +363,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { (json, response) => response.status shouldEqual StatusCodes.OK val expected = jsonContentOf( - "/kg/views/statistics.json", + "kg/views/statistics.json", "total" -> "5", "processed" -> "5", "evaluated" -> "5", @@ -375,7 +375,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { } "remove @type on a resource" in { - val payload = filterKey("@type")(jsonContentOf("/kg/views/instances/instance1.json")) + val payload = filterKey("@type")(jsonContentOf("kg/views/instances/instance1.json")) val id = `@id`.getOption(payload).value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") @@ -394,7 +394,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val index = hits(0)._index.string.getOption(json).value filterKey("took")(json) shouldEqual - jsonContentOf("/kg/views/elasticsearch/search-response-no-type.json", "index" -> index) + jsonContentOf("kg/views/elasticsearch/search-response-no-type.json", "index" -> index) deltaClient .post[Json](s"/views/$fullId/test-resource:cell-view/_search", matchAll, ScoobyDoo) { (json2, _) => @@ -405,7 +405,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { } "deprecate a resource" in { - val payload = filterKey("@type")(jsonContentOf("/kg/views/instances/instance2.json")) + val payload = filterKey("@type")(jsonContentOf("kg/views/instances/instance2.json")) val id = payload.asObject.value("@id").value.asString.value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") deltaClient.delete[Json](s"/resources/$fullId/_/patchedcell:$unprefixedId?rev=2", ScoobyDoo) { (_, response) => @@ -419,7 +419,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { result.status shouldEqual StatusCodes.OK val index = hits(0)._index.string.getOption(json).value filterKey("took")(json) shouldEqual - jsonContentOf("/kg/views/elasticsearch/search-response-no-deprecated.json", "index" -> index) + jsonContentOf("kg/views/elasticsearch/search-response-no-deprecated.json", "index" -> index) deltaClient .post[Json](s"/views/$fullId/test-resource:cell-view/_search", matchAll, ScoobyDoo) { (json2, _) => @@ -446,7 +446,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/views/$fullId/test-resource:wrong-view/_mapping", ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.NotFound json shouldEqual jsonContentOf( - "/kg/views/elasticsearch/errors/es-view-not-found.json", + "kg/views/elasticsearch/errors/es-view-not-found.json", replacements( ScoobyDoo, "viewId" -> "https://dev.nexus.test.com/simplified-resource/wrong-view", @@ -461,7 +461,7 @@ class ElasticSearchViewsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/views/$fullId2/$view/_mapping", ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.BadRequest json shouldEqual jsonContentOf( - "/kg/views/elasticsearch/errors/es-incorrect-view-type.json", + "kg/views/elasticsearch/errors/es-incorrect-view-type.json", replacements( ScoobyDoo, "view" -> view, diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/EventsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/EventsSpec.scala index fe23bfa166..05c34f5481 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/EventsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/EventsSpec.scala @@ -169,7 +169,7 @@ class EventsSpec extends BaseIntegrationSpec { ) val json = Json.arr(projectEvents.flatMap(_._2.map(events.filterFields)): _*) json shouldEqual jsonContentOf( - "/kg/events/events.json", + "kg/events/events.json", replacements( BugsBunny, "resources" -> s"${config.deltaUri}/resources/$id", @@ -199,7 +199,7 @@ class EventsSpec extends BaseIntegrationSpec { ) val json = Json.arr(projectEvents.flatMap(_._2.map(events.filterFields)): _*) json shouldEqual jsonContentOf( - "/kg/events/events.json", + "kg/events/events.json", replacements( BugsBunny, "resources" -> s"${config.deltaUri}/resources/$id", @@ -223,7 +223,7 @@ class EventsSpec extends BaseIntegrationSpec { projectEvents.flatMap(_._1) should contain theSameElementsInOrderAs List("ResourceCreated") val json = Json.arr(projectEvents.flatMap(_._2.map(events.filterFields)): _*) json shouldEqual jsonContentOf( - "/kg/events/events2.json", + "kg/events/events2.json", replacements( BugsBunny, "resources" -> s"${config.deltaUri}/resources/$id", @@ -263,7 +263,7 @@ class EventsSpec extends BaseIntegrationSpec { ) val json = Json.arr(projectEvents.flatMap(_._2.map(events.filterFields)): _*) json shouldEqual jsonContentOf( - "/kg/events/events-multi-project.json", + "kg/events/events-multi-project.json", replacements( BugsBunny, "resources" -> s"${config.deltaUri}/resources/$id", diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/GraphAnalyticsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/GraphAnalyticsSpec.scala index 682718c22d..1be0f5792c 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/GraphAnalyticsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/GraphAnalyticsSpec.scala @@ -39,35 +39,35 @@ final class GraphAnalyticsSpec extends BaseIntegrationSpec { deltaClient.post[Json](s"/resources/$ref/", jsonContentOf(resourcePath), Bojack)(expectCreated) for { - _ <- postResource("/kg/graph-analytics/context-test.json") - _ <- postResource("/kg/graph-analytics/person1.json") - _ <- postResource("/kg/graph-analytics/person2.json") - _ <- postResource("/kg/graph-analytics/person3.json") - _ <- postResource("/kg/graph-analytics/organization.json") + _ <- postResource("kg/graph-analytics/context-test.json") + _ <- postResource("kg/graph-analytics/person1.json") + _ <- postResource("kg/graph-analytics/person2.json") + _ <- postResource("kg/graph-analytics/person3.json") + _ <- postResource("kg/graph-analytics/organization.json") } yield succeed } "fetch relationships" in eventually { deltaClient.get[Json](s"/graph-analytics/$ref/relationships", Bojack) { (json, _) => - json shouldEqual jsonContentOf("/kg/graph-analytics/relationships.json") + json shouldEqual jsonContentOf("kg/graph-analytics/relationships.json") } } "fetch properties" in eventually { deltaClient.get[Json](s"/graph-analytics/$ref/properties/http%3A%2F%2Fschema.org%2FPerson", Bojack) { (json, _) => - json shouldEqual jsonContentOf("/kg/graph-analytics/properties-person.json") + json shouldEqual jsonContentOf("kg/graph-analytics/properties-person.json") } } "update resources" in { for { - _ <- deltaClient.post[Json](s"/resources/$ref/", jsonContentOf("/kg/graph-analytics/person4.json"), Bojack)( + _ <- deltaClient.post[Json](s"/resources/$ref/", jsonContentOf("kg/graph-analytics/person4.json"), Bojack)( expectCreated ) _ <- deltaClient.put[Json]( s"/resources/$ref/_/http%3A%2F%2Fexample.com%2Fepfl?rev=1", - jsonContentOf("/kg/graph-analytics/organization-updated.json"), + jsonContentOf("kg/graph-analytics/organization-updated.json"), Bojack )( expectOk @@ -76,12 +76,12 @@ final class GraphAnalyticsSpec extends BaseIntegrationSpec { } "fetch updated relationships" in eventually { deltaClient.get[Json](s"/graph-analytics/$ref/relationships", Bojack) { (json, _) => - json shouldEqual jsonContentOf("/kg/graph-analytics/relationships-updated.json") + json shouldEqual jsonContentOf("kg/graph-analytics/relationships-updated.json") } } "fetch updated properties" in eventually { deltaClient.get[Json](s"/graph-analytics/$ref/properties/http%3A%2F%2Fschema.org%2FPerson", Bojack) { (json, _) => - json shouldEqual jsonContentOf("/kg/graph-analytics/properties-person-updated.json") + json shouldEqual jsonContentOf("kg/graph-analytics/properties-person-updated.json") } } @@ -90,7 +90,7 @@ final class GraphAnalyticsSpec extends BaseIntegrationSpec { } "query for person1" in eventually { - val expected = jsonContentOf("/kg/graph-analytics/es-hit-source-person1.json", "projectRef" -> ref) + val expected = jsonContentOf("kg/graph-analytics/es-hit-source-person1.json", "projectRef" -> ref) // We ignore fields that are time or project dependent. // "relationships" are ignored as its "found" field can sometimes be diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/KgDsl.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/KgDsl.scala index ccd6444e7b..0a54e99218 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/KgDsl.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/KgDsl.scala @@ -8,17 +8,17 @@ import io.circe.Json class KgDsl(config: TestsConfig) { - def projectJson(path: String = "/kg/projects/project.json", name: String): IO[Json] = + def projectJson(path: String = "kg/projects/project.json", name: String): IO[Json] = KgDsl.projectJson(path, name, config) - def projectJsonWithCustomBase(path: String = "/kg/projects/project.json", name: String, base: String): IO[Json] = { + def projectJsonWithCustomBase(path: String = "kg/projects/project.json", name: String, base: String): IO[Json] = { loader.jsonContentOf(path, "name" -> name, "base" -> base) } } object KgDsl { private val loader = ClasspathResourceLoader() - def projectJson(path: String = "/kg/projects/project.json", name: String, config: TestsConfig): IO[Json] = { + def projectJson(path: String = "kg/projects/project.json", name: String, config: TestsConfig): IO[Json] = { val base = s"${config.deltaUri.toString()}/resources/$name/_/" loader.jsonContentOf(path, "name" -> name, "base" -> base) } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ListingsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ListingsSpec.scala index 0f1cdb5dd8..8182e8523b 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ListingsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ListingsSpec.scala @@ -93,7 +93,7 @@ final class ListingsSpec extends BaseIntegrationSpec { "self" -> resolverSelf(ref11, defaultResolverId) ) - val expected = jsonContentOf("/kg/listings/default-resolver.json", mapping: _*) + val expected = jsonContentOf("kg/listings/default-resolver.json", mapping: _*) eventually { deltaClient.get[Json](s"/resolvers/$ref11", Bob) { (json, response) => @@ -120,7 +120,7 @@ final class ListingsSpec extends BaseIntegrationSpec { "searchViewSelf" -> viewSelf(ref11, searchView) ) - val expected = jsonContentOf("/kg/listings/default-view.json", mapping: _*) + val expected = jsonContentOf("kg/listings/default-view.json", mapping: _*) eventually { deltaClient.get[Json](s"/views/$ref11", Bob) { (json, response) => response.status shouldEqual StatusCodes.OK @@ -140,7 +140,7 @@ final class ListingsSpec extends BaseIntegrationSpec { "self" -> storageSelf(ref11, defaultStorageId) ) - val expected = jsonContentOf("/kg/listings/default-storage.json", mapping: _*) + val expected = jsonContentOf("kg/listings/default-storage.json", mapping: _*) eventually { deltaClient.get[Json](s"/storages/$ref11", Bob) { (json, response) => @@ -153,7 +153,7 @@ final class ListingsSpec extends BaseIntegrationSpec { val resource11WithSchemaId = s"${config.deltaUri}/resources/$proj11/_/resource11_with_schema" val resource11WithSchemaSelf = resourceSelf(ref11, resource11WithSchemaId) val resource11WithSchemaResult = jsonContentOf( - "/kg/listings/project/resource11-schema.json", + "kg/listings/project/resource11-schema.json", replacements( Bob, "org" -> org1, @@ -234,7 +234,7 @@ final class ListingsSpec extends BaseIntegrationSpec { val projectType = URLEncoder.encode("https://bluebrain.github.io/nexus/vocabulary/Project", "UTF-8") "get resources from both projects in the org for user with appropriate acls" in { val expected = jsonContentOf( - "/kg/listings/org/filter-project-2.json", + "kg/listings/org/filter-project-2.json", replacements( Bob, "org" -> org1, @@ -254,7 +254,7 @@ final class ListingsSpec extends BaseIntegrationSpec { "get resources from only one project in the org for user with restricted acls" in { val expected = jsonContentOf( - "/kg/listings/org/filter-project-1.json", + "kg/listings/org/filter-project-1.json", replacements( Bob, "org" -> org1, @@ -275,7 +275,7 @@ final class ListingsSpec extends BaseIntegrationSpec { val resource13Id = s"${config.deltaUri}/resources/$proj13/_/resource13" val resource13Self = resourceSelf(ref13, resource13Id) val expected = jsonContentOf( - "/kg/listings/project/resources-tagged.json", + "kg/listings/project/resources-tagged.json", replacements( Bob, "org" -> org1, @@ -309,7 +309,7 @@ final class ListingsSpec extends BaseIntegrationSpec { "get resources from all projects for user with appropriate acls" in { val expected = jsonContentOf( - "/kg/listings/all/resource-by-type-4.json", + "kg/listings/all/resource-by-type-4.json", replacements( Bob, "org1" -> org1, @@ -332,7 +332,7 @@ final class ListingsSpec extends BaseIntegrationSpec { "get resources from only one project for user with restricted acls" in { val expected = jsonContentOf( - "/kg/listings/all/resource-by-type-1.json", + "kg/listings/all/resource-by-type-1.json", replacements( Bob, "org" -> org1, @@ -363,7 +363,7 @@ final class ListingsSpec extends BaseIntegrationSpec { eventually { deltaClient.get[Json](s"$endpoint?from=10&after=%5B%22test%22%5D", Bob) { (json, response) => response.status shouldEqual StatusCodes.BadRequest - json shouldEqual jsonContentOf("/kg/listings/from-and-after-error.json") + json shouldEqual jsonContentOf("kg/listings/from-and-after-error.json") } } } @@ -374,7 +374,7 @@ final class ListingsSpec extends BaseIntegrationSpec { eventually { deltaClient.get[Json](s"$endpoint?from=10001", Bob) { (json, response) => response.status shouldEqual StatusCodes.BadRequest - json shouldEqual jsonContentOf("/kg/listings/from-over-limit-error.json") + json shouldEqual jsonContentOf("kg/listings/from-over-limit-error.json") } } } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/MultiFetchSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/MultiFetchSpec.scala index eb7eef56f1..1f1449b210 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/MultiFetchSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/MultiFetchSpec.scala @@ -65,7 +65,7 @@ class MultiFetchSpec extends BaseIntegrationSpec { "get all resources for a user with all access" in { val expected = jsonContentOf( - "/kg/multi-fetch/all-success.json", + "kg/multi-fetch/all-success.json", "project1" -> ref11, "project2" -> ref12 ) @@ -78,7 +78,7 @@ class MultiFetchSpec extends BaseIntegrationSpec { "get all resources for a user with limited access" in { val expected = jsonContentOf( - "/kg/multi-fetch/limited-access.json", + "kg/multi-fetch/limited-access.json", "project1" -> ref11, "project2" -> ref12 ) @@ -99,7 +99,7 @@ class MultiFetchSpec extends BaseIntegrationSpec { ] }""" - val expected = jsonContentOf("/kg/multi-fetch/unknown.json", "project1" -> ref11) + val expected = jsonContentOf("kg/multi-fetch/unknown.json", "project1" -> ref11) multiFetchRequest(request, Bob) { (json, response) => response.status shouldEqual StatusCodes.OK diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ProjectsDeletionSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ProjectsDeletionSpec.scala index d5ee04dfe1..2592a2fd2e 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ProjectsDeletionSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ProjectsDeletionSpec.scala @@ -98,11 +98,11 @@ final class ProjectsDeletionSpec extends BaseIntegrationSpec { val schemaPayload = SchemaPayload.loadSimple().accepted val resolverPayload = jsonContentOf( - "/kg/resources/cross-project-resolver.json", + "kg/resources/cross-project-resolver.json", replacements(Bojack, "project" -> ref2): _* ) val aggregateSparqlPayload = - jsonContentOf("/kg/views/agg-sparql-view.json", "project1" -> ref1, "project2" -> ref2) + jsonContentOf("kg/views/agg-sparql-view.json", "project1" -> ref1, "project2" -> ref2) for { _ <- deltaClient.put[Json](s"/resources/$ref1/_/resource11", resourcePayload, Bojack)(expectCreated) diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/RemoteStorageSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/RemoteStorageSpec.scala index 03e84f2ad6..52abb4c436 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/RemoteStorageSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/RemoteStorageSpec.scala @@ -46,7 +46,7 @@ class RemoteStorageSpec extends StorageSpec { private def storageResponse(project: String, id: String, readPermission: String, writePermission: String) = jsonContentOf( - "/kg/storages/remote-disk-response.json", + "kg/storages/remote-disk-response.json", replacements( Coyote, "endpoint" -> externalEndpoint, @@ -62,7 +62,7 @@ class RemoteStorageSpec extends StorageSpec { override def createStorages: IO[Assertion] = { val payload = jsonContentOf( - "/kg/storages/remote-disk.json", + "kg/storages/remote-disk.json", "endpoint" -> externalEndpoint, "read" -> "resources/read", "write" -> "files/write", @@ -71,7 +71,7 @@ class RemoteStorageSpec extends StorageSpec { ) val payload2 = jsonContentOf( - "/kg/storages/remote-disk.json", + "kg/storages/remote-disk.json", "endpoint" -> externalEndpoint, "read" -> s"$storageName/read", "write" -> s"$storageName/write", @@ -93,7 +93,7 @@ class RemoteStorageSpec extends StorageSpec { _ <- deltaClient.get[Json](s"/storages/$projectRef/nxv:$storageId/source", Coyote) { (json, response) => response.status shouldEqual StatusCodes.OK val expected = jsonContentOf( - "/kg/storages/storage-source.json", + "kg/storages/storage-source.json", "folder" -> remoteFolder, "storageBase" -> externalEndpoint ) @@ -139,7 +139,7 @@ class RemoteStorageSpec extends StorageSpec { "succeed many large files are in the archive, going over the time limit" ignore { val content = randomString(130000000) - val payload = jsonContentOf("/kg/archives/archive-many-large-files.json") + val payload = jsonContentOf("kg/archives/archive-many-large-files.json") var before = 0L for { _ <- putFile("largefile1.txt", content, s"${storageId}2") @@ -177,7 +177,7 @@ class RemoteStorageSpec extends StorageSpec { "Creating a remote storage" should { "fail creating a RemoteDiskStorage without folder" in { val payload = jsonContentOf( - "/kg/storages/remote-disk.json", + "kg/storages/remote-disk.json", "endpoint" -> externalEndpoint, "read" -> "resources/read", "write" -> "files/write", @@ -205,7 +205,7 @@ class RemoteStorageSpec extends StorageSpec { def linkFile(payload: Json)(fileId: String, filename: String, mediaType: Option[String]) = { val expected = jsonContentOf( - "/kg/files/remote-linked.json", + "kg/files/remote-linked.json", replacements( Coyote, "id" -> fileId, @@ -227,7 +227,7 @@ class RemoteStorageSpec extends StorageSpec { def fetchUpdatedLinkedFile(fileId: String, filename: String, mediaType: String) = { val expected = jsonContentOf( - "/kg/files/remote-updated-linked.json", + "kg/files/remote-updated-linked.json", replacements( Coyote, "id" -> fileId, diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ResourcesSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ResourcesSpec.scala index 4c70c46e62..8a8fba3393 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ResourcesSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/ResourcesSpec.scala @@ -87,7 +87,7 @@ class ResourcesSpec extends BaseIntegrationSpec { } "creating a schema with property shape" in { - val schemaPayload = jsonContentOf("/kg/schemas/simple-schema-prop-shape.json") + val schemaPayload = jsonContentOf("kg/schemas/simple-schema-prop-shape.json") deltaClient.post[Json](s"/schemas/$project1", schemaPayload, Rick) { (_, response) => response.status shouldEqual StatusCodes.Created @@ -95,7 +95,7 @@ class ResourcesSpec extends BaseIntegrationSpec { } "creating a schema that imports the property shape schema" in { - val schemaPayload = jsonContentOf("/kg/schemas/simple-schema-imports.json") + val schemaPayload = jsonContentOf("kg/schemas/simple-schema-imports.json") eventually { deltaClient.post[Json](s"/schemas/$project1", schemaPayload, Rick) { (_, response) => @@ -111,7 +111,7 @@ class ResourcesSpec extends BaseIntegrationSpec { deltaClient.put[Json](s"/resources/$project1/_/test-schema", Json.obj(), Rick) { (json, response) => response.status shouldEqual StatusCodes.Conflict json shouldEqual jsonContentOf( - "/kg/resources/resource-already-exists-rejection.json", + "kg/resources/resource-already-exists-rejection.json", "id" -> "https://dev.nexus.test.com/test-schema", "project" -> project1 ) @@ -265,7 +265,7 @@ class ResourcesSpec extends BaseIntegrationSpec { "cross-project resolvers" should { val resolverPayload = jsonContentOf( - "/kg/resources/cross-project-resolver.json", + "kg/resources/cross-project-resolver.json", replacements(Rick, "project" -> project1): _* ) @@ -292,7 +292,7 @@ class ResourcesSpec extends BaseIntegrationSpec { "fetch the update" in { val expected = jsonContentOf( - "/kg/resources/cross-project-resolver-updated-resp.json", + "kg/resources/cross-project-resolver-updated-resp.json", replacements( Rick, "project" -> project1, @@ -601,7 +601,7 @@ class ResourcesSpec extends BaseIntegrationSpec { } "create context" in { - val payload = jsonContentOf("/kg/resources/simple-context.json") + val payload = jsonContentOf("kg/resources/simple-context.json") deltaClient.put[Json](s"/resources/$project1/_/test-resource:mycontext", payload, Rick) { (_, response) => response.status shouldEqual StatusCodes.Created @@ -609,7 +609,7 @@ class ResourcesSpec extends BaseIntegrationSpec { } "create resource using the created context" in { - val payload = jsonContentOf("/kg/resources/simple-resource-context.json") + val payload = jsonContentOf("kg/resources/simple-resource-context.json") deltaClient.post[Json](s"/resources/$project1/", payload, Rick) { (_, response) => response.status shouldEqual StatusCodes.Created @@ -675,7 +675,7 @@ class ResourcesSpec extends BaseIntegrationSpec { "create resource using the created project" in { val payload = - jsonContentOf("/kg/resources/simple-resource-with-type.json", "id" -> FullResourceId, "type" -> ResourceType) + jsonContentOf("kg/resources/simple-resource-with-type.json", "id" -> FullResourceId, "type" -> ResourceType) deltaClient.post[Json](s"/resources/$project3/", payload, Rick) { (_, response) => response.status shouldEqual StatusCodes.Created diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/S3StorageSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/S3StorageSpec.scala index cd864ea7f6..51af5b062c 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/S3StorageSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/S3StorageSpec.scala @@ -68,7 +68,7 @@ class S3StorageSpec extends StorageSpec { private def storageResponse(project: String, id: String, readPermission: String, writePermission: String) = jsonContentOf( - "/kg/storages/s3-response.json", + "kg/storages/s3-response.json", replacements( Coyote, "id" -> id, @@ -84,14 +84,14 @@ class S3StorageSpec extends StorageSpec { override def createStorages: IO[Assertion] = { val payload = jsonContentOf( - "/kg/storages/s3.json", + "kg/storages/s3.json", "storageId" -> s"https://bluebrain.github.io/nexus/vocabulary/$storageId", "bucket" -> bucket, "endpoint" -> s3Endpoint ) val payload2 = jsonContentOf( - "/kg/storages/s3.json", + "kg/storages/s3.json", "storageId" -> s"https://bluebrain.github.io/nexus/vocabulary/${storageId}2", "bucket" -> bucket, "endpoint" -> s3Endpoint @@ -127,14 +127,14 @@ class S3StorageSpec extends StorageSpec { "creating a s3 storage" should { "fail creating an S3Storage with an invalid bucket" in { val payload = jsonContentOf( - "/kg/storages/s3.json", + "kg/storages/s3.json", "storageId" -> s"https://bluebrain.github.io/nexus/vocabulary/missing", "bucket" -> "foobar", "endpoint" -> s3Endpoint ) deltaClient.post[Json](s"/storages/$projectRef", payload, Coyote) { (json, response) => - json shouldEqual jsonContentOf("/kg/storages/s3-error.json") + json shouldEqual jsonContentOf("kg/storages/s3-error.json") response.status shouldEqual StatusCodes.BadRequest } } @@ -153,7 +153,7 @@ class S3StorageSpec extends StorageSpec { response.status shouldEqual StatusCodes.Created filterMetadataKeys(json) shouldEqual jsonContentOf( - "/kg/files/linking-metadata.json", + "kg/files/linking-metadata.json", replacements( Coyote, "projId" -> projectRef, @@ -178,7 +178,7 @@ class S3StorageSpec extends StorageSpec { (json, response) => response.status shouldEqual StatusCodes.BadRequest json shouldEqual jsonContentOf( - "/kg/files/linking-notfound.json", + "kg/files/linking-notfound.json", "org" -> orgId, "proj" -> projId, "endpointBucket" -> s3BucketEndpoint diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SchemasSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SchemasSpec.scala index c12ef9b903..594f85db8c 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SchemasSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SchemasSpec.scala @@ -77,7 +77,7 @@ class SchemasSpec extends BaseIntegrationSpec { def resourceWithPowerLevel(id: String, powerLevel: Int) = jsonContentOf( - "/kg/resources/resource-with-power-level.json", + "kg/resources/resource-with-power-level.json", "id" -> id, "powerLevel" -> powerLevel ) @@ -124,19 +124,19 @@ class SchemasSpec extends BaseIntegrationSpec { _ <- deltaClient .post[Json]( s"/schemas/$project", - jsonContentOf("/kg/schemas/bicycle-schema.json", "id" -> schemaId, "maxNumberOfGears" -> 13), + jsonContentOf("kg/schemas/bicycle-schema.json", "id" -> schemaId, "maxNumberOfGears" -> 13), Rick ) { expectCreated } _ <- deltaClient .post[Json]( s"/resources/$project/${UrlUtils.encode(schemaId)}", - jsonContentOf("/kg/resources/bicycle.json", "id" -> genId(), "gears" -> 13), + jsonContentOf("kg/resources/bicycle.json", "id" -> genId(), "gears" -> 13), Rick ) { expectCreated } _ <- deltaClient .post[Json]( s"/resources/$project/${UrlUtils.encode(schemaId)}", - jsonContentOf("/kg/resources/bicycle.json", "id" -> genId(), "gears" -> 14), + jsonContentOf("kg/resources/bicycle.json", "id" -> genId(), "gears" -> 14), Rick ) { expectBadRequest } } yield succeed @@ -151,19 +151,19 @@ class SchemasSpec extends BaseIntegrationSpec { _ <- deltaClient .post[Json]( s"/schemas/$project", - jsonContentOf("/kg/schemas/bicycle-schema.json", "id" -> schemaId13Gears, "maxNumberOfGears" -> 13), + jsonContentOf("kg/schemas/bicycle-schema.json", "id" -> schemaId13Gears, "maxNumberOfGears" -> 13), Rick ) { expectCreated } _ <- deltaClient .post[Json]( s"/schemas/$project", - jsonContentOf("/kg/schemas/bicycle-schema.json", "id" -> schemaId12Gears, "maxNumberOfGears" -> 12), + jsonContentOf("kg/schemas/bicycle-schema.json", "id" -> schemaId12Gears, "maxNumberOfGears" -> 12), Rick ) { expectCreated } _ <- deltaClient .post[Json]( s"/resources/$project/$schemaId13Gears", - jsonContentOf("/kg/resources/bicycle.json", "id" -> resourceId, "gears" -> 13), + jsonContentOf("kg/resources/bicycle.json", "id" -> resourceId, "gears" -> 13), Rick ) { expectCreated } _ <- deltaClient.get[Json](s"/resources/$project/$schemaId13Gears/$resourceId/validate", Rick) { diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchAccessSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchAccessSpec.scala index 760ccccf00..906a64a2b3 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchAccessSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchAccessSpec.scala @@ -26,16 +26,16 @@ class SearchAccessSpec extends BaseIntegrationSpec { _ <- aclDsl.addPermission("/", Rick, Organizations.Create) _ <- adminDsl.createOrganization(orgId, orgId, Rick) - _ <- adminDsl.createProjectWith(orgId, projId1, path = "/kg/projects/bbp.json", name = id1, authenticated = Rick) - _ <- adminDsl.createProjectWith(orgId, projId2, path = "/kg/projects/bbp.json", name = id2, authenticated = Rick) + _ <- adminDsl.createProjectWith(orgId, projId1, path = "kg/projects/bbp.json", name = id1, authenticated = Rick) + _ <- adminDsl.createProjectWith(orgId, projId2, path = "kg/projects/bbp.json", name = id2, authenticated = Rick) _ <- aclDsl.addPermission(s"/$orgId", Rick, Resources.Read) _ <- aclDsl.addPermission(s"/$orgId/$projId1", Rick, Resources.Read) _ <- aclDsl.addPermission(s"/$orgId/$projId2", Rick, Resources.Read) - _ <- postResource("/kg/search/neuroshapes.json") - _ <- postResource("/kg/search/bbp-neuroshapes.json") - _ <- postResource("/kg/search/trace.json") + _ <- postResource("kg/search/neuroshapes.json") + _ <- postResource("kg/search/bbp-neuroshapes.json") + _ <- postResource("kg/search/trace.json") } yield () setup.accepted @@ -70,7 +70,7 @@ class SearchAccessSpec extends BaseIntegrationSpec { "return config" in { deltaClient.get[Json]("/search/config", Rick) { (body, response) => response.status shouldEqual StatusCodes.OK - body shouldEqual jsonContentOf("/kg/search/config.json") + body shouldEqual jsonContentOf("kg/search/config.json") } } } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchConfigIndexingSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchConfigIndexingSpec.scala index 911bd4d36f..655f80992b 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchConfigIndexingSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SearchConfigIndexingSpec.scala @@ -38,30 +38,30 @@ class SearchConfigIndexingSpec extends BaseIntegrationSpec { // the resources that should appear in the search index private val mainResources = List( - "/kg/search/patched-cell.json", - "/kg/search/trace.json", - "/kg/search/curated-trace.json", - "/kg/search/unassessed-trace.json", - "/kg/search/neuron-morphology.json", - "/kg/search/neuron-density.json", - "/kg/search/synapse.json", - "/kg/search/synapse-two-pathways.json", - "/kg/search/layer-thickness.json", - "/kg/search/bouton-density.json", - "/kg/search/detailed-circuit.json", - "/kg/search/data/simulations/simulation-campaign-configuration.json", - "/kg/search/data/simulations/simulation-campaign-execution.json", - "/kg/search/data/simulations/simulation-campaign.json", - "/kg/search/data/simulations/simulation.json", - "/kg/search/data/simulations/analysis-report-simulation.json" + "kg/search/patched-cell.json", + "kg/search/trace.json", + "kg/search/curated-trace.json", + "kg/search/unassessed-trace.json", + "kg/search/neuron-morphology.json", + "kg/search/neuron-density.json", + "kg/search/synapse.json", + "kg/search/synapse-two-pathways.json", + "kg/search/layer-thickness.json", + "kg/search/bouton-density.json", + "kg/search/detailed-circuit.json", + "kg/search/data/simulations/simulation-campaign-configuration.json", + "kg/search/data/simulations/simulation-campaign-execution.json", + "kg/search/data/simulations/simulation-campaign.json", + "kg/search/data/simulations/simulation.json", + "kg/search/data/simulations/analysis-report-simulation.json" ) private val otherResources = List( - "/kg/search/article.json", - "/kg/search/org.json", - "/kg/search/license.json", - "/kg/search/activity.json", - "/kg/search/protocol.json", - "/kg/search/person.json" + "kg/search/article.json", + "kg/search/org.json", + "kg/search/license.json", + "kg/search/activity.json", + "kg/search/protocol.json", + "kg/search/person.json" ) private val allResources = otherResources ++ mainResources @@ -72,13 +72,13 @@ class SearchConfigIndexingSpec extends BaseIntegrationSpec { _ <- aclDsl.cleanAcls(Rick) _ <- aclDsl.addPermission("/", Rick, Organizations.Create) _ <- adminDsl.createOrganization(orgId, orgId, Rick) - _ <- adminDsl.createProjectWith(orgId, projId1, path = "/kg/projects/bbp.json", name = id1, authenticated = Rick) + _ <- adminDsl.createProjectWith(orgId, projId1, path = "kg/projects/bbp.json", name = id1, authenticated = Rick) _ <- aclDsl.addPermission(s"/$orgId", Rick, Resources.Read) _ <- aclDsl.addPermission(s"/$orgId/$projId1", Rick, Resources.Read) - _ <- postResource("/kg/search/neuroshapes.json") - _ <- postResource("/kg/search/bbp-neuroshapes.json") + _ <- postResource("kg/search/neuroshapes.json") + _ <- postResource("kg/search/bbp-neuroshapes.json") _ <- allResources.traverseTap(postResource) } yield () @@ -846,10 +846,10 @@ class SearchConfigIndexingSpec extends BaseIntegrationSpec { * the requested field */ private def queryField(id: String, field: String) = - jsonContentOf("/kg/search/id-query-single-field.json", "id" -> id, "field" -> field) + jsonContentOf("kg/search/id-query-single-field.json", "id" -> id, "field" -> field) private def queryDocument(id: String) = - jsonContentOf("/kg/search/id-query.json", "id" -> id) + jsonContentOf("kg/search/id-query.json", "id" -> id) /** Post a resource across all defined projects in the suite */ private def postResource(resourcePath: String): IO[List[Assertion]] = { diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SparqlViewsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SparqlViewsSpec.scala index 2a87914e3a..616dca42f0 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SparqlViewsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SparqlViewsSpec.scala @@ -49,7 +49,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { "creating the view" should { "create a context" in { - val payload = jsonContentOf("/kg/views/context.json") + val payload = jsonContentOf("kg/views/context.json") projects.parTraverse { project => deltaClient.put[Json](s"/resources/$project/resource/test-resource:context", payload, ScoobyDoo) { @@ -60,7 +60,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { } "create an Sparql view that index tags" in { - val payload = jsonContentOf("/kg/views/sparql-view.json") + val payload = jsonContentOf("kg/views/sparql-view.json") deltaClient.put[Json](s"/views/$fullId/test-resource:cell-view", payload, ScoobyDoo) { (_, response) => response.status shouldEqual StatusCodes.Created } @@ -71,7 +71,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val viewId = "https://dev.nexus.test.com/simplified-resource/cell-view" val expected = jsonContentOf( - "/kg/views/sparql-view-response.json", + "kg/views/sparql-view-response.json", replacements( ScoobyDoo, "id" -> "https://dev.nexus.test.com/simplified-resource/cell-view", @@ -85,7 +85,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { } "create an AggregateSparqlView" in { - val payload = jsonContentOf("/kg/views/agg-sparql-view.json", "project1" -> fullId, "project2" -> fullId2) + val payload = jsonContentOf("kg/views/agg-sparql-view.json", "project1" -> fullId, "project2" -> fullId2) deltaClient.put[Json](s"/views/$fullId2/test-resource:agg-cell-view", payload, ScoobyDoo) { (_, response) => response.status shouldEqual StatusCodes.Created @@ -97,7 +97,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { response.status shouldEqual StatusCodes.OK val viewId = "https://dev.nexus.test.com/simplified-resource/agg-cell-view" val expected = jsonContentOf( - "/kg/views/agg-sparql-view-response.json", + "kg/views/agg-sparql-view-response.json", replacements( ScoobyDoo, "id" -> viewId, @@ -114,7 +114,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { "post instances" in { (1 to 8).toList.parTraverse { i => - val payload = jsonContentOf(s"/kg/views/instances/instance$i.json") + val payload = jsonContentOf(s"kg/views/instances/instance$i.json") val id = `@id`.getOption(payload).value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") val projectId = if (i > 5) fullId2 else fullId @@ -158,7 +158,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.sparqlQuery[Json](s"/views/$fullId/nxv:defaultSparqlIndex/sparql", query, ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK - json shouldEqual jsonContentOf("/kg/views/sparql-search-response.json") + json shouldEqual jsonContentOf("kg/views/sparql-search-response.json") } } @@ -166,7 +166,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.sparqlQuery[Json](s"/views/$fullId2/nxv:defaultSparqlIndex/sparql", query, ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK - json shouldEqual jsonContentOf("/kg/views/sparql-search-response-2.json") + json shouldEqual jsonContentOf("kg/views/sparql-search-response-2.json") } } @@ -174,7 +174,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.sparqlQuery[Json](s"/views/$fullId2/test-resource:agg-cell-view/sparql", query, ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK - json should equalIgnoreArrayOrder(jsonContentOf("/kg/views/sparql-search-response-aggregated.json")) + json should equalIgnoreArrayOrder(jsonContentOf("kg/views/sparql-search-response-aggregated.json")) } } @@ -182,7 +182,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.sparqlQuery[Json](s"/views/$fullId2/test-resource:agg-cell-view/sparql", query, Anonymous) { (json, response) => response.status shouldEqual StatusCodes.OK - json should equalIgnoreArrayOrder(jsonContentOf("/kg/views/sparql-search-response-2.json")) + json should equalIgnoreArrayOrder(jsonContentOf("kg/views/sparql-search-response-2.json")) } } @@ -192,7 +192,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { val expected = filterNestedKeys("delayInSeconds")( jsonContentOf( - "/kg/views/statistics.json", + "kg/views/statistics.json", "total" -> "0", "processed" -> "0", "evaluated" -> "0", @@ -209,7 +209,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/views/$fullId/nxv:defaultSparqlIndex/statistics", ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK val expected = jsonContentOf( - "/kg/views/statistics.json", + "kg/views/statistics.json", "total" -> "13", "processed" -> "13", "evaluated" -> "13", @@ -224,13 +224,13 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.sparqlQuery[Json](s"/views/$fullId/test-resource:cell-view/sparql", query, ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK - json shouldEqual jsonContentOf("/kg/views/sparql-search-response-empty.json") + json shouldEqual jsonContentOf("kg/views/sparql-search-response-empty.json") } } "tag resources" in { (1 to 5).toList.parTraverse { i => - val payload = jsonContentOf(s"/kg/views/instances/instance$i.json") + val payload = jsonContentOf(s"kg/views/instances/instance$i.json") val id = `@id`.getOption(payload).value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") deltaClient.post[Json]( @@ -247,7 +247,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/views/$fullId/test-resource:cell-view/statistics", ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK val expected = jsonContentOf( - "/kg/views/statistics.json", + "kg/views/statistics.json", "total" -> "5", "processed" -> "5", "evaluated" -> "5", @@ -272,7 +272,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.sparqlQuery[Json](s"/views/$fullId/nxv:defaultSparqlIndex/sparql", byTagQuery, ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK - json shouldEqual jsonContentOf("/kg/views/sparql-search-response-tagged.json") + json shouldEqual jsonContentOf("kg/views/sparql-search-response-tagged.json") } } @@ -281,14 +281,14 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.sparqlQuery[Json](s"/views/$fullId/test-resource:cell-view/sparql", query, ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK - json shouldEqual jsonContentOf("/kg/views/sparql-search-response.json") + json shouldEqual jsonContentOf("kg/views/sparql-search-response.json") } } } "delete tags" in { (1 to 5).toList.parTraverse { i => - val payload = jsonContentOf(s"/kg/views/instances/instance$i.json") + val payload = jsonContentOf(s"kg/views/instances/instance$i.json") val id = `@id`.getOption(payload).value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") deltaClient.delete[Json]( @@ -304,12 +304,12 @@ class SparqlViewsSpec extends BaseIntegrationSpec { deltaClient.sparqlQuery[Json](s"/views/$fullId/test-resource:cell-view/sparql", query, ScoobyDoo) { (json, response) => response.status shouldEqual StatusCodes.OK - json shouldEqual jsonContentOf("/kg/views/sparql-search-response-empty.json") + json shouldEqual jsonContentOf("kg/views/sparql-search-response-empty.json") } } "remove @type on a resource" in { - val payload = filterKey("@type")(jsonContentOf("/kg/views/instances/instance1.json")) + val payload = filterKey("@type")(jsonContentOf("kg/views/instances/instance1.json")) val id = `@id`.getOption(payload).value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") @@ -323,7 +323,7 @@ class SparqlViewsSpec extends BaseIntegrationSpec { } "deprecate a resource" in { - val payload = filterKey("@type")(jsonContentOf("/kg/views/instances/instance2.json")) + val payload = filterKey("@type")(jsonContentOf("kg/views/instances/instance2.json")) val id = payload.asObject.value("@id").value.asString.value val unprefixedId = id.stripPrefix("https://bbp.epfl.ch/nexus/v0/data/bbp/experiment/patchedcell/v0.1.0/") deltaClient.delete[Json](s"/resources/$fullId/_/patchedcell:$unprefixedId?rev=3", ScoobyDoo) { (_, response) => @@ -332,14 +332,14 @@ class SparqlViewsSpec extends BaseIntegrationSpec { } "create a another SPARQL view" in { - val payload = jsonContentOf("/kg/views/sparql-view.json") + val payload = jsonContentOf("kg/views/sparql-view.json") deltaClient.put[Json](s"/views/$fullId/test-resource:cell-view2", payload, ScoobyDoo) { (_, response) => response.status shouldEqual StatusCodes.Created } } "update a new SPARQL view with indexing=sync" in { - val payload = jsonContentOf("/kg/views/sparql-view.json").mapObject( + val payload = jsonContentOf("kg/views/sparql-view.json").mapObject( _.remove("resourceTag").remove("resourceTypes").remove("resourceSchemas") ) deltaClient.put[Json](s"/views/$fullId/test-resource:cell-view2?rev=1&indexing=sync", payload, ScoobyDoo) { diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/StorageSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/StorageSpec.scala index 023a1e1fa3..630e4260db 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/StorageSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/StorageSpec.scala @@ -159,7 +159,7 @@ abstract class StorageSpec extends BaseIntegrationSpec { "have the expected metadata" in { val id = s"${attachmentPrefix}attachment.json" val expected = jsonContentOf( - "/kg/files/attachment-metadata.json", + "kg/files/attachment-metadata.json", replacements( Coyote, "id" -> id, @@ -260,7 +260,7 @@ abstract class StorageSpec extends BaseIntegrationSpec { deltaClient.get[Json](s"/storages/$projectRef/nxv:fail/statistics", Coyote) { (json, response) => response.status shouldEqual StatusCodes.NotFound json shouldEqual jsonContentOf( - "/kg/storages/not-found.json", + "kg/storages/not-found.json", "storageId" -> (nxv + "fail"), "projId" -> s"$projectRef" ) @@ -278,7 +278,7 @@ abstract class StorageSpec extends BaseIntegrationSpec { "storageId" -> storageId, "storageType" -> storageType ) - val expected = jsonContentOf("/kg/files/list.json", mapping: _*) + val expected = jsonContentOf("kg/files/list.json", mapping: _*) filterSearchMetadata .andThen(filterResults(Set("_location")))(json) should equalIgnoreArrayOrder(expected) } @@ -338,7 +338,7 @@ abstract class StorageSpec extends BaseIntegrationSpec { "self" -> fileSelf(projectRef, id), "storageId" -> storageId ) - val expected = jsonContentOf("/kg/files/sparql.json", mapping: _*) + val expected = jsonContentOf("kg/files/sparql.json", mapping: _*) json should equalIgnoreArrayOrder(expected) } } @@ -399,7 +399,7 @@ abstract class StorageSpec extends BaseIntegrationSpec { "fetch metadata" in { val id = s"${attachmentPrefix}attachment2" val expected = jsonContentOf( - "/kg/files/attachment2-metadata.json", + "kg/files/attachment2-metadata.json", replacements( Coyote, "id" -> id, diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SupervisionSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SupervisionSpec.scala index 7567aaf267..bde34961df 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SupervisionSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/SupervisionSpec.scala @@ -49,9 +49,9 @@ class SupervisionSpec extends BaseIntegrationSpec { val module = "elasticsearch" val projectionName = s"$module-$fullId-$viewId" val createEsViewPayload = - jsonContentOf("/kg/supervision/es-payload.json", "viewName" -> viewName, "type" -> "https://schema.org/Book") + jsonContentOf("kg/supervision/es-payload.json", "viewName" -> viewName, "type" -> "https://schema.org/Book") val updateEsViewPayload = - jsonContentOf("/kg/supervision/es-payload.json", "viewName" -> viewName, "type" -> "https://schema.org/Movie") + jsonContentOf("kg/supervision/es-payload.json", "viewName" -> viewName, "type" -> "https://schema.org/Movie") def elasticsearchProjectionMetadata(revision: Int, restarts: Int) = metadataJson(module, projectionName, fullId, viewId, revision, restarts) @@ -115,9 +115,9 @@ class SupervisionSpec extends BaseIntegrationSpec { val module = "blazegraph" val projectionName = s"$module-$fullId-$viewId" val createBgViewPayload = - jsonContentOf("/kg/supervision/bg-payload.json", "viewName" -> viewName, "type" -> "https://schema.org/Book") + jsonContentOf("kg/supervision/bg-payload.json", "viewName" -> viewName, "type" -> "https://schema.org/Book") val updateBgViewPayload = - jsonContentOf("/kg/supervision/bg-payload.json", "viewName" -> viewName, "type" -> "https://schema.org/Movie") + jsonContentOf("kg/supervision/bg-payload.json", "viewName" -> viewName, "type" -> "https://schema.org/Movie") def blazegraphProjectionMetadata(revision: Int, restarts: Int) = metadataJson(module, projectionName, fullId, viewId, revision, restarts) @@ -181,13 +181,13 @@ class SupervisionSpec extends BaseIntegrationSpec { val projectionName = s"composite-views-$fullId-$viewId" val createCompositeViewPayload = jsonContentOf( - "/kg/supervision/composite-payload.json", + "kg/supervision/composite-payload.json", "viewName" -> viewName, "interval" -> "5 seconds" ) val updateCompositeViewPayload = jsonContentOf( - "/kg/supervision/composite-payload.json", + "kg/supervision/composite-payload.json", "viewName" -> viewName, "interval" -> "10 seconds" ) @@ -253,7 +253,7 @@ class SupervisionSpec extends BaseIntegrationSpec { restarts: Int ) = jsonContentOf( - "/kg/supervision/scoped-projection-metadata.json", + "kg/supervision/scoped-projection-metadata.json", "module" -> module, "projectionName" -> projectionName, "project" -> orgProject, diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/resources/SimpleResource.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/resources/SimpleResource.scala index 3e77451642..1f40e09d60 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/resources/SimpleResource.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/resources/SimpleResource.scala @@ -19,7 +19,7 @@ object SimpleResource extends HandleBarsFixture with SelfFixture { config: TestsConfig ): IO[Json] = loader.jsonContentOf( - "/kg/resources/simple-resource-response.json", + "kg/resources/simple-resource-response.json", replacements( user, "priority" -> priority.toString, @@ -34,7 +34,7 @@ object SimpleResource extends HandleBarsFixture with SelfFixture { config: TestsConfig ): IO[Json] = loader.jsonContentOf( - "/kg/resources/simple-resource-with-metadata.json", + "kg/resources/simple-resource-with-metadata.json", replacements( user, "priority" -> priority.toString, @@ -47,20 +47,20 @@ object SimpleResource extends HandleBarsFixture with SelfFixture { def sourcePayload(id: String, priority: Int): IO[Json] = loader.jsonContentOf( - "/kg/resources/simple-resource.json", + "kg/resources/simple-resource.json", "resourceId" -> id, "priority" -> priority.toString ) def sourcePayload(priority: Int): IO[Json] = loader.jsonContentOf( - "/kg/resources/simple-resource.json", + "kg/resources/simple-resource.json", "priority" -> priority.toString ) def sourcePayloadWithType(resourceType: String, priority: Int): IO[Json] = loader.jsonContentOf( - "/kg/resources/simple-resource.json", + "kg/resources/simple-resource.json", "priority" -> priority.toString, "resourceType" -> resourceType ) From 968ad82ef0ca4c2af326d5e9ecdde015d79144b2 Mon Sep 17 00:00:00 2001 From: Daniel Bell Date: Tue, 21 Nov 2023 20:54:14 +0100 Subject: [PATCH 6/6] Fix resource paths --- .../ch/epfl/bluebrain/nexus/delta/config/AppConfigSpec.scala | 2 +- .../plugins/blazegraph/client/BlazegraphClientSpec.scala | 2 +- .../ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/config/AppConfigSpec.scala b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/config/AppConfigSpec.scala index 721d2742d2..6f0f08bfd7 100644 --- a/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/config/AppConfigSpec.scala +++ b/delta/app/src/test/scala/ch/epfl/bluebrain/nexus/delta/config/AppConfigSpec.scala @@ -23,7 +23,7 @@ class AppConfigSpec extends CatsEffectSpec with BeforeAndAfterAll { "AppConfig" should { - val externalConfigPath = loader.absolutePath("/config/external.conf").accepted + val externalConfigPath = loader.absolutePath("config/external.conf").accepted "load conf" in { val (conf, _) = AppConfig.load().accepted diff --git a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala index 75188addd8..dc90e5cf36 100644 --- a/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala +++ b/delta/plugins/blazegraph/src/test/scala/ch/epfl/bluebrain/nexus/delta/plugins/blazegraph/client/BlazegraphClientSpec.scala @@ -130,7 +130,7 @@ class BlazegraphClientSpec(docker: BlazegraphDocker) } "attempt to create a namespace with wrong payload" in { - val props = propertiesOf("/sparql/wrong.properties") + val props = propertiesOf("sparql/wrong.properties") val err = client.createNamespace("other", props).rejectedWith[WrappedHttpClientError] err.http shouldBe a[HttpServerStatusError] } diff --git a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala index 1fdbfe2144..cd349d3dc1 100644 --- a/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala +++ b/tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/admin/ProjectsSpec.scala @@ -145,7 +145,7 @@ class ProjectsSpec extends BaseIntegrationSpec with OpticsValidators { val vocabRev2 = s"${config.deltaUri.toString()}/${genString()}/" val updateRev2Json = adminDsl .projectPayload( - "/admin/projects/update.json", + "admin/projects/update.json", "nxv", "person", description = descRev2, @@ -159,7 +159,7 @@ class ProjectsSpec extends BaseIntegrationSpec with OpticsValidators { val vocabRev3 = s"${config.deltaUri.toString()}/${genString()}/" val updateRev3Json = adminDsl .projectPayload( - "/admin/projects/update.json", + "admin/projects/update.json", "nxv", "person", description = descRev3,