Fixed share VC type.
Change-Id: I004888ef0a09aea44700b56601bc9deea7fa9cc9
diff --git a/full/Changes b/full/Changes
index e9c1ada..78a7e5e 100644
--- a/full/Changes
+++ b/full/Changes
@@ -35,6 +35,8 @@
- Fixed username verification in DefaultSettingService (margaretha)
- Added foundry rewrite with user default setting (margaretha)
- Added default foundry for morphology layer (margaretha)
+29/01/2019
+ - Fixed share VC type (margaretha)
# version 0.61.4
14/11/2018
diff --git a/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java b/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java
index c711009..d1e16df 100644
--- a/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/service/VirtualCorpusService.java
@@ -459,7 +459,7 @@
cause.getMessage());
}
- vcDao.editVirtualCorpus(vc, null, VirtualCorpusType.PUBLISHED, null,
+ vcDao.editVirtualCorpus(vc, null, VirtualCorpusType.PROJECT, null,
null, null, null, null, vc.isCached());
}
}
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
index 6c1f4e3..558a0af 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
@@ -325,7 +325,7 @@
}
@Test
- public void testCreatePublishVC () throws KustvaktException {
+ public void testCreatePublishedVC () throws KustvaktException {
String json = "{\"name\": \"new published vc\",\"type\": \"PUBLISHED\""
+ ",\"corpusQuery\": \"corpusSigle=GOE\"}";
ClientResponse response = resource().path(API_VERSION).path("vc")
@@ -688,11 +688,17 @@
* @throws KustvaktException
*/
@Test
- public void testEditPublishVC () throws KustvaktException {
+ public void testPublishProjectVC () throws KustvaktException {
String vcId = "2";
+
+ // check the vc type
+ JsonNode node = testSearchVC("dory", vcId);
+ assertEquals(VirtualCorpusType.PROJECT.displayName(),
+ node.get("type").asText());
+
+ // edit vc
String json = "{\"id\": \"" + vcId + "\", \"type\": \"PUBLISHED\"}";
-
ClientResponse response = resource().path(API_VERSION).path("vc")
.path("edit")
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
@@ -700,11 +706,10 @@
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
.header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
.post(ClientResponse.class, json);
-
assertEquals(Status.OK.getStatusCode(), response.getStatus());
// check VC
- JsonNode node = testListOwnerVC("dory");
+ node = testListOwnerVC("dory");
JsonNode n = node.get(1);
assertEquals(VirtualCorpusType.PUBLISHED.displayName(),
n.get("type").asText());
@@ -782,11 +787,21 @@
ClientHandlerException, KustvaktException {
String vcId = "5";
+
+ // check the vc type
+ JsonNode node = testSearchVC("marlin", vcId);
+ assertEquals("marlin VC", node.at("/name").asText());
+ assertEquals("private", node.at("/type").asText());
+
ClientResponse response = testShareVC(vcId);
assertEquals(Status.OK.getStatusCode(), response.getStatus());
+ // check the vc type
+ node = testSearchVC("marlin", vcId);
+ assertEquals("project", node.at("/type").asText());
+
// list vc access by marlin
- JsonNode node = testlistAccessByVC("marlin", vcId);
+ node = testlistAccessByVC("marlin", vcId);
assertEquals(1, node.size());
node = node.get(0);
assertEquals(5, node.at("/vcId").asInt());
@@ -799,7 +814,7 @@
testCreateNonUniqueAccess(vcId);
testDeleteAccessUnauthorized(accessId);
- // delete access
+ // delete access by vc-admin
// dory is a vc-admin in marlin group
testDeleteAccess("dory", accessId);