more tests + 1M tested

This commit is contained in:
Benjamin Gamard 2018-04-01 21:00:26 +02:00
parent 90a3d7aa68
commit 68729e3b54
2 changed files with 58 additions and 40 deletions

View File

@ -51,7 +51,7 @@ Features
- RESTful Web API
- Fully featured Android client
- [Bulk files importer](https://github.com/sismics/docs/tree/master/docs-importer) (single or scan mode) ![New!](https://www.sismics.com/public/img/new.png)
- Tested to 100k documents
- Tested to one million documents
Install with Docker
-------------------

View File

@ -1,6 +1,8 @@
package com.sismics.docs.rest;
import java.util.Date;
import com.sismics.util.filter.TokenBasedSecurityFilter;
import org.junit.Assert;
import org.junit.Test;
import javax.json.JsonArray;
import javax.json.JsonObject;
@ -8,11 +10,7 @@ import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.junit.Assert;
import org.junit.Test;
import com.sismics.util.filter.TokenBasedSecurityFilter;
import java.util.Date;
/**
@ -60,6 +58,16 @@ public class TestAclResource extends BaseJerseyTest {
.get();
Assert.assertEquals(Status.NOT_FOUND, Status.fromStatusCode(response.getStatus()));
// List all documents with acl2
json = target().path("/document/list")
.queryParam("sort_column", 3)
.queryParam("asc", true)
.request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl2Token)
.get(JsonObject.class);
JsonArray documents = json.getJsonArray("documents");
Assert.assertEquals(0, documents.size());
// Add an ACL READ for acl2 with acl1
json = target().path("/acl").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
@ -79,6 +87,16 @@ public class TestAclResource extends BaseJerseyTest {
.param("target", "acl2")
.param("type", "USER")), JsonObject.class);
// List all documents with acl2
json = target().path("/document/list")
.queryParam("sort_column", 3)
.queryParam("asc", true)
.request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl2Token)
.get(JsonObject.class);
documents = json.getJsonArray("documents");
Assert.assertEquals(1, documents.size());
// Add an ACL WRITE for acl2 with acl1 (again)
target().path("/acl").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
@ -114,7 +132,7 @@ public class TestAclResource extends BaseJerseyTest {
.request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl2Token)
.get(JsonObject.class);
JsonArray documents = json.getJsonArray("documents");
documents = json.getJsonArray("documents");
Assert.assertEquals(1, documents.size());
// Get the document as acl1
@ -217,8 +235,8 @@ public class TestAclResource extends BaseJerseyTest {
// Delete the ACL READ for acl1 with acl1
response = target().path("/acl/" + document1Id + "/READ/" + acl1Id).request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
.delete();
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
.delete();
Assert.assertEquals(Status.BAD_REQUEST, Status.fromStatusCode(response.getStatus()));
// Delete the ACL WRITE for acl1 with acl1