Created
February 20, 2013 18:42
-
-
Save okram/4997949 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testQuery() { | |
EgoSystemGraph g = new EgoSystemGraph(); | |
GetHomepageUriExtension gt = new GetHomepageUriExtension(); | |
JSONObject request = new JSONObject(''' | |
{ | |
person : 'Marko A. Rodriguez', | |
institution : 'Aurelius' | |
} | |
'''); | |
JSONObject result = gt.evaluate(new RexsterResourceContext(null, null, null, request, null, null, null), g).getJerseyResponse().getEntity(); | |
assertEquals(result.getString(Tokens.RESULT), "http://markorodriguez.com/"); | |
request = new JSONObject(''' | |
{ | |
person : 'Herbert van de Sompel', | |
institution : 'Los Alamos National Laboratory' | |
} | |
'''); | |
result = gt.evaluate(new RexsterResourceContext(null, null, null, request, null, null, null), g).getJerseyResponse().getEntity(); | |
assertEquals(result.getString(Tokens.RESULT), "http://public.lanl.gov/herbertv/bio/"); | |
request = new JSONObject(''' | |
{ | |
person : 'Jae-Wook Kim', | |
institution : 'Seoul National University' | |
} | |
'''); | |
result = gt.evaluate(new RexsterResourceContext(null, null, null, request, null, null, null), g).getJerseyResponse().getEntity(); | |
assertEquals(result.getString(Tokens.RESULT), ""); // his title name is in Korean (crazy characters) | |
request = new JSONObject(''' | |
{ | |
person : 'Rhiannon Meharchand', | |
institution : 'Michigan State University' | |
} | |
'''); | |
result = gt.evaluate(new RexsterResourceContext(null, null, null, request, null, null, null), g).getJerseyResponse().getEntity(); | |
assertEquals(result.getString(Tokens.RESULT), "http://www.linkedin.com/in/rhiannonmeharchand"); // his real homepage gives a 404 | |
request = new JSONObject(''' | |
{ | |
person : 'Johan Bollen', | |
institution : 'Indiana University' | |
} | |
'''); | |
result = gt.evaluate(new RexsterResourceContext(null, null, null, request, null, null, null), g).getJerseyResponse().getEntity(); | |
assertEquals(result.getString(Tokens.RESULT), "http://cnets.indiana.edu/people/johan-bollen"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment