Skip to content

Commit

Permalink
fixed serveraddress for subjects and removed debugging query
Browse files Browse the repository at this point in the history
  • Loading branch information
fasseg committed May 17, 2013
1 parent c1544aa commit d5da86c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Expand Up @@ -105,7 +105,7 @@ public Response searchSubmitRdf(@FormParam("terms") final String terms,
/* and add the RDF model of each found fedora:resource node to the response model */
for (ObjectFields field : result.getObjectFieldsList()){
final FedoraResource fo = this.nodeService.getObject(session, field.getPath());
Resource objResource = model.createResource("info:fedora/"+ field.getPath());
Resource objResource = model.createResource(uriInfo.getBaseUri().toASCIIString() + "rest" + field.getPath());
model.add(JcrRdfTools.getJcrPropertiesModel(FedoraResource.DEFAULT_SUBJECT_FACTORY, fo.getNode()));
}

Expand Down Expand Up @@ -201,8 +201,7 @@ public FieldSearchResult search(final Query query, final int offSet,
public static String buildQueryString() {
//TODO expand to more fields
final String sqlExpression =
"SELECT * FROM [" + FEDORA_RESOURCE + "] WHERE PATH([" + FEDORA_RESOURCE + "]) like $sterm OR [dc:identifier] like $sterm OR [dc:title] like $sterm";
// "SELECT * FROM [" + FEDORA_RESOURCE + "] WHERE [dc:identifier] like $sterm OR [dc:title] like $sterm";
"SELECT * FROM [" + FEDORA_RESOURCE + "] WHERE [dc:identifier] like $sterm OR [dc:title] like $sterm";
return sqlExpression;
}
}
Expand Up @@ -50,8 +50,8 @@ public void testSearchSubmitRdfJSON() throws Exception {

/* and add a dc title to the object so the query returns a result */
HttpPost postDc = new HttpPost(serverAddress + "objects/testobj");
postDc.addHeader("Content-Type", "application/sparql-update");
String updateString = "INSERT { <info:fedora/objects/testobj> <http://purl.org/dc/terms/title> \"testobj\" } WHERE { }";
postDc.setHeader("Content-Type", "application/sparql-update");
String updateString = "INSERT { <" + serverAddress + "objects/testobj> <http://purl.org/dc/terms/title> \"testobj\" } WHERE { }";
postDc.setEntity(new StringEntity(updateString));
HttpResponse dcResp = execute(postDc);
assertTrue(dcResp.getStatusLine().toString(),204 == dcResp.getStatusLine().getStatusCode());
Expand All @@ -69,8 +69,7 @@ public void testSearchSubmitRdfJSON() throws Exception {
HttpResponse resp = execute(method);
String json = IOUtils.toString(resp.getEntity().getContent());
assertEquals("Server returned\n" + json, 200, resp.getStatusLine().getStatusCode());
logger.debug("RDF/JSON Response for field search:\n" + json);
assertTrue(new JSONObject(json).getJSONObject("http://localhost:8080/rest/fcr:search")
assertTrue(new JSONObject(json).getJSONObject(serverAddress + "fcr:search")
.getJSONArray("info:fedora/fedora-system:def/search#numSearchResults")
.getJSONObject(0).getString("value").equals("1"));
method.releaseConnection();
Expand Down

0 comments on commit d5da86c

Please sign in to comment.