-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4aad7b
commit 6edc510
Showing
4 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
78 changes: 78 additions & 0 deletions
78
src/test/java/org/sandiegozoo/pathology/contact_tracer/DaylightSavingsTimeTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package org.sandiegozoo.pathology.contact_tracer; | ||
|
||
import java.io.*; | ||
import java.util.List; | ||
|
||
import org.hibernate.Query; | ||
import org.hibernate.Session; | ||
import org.hibernate.SessionFactory; | ||
import org.hibernate.cfg.Configuration; | ||
import org.sandiegozoo.pathology.contact_tracer.dataimport.*; | ||
import org.sandiegozoo.pathology.database.domain.*; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class DaylightSavingsTimeTest extends MyBase { | ||
|
||
|
||
CTIOHandler timeline_reader; | ||
CTIOHandler infection_reader; | ||
|
||
public void setUp(){ | ||
|
||
// A SessionFactory is set up once for an application | ||
this.setupFactory(); | ||
|
||
timeline_reader = new TimelineHandler(new File(getClass().getClassLoader().getResource("DSTTestFiles/dst_timeline.txt").getFile())); | ||
timeline_reader.setSessionFactory(sessionFactory); | ||
infection_reader = new InfectionHandler(new File(getClass().getClassLoader().getResource("DSTTestFiles/dst_infections.txt").getFile())); | ||
infection_reader.setSessionFactory(sessionFactory); | ||
|
||
|
||
} | ||
|
||
public void testTracer(){ | ||
|
||
System.out.println("LOADING TIMELINE"); | ||
|
||
//Attempt loading the timeline file | ||
try { | ||
timeline_reader.call(); | ||
} catch (Exception e) { | ||
this.fail(e.getMessage()); | ||
} | ||
|
||
System.out.println("LOADING INFECTIONS"); | ||
|
||
//Attempt loading the infection file | ||
try { | ||
infection_reader.call(); | ||
} catch (Exception e) { | ||
this.fail(e.getMessage()); | ||
} | ||
|
||
|
||
ContactTracer myTracer = new ContactTracer(sessionFactory); | ||
|
||
myTracer.process_contaminations(); | ||
myTracer.process_exposures(); | ||
|
||
System.out.println("FINISHED CONTACT TRACER"); | ||
|
||
Session session = sessionFactory.openSession(); | ||
Query find_contaminations = session.createQuery("from Contamination"); | ||
List<Contamination> my_contaminations = (List<Contamination>)find_contaminations.list(); | ||
for(Contamination one_contam : my_contaminations){ | ||
System.out.println("FOUND A CONTAMINATION: " + one_contam); | ||
} | ||
|
||
Query find_exposures = session.createQuery("from Exposure"); | ||
List<Exposure> my_exposures = (List<Exposure>)find_exposures.list(); | ||
for(Exposure one_exp : my_exposures){ | ||
System.out.println("FOUND AN EXPOSURE: " + one_exp); | ||
} | ||
|
||
session.close(); | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Infected, 0, 1984-02-02, 2010-01-01 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Infected, HotelCalifornia, 1998-10-18, 1998-11-10 | ||
Target, HotelCalifornia, 1990-01-01, 2000-01-01 |