Skip to content

Commit

Permalink
add GroupsRestService to layers
Browse files Browse the repository at this point in the history
  • Loading branch information
mpro7 committed Apr 3, 2024
1 parent b3f1fc5 commit 917ee77
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
27 changes: 15 additions & 12 deletions integration/src/test/scala/org/knora/webapi/core/LayersTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package org.knora.webapi.core

import org.apache.pekko
import zio._

import org.knora.webapi.config.AppConfig.AppConfigurations
import org.knora.webapi.config.AppConfig.AppConfigurationsTest
import org.knora.webapi.config.AppConfigForTestContainers
Expand All @@ -31,9 +30,12 @@ import org.knora.webapi.routing._
import org.knora.webapi.slice.admin.AdminModule
import org.knora.webapi.slice.admin.api.AdminApiModule
import org.knora.webapi.slice.admin.api._
import org.knora.webapi.slice.admin.api.service.PermissionsRestService
import org.knora.webapi.slice.admin.api.service.ProjectRestService
import org.knora.webapi.slice.admin.api.service.UsersRestService
import org.knora.webapi.slice.admin.api.service.{
GroupsRestService,
PermissionsRestService,
ProjectRestService,
UsersRestService,
}
import org.knora.webapi.slice.admin.domain.service.ProjectExportStorageService
import org.knora.webapi.slice.admin.domain.service._
import org.knora.webapi.slice.common.api._
Expand Down Expand Up @@ -86,14 +88,14 @@ object LayersTest {
type CommonR =
ApiRoutes & AdminApiEndpoints & ApiV2Endpoints & AppRouter & AssetPermissionsResponder & Authenticator &
AuthorizationRestService & CacheServiceRequestMessageHandler & CardinalityHandler & ConstructResponseUtilV2 &
DspIngestClient & GravsearchTypeInspectionRunner & GroupsResponderADM & HttpServer & IIIFRequestMessageHandler &
InferenceOptimizationService & IriConverter & ListsResponder & ListsResponderV2 & MessageRelay & OntologyCache &
OntologyHelpers & OntologyInferencer & OntologyRepo & OntologyResponderV2 & PermissionUtilADM &
PermissionsResponderADM & PermissionsRestService & ProjectExportService & ProjectExportStorageService &
ProjectImportService & ProjectService & ProjectRestService & QueryTraverser & RepositoryUpdater &
ResourceUtilV2 & ResourcesResponderV2 & RestCardinalityService & SearchApiRoutes & SearchResponderV2 &
StandoffResponderV2 & StandoffTagUtilV2 & State & TestClientService & TriplestoreService & UserService &
UsersResponder & UsersRestService & ValuesResponderV2
DspIngestClient & GravsearchTypeInspectionRunner & GroupsResponderADM & GroupsRestService & HttpServer &
IIIFRequestMessageHandler & InferenceOptimizationService & IriConverter & ListsResponder & ListsResponderV2 &
MessageRelay & OntologyCache & OntologyHelpers & OntologyInferencer & OntologyRepo & OntologyResponderV2 &
PermissionUtilADM & PermissionsResponderADM & PermissionsRestService & ProjectExportService &
ProjectExportStorageService & ProjectImportService & ProjectService & ProjectRestService & QueryTraverser &
RepositoryUpdater & ResourceUtilV2 & ResourcesResponderV2 & RestCardinalityService & SearchApiRoutes &
SearchResponderV2 & StandoffResponderV2 & StandoffTagUtilV2 & State & TestClientService & TriplestoreService &
UserService & UsersResponder & UsersRestService & ValuesResponderV2

private val commonLayersForAllIntegrationTests =
ZLayer.makeSome[CommonR0, CommonR](
Expand All @@ -115,6 +117,7 @@ object LayersTest {
DspIngestClientLive.layer,
GravsearchTypeInspectionRunner.layer,
GroupsResponderADM.layer,
GroupsRestService.layer,
HandlerMapper.layer,
HttpServer.layer,
IIIFRequestMessageHandlerLive.layer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ package org.knora.webapi.responders.admin
import zio._

import java.util.UUID

import dsp.errors._
import org.apache.pekko.testkit.ImplicitSender
import org.knora.webapi._
import org.knora.webapi.messages.admin.responder.usersmessages._
import org.knora.webapi.messages.store.triplestoremessages.StringLiteralV2
Expand All @@ -18,6 +18,7 @@ import org.knora.webapi.sharedtestdata.SharedTestDataADM._
import org.knora.webapi.slice.admin.api.GroupsRequests.GroupCreateRequest
import org.knora.webapi.slice.admin.api.GroupsRequests.GroupStatusUpdateRequest
import org.knora.webapi.slice.admin.api.GroupsRequests.GroupUpdateRequest
import org.knora.webapi.slice.admin.api.service.GroupsRestService
import org.knora.webapi.slice.admin.domain.model.GroupDescriptions
import org.knora.webapi.slice.admin.domain.model.GroupIri
import org.knora.webapi.slice.admin.domain.model.GroupName
Expand All @@ -30,13 +31,15 @@ import org.knora.webapi.util.ZioScalaTestUtil.assertFailsWithA
/**
* This spec is used to test the messages received by the [[GroupsResponderADMSpec]] actor.
*/
class GroupsResponderADMSpec extends CoreSpec {
class GroupsResponderADMSpec extends CoreSpec with ImplicitSender {
private val groupsRestService = ZIO.serviceWithZIO[GroupsRestService]

"The GroupsResponder " when {
"asked about all groups" should {
"return a list" in {
val groups = UnsafeZioRun.runOrThrow(ZIO.serviceWithZIO[GroupsResponderADM](_.groupsGetADM))
assert(groups.nonEmpty)
assert(groups.size == 2)
val response = UnsafeZioRun.runOrThrow(groupsRestService(_.getGroups))
assert(response.groups.nonEmpty)
assert(response.groups.size == 2)
}
}

Expand Down
13 changes: 8 additions & 5 deletions webapi/src/main/scala/org/knora/webapi/core/LayersLive.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package org.knora.webapi.core
import org.apache.pekko.actor.ActorSystem
import zio.ULayer
import zio.ZLayer

import org.knora.webapi.config.AppConfig
import org.knora.webapi.config.AppConfig.AppConfigurations
import org.knora.webapi.config.InstrumentationServerConfig
Expand All @@ -33,9 +32,12 @@ import org.knora.webapi.routing._
import org.knora.webapi.slice.admin.AdminModule
import org.knora.webapi.slice.admin.api.AdminApiModule
import org.knora.webapi.slice.admin.api._
import org.knora.webapi.slice.admin.api.service.PermissionsRestService
import org.knora.webapi.slice.admin.api.service.ProjectRestService
import org.knora.webapi.slice.admin.api.service.UsersRestService
import org.knora.webapi.slice.admin.api.service.{
GroupsRestService,
PermissionsRestService,
ProjectRestService,
UsersRestService,
}
import org.knora.webapi.slice.admin.domain.service._
import org.knora.webapi.slice.common.api._
import org.knora.webapi.slice.common.repo.service.PredicateObjectMapper
Expand Down Expand Up @@ -72,7 +74,7 @@ object LayersLive {
ActorSystem & AdminApiEndpoints & ApiRoutes & ApiV2Endpoints & AppConfigurations & AppRouter &
AssetPermissionsResponder & Authenticator & AuthorizationRestService &
CacheServiceRequestMessageHandler & CardinalityHandler & ConstructResponseUtilV2 &
GravsearchTypeInspectionRunner & GroupsResponderADM & HttpServer &
GravsearchTypeInspectionRunner & GroupsResponderADM & GroupsRestService & HttpServer &
IIIFRequestMessageHandler & InferenceOptimizationService & InstrumentationServerConfig & IriConverter &
JwtService & ListsResponder & ListsResponderV2 & MessageRelay & OntologyCache & OntologyHelpers &
OntologyInferencer & OntologyResponderV2 & PermissionsResponderADM & PermissionsRestService &
Expand Down Expand Up @@ -106,6 +108,7 @@ object LayersLive {
DspIngestClientLive.layer,
GravsearchTypeInspectionRunner.layer,
GroupsResponderADM.layer,
GroupsRestService.layer,
HandlerMapper.layer,
HttpServer.layer,
IIIFRequestMessageHandlerLive.layer,
Expand Down

0 comments on commit 917ee77

Please sign in to comment.