Package org.apache.stanbol.commons.testing.http

Examples of org.apache.stanbol.commons.testing.http.Request


        executor.execute(r).assertStatus(201);
    }

    @Test
    public void getFactSchemaByURN() throws Exception {
        Request r1 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://www.iks-project.eu/ont/test2"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"organization\":\"iks:organization\",\"person\":\"iks:person\"}}}")
                .withHeader("Content-Type", "application/json");

        executor.execute(r1).assertStatus(201);

        Request r2 = builder.buildOtherRequest(
            new HttpGet(builder.buildUrl("/factstore/facts/"
                                         + encodeURI("http://www.iks-project.eu/ont/test2")))).withHeader(
            "Content-Type", "application/json");

        String actual = executor.execute(r2).assertStatus(200).getContent();
View Full Code Here


        Assert.assertEquals(expected, actual);
    }

    @Test
    public void doubleCreateFactSchema() throws Exception {
        Request r = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://www.iks-project.eu/ont/double"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"organization\":\"iks:organization\",\"person\":\"iks:person\"}}}")
View Full Code Here

        executor.execute(r).assertStatus(409);
    }

    @Test
    public void createSchemaMultiTypes() throws Exception {
        Request r = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://www.schema.org/attendees"))))
                .withContent(
                    "{\"@context\":{\"@types\":{\"organization\":\"http://iks-project.eu/ont/organization\",\"person\":[\"http://iks-project.eu/ont/person\",\"http://www.schema.org/Person\"]}}}")
View Full Code Here

        executor.execute(r).assertStatus(201);
    }

    @Test
    public void getSchemaMultiTypes() throws Exception {
        Request r1 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://www.schema.org/Event.attendees"))))
                .withContent(
                    "{\"@context\":{\"@types\":{\"organization\":\"http://iks-project.eu/ont/organization\",\"person\":[\"http://iks-project.eu/ont/person\",\"http://www.schema.org/Person\"]}}}")
                .withHeader("Content-Type", "application/json");

        executor.execute(r1).assertStatus(201);

        Request r2 = builder.buildOtherRequest(
            new HttpGet(builder.buildUrl("/factstore/facts/"
                                         + encodeURI("http://www.schema.org/Event.attendees")))).withHeader(
            "Accept", "application/json");

        String actual = executor.execute(r2).assertStatus(200).getContent();
View Full Code Here

        Assert.assertEquals(expected, actual);
    }

    @Test
    public void postSingleFact() throws Exception {
        Request r1 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://iks-project.eu/ont/employeeOf1"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"organization\":\"iks:organization\"}}}")
                .withHeader("Content-Type", "application/json");

        executor.execute(r1).assertStatus(201);

        Request r2 = builder
                .buildOtherRequest(new HttpPost(builder.buildUrl("/factstore/facts/")))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@profile\":\"iks:employeeOf1\",\"person\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}}")
                .withHeader("Content-Type", "application/json");
View Full Code Here

        executor.execute(r2).assertStatus(200).assertHeader("Location", builder.buildUrl("/factstore/facts/http%3A%2F%2Fiks-project.eu%2Font%2FemployeeOf1/1"));
    }
   
    @Test
    public void postSingleFactNeg() throws Exception {
        Request r1 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://iks-project.eu/ont/employeeOf1Neg"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"organization\":\"iks:organization\"}}}")
                .withHeader("Content-Type", "application/json");

        executor.execute(r1).assertStatus(201);

        Request r2 = builder
                .buildOtherRequest(new HttpPost(builder.buildUrl("/factstore/facts/")))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@profile\":\"iks:employeeOf1Wrong\",\"person\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}}")
                .withHeader("Content-Type", "application/json");
View Full Code Here

        executor.execute(r2).assertStatus(500);
    }
   
    @Test
    public void postSingleFactNeg2() throws Exception {
        Request r1 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://iks-project.eu/ont/employeeOf2Neg"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"organization\":\"iks:organization\"}}}")
                .withHeader("Content-Type", "application/json");

        executor.execute(r1).assertStatus(201);

        Request r2 = builder
                .buildOtherRequest(new HttpPost(builder.buildUrl("/factstore/facts/")))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@profile\":\"iks:employeeOf2Neg\",\"people\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}}")
                .withHeader("Content-Type", "application/json");
View Full Code Here

        executor.execute(r2).assertStatus(500);
    }

    @Test
    public void postMultiFactsMultiTypes() throws Exception {
        Request r1 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://iks-project.eu/ont/employeeOf2"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"organization\":\"iks:organization\"}}}")
                .withHeader("Content-Type", "application/json");
        executor.execute(r1).assertStatus(201);

        Request r2 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://iks-project.eu/ont/friendOf2"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"friend\":\"iks:person\"}}}")
                .withHeader("Content-Type", "application/json");
        executor.execute(r2).assertStatus(201);

        Request r3 = builder
                .buildOtherRequest(new HttpPost(builder.buildUrl("/factstore/facts/")))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@subject\":[{\"@profile\":\"iks:employeeOf2\",\"person\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}},{\"@profile\":\"iks:friendOf2\",\"person\":{\"@iri\":\"upb:bnagel\"},\"friend\":{\"@iri\":\"upb:fchrist\"}}]}")
                .withHeader("Content-Type", "application/json");
        executor.execute(r3).assertStatus(200);
View Full Code Here

        executor.execute(r3).assertStatus(200);
    }

    @Test
    public void postMultiFactsMultiTypesNeg() throws Exception {
        Request r1 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://iks-project.eu/ont/employeeOf3Neg"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"organization\":\"iks:organization\"}}}")
                .withHeader("Content-Type", "application/json");
        executor.execute(r1).assertStatus(201);

        Request r2 = builder
                .buildOtherRequest(
                    new HttpPut(builder.buildUrl("/factstore/facts/"
                                                 + encodeURI("http://iks-project.eu/ont/friendOf3Neg"))))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"friend\":\"iks:person\"}}}")
                .withHeader("Content-Type", "application/json");
        executor.execute(r2).assertStatus(201);

        Request r3 = builder
                .buildOtherRequest(new HttpPost(builder.buildUrl("/factstore/facts/")))
                .withContent(
                    "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@subject\":[{\"@profile\":\"iks:employeeOf3NegWrong\",\"person\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://uni-paderborn.de\"}},{\"@profile\":\"iks:friendOf3Neg\",\"person\":{\"@iri\":\"upb:bnagel\"},\"friend\":{\"@iri\":\"upb:fchrist\"}}]}")
                .withHeader("Content-Type", "application/json");
        executor.execute(r3).assertStatus(500);
View Full Code Here

        executor.execute(r3).assertStatus(500);
    }
   
    @Test
    public void querySingleFact() throws Exception {
        Request r1 = builder
        .buildOtherRequest(
            new HttpPut(builder.buildUrl("/factstore/facts/"
                                         + encodeURI("http://iks-project.eu/ont/employeeOf"))))
        .withContent(
            "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"@types\":{\"person\":\"iks:person\",\"organization\":\"iks:organization\"}}}")
        .withHeader("Content-Type", "application/json");
        executor.execute(r1).assertStatus(201);

        Request r2 = builder
        .buildOtherRequest(new HttpPost(builder.buildUrl("/factstore/facts/")))
        .withContent(
            "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\",\"upb\":\"http://upb.de/persons/\"},\"@profile\":\"iks:employeeOf\",\"person\":{\"@iri\":\"upb:bnagel\"},\"organization\":{\"@iri\":\"http://upb.de\"}}")
        .withHeader("Content-Type", "application/json");
        executor.execute(r2).assertStatus(200);
       
        String queryString = "{\"@context\":{\"iks\":\"http://iks-project.eu/ont/\"},\"select\":[\"person\"],\"from\":\"iks:employeeOf\",\"where\":[{\"=\":{\"organization\":{\"@iri\":\"http://upb.de\"}}}]}";
        Request q = builder
        .buildOtherRequest(new HttpPost(builder.buildUrl("/factstore/query/")))
        .withContent(queryString)
        .withHeader("Content-Type", "application/json")
        .withHeader("Accept", "application/json");
               
View Full Code Here

TOP

Related Classes of org.apache.stanbol.commons.testing.http.Request

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.