-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
27 changed files
with
493 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
integration/src/test/scala/org/knora/webapi/responders/v2/ListsResponderV2Spec.scala
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
integration/src/test/scala/org/knora/webapi/responders/v2/ListsResponderV2SpecFullData.scala
This file was deleted.
Oops, something went wrong.
85 changes: 85 additions & 0 deletions
85
integration/src/test/scala/org/knora/webapi/slice/lists/ListsServiceSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright © 2021 - 2024 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.knora.webapi.slice.lists | ||
|
||
import org.apache.pekko | ||
import org.apache.pekko.testkit.ImplicitSender | ||
import zio.* | ||
|
||
import org.knora.webapi.CoreSpec | ||
import org.knora.webapi.messages.admin.responder.listsmessages | ||
import org.knora.webapi.messages.admin.responder.listsmessages.ListADM | ||
import org.knora.webapi.messages.store.triplestoremessages.RdfDataObject | ||
import org.knora.webapi.messages.store.triplestoremessages.StringLiteralSequenceV2 | ||
import org.knora.webapi.messages.store.triplestoremessages.StringLiteralV2 | ||
import org.knora.webapi.messages.v2.responder.listsmessages.ListGetResponseV2 | ||
import org.knora.webapi.messages.v2.responder.listsmessages.NodeGetResponseV2 | ||
import org.knora.webapi.routing.UnsafeZioRun | ||
import org.knora.webapi.sharedtestdata.SharedListsTestDataADM | ||
import org.knora.webapi.sharedtestdata.SharedTestDataADM | ||
import org.knora.webapi.slice.admin.domain.model.ListProperties.ListIri | ||
import org.knora.webapi.slice.lists.domain.ListsService | ||
|
||
class ListsServiceSpec extends CoreSpec with ImplicitSender { | ||
|
||
private val listsService = ZIO.serviceWithZIO[ListsService] | ||
|
||
override lazy val rdfDataObjects: List[RdfDataObject] = List( | ||
RdfDataObject( | ||
path = "test_data/project_data/anything-data.ttl", | ||
name = "http://www.knora.org/data/0001/anything", | ||
), | ||
) | ||
|
||
"The ListsService" should { | ||
"return a list" in { | ||
val actual = UnsafeZioRun.runOrThrow( | ||
listsService( | ||
_.getList(ListIri.unsafeFrom("http://rdfh.ch/lists/0001/treeList"), SharedTestDataADM.anythingUser2), | ||
), | ||
) | ||
assert( | ||
actual == ListGetResponseV2( | ||
list = ListADM( | ||
listinfo = SharedListsTestDataADM.treeListInfo.sorted, | ||
children = SharedListsTestDataADM.treeListChildNodes.map(_.sorted), | ||
), | ||
userLang = "de", | ||
fallbackLang = "en", | ||
), | ||
) | ||
} | ||
|
||
"return a node" in { | ||
val actual = UnsafeZioRun.runOrThrow( | ||
listsService( | ||
_.getNode(ListIri.unsafeFrom("http://rdfh.ch/lists/0001/treeList11"), SharedTestDataADM.anythingUser2), | ||
), | ||
) | ||
assert( | ||
actual == NodeGetResponseV2( | ||
node = listsmessages.ListChildNodeInfoADM( | ||
name = Some("Tree list node 11"), | ||
id = "http://rdfh.ch/lists/0001/treeList11", | ||
labels = StringLiteralSequenceV2( | ||
stringLiterals = Vector( | ||
StringLiteralV2.from( | ||
value = "Tree list node 11", | ||
language = Some("en"), | ||
), | ||
), | ||
), | ||
position = 1, | ||
hasRootNode = "http://rdfh.ch/lists/0001/treeList", | ||
comments = StringLiteralSequenceV2.empty, | ||
), | ||
userLang = "de", | ||
fallbackLang = "en", | ||
), | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.