List of usage examples for java.time LocalTime parse
public static LocalTime parse(CharSequence text)
From source file:org.ojbc.adapters.analyticsstaging.custody.CamelContextAdamsTest.java
public void testBookingReportServiceRouteDup() throws Exception, IOException { Exchange senderExchange = createSenderExchange( "src/test/resources/xmlInstances/bookingReport/BookingReport-Adams-dup.xml"); Person person = analyticalDatastoreDAO.getPerson(1); Assert.assertNotNull(person);//from w w w. ja va 2s .c om Booking booking = analyticalDatastoreDAO.getBookingByBookingNumber("Booking Number"); assertNotNull(booking); List<BookingCharge> bookingCharges = analyticalDatastoreDAO.getBookingCharges(1); assertFalse(bookingCharges.isEmpty()); List<BookingArrest> bookingArrests = analyticalDatastoreDAO.getBookingArrests(1); assertFalse(bookingArrests.isEmpty()); //Send the one-way exchange. Using template.send will send an one way message Exchange returnExchange = template.send("direct:bookingReportServiceEndpoint", senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); } assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from Booking", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=2 from BookingArrest", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=2 from BookingCharge", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from Location", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from Person", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from BehavioralHealthAssessment", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from Treatment", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from BehavioralHealthEvaluation", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BehavioralHealthAssessmentCategory", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from PrescribedMedication", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from CustodyRelease", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChange", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChangeArrest", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChangeCharge", Boolean.class)); booking = analyticalDatastoreDAO.getBookingByBookingNumber("Booking Number"); assertNotNull(booking); assertEquals(LocalDate.parse("2013-12-17"), booking.getBookingDate()); assertEquals(LocalTime.parse("09:30"), booking.getBookingTime()); assertThat(booking.getFacilityId(), is(1)); assertThat(booking.getSupervisionUnitTypeId(), nullValue()); assertEquals("Booking Number", booking.getBookingNumber()); assertEquals(LocalDate.parse("2014-12-17"), booking.getScheduledReleaseDate()); assertThat(booking.getInmateJailResidentIndicator(), is(false)); person = analyticalDatastoreDAO.getPerson(booking.getPersonId()); Assert.assertNotNull(person); assertThat(person.getPersonId(), is(not(1))); assertThat(person.getPersonSexId(), is(1)); assertThat(person.getPersonRaceId(), is(1)); assertThat(person.getPersonSexDescription(), is("Male")); assertThat(person.getPersonRaceDescription(), is("Asian")); assertThat(person.getLanguage(), is("English")); assertThat(person.getPersonBirthDate(), is(LocalDate.parse("1968-12-17"))); Assert.assertEquals("e807f1fcf82d132f9bb018ca6738a19f", person.getPersonUniqueIdentifier()); assertThat(person.getLanguageId(), is(1)); assertThat(person.getSexOffenderStatusTypeId(), is(1)); assertThat(person.getMilitaryServiceStatusType().getValue(), is("Honorable Discharge")); assertThat(person.getEducationLevel(), is("High School Graduate")); assertThat(person.getOccupation(), is("Truck Driver")); List<BehavioralHealthAssessment> behavioralHealthAssessments = analyticalDatastoreDAO .getBehavioralHealthAssessments(booking.getPersonId()); assertFalse(behavioralHealthAssessments.isEmpty()); BehavioralHealthAssessment behavioralHealthAssessment = behavioralHealthAssessments.get(0); assertTrue(behavioralHealthAssessment.getBehavioralHealthDiagnoses().size() == 1); assertThat(behavioralHealthAssessment.getBehavioralHealthDiagnoses().get(0), is("Schizophrenia 295.10")); assertThat(behavioralHealthAssessment.getPersonId(), is(not(1))); assertThat(behavioralHealthAssessment.getBehavioralHealthAssessmentId(), is(not(1))); assertThat(behavioralHealthAssessment.getSeriousMentalIllness(), is(true)); assertThat(behavioralHealthAssessment.getCareEpisodeStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(behavioralHealthAssessment.getCareEpisodeEndDate(), is(LocalDate.parse("2016-04-01"))); assertThat(behavioralHealthAssessment.getEnrolledProviderName(), is("79")); assertThat(behavioralHealthAssessment.getMedicaidStatusTypeId(), nullValue()); List<Treatment> treatments = analyticalDatastoreDAO .getTreatments(behavioralHealthAssessment.getBehavioralHealthAssessmentId()); assertThat(treatments.size(), is(1)); Treatment treatment = treatments.get(0); assertThat(treatment.getBehavioralHealthAssessmentID(), is(not(1))); assertThat(treatment.getTreatmentStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(treatment.getTreatmentAdmissionReasonTypeId(), nullValue()); assertThat(treatment.getTreatmentStatusTypeId(), nullValue()); assertThat(treatment.getTreatmentProviderName(), is("Treatment Providing Organization Name")); List<PrescribedMedication> prescribedMedications = analyticalDatastoreDAO .getPrescribedMedication(behavioralHealthAssessment.getBehavioralHealthAssessmentId()); assertThat(prescribedMedications.size(), is(1)); PrescribedMedication prescribedMedication = prescribedMedications.get(0); assertThat(prescribedMedication.getBehavioralHealthAssessmentID(), is(not(1))); assertThat(prescribedMedication.getMedicationDescription(), is("Zyprexa")); assertThat(prescribedMedication.getMedicationDispensingDate(), is(LocalDate.parse("2016-01-01"))); assertThat(prescribedMedication.getMedicationDoseMeasure(), is("3mg")); bookingArrests = analyticalDatastoreDAO.getBookingArrests(booking.getBookingId()); assertFalse(bookingArrests.isEmpty()); BookingArrest bookingArrest = bookingArrests.get(0); assertThat(bookingArrest.getBookingId(), is(booking.getBookingId())); assertThat(bookingArrest.getBookingArrestId(), is(not(1))); assertEquals("392", bookingArrest.getAddress().getStreetNumber()); assertEquals("Woodlawn Ave", bookingArrest.getAddress().getStreetName()); assertEquals("Burlington", bookingArrest.getAddress().getCity()); assertEquals("NY", bookingArrest.getAddress().getState()); assertEquals("05408", bookingArrest.getAddress().getPostalcode()); assertTrue(bookingArrest.getAddress().getLocationLatitude().doubleValue() == 56.1111); assertTrue(bookingArrest.getAddress().getLocationLongitude().doubleValue() == 32.1111); assertThat(bookingArrest.getArrestAgencyId(), is(29)); bookingCharges = analyticalDatastoreDAO.getBookingCharges(booking.getBookingId()); assertThat(bookingCharges.size(), is(2)); BookingCharge bookingCharge = bookingCharges.get(0); assertThat(bookingCharge.getChargeCode(), is("Charge Code ID")); assertThat(bookingCharge.getBookingArrestId(), is(not(1))); assertTrue(bookingCharge.getBondAmount().doubleValue() == 500.00); assertThat(bookingCharge.getBondType().getValue(), is("CASH/SURETY/PROPERTY")); assertThat(bookingCharge.getAgencyId(), is(21)); assertThat(bookingCharge.getChargeClassTypeId(), is(1)); assertThat(bookingCharge.getBondStatusTypeId(), is(17)); assertThat(bookingCharge.getChargeJurisdictionTypeId(), is(3)); assertThat(bookingCharge.getChargeDisposition(), is("Disposition")); CustodyRelease custodyRelease = analyticalDatastoreDAO.getCustodyReleaseByBookingId(booking.getBookingId()); log.info(custodyRelease.toString()); assertEquals(LocalDate.parse("2014-12-17"), custodyRelease.getReleaseDate()); assertEquals(LocalTime.parse("10:30"), custodyRelease.getReleaseTime()); analyticalDatastoreDAO.deleteBooking(booking.getBookingId()); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from Booking", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BookingArrest", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BookingCharge", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from Location", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from Person", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BehavioralHealthAssessment", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from Treatment", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BehavioralHealthEvaluation", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BehavioralHealthAssessmentCategory", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from PrescribedMedication", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyRelease", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChange", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChangeArrest", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChangeCharge", Boolean.class)); }
From source file:org.ojbc.adapters.analyticsstaging.custody.CamelContextAdamsWrongOrderTest.java
public void testBookingReportServiceRouteDup() throws Exception, IOException { Exchange senderExchange = createSenderExchange( "src/test/resources/xmlInstances/bookingReport/BookingReport-Adams-dup.xml"); Person person = analyticalDatastoreDAO.getPerson(1); Assert.assertNotNull(person);//w w w. j a v a2 s. co m Booking booking = analyticalDatastoreDAO.getBookingByBookingNumber("Booking Number"); assertNotNull(booking); List<BookingCharge> bookingCharges = analyticalDatastoreDAO.getBookingCharges(1); assertFalse(bookingCharges.isEmpty()); List<BookingArrest> bookingArrests = analyticalDatastoreDAO.getBookingArrests(1); assertFalse(bookingArrests.isEmpty()); //Send the one-way exchange. Using template.send will send an one way message Exchange returnExchange = template.send("direct:bookingReportServiceEndpoint", senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); } assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from Booking", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=2 from BookingArrest", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=2 from BookingCharge", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from Location", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from Person", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from BehavioralHealthAssessment", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from Treatment", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from BehavioralHealthEvaluation", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BehavioralHealthAssessmentCategory", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from PrescribedMedication", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=1 from CustodyRelease", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChange", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChangeArrest", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChangeCharge", Boolean.class)); booking = analyticalDatastoreDAO.getBookingByBookingNumber("Booking Number"); assertNotNull(booking); assertEquals(LocalDate.parse("2013-12-17"), booking.getBookingDate()); assertEquals(LocalTime.parse("09:30"), booking.getBookingTime()); assertThat(booking.getFacilityId(), is(1)); assertThat(booking.getSupervisionUnitTypeId(), nullValue()); assertEquals("Booking Number", booking.getBookingNumber()); assertEquals(LocalDate.parse("2014-12-17"), booking.getScheduledReleaseDate()); assertThat(booking.getInmateJailResidentIndicator(), is(false)); person = analyticalDatastoreDAO.getPerson(booking.getPersonId()); Assert.assertNotNull(person); assertThat(person.getPersonId(), is(not(1))); assertThat(person.getPersonSexId(), is(1)); assertThat(person.getPersonRaceId(), is(1)); assertThat(person.getPersonSexDescription(), is("Male")); assertThat(person.getPersonRaceDescription(), is("Asian")); assertThat(person.getLanguage(), is("English")); assertThat(person.getPersonBirthDate(), is(LocalDate.parse("1968-12-17"))); Assert.assertEquals("e807f1fcf82d132f9bb018ca6738a19f", person.getPersonUniqueIdentifier()); assertThat(person.getLanguageId(), is(1)); assertThat(person.getSexOffenderStatusTypeId(), is(1)); assertThat(person.getMilitaryServiceStatusType().getValue(), is("Honorable Discharge")); assertThat(person.getEducationLevel(), is("High School Graduate")); assertThat(person.getOccupation(), is("Truck Driver")); List<BehavioralHealthAssessment> behavioralHealthAssessments = analyticalDatastoreDAO .getBehavioralHealthAssessments(booking.getPersonId()); assertFalse(behavioralHealthAssessments.isEmpty()); BehavioralHealthAssessment behavioralHealthAssessment = behavioralHealthAssessments.get(0); assertTrue(behavioralHealthAssessment.getBehavioralHealthDiagnoses().size() == 1); assertThat(behavioralHealthAssessment.getBehavioralHealthDiagnoses().get(0), is("Schizophrenia 295.10")); assertThat(behavioralHealthAssessment.getPersonId(), is(not(1))); assertThat(behavioralHealthAssessment.getBehavioralHealthAssessmentId(), is(not(1))); assertThat(behavioralHealthAssessment.getSeriousMentalIllness(), is(true)); assertThat(behavioralHealthAssessment.getCareEpisodeStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(behavioralHealthAssessment.getCareEpisodeEndDate(), is(LocalDate.parse("2016-04-01"))); assertThat(behavioralHealthAssessment.getEnrolledProviderName(), is("79")); assertThat(behavioralHealthAssessment.getMedicaidStatusTypeId(), nullValue()); List<Treatment> treatments = analyticalDatastoreDAO .getTreatments(behavioralHealthAssessment.getBehavioralHealthAssessmentId()); assertThat(treatments.size(), is(1)); Treatment treatment = treatments.get(0); assertThat(treatment.getBehavioralHealthAssessmentID(), is(not(1))); assertThat(treatment.getTreatmentStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(treatment.getTreatmentAdmissionReasonTypeId(), nullValue()); assertThat(treatment.getTreatmentStatusTypeId(), nullValue()); assertThat(treatment.getTreatmentProviderName(), is("Treatment Providing Organization Name")); List<PrescribedMedication> prescribedMedications = analyticalDatastoreDAO .getPrescribedMedication(behavioralHealthAssessment.getBehavioralHealthAssessmentId()); assertThat(prescribedMedications.size(), is(1)); PrescribedMedication prescribedMedication = prescribedMedications.get(0); assertThat(prescribedMedication.getBehavioralHealthAssessmentID(), is(not(1))); assertThat(prescribedMedication.getMedicationDescription(), is("Zyprexa")); assertThat(prescribedMedication.getMedicationDispensingDate(), is(LocalDate.parse("2016-01-01"))); assertThat(prescribedMedication.getMedicationDoseMeasure(), is("3mg")); bookingArrests = analyticalDatastoreDAO.getBookingArrests(booking.getBookingId()); assertFalse(bookingArrests.isEmpty()); BookingArrest bookingArrest = bookingArrests.get(0); assertThat(bookingArrest.getBookingId(), is(booking.getBookingId())); assertThat(bookingArrest.getBookingArrestId(), is(not(1))); assertEquals("392", bookingArrest.getAddress().getStreetNumber()); assertEquals("Woodlawn Ave", bookingArrest.getAddress().getStreetName()); assertEquals("Burlington", bookingArrest.getAddress().getCity()); assertEquals("NY", bookingArrest.getAddress().getState()); assertEquals("05408", bookingArrest.getAddress().getPostalcode()); assertTrue(bookingArrest.getAddress().getLocationLatitude().doubleValue() == 56.1111); assertTrue(bookingArrest.getAddress().getLocationLongitude().doubleValue() == 32.1111); assertThat(bookingArrest.getArrestAgencyId(), is(29)); bookingCharges = analyticalDatastoreDAO.getBookingCharges(booking.getBookingId()); assertThat(bookingCharges.size(), is(2)); BookingCharge bookingCharge = bookingCharges.get(0); assertThat(bookingCharge.getChargeCode(), is("Charge Code ID")); assertThat(bookingCharge.getBookingArrestId(), is(not(1))); assertTrue(bookingCharge.getBondAmount().doubleValue() == 500.00); assertThat(bookingCharge.getBondType().getValue(), is("CASH/SURETY/PROPERTY")); assertThat(bookingCharge.getAgencyId(), is(21)); assertThat(bookingCharge.getChargeClassTypeId(), is(1)); assertThat(bookingCharge.getBondStatusTypeId(), is(17)); assertThat(bookingCharge.getChargeJurisdictionTypeId(), is(3)); assertThat(bookingCharge.getChargeDisposition(), is("Disposition")); CustodyRelease custodyRelease = analyticalDatastoreDAO.getCustodyReleaseByBookingId(booking.getBookingId()); log.info(custodyRelease.toString()); assertEquals(LocalDate.parse("2014-12-17"), custodyRelease.getReleaseDate()); assertEquals(LocalTime.parse("10:30"), custodyRelease.getReleaseTime()); assertThat(custodyRelease.getBookingNumber(), is("Booking Number")); analyticalDatastoreDAO.deleteBooking(booking.getBookingId()); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from Booking", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BookingArrest", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BookingCharge", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from Location", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from Person", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BehavioralHealthAssessment", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from Treatment", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BehavioralHealthEvaluation", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from BehavioralHealthAssessmentCategory", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from PrescribedMedication", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyRelease", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChange", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChangeArrest", Boolean.class)); assertTrue(jdbcTemplate.queryForObject("select count(*)=0 from CustodyStatusChangeCharge", Boolean.class)); }
From source file:org.ojbc.adapters.analyticsstaging.custody.CamelContextAdamsTest.java
public void testCustodyReleaseReportServiceRoute() throws Exception { CustodyRelease custodyRelease = analyticalDatastoreDAO.getCustodyReleaseByBookingId(1); assertEquals(LocalDate.parse("2014-12-17"), custodyRelease.getReleaseDate()); assertEquals(LocalTime.parse("10:30"), custodyRelease.getReleaseTime()); Exchange senderExchange = createSenderExchange( "src/test/resources/xmlInstances/custodyReleaseReport/CustodyReleaseReport-Adams.xml"); //Send the one-way exchange. Using template.send will send an one way message Exchange returnExchange = template.send("direct:custodyReleaseServiceEndpoint", senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); }// w w w. ja va 2 s . com custodyRelease = analyticalDatastoreDAO.getCustodyReleaseByBookingId(1); assertEquals(LocalDate.parse("2001-12-17"), custodyRelease.getReleaseDate()); assertEquals(LocalTime.parse("09:30:47"), custodyRelease.getReleaseTime()); assertThat(custodyRelease.getBookingNumber(), is("Booking Number")); List<BehavioralHealthAssessment> behavioralHealthAssessments = analyticalDatastoreDAO .getBehavioralHealthAssessments(2); assertThat(behavioralHealthAssessments.size(), is(2)); BehavioralHealthAssessment behavioralHealthAssessment = behavioralHealthAssessments.get(1); assertTrue(behavioralHealthAssessment.getBehavioralHealthDiagnoses().size() == 1); assertThat(behavioralHealthAssessment.getBehavioralHealthDiagnoses().get(0), is("Schizophrenia 295.10")); assertThat(behavioralHealthAssessment.getPersonId(), is(2)); assertThat(behavioralHealthAssessment.getBehavioralHealthAssessmentId(), is(3)); assertThat(behavioralHealthAssessment.getSeriousMentalIllness(), is(true)); assertThat(behavioralHealthAssessment.getCareEpisodeStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(behavioralHealthAssessment.getCareEpisodeEndDate(), is(LocalDate.parse("2016-04-01"))); assertThat(behavioralHealthAssessment.getEnrolledProviderName(), is("79")); assertThat(behavioralHealthAssessment.getMedicaidStatusTypeId(), nullValue()); List<Treatment> treatments = analyticalDatastoreDAO.getTreatments(3); assertThat(treatments.size(), is(1)); Treatment treatment = treatments.get(0); assertThat(treatment.getBehavioralHealthAssessmentID(), is(3)); assertThat(treatment.getTreatmentStartDate(), is(LocalDate.parse("2016-01-01"))); assertThat(treatment.getTreatmentAdmissionReasonTypeId(), nullValue()); assertThat(treatment.getTreatmentStatusTypeId(), nullValue()); assertThat(treatment.getTreatmentProviderName(), is("Treatment Providing Organization Name")); List<PrescribedMedication> prescribedMedications = analyticalDatastoreDAO.getPrescribedMedication(3); assertThat(prescribedMedications.size(), is(1)); PrescribedMedication prescribedMedication = prescribedMedications.get(0); assertThat(prescribedMedication.getBehavioralHealthAssessmentID(), is(3)); assertThat(prescribedMedication.getMedicationDescription(), is("Zyprexa")); assertThat(prescribedMedication.getMedicationDispensingDate(), is(LocalDate.parse("2016-01-01"))); assertThat(prescribedMedication.getMedicationDoseMeasure(), is("3mg")); }
From source file:org.ojbc.adapters.analyticsstaging.custody.CamelContextAdamsWrongOrderTest.java
public void testCustodyReleaseReportServiceRoute() throws Exception { CustodyRelease custodyRelease = analyticalDatastoreDAO.getCustodyReleaseByBookingNumber("Booking Number"); assertThat(custodyRelease, nullValue()); Exchange senderExchange = createSenderExchange( "src/test/resources/xmlInstances/custodyReleaseReport/CustodyReleaseReport-Adams.xml"); //Send the one-way exchange. Using template.send will send an one way message Exchange returnExchange = template.send("direct:custodyReleaseServiceEndpoint", senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); }//w ww .ja v a 2 s .com custodyRelease = analyticalDatastoreDAO.getCustodyReleaseByBookingNumber("Booking Number"); assertEquals(LocalDate.parse("2001-12-17"), custodyRelease.getReleaseDate()); assertEquals(LocalTime.parse("09:30:47"), custodyRelease.getReleaseTime()); assertThat(custodyRelease.getBookingId(), nullValue()); assertThat(jdbcTemplate.queryForObject("select count(*) from BehavioralHealthAssessment", Integer.class), is(0)); }
From source file:dhbw.clippinggorilla.objects.user.UserUtils.java
private static Set<LocalTime> loadAllClippingSendTimes(User u) { Set<LocalTime> times = new HashSet<>(); try {/*w w w . j a v a 2s . c o m*/ String sql = "SELECT * FROM " + Tables.USER_CLIPPING_TIMES + " WHERE " + Columns.USER_ID + " = ?"; PreparedStatement statement = Database.getConnection().prepareStatement(sql); statement.setInt(1, u.getId()); ResultSet result = statement.executeQuery(); while (result.next()) { times.add(LocalTime.parse(result.getString(Columns.CLIPPING_TIME))); } } catch (SQLException ex) { Log.warning("Sql failed: loadClippingTime", ex); } return times; }
From source file:dhbw.clippinggorilla.objects.user.UserUtils.java
/** * Returns all Clipping sending times for all users * * @return The Times for all users//from w ww . j a v a 2 s . com */ public static Map<User, Set<LocalTime>> getAllClippingSendTimesForAllUsers() { String sql = "SELECT * FROM " + Tables.USER_CLIPPING_TIMES + " ORDER BY " + Columns.USER_ID; Map<User, Set<LocalTime>> allClippingTimes = new HashMap<>(); try { Statement statement = Database.getConnection().createStatement(); ResultSet result = statement.executeQuery(sql); while (result.next()) { User user = getUser(result.getInt(Columns.USER_ID)); LocalTime userTime = LocalTime.parse(result.getString(Columns.CLIPPING_TIME)); if (allClippingTimes.containsKey(user)) { allClippingTimes.get(user).add(userTime); } else { HashSet<LocalTime> userTimes = new HashSet<>(); userTimes.add(userTime); allClippingTimes.put(user, userTimes); } } } catch (SQLException ex) { Log.warning("Sql failed: getAllClippingTime", ex); } return allClippingTimes; }