Skip to content

Commit

Permalink
fix PR issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyhappydan committed Sep 20, 2023
1 parent 8ba2041 commit 0f37915
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ class CompositeViewsPluginModule(priority: Int) extends ModuleDef {

many[ResourceShift[_, _, _]].ref[CompositeView.Shift]

many[SseEncoder[_]].add { (base: BaseUri) => CompositeViewEvent.sseEncoder()(base) }
many[SseEncoder[_]].add { (base: BaseUri) => CompositeViewEvent.sseEncoder(base) }

many[ScopedEventMetricEncoder[_]].add { () => CompositeViewEvent.compositeViewMetricEncoder() }
many[ScopedEventMetricEncoder[_]].add { () => CompositeViewEvent.compositeViewMetricEncoder }

many[PriorityRoute].add {
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import ch.epfl.bluebrain.nexus.delta.sourcing.offset.Offset
import ch.epfl.bluebrain.nexus.delta.sourcing.offset.Offset.Start
import ch.epfl.bluebrain.nexus.delta.sourcing.stream.{Elem, RemainingElems}
import com.typesafe.scalalogging.Logger
import io.circe.Json
import io.circe.parser.decode
import fs2._
import monix.bio.{IO, UIO}
Expand Down Expand Up @@ -72,12 +71,6 @@ trait DeltaClient {
* Fetches a resource with a given id in n-quads format.
*/
def resourceAsNQuads(source: RemoteProjectSource, id: Iri): HttpResult[Option[NQuads]]

/**
* Fetches a resource with a given id in n-quads format.
*/
def resourceAsJson(source: RemoteProjectSource, id: Iri): HttpResult[Option[Json]]

}

object DeltaClient {
Expand Down Expand Up @@ -180,20 +173,6 @@ object DeltaClient {
}
} yield result
}

override def resourceAsJson(source: RemoteProjectSource, id: Iri): HttpResult[Option[Json]] = {
for {
authToken <- authTokenProvider(credentials)
req =
Get(
source.endpoint / "resources" / source.project.organization.value / source.project.project.value / "_" / id.toString
).addHeader(accept).withCredentials(authToken)
result <-
client.toJson(req).map(Some(_)).onErrorRecover { case HttpClientStatusError(_, StatusCodes.NotFound, _) =>
None
}
} yield result
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ class DeltaClientSpec
"fail if project is unknown" in {
deltaClient.projectStatistics(unknownProjectSource).rejected.errorCode.value shouldEqual StatusCodes.NotFound
}

// "fail if token is invalid" in {
// deltaClient.projectStatistics(unknownToken).rejected.errorCode.value shouldEqual StatusCodes.Forbidden
// }
}

"Getting remaining information" should {
Expand All @@ -185,10 +181,6 @@ class DeltaClientSpec
.errorCode
.value shouldEqual StatusCodes.NotFound
}

// "fail if token is invalid" in {
// deltaClient.remaining(unknownToken, Offset.Start).rejected.errorCode.value shouldEqual StatusCodes.Forbidden
// }
}

"Getting elems" should {
Expand All @@ -213,23 +205,11 @@ class DeltaClientSpec
"return None if tag doesn't exist" in {
deltaClient.resourceAsNQuads(source.copy(resourceTag = invalidTag), resourceId).accepted shouldEqual None
}

// "fail if token is invalid" in {
// deltaClient
// .resourceAsNQuads(unknownToken, resourceId)
// .rejected
// .errorCode
// .value shouldEqual StatusCodes.Forbidden
// }
}

"Checking elems" should {
"work" in {
deltaClient.checkElems(source).accepted
}
// "fail if token is invalid" in {
// deltaClient.checkElems(unknownToken).rejected.errorCode.value shouldEqual StatusCodes.Forbidden
// }
}

}

0 comments on commit 0f37915

Please sign in to comment.