use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.
the class TableEntryTest method test4.
@Test
@SuppressWarnings("deprecation")
public void test4() {
TableEntry te = new TableEntry("bla", "bla", "bla", "bla", new Date(1, 1, 1), new Date(1, 1, 1), "", "", "", "", "");
te.setUrl("url");
te.setName("name");
te.setDeathPlace("deathPlace");
te.setBirthPlace("birthPlace");
te.setBirthDate(new Date(2000, 10, 21));
te.setDeathDate(new Date(2015, 10, 21));
te.setOverview("An interesting overview");
assertEquals(te.getBirthDate(), new Date(2000, 10, 21));
assertEquals(te.getDeathDate(), new Date(2015, 10, 21));
assertEquals("birthPlace", te.getBirthPlace());
assertEquals("deathPlace", te.getDeathPlace());
assertEquals("url", te.getUrl());
assertEquals("name", te.getName());
assertEquals("An interesting overview", te.getOverview());
}
use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.
the class TableEntryTest method test1.
@Test
public void test1() {
TableEntry te = new TableEntry();
assertNull(te.getBirthDate());
assertNull(te.getDeathDate());
assertEquals("", te.getBirthPlace());
assertEquals("", te.getDeathPlace());
assertEquals("", te.getUrl());
assertEquals("", te.getName());
}
use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.
the class InfoevalServiceImp method differentDeathPlace.
@Override
@RequestMapping(path = "Queries/Query1", method = RequestMethod.GET)
public ArrayList<TableEntry> differentDeathPlace() throws Exception {
logger.log(Level.INFO, "Born and died in different place was called");
//ArrayList<TableEntry> $ = new ArrayList<>();
//
//java.sql.Date utilDate1 = java.sql.Date.valueOf( LocalDate.of(1912, 6, 23) );
// java.sql.Date utilDate2 = java.sql.Date.valueOf( LocalDate.of(1954, 6, 7) );
//
// TableEntry entry = new TableEntry(null, "Alan Turing", "Maida Vale", "Wilmslow", utilDate1, utilDate2,"","","");
//$.add(entry);
//
//utilDate1 = java.sql.Date.valueOf((LocalDate.of(1886, 10, 16)));
//utilDate2 = java.sql.Date.valueOf(LocalDate.of(1973, 12, 1));
//
//entry = new TableEntry(null, "David Ben-Gurion", "plonsk", "Ramat Gan", utilDate1, utilDate2,"","","");
//$.add(entry);
//return $;
//This is the code that should really run. The code above is just a stub. We don't run the actual Java code to find real resultsbecause the server is too slow for now ...
/*
* TODO: DO NOT REMOVE THE CODE BELOW !!!! @MOSHIKO
*
*/
SqlRunner runner = new SqlRunner();
ArrayList<TableEntry> $ = runner.getDifferentDeathPlace();
logger.log(Level.INFO, "list size:" + $.size());
return $;
}
use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.
the class SqlRunnerTest method getPersonalInfoTest.
@Ignore
@Test
public void getPersonalInfoTest() throws Exception {
String name = "yasuhiro takato";
TableEntry te = querun.getPersonalInfo(name);
System.out.println("Name is " + te.getName());
System.out.println("Birth Place is " + te.getBirthPlace());
System.out.println("Birth Place is " + te.getDeathPlace());
Date birthDate = te.getBirthDate();
if (birthDate != null)
System.out.println("Birth Date is " + birthDate);
Date deathDate = te.getDeathDate();
if (deathDate != null)
System.out.println("Death Date is " + deathDate);
System.out.println("Occupation is " + te.getOccupation());
System.out.println("Spouse Name is " + te.getSpouseName());
System.out.println("Spouse Occupation is " + te.getSpouseOccupation());
System.out.println("PhotoLink is " + te.getPhotoLink());
System.out.println("Abstract is " + te.getOverview());
}
use of infoeval.main.mysql.TableEntry in project Info-Evaluation by TechnionYP5777.
the class SqlRunnerTest method getOccupationBetweenYearsTest.
@Ignore
@Test
public void getOccupationBetweenYearsTest() throws Exception {
for (TableEntry te : querun.getOccupationBetweenYears("1840", "1920", "Politician")) {
assertEquals(te.getOccupation(), "Politician");
java.sql.Date birthDate = te.getBirthDate();
SimpleDateFormat formatYear = new SimpleDateFormat("yyyy");
String birthYear = formatYear.format(birthDate);
int bYear = Integer.parseInt(birthYear);
assert bYear >= 1840;
java.sql.Date deathDate = te.getDeathDate();
formatYear.format(deathDate);
assert Integer.parseInt(birthYear) <= 1920;
}
}
Aggregations