Skip to content

Commit

Permalink
Introduce etag/last modified when fetching the different types of res…
Browse files Browse the repository at this point in the history
…ource
  • Loading branch information
Simon Dumas committed Oct 2, 2024
1 parent be51996 commit 2dcac23
Show file tree
Hide file tree
Showing 59 changed files with 533 additions and 199 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteCon
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder
import ch.epfl.bluebrain.nexus.delta.rdf.utils.JsonKeyOrdering
import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclCheck
import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives.{emit, lastEventId}
import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives._
import ch.epfl.bluebrain.nexus.delta.sdk.directives.UriDirectives.baseUriPrefix
import ch.epfl.bluebrain.nexus.delta.sdk.directives.{AuthDirectives, DeltaSchemeDirectives}
import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives._
import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities
import ch.epfl.bluebrain.nexus.delta.sdk.instances._
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields
import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri
import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions.events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import ch.epfl.bluebrain.nexus.delta.sdk.fusion.FusionConfig
import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities
import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller
import ch.epfl.bluebrain.nexus.delta.sdk.implicits._
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.{AnnotatedSource, RdfMarshalling}
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.{AnnotatedSource, HttpResponseFields, RdfMarshalling}
import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, IdSegment, IdSegmentRef, ResourceF}
import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions
import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions.resolvers.{read => Read, write => Write}
Expand Down Expand Up @@ -172,7 +172,7 @@ final class ResolversRoutes(
output: ResolvedResourceOutputType
)(implicit baseUri: BaseUri, caller: Caller): Route =
authorizeFor(project, Permissions.resources.read).apply {
def emitResult[R: JsonLdEncoder](io: IO[MultiResolutionResult[R]]) = {
def emitResult[R: JsonLdEncoder: HttpResponseFields](io: IO[MultiResolutionResult[R]]) = {
output match {
case ResolvedResourceOutputType.Report => emit(io.map(_.report).attemptNarrow[ResolverRejection])
case ResolvedResourceOutputType.JsonLd => emit(io.map(_.value.jsonLdValue).attemptNarrow[ResolverRejection])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.RemoteContextResolution
import ch.epfl.bluebrain.nexus.delta.rdf.utils.JsonKeyOrdering
import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclCheck
import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives._
import ch.epfl.bluebrain.nexus.delta.sdk.instances._
import ch.epfl.bluebrain.nexus.delta.sdk.directives.{AuthDirectives, FileResponse}
import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities
import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives.emit
import ch.epfl.bluebrain.nexus.delta.sdk.directives.UriDirectives.{baseUriPrefix, projectRef}
import ch.epfl.bluebrain.nexus.delta.sdk.directives._
import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.RdfMarshalling
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.{HttpResponseFields, RdfMarshalling}
import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri
import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions.{projects, supervision}
import ch.epfl.bluebrain.nexus.delta.sdk.projects.model.{ProjectHealer, ProjectRejection, ProjectsHealth}
Expand Down Expand Up @@ -83,6 +83,8 @@ object SupervisionRoutes {
implicit val runningProjectionsJsonLdEncoder: JsonLdEncoder[SupervisionBundle] =
JsonLdEncoder.computeFromCirce(ContextValue(contexts.supervision))

implicit val versionHttpResponseFields: HttpResponseFields[SupervisionBundle] = HttpResponseFields.defaultOk

private val allProjectsAreHealthy =
Json.obj("status" := "All projects are healthy.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ch.epfl.bluebrain.nexus.delta.sdk.acls.model.AclAddress
import ch.epfl.bluebrain.nexus.delta.sdk.directives.AuthDirectives
import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives._
import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.{HttpResponseFields, RdfMarshalling}
import ch.epfl.bluebrain.nexus.delta.sdk.model.ComponentDescription.{PluginDescription, ServiceDescription}
import ch.epfl.bluebrain.nexus.delta.sdk.model.{BaseUri, ComponentDescription, Name}
import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions.version
Expand All @@ -33,7 +34,8 @@ class VersionRoutes(
baseUri: BaseUri,
cr: RemoteContextResolution,
ordering: JsonKeyOrdering
) extends AuthDirectives(identities, aclCheck) {
) extends AuthDirectives(identities, aclCheck)
with RdfMarshalling {

def routes: Route =
baseUriPrefix(baseUri.prefix) {
Expand Down Expand Up @@ -75,6 +77,8 @@ object VersionRoutes {

implicit val versionBundleJsonLdEncoder: JsonLdEncoder[VersionBundle] =
JsonLdEncoder.computeFromCirce(ContextValue(Vocabulary.contexts.version))

implicit val versionHttpResponseFields: HttpResponseFields[VersionBundle] = HttpResponseFields.defaultOk
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import akka.http.scaladsl.server.Route
import cats.implicits._
import ch.epfl.bluebrain.nexus.delta.kernel.utils.{UUIDF, UrlUtils}
import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri
import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.{contexts, nxv, schema => schemaOrg, schemas}
import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.{contexts, nxv, schemas, schema => schemaOrg}
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords
import ch.epfl.bluebrain.nexus.delta.sdk.IndexingAction
import ch.epfl.bluebrain.nexus.delta.sdk.acls.AclSimpleCheck
Expand Down Expand Up @@ -464,6 +464,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with ValidateResourceFixture wit
status shouldEqual StatusCodes.OK
val meta = standardWriterMetadata(id, tpe = "schema:Custom")
response.asJson shouldEqual simplePayload(id).deepMerge(meta).deepMerge(resourceCtx)
response.expectConditionalCacheHeaders
response.headers should contain(varyHeader)
}
}
Expand All @@ -483,6 +484,7 @@ class ResourcesRoutesSpec extends BaseRouteSpec with ValidateResourceFixture wit
Get(endpoint) ~> asReader ~> routes ~> check {
status shouldEqual StatusCodes.OK
response.asJson shouldEqual simplePayload(id).deepMerge(meta).deepMerge(resourceCtx)
response.expectConditionalCacheHeaders
response.headers should contain(varyHeader)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.epfl.bluebrain.nexus.delta.sourcing
package ch.epfl.bluebrain.nexus.delta.kernel

import java.security.MessageDigest

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package ch.epfl.bluebrain.nexus.delta.sourcing
package ch.epfl.bluebrain.nexus.delta.kernel

import cats.effect.IO
import cats.effect.Ref
import cats.effect.{IO, Ref}
import cats.implicits._
import ch.epfl.bluebrain.nexus.testkit.mu.NexusSuite
import munit.CatsEffectSuite

class MD5Suite extends NexusSuite {
class MD5Suite extends CatsEffectSuite {

test("a string should have the correct MD5 hash") {
val input = "bbp/atlas"
Expand All @@ -26,12 +25,8 @@ class MD5Suite extends NexusSuite {
}
}

for {
_ <- task
c <- cache.get
_ = c.assertOneElem
_ = c.assertContains("3f33bc38009c0cfcda4fa7737f5fac85")
} yield ()
val expected = Set("3f33bc38009c0cfcda4fa7737f5fac85")
task >> cache.get.assertEquals(expected)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import akka.http.scaladsl.model.headers.OAuth2BearerToken
import akka.http.scaladsl.server.{ExceptionHandler, RejectionHandler}
import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.Fixtures
import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.SparqlLink.{SparqlExternalLink, SparqlResourceLink}
import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.{schema, SparqlLink}
import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.model.{SparqlLink, schema}
import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.nxv
import ch.epfl.bluebrain.nexus.delta.rdf.utils.JsonKeyOrdering
import ch.epfl.bluebrain.nexus.delta.sdk.ConfigFixtures
Expand All @@ -24,14 +24,16 @@ import ch.epfl.bluebrain.nexus.delta.sdk.utils.RouteHelpers
import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.{Anonymous, Authenticated, Group, User}
import ch.epfl.bluebrain.nexus.delta.sourcing.model.{Identity, Label, ResourceRef}
import ch.epfl.bluebrain.nexus.delta.sourcing.postgres.DoobieScalaTestFixture
import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsEffectSpec
import ch.epfl.bluebrain.nexus.testkit.{CirceEq, CirceLiteral}
import org.scalatest.{BeforeAndAfterAll, CancelAfterFailure, Inspectors}

import java.time.Instant
import java.util.UUID

trait BlazegraphViewRoutesFixtures
extends RouteHelpers
extends CatsEffectSpec
with RouteHelpers
with DoobieScalaTestFixture
with CirceLiteral
with CirceEq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ch.epfl.bluebrain.nexus.delta.rdf.Vocabulary.contexts
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.ContextValue
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields
import io.circe.Encoder
import io.circe.generic.extras.Configuration
import io.circe.generic.extras.semiauto.deriveConfiguredEncoder
Expand Down Expand Up @@ -52,4 +53,7 @@ object CompositeIndexingDescription {
implicit val compositeIndexingDescriptionJsonLdEncoder: JsonLdEncoder[CompositeIndexingDescription] =
JsonLdEncoder.computeFromCirce(ContextValue(contexts.offset).merge(ContextValue(contexts.statistics)))

implicit val compositeIndexingDescriptionHttpResponseFields: HttpResponseFields[CompositeIndexingDescription] =
HttpResponseFields.defaultOk

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import ch.epfl.bluebrain.nexus.delta.sourcing.model.Label
import ch.epfl.bluebrain.nexus.delta.sourcing.postgres.DoobieScalaTestFixture
import ch.epfl.bluebrain.nexus.testkit.clock.FixedClock
import ch.epfl.bluebrain.nexus.testkit.scalatest.TestMatchers
import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsIOValues
import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.{CatsEffectSpec, CatsIOValues}
import ch.epfl.bluebrain.nexus.testkit.{CirceEq, CirceLiteral}
import org.scalatest.matchers.should.Matchers
import org.scalatest.{CancelAfterFailure, Inspectors, OptionValues}

trait CompositeViewsRoutesFixtures
extends RouteHelpers
extends CatsEffectSpec
with RouteHelpers
with DoobieScalaTestFixture
with Matchers
with CatsIOValues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.{CompactedJsonLd, ExpandedJsonLd
import ch.epfl.bluebrain.nexus.delta.sdk.error.ServiceError.AuthorizationFailed
import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller
import ch.epfl.bluebrain.nexus.delta.sdk.jsonld.JsonLdContent
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields
import ch.epfl.bluebrain.nexus.delta.sdk.model.ResourceF._
import ch.epfl.bluebrain.nexus.delta.sdk.model.search.SearchResults.searchResultsJsonLdEncoder
import ch.epfl.bluebrain.nexus.delta.sdk.model.search.{SearchResults, SortList}
Expand Down Expand Up @@ -137,4 +138,6 @@ object IdResolutionResponse {
}
}

implicit val reultHttpResponseFields: HttpResponseFields[Result] = HttpResponseFields.defaultOk

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives._
import ch.epfl.bluebrain.nexus.delta.sdk.directives.{AuthDirectives, DeltaSchemeDirectives}
import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities
import ch.epfl.bluebrain.nexus.delta.sdk.identities.model.Caller
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields
import ch.epfl.bluebrain.nexus.delta.sdk.model._
import ch.epfl.bluebrain.nexus.delta.sdk.model.search.AggregationResult.aggregationResultJsonLdEncoder
import ch.epfl.bluebrain.nexus.delta.sdk.model.search.SearchResults.searchResultsJsonLdEncoder
Expand Down Expand Up @@ -160,6 +161,8 @@ class ElasticSearchQueryRoutes(
implicit val searchJsonLdEncoder: JsonLdEncoder[AggregationResult] =
aggregationResultJsonLdEncoder(ContextValue(contexts.aggregations))

implicit val reultHttpResponseFields: HttpResponseFields[AggregationResult] = HttpResponseFields.defaultOk

emit(request.flatMap(defaultViewsQuery.aggregate).attemptNarrow[ElasticSearchQueryError])
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import ch.epfl.bluebrain.nexus.delta.sdk.utils.RouteHelpers
import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.User
import ch.epfl.bluebrain.nexus.delta.sourcing.model.Tag.UserTag
import ch.epfl.bluebrain.nexus.delta.sourcing.model.{Label, ResourceRef}
import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsEffectSpec
import io.circe.Codec
import io.circe.generic.extras.Configuration
import io.circe.generic.extras.semiauto.deriveConfiguredCodec
import io.circe.syntax.EncoderOps

import java.time.Instant

class ElasticSearchViewsDirectivesSpec extends RouteHelpers with CirceMarshalling with ElasticSearchViewsDirectives {
class ElasticSearchViewsDirectivesSpec extends CatsEffectSpec with RouteHelpers with CirceMarshalling with ElasticSearchViewsDirectives {

implicit private val baseUri: BaseUri = BaseUri("http://localhost", Label.unsafe("v1"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import ch.epfl.bluebrain.nexus.delta.sourcing.model.Identity.{Anonymous, Authent
import ch.epfl.bluebrain.nexus.delta.sourcing.model.{Label, ProjectRef}
import ch.epfl.bluebrain.nexus.delta.sourcing.postgres.DoobieScalaTestFixture
import ch.epfl.bluebrain.nexus.testkit._
import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsIOValues
import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.{CatsEffectSpec, CatsIOValues}
import org.scalatest.CancelAfterFailure

import java.util.UUID

class ElasticSearchViewsRoutesFixtures
extends RouteHelpers
extends CatsEffectSpec
with RouteHelpers
with CatsIOValues
with DoobieScalaTestFixture
with CirceLiteral
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.ContextValue
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields
import io.circe._
import io.circe.generic.extras.Configuration
import io.circe.generic.extras.semiauto._
Expand Down Expand Up @@ -87,6 +88,8 @@ object AnalyticsGraph {
implicit val relationshipsJsonLdEncoder: JsonLdEncoder[AnalyticsGraph] =
JsonLdEncoder.computeFromCirce(ContextValue(contexts.relationships))

implicit val relationshipsHttpResponseFields: HttpResponseFields[AnalyticsGraph] = HttpResponseFields.defaultOk

implicit val relationshipsDecoderFromEsAggregations: Decoder[AnalyticsGraph] = {

def resourceType(hc: HCursor) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ package ch.epfl.bluebrain.nexus.delta.plugins.graph.analytics.model

import cats.implicits._
import ch.epfl.bluebrain.nexus.delta.plugins.graph.analytics.GraphAnalytics.{name, toPaths}
import ch.epfl.bluebrain.nexus.delta.plugins.graph.analytics.contexts
import ch.epfl.bluebrain.nexus.delta.plugins.graph.analytics.model.PropertiesStatistics.Metadata
import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.ContextValue
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields
import ch.epfl.bluebrain.nexus.delta.sdk.syntax._
import io.circe._
import io.circe.generic.extras.Configuration
import io.circe.generic.extras.semiauto.deriveConfiguredEncoder
import io.circe._
import io.circe.syntax._
import ch.epfl.bluebrain.nexus.delta.sdk.syntax._
import ch.epfl.bluebrain.nexus.delta.plugins.graph.analytics.contexts

import scala.annotation.tailrec

Expand Down Expand Up @@ -56,6 +57,9 @@ object PropertiesStatistics {
implicit val propertiesJsonLdEncoder: JsonLdEncoder[PropertiesStatistics] =
JsonLdEncoder.computeFromCirce(ContextValue(contexts.properties))

implicit val propertiesStatisticsHttpResponseFields: HttpResponseFields[PropertiesStatistics] =
HttpResponseFields.defaultOk

implicit def propertiesDecoderFromEsAggregations(tpe: Iri): Decoder[PropertiesStatistics] = {

implicit val intOrdering: Ordering[Int] = Ordering.Int.reverse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ch.epfl.bluebrain.nexus.delta.sdk.circe.CirceUnmarshalling
import ch.epfl.bluebrain.nexus.delta.sdk.directives.AuthDirectives
import ch.epfl.bluebrain.nexus.delta.sdk.directives.DeltaDirectives._
import ch.epfl.bluebrain.nexus.delta.sdk.identities.Identities
import ch.epfl.bluebrain.nexus.delta.sdk.instances._
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.RdfMarshalling
import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri
import ch.epfl.bluebrain.nexus.delta.sdk.permissions.Permissions.resources.{read => Read}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ch.epfl.bluebrain.nexus.delta.plugins.projectdeletion.model
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.ContextValue
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.JsonLdContext.keywords
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.encoder.JsonLdEncoder
import ch.epfl.bluebrain.nexus.delta.sdk.marshalling.HttpResponseFields
import io.circe.{Encoder, Json, JsonObject}
import pureconfig.ConfigReader
import pureconfig.error.CannotConvert
Expand Down Expand Up @@ -51,16 +52,19 @@ object ProjectDeletionConfig {
JsonLdEncoder.computeFromCirce(ContextValue(contexts.projectDeletion))
}

implicit val projectDeletionConfigHttpResponseFields: HttpResponseFields[ProjectDeletionConfig] =
HttpResponseFields.defaultOk

implicit final val projectDeletionConfigReader: ConfigReader[ProjectDeletionConfig] =
deriveReader[ProjectDeletionConfig].emap { cfg =>
if (cfg.idleInterval.toMillis < cfg.idleCheckPeriod.toMillis)
Left(
CannotConvert(
cfg.idleCheckPeriod.toString,
classOf[FiniteDuration].getSimpleName,
"'idle-interval' cannot be smaller than 'idle-check-period'"
)
Either.cond(
cfg.idleInterval.toMillis > cfg.idleCheckPeriod.toMillis,
cfg,
CannotConvert(
cfg.idleCheckPeriod.toString,
classOf[FiniteDuration].getSimpleName,
"'idle-interval' cannot be smaller than 'idle-check-period'"
)
else Right(cfg)
)
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package ch.epfl.bluebrain.nexus.delta.plugins.projectdeletion

import akka.http.scaladsl.model.StatusCodes
import ch.epfl.bluebrain.nexus.delta.plugins.projectdeletion.model.{contexts, ProjectDeletionConfig}
import ch.epfl.bluebrain.nexus.delta.plugins.projectdeletion.model.{ProjectDeletionConfig, contexts}
import ch.epfl.bluebrain.nexus.delta.rdf.RdfMediaTypes
import ch.epfl.bluebrain.nexus.delta.rdf.jsonld.context.{ContextValue, RemoteContextResolution}
import ch.epfl.bluebrain.nexus.delta.rdf.utils.JsonKeyOrdering
import ch.epfl.bluebrain.nexus.delta.sdk.model.BaseUri
import ch.epfl.bluebrain.nexus.delta.sdk.utils.RouteHelpers
import ch.epfl.bluebrain.nexus.delta.sourcing.model.Label
import ch.epfl.bluebrain.nexus.testkit.scalatest.ce.CatsEffectSpec

import scala.concurrent.duration.DurationInt

class ProjectDeletionRoutesSpec extends RouteHelpers {
class ProjectDeletionRoutesSpec extends CatsEffectSpec with RouteHelpers {

implicit private val ordering: JsonKeyOrdering = JsonKeyOrdering.default()
implicit private val baseUri: BaseUri = BaseUri("http://localhost", Label.unsafe("v1"))
Expand Down
Loading

0 comments on commit 2dcac23

Please sign in to comment.