mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
more tests + 1M tested
This commit is contained in:
parent
90a3d7aa68
commit
68729e3b54
@ -51,7 +51,7 @@ Features
|
|||||||
- RESTful Web API
|
- RESTful Web API
|
||||||
- Fully featured Android client
|
- 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)
|
- [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
|
Install with Docker
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.sismics.docs.rest;
|
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.JsonArray;
|
||||||
import javax.json.JsonObject;
|
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.Form;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.Response.Status;
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
import java.util.Date;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import com.sismics.util.filter.TokenBasedSecurityFilter;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,6 +58,16 @@ public class TestAclResource extends BaseJerseyTest {
|
|||||||
.get();
|
.get();
|
||||||
Assert.assertEquals(Status.NOT_FOUND, Status.fromStatusCode(response.getStatus()));
|
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
|
// Add an ACL READ for acl2 with acl1
|
||||||
json = target().path("/acl").request()
|
json = target().path("/acl").request()
|
||||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
|
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
|
||||||
@ -79,6 +87,16 @@ public class TestAclResource extends BaseJerseyTest {
|
|||||||
.param("target", "acl2")
|
.param("target", "acl2")
|
||||||
.param("type", "USER")), JsonObject.class);
|
.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)
|
// Add an ACL WRITE for acl2 with acl1 (again)
|
||||||
target().path("/acl").request()
|
target().path("/acl").request()
|
||||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
|
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
|
||||||
@ -114,7 +132,7 @@ public class TestAclResource extends BaseJerseyTest {
|
|||||||
.request()
|
.request()
|
||||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl2Token)
|
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl2Token)
|
||||||
.get(JsonObject.class);
|
.get(JsonObject.class);
|
||||||
JsonArray documents = json.getJsonArray("documents");
|
documents = json.getJsonArray("documents");
|
||||||
Assert.assertEquals(1, documents.size());
|
Assert.assertEquals(1, documents.size());
|
||||||
|
|
||||||
// Get the document as acl1
|
// Get the document as acl1
|
||||||
@ -217,8 +235,8 @@ public class TestAclResource extends BaseJerseyTest {
|
|||||||
|
|
||||||
// Delete the ACL READ for acl1 with acl1
|
// Delete the ACL READ for acl1 with acl1
|
||||||
response = target().path("/acl/" + document1Id + "/READ/" + acl1Id).request()
|
response = target().path("/acl/" + document1Id + "/READ/" + acl1Id).request()
|
||||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
|
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acl1Token)
|
||||||
.delete();
|
.delete();
|
||||||
Assert.assertEquals(Status.BAD_REQUEST, Status.fromStatusCode(response.getStatus()));
|
Assert.assertEquals(Status.BAD_REQUEST, Status.fromStatusCode(response.getStatus()));
|
||||||
|
|
||||||
// Delete the ACL WRITE for acl1 with acl1
|
// Delete the ACL WRITE for acl1 with acl1
|
||||||
|
Loading…
Reference in New Issue
Block a user