Package org.apache.stanbol.factstore.web.resource

Examples of org.apache.stanbol.factstore.web.resource.FactsResource


        this.uriInfoMock = new UriInfoMock();
    }

    @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


        assertTrue(response.getStatus() == Status.OK.getStatusCode());
    }

    @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

        assertTrue(response.getStatus() == Status.BAD_REQUEST.getStatusCode());
    }

    @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

        assertTrue(response.getStatus() == Status.BAD_REQUEST.getStatusCode());
    }

    @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

        assertTrue(response.getStatus() == Status.BAD_REQUEST.getStatusCode());
    }

    @Test
    public void testTooLongURN() {
        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\"}}}",
                    "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

        assertTrue(response.getStatus() == Status.BAD_REQUEST.getStatusCode());
    }

    @Test
    public void testPutFactSchemaValidInput() {
        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

        assertTrue(response.getStatus() == Status.CREATED.getStatusCode());
    }

    @Test
    public void testPostSingleFact() {
        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());
View Full Code Here

        assertEquals("http://testhost:1234/factstore/facts/http%3A%2F%2Fiks-project.eu%2Font%2FemployeeOf/99", response.getMetadata().get("Location").get(0).toString());
    }

    @Test
    public void testPostMultiFacts() {
        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());
View Full Code Here

        assertNull(response.getEntity());
    }

    @Test
    public void testPostMultiFactsDifferentTypes() {
        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

TOP

Related Classes of org.apache.stanbol.factstore.web.resource.FactsResource

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.