Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of ssh://git-repo.oucs.ox.ac.uk/~git/repos/loca…

…l-project/sirlouie
  • Loading branch information...
commit 2e4f01eb6fdf3dfc19c788621813c1dc2c337a97 2 parents cad8a64 + fb15641
@buckett buckett authored
View
8 src/main/java/uk/ac/ox/oucs/sirlouie/primo/PrimoService.java
@@ -28,21 +28,25 @@
public PrimoService(String webResourceURL) {
- log.debug(webResourceURL);
+ //log.debug(webResourceURL);
client = Client.create();
webResource = client.resource(webResourceURL);
}
public ResponseBean getResource(String id) throws Exception {
- log.debug("getResource ["+id+"]");
+ //log.debug("getResource ["+id+"]");
MultivaluedMap<String, String> params = new MultivaluedMapImpl();
params.add("institution", "OXVU1");
params.add("docId", id);
params.add("isLoggedIn", "false");
params.add("onCampus", "false");
+ WebResource query = webResource.queryParams(params);
+ //System.out.println("PrimoService.query ["+query.getURI().toString()+"]");
+
String responseXML = webResource.queryParams(params).get(String.class);
+ //System.out.println("PrimoService.response ["+responseXML+"]");
//log.debug("response ["+responseXML+"]");
ResponseBean responseBean = new ResponseBean(id);
View
12 src/main/java/uk/ac/ox/oucs/sirlouie/sfx/SFXService.java
@@ -28,23 +28,27 @@
public SFXService(String webResourceURL) {
- log.debug(webResourceURL);
+ //log.debug(webResourceURL);
client = Client.create();
webResource = client.resource(webResourceURL);
}
public ResponseBean getResource(String id) throws Exception {
- log.debug("getResource");
MultivaluedMap<String, String> params = new MultivaluedMapImpl();
params.add("sfx.response_type", "simplexml");
+ WebResource query = webResource.queryParams(params);
+ //System.out.println("SFXService.query ["+query.getURI().toString()+"]");
+ //log.debug("Query ["+query.getURI().toString()+"]");
+
String responseXML = webResource.queryParams(params).get(String.class);
- log.debug("response ["+responseXML+"]");
+ //System.out.println("SFXService.response ["+responseXML+"]");
+ //log.debug("response ["+responseXML+"]");
- ResponseBean responseBean = new ResponseBean();
Collection<SearObject> beans = filterResponse(responseXML);
+ ResponseBean responseBean = new ResponseBean();
Document document = new Document(id, null);
document.addItems(beans);
responseBean.addDocument(document);
View
14 src/main/webapp/WEB-INF/web.xml
@@ -9,7 +9,11 @@
<context-param>
<param-name>webresourceURL</param-name>
+ <!--
<param-value>http://primo-s-web-2.sers.ox.ac.uk:1701/PrimoWebServices/xservice/getit</param-value>
+ -->
+ <param-value>http://solo.bodleian.ox.ac.uk/PrimoWebServices/xservice/getit</param-value>
+
<param-type>java.lang.String</param-type>
</context-param>
@@ -22,10 +26,16 @@
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>uk.ac.ox.oucs.sirlouie</param-value>
</init-param>
- <init-param>
+
+ <init-param>
<param-name>ConfigClass</param-name>
- <param-value>uk.ac.ox.oucs.sirlouie.properties.SakaiProperties</param-value>
+ <!--
+ Properties taken from sakai.properties or from context
+ -->
+ <!--param-value>uk.ac.ox.oucs.sirlouie.properties.SakaiProperties</param-value-->
+ <param-value>uk.ac.ox.oucs.sirlouie.properties.ContextProperties</param-value>
</init-param>
+
<load-on-startup>1</load-on-startup>
</servlet>
View
10 src/test/java/uk/ac/ox/oucs/sirlouie/PrimoServiceTest.java
@@ -330,10 +330,9 @@ public void testGetOLISResource() {
System.out.println("testGetResource("+(System.currentTimeMillis()-l)+")");
Assert.assertNotNull(bean);
- Map<String, Object> jsonData = bean.toJSON("2009-06-09T15:39:52.831+02:00");
- ObjectMapper mapper = new ObjectMapper();
+ JSONObject jsonData = bean.toJSON("2009-06-09T15:39:52.831+02:00");
- Assert.assertEquals(OLIS_JSON, mapper.writeValueAsString(jsonData));
+ Assert.assertEquals(OLIS_JSON, jsonData.toString());
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
@@ -350,10 +349,9 @@ public void testGetORAResource() {
System.out.println("testGetResource("+(System.currentTimeMillis()-l)+")");
Assert.assertNotNull(bean);
- Map<String, Object> jsonData = bean.toJSON("2009-06-09T15:39:52.831+02:00");
- ObjectMapper mapper = new ObjectMapper();
+ JSONObject jsonData = bean.toJSON("2009-06-09T15:39:52.831+02:00");
- Assert.assertEquals(ORA_JSON, mapper.writeValueAsString(jsonData));
+ Assert.assertEquals(ORA_JSON, jsonData.toString());
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
Please sign in to comment.
Something went wrong with that request. Please try again.