Search in sources :

Example 31 with RequestExecutor

use of org.apache.stanbol.commons.testing.http.RequestExecutor in project stanbol by apache.

the class SitesManagerTest method testRetrievel.

/**
     * Tests retrieval of Entities
     * @throws IOException
     * @throws JSONException
     */
@Test
public void testRetrievel() throws IOException, JSONException {
    String id = "http://dbpedia.org/resource/Paris";
    RequestExecutor re = executor.execute(builder.buildGetRequest(SITES_MANAGER_PATH + "/entity", "id", id).withHeader("Accept", "application/json"));
    re.assertStatus(200);
    //do not check for the site of the entity, because this might change
    JSONObject jEntity = assertEntity(re.getContent(), id, null);
    assertRepresentation(jEntity.getJSONObject("representation"), DBPEDIA_DEFAULTDATA_REQUIRED_FIELDS, DBPEDIA_DEFAULTDATA_OPTIONAL_FIELDS);
}
Also used : JSONObject(org.codehaus.jettison.json.JSONObject) RequestExecutor(org.apache.stanbol.commons.testing.http.RequestExecutor) DbpediaQueryTest(org.apache.stanbol.entityhub.it.query.DbpediaQueryTest) Test(org.junit.Test)

Aggregations

RequestExecutor (org.apache.stanbol.commons.testing.http.RequestExecutor)31 Test (org.junit.Test)18 JSONObject (org.codehaus.jettison.json.JSONObject)12 HttpDelete (org.apache.http.client.methods.HttpDelete)7 ArrayList (java.util.ArrayList)4 Request (org.apache.stanbol.commons.testing.http.Request)4 JSONArray (org.codehaus.jettison.json.JSONArray)4 HttpPut (org.apache.http.client.methods.HttpPut)3 InputStream (java.io.InputStream)2 List (java.util.List)2 Set (java.util.Set)2 HttpEntityEnclosingRequest (org.apache.http.HttpEntityEnclosingRequest)2 DbpediaQueryTest (org.apache.stanbol.entityhub.it.query.DbpediaQueryTest)2 Before (org.junit.Before)2 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 TreeSet (java.util.TreeSet)1 ZipEntry (java.util.zip.ZipEntry)1