Created
April 16, 2009 03:41
-
-
Save stephenroller/96195 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
### Jazz Patch 1.0 | |
#date: "2009-04-15 23:42:41.000000234 -0400" | |
#itemid: "iTrust/unittests/edu/ncsu/csc/itrust/dao" "_R3TmkBpGEd6nA98H4Bi_fQ" "_n1RZMBZVEd6JG7OCVhzRHg" | |
#itemid: "iTrust/src/edu/ncsu/csc/itrust/dao/mysql" "_R5W1ABpGEd6nA98H4Bi_fQ" "_n1RZMBZVEd6JG7OCVhzRHg" | |
#itemid: "iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java" "_yHEdACPmEd6N8ZDIVCJVWg" "_n1RZMBZVEd6JG7OCVhzRHg" | |
#itemid: "iTrust/unittests/edu/ncsu/csc/itrust/dao/ConsultationDAOTest.java" "_Tf3D4CR6Ed6RqZ79QsSawQ" "_n1RZMBZVEd6JG7OCVhzRHg" | |
#before_state: "iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java" "_yHEdACPmEd6N8ZDIVCJVWg" "_Qs43oSn5Ed6JG7OCVhzRHg" | |
#before_state: "iTrust/unittests/edu/ncsu/csc/itrust/dao/ConsultationDAOTest.java" "_Tf3D4CR6Ed6RqZ79QsSawQ" "_BXc48SmcEd6JG7OCVhzRHg" | |
# | |
diff -u -N iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java | |
--- iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java 2009-04-15 11:34:57.000000171 -0400 | |
+++ iTrust/src/edu/ncsu/csc/itrust/dao/mysql/ConsultationDAO.java 2009-04-15 23:34:19.000000000 -0400 | |
@@ -152,9 +152,9 @@ | |
* @return the recieving HCPs MID | |
* @throws DBException | |
*/ | |
- public long getRecievingHCP(int cid) throws DBException{ | |
+ public long getReceivingHCP(int cid) throws DBException{ | |
String query; | |
- query = "SELECT C.recievingHCP " + | |
+ query = "SELECT C.receivingHCP " + | |
"FROM consultation AS C " + | |
"WHERE C.consult_id = ? "; | |
Connection conn = null; | |
@@ -165,7 +165,7 @@ | |
ps.setInt(1,cid); | |
ResultSet rs = ps.executeQuery(); | |
rs.next(); | |
- return rs.getLong("recievingHCP"); | |
+ return rs.getLong("receivingHCP"); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
throw new DBException(e); | |
@@ -209,9 +209,38 @@ | |
* @return the details | |
* @throws DBException | |
*/ | |
- public String getDetails(int cid) throws DBException{ | |
+ public String getConsultationDetails(int cid) throws DBException{ | |
+ String query; | |
+ query = "SELECT C.consultationDetails " + | |
+ "FROM consultation AS C " + | |
+ "WHERE C.consult_id = ? "; | |
+ Connection conn = null; | |
+ PreparedStatement ps = null; | |
+ try { | |
+ conn = factory.getConnection(); | |
+ ps = conn.prepareStatement(query); | |
+ ps.setInt(1,cid); | |
+ | |
+ ResultSet rs = ps.executeQuery(); | |
+ rs.next(); | |
+ return rs.getString("consultationDetails"); | |
+ } catch (SQLException e) { | |
+ e.printStackTrace(); | |
+ throw new DBException(e); | |
+ } finally { | |
+ DBUtil.closeConnection(conn, ps); | |
+ } | |
+ } | |
+ | |
+ /** | |
+ * get the consultations details | |
+ * @param cid the consultation ID | |
+ * @return the details | |
+ * @throws DBException | |
+ */ | |
+ public String getReferralDetails(int cid) throws DBException{ | |
String query; | |
- query = "SELECT C.details " + | |
+ query = "SELECT C.referralDetails " + | |
"FROM consultation AS C " + | |
"WHERE C.consult_id = ? "; | |
Connection conn = null; | |
@@ -223,7 +252,7 @@ | |
ResultSet rs = ps.executeQuery(); | |
rs.next(); | |
- return rs.getString("details"); | |
+ return rs.getString("referralDetails"); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
throw new DBException(e); | |
@@ -231,6 +260,7 @@ | |
DBUtil.closeConnection(conn, ps); | |
} | |
} | |
+ | |
/** | |
* get the consultations status | |
* @param cid the consultation ID | |
diff -u -N iTrust/unittests/edu/ncsu/csc/itrust/dao/ConsultationDAOTest.java iTrust/unittests/edu/ncsu/csc/itrust/dao/ConsultationDAOTest.java | |
--- iTrust/unittests/edu/ncsu/csc/itrust/dao/ConsultationDAOTest.java 2009-04-15 04:55:46.000000931 -0400 | |
+++ iTrust/unittests/edu/ncsu/csc/itrust/dao/ConsultationDAOTest.java 2009-04-15 23:35:36.000000000 -0400 | |
@@ -28,9 +28,10 @@ | |
ConsultationBean cb = new ConsultationBean("pending",9000000002L, 9000000000L, 2L, "awesome", "legendary"); | |
int cid = consultationDAO.addConsultation(cb); | |
assertEquals(9000000000L,consultationDAO.getSendingHCP(cid)); | |
- assertEquals(9000000002L,consultationDAO.getRecievingHCP(cid)); | |
+ assertEquals(9000000002L,consultationDAO.getReceivingHCP(cid)); | |
assertEquals(2L,consultationDAO.getPatientMID(cid)); | |
- assertEquals("awesome",consultationDAO.getDetails(cid)); | |
+ assertEquals("awesome",consultationDAO.getReferralDetails(cid)); | |
+ assertEquals("legendary",consultationDAO.getConsultationDetails(cid)); | |
assertEquals("pending",consultationDAO.getStatus(cid)); | |
consultationDAO.editStatus(cid,"finish"); | |
assertEquals("finish",consultationDAO.getStatus(cid)); | |
@@ -42,7 +43,7 @@ | |
assertEquals(2L,otherbean.getPatientMID()); | |
assertEquals("awesome",otherbean.getReferralDetails()); | |
assertEquals("legendary",otherbean.getConsultationDetails()); | |
- assertEquals("pending",otherbean.getStatus()); | |
+ assertEquals("finish",otherbean.getStatus()); | |
consultationDAO.removeConsultation(cid); | |
@@ -69,7 +70,7 @@ | |
public void testgetRecievingHCPException() throws Exception { | |
try { | |
- evilDAO.getRecievingHCP(1); | |
+ evilDAO.getReceivingHCP(1); | |
fail("DBException should have been thrown"); | |
} catch (DBException e) { | |
assertEquals(EvilDAOFactory.MESSAGE, e.getSQLException().getMessage()); | |
@@ -87,7 +88,7 @@ | |
public void testgetDetailsException() throws Exception { | |
try { | |
- evilDAO.getDetails(1); | |
+ evilDAO.getConsultationDetails(1); | |
fail("DBException should have been thrown"); | |
} catch (DBException e) { | |
assertEquals(EvilDAOFactory.MESSAGE, e.getSQLException().getMessage()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment