Package org.apache.stanbol.factstore

Examples of org.apache.stanbol.factstore.HttpHeadersMock


    }

    @Test
    public void testGet() {
        FactsResource fr = new FactsResourceWrapper(this.servletContext, this.uriInfoMock);
        Response response = fr.get(new HttpHeadersMock());
        assertTrue(response.getStatus() == Status.OK.getStatusCode());
    }
View Full Code Here


    @Test
    public void testPutFactSchemaNoSchemaURI() {
        FactsResource fr = new FactsResourceWrapper(this.servletContext, this.uriInfoMock);

        Response response = fr.putFactSchema("", null, new HttpHeadersMock());
        assertTrue(response.getStatus() == Status.BAD_REQUEST.getStatusCode());
    }
View Full Code Here

    @Test
    public void testPutFactSchemaNoJSON() {
        FactsResource fr = new FactsResourceWrapper(this.servletContext, this.uriInfoMock);

        Response response = fr.putFactSchema("no JSON-LD string", "test2", new HttpHeadersMock());
        assertTrue(response.getStatus() == Status.BAD_REQUEST.getStatusCode());
    }
View Full Code Here

    @Test
    public void testPutFactSchemaNoJSONSchema() {
        FactsResource fr = new FactsResourceWrapper(this.servletContext, this.uriInfoMock);

        Response response = fr.putFactSchema("{}", "test2", new HttpHeadersMock());
        assertTrue(response.getStatus() == Status.BAD_REQUEST.getStatusCode());
    }
View Full Code Here

        Response response = fr
                .putFactSchema(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"organization\":\"iks:organization\"}}}",
                    "http://www.test.de/this/urn/is/a/bit/too/long/to/be/used/in/this/fact/store/implementation/with/derby",
                    new HttpHeadersMock());
        assertTrue(response.getStatus() == Status.BAD_REQUEST.getStatusCode());
    }
View Full Code Here

        FactsResource fr = new FactsResourceWrapper(this.servletContext, this.uriInfoMock);

        Response response = fr
                .putFactSchema(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"organization\":\"iks:organization\"}}}",
                    "test2", new HttpHeadersMock());
        assertTrue(response.getStatus() == Status.CREATED.getStatusCode());
    }
View Full Code Here

        FactsResource fr = new FactsResourceWrapper(this.servletContext, this.uriInfoMock);

        Response response = fr
                .postFacts(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@profile\":\"iks:employeeOf\",\"person\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}}",
                    new HttpHeadersMock());

        assertTrue(response.getStatus() == Status.OK.getStatusCode());
        System.out.println(response.getMetadata().get("Location").get(0));
        assertEquals("http://testhost:1234/factstore/facts/http%3A%2F%2Fiks-project.eu%2Font%2FemployeeOf/99", response.getMetadata().get("Location").get(0).toString());
    }
View Full Code Here

        FactsResource fr = new FactsResourceWrapper(this.servletContext, this.uriInfoMock);

        Response response = fr
                .postFacts(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@profile\":\"iks:employeeOf\",\"@subject\":[{\"person\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}},{\"person\":{\"@iri\":\"upb:fchrist\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}}]}",
                    new HttpHeadersMock());

        assertTrue(response.getStatus() == Status.OK.getStatusCode());
        assertNull(response.getEntity());
    }
View Full Code Here

        FactsResource fr = new FactsResourceWrapper(this.servletContext, this.uriInfoMock);

        Response response = fr
                .postFacts(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@subject\":[{\"@profile\":\"iks:employeeOf\",\"person\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}},{\"@profile\":\"iks:friendOf\",\"person\":{\"@iri\":\"upb:bnagel\"},\"friend\":{\"@iri\":\"upb:fchrist\"}}]}",
                    new HttpHeadersMock());

        assertTrue(response.getStatus() == Status.OK.getStatusCode());
    }
View Full Code Here

    public void testValidQuery() {
        QueryResource qr = new QueryResource(this.servletContext);
       
        String queryString = "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\"},\"select\":[\"person\"],\"from\":\"iks:employeeOf\",\"where\":[{\"=\":{\"organization\":{\"@iri\":\"http://upb.de\"}}}]}";
       
        Response response = qr.query(queryString, new HttpHeadersMock());
        assertTrue(response.getStatus() == Status.OK.getStatusCode());
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.factstore.HttpHeadersMock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.