RTGovSituationsProvider implements SituationsProvider, ActiveChangeListener { protected static SituationsQuery createQuery(SituationsFilterBean filters) { SituationsQuery ret=new SituationsQuery(); ret.setType(filters.getType()); if (filters.getSeverity() != null && filters.getSeverity().trim().length() > 0) { String severityName=Character.toUpperCase(filters.getSeverity().charAt(0)) +filters.getSeverity().substring(1); ret.setSeverity(Situation.Severity.valueOf(severityName)); } if (filters.getTimestampFrom() != null) { ret.setFromTimestamp(filters.getTimestampFrom().getTime()); } if (filters.getTimestampTo() != null) { ret.setToTimestamp(filters.getTimestampTo().getTime()); } ret.setDescription(filters.getDescription()); ret.setResolutionState(filters.getResolutionState()); ret.setSubject(filters.getSubject()); try { ret.setProperties(filters.getProperties()); } catch (IOException ioException) { Throwables.propagate(ioException); } return (ret); } RTGovSituationsProvider(); @PostConstruct void init(); String getName(); void addSituationEventListener(SituationEventListener l); void removeSituationEventListener(SituationEventListener l); java.util.List<SituationSummaryBean> search(SituationsFilterBean filters); @Override SituationBean getSituation(String situationId); @Override void resubmit(String situationId, MessageBean message, String username); @Override BatchRetryResult resubmit(SituationsFilterBean situationsFilterBean, String username); @Override java.util.List<SituationSummaryBean> getResubmitFailures(String situationId); @Override void export(SituationsFilterBean situationsFilterBean, OutputStream outputStream); @Override void inserted(Object key, Object value); @Override void updated(Object key, Object value); @Override void removed(Object key, Object value); @Override void assign(String situationId, final String userName); @Override void unassign(String situationId); @Override void updateResolutionState(String situationId, final ResolutionState resolutionState); @Override int delete(SituationsFilterBean situationsFilterBean);  }
@Test public void testCreateQuery() { SituationsFilterBean sfb=new SituationsFilterBean(); long fromTimestamp=12345678; long toTimestamp=87654321; sfb.setSeverity(Severity.Critical.toString().toLowerCase()); sfb.setTimestampFrom(new java.util.Date(fromTimestamp)); sfb.setTimestampTo(new java.util.Date(toTimestamp)); sfb.setType(TEST_TYPE); SituationsQuery query=RTGovSituationsProvider.createQuery(sfb); if (query == null) { fail("No query returned"); } if (query.getSeverity() != Severity.Critical) { fail("Severity was incorrect: "+query.getSeverity()); } if (query.getFromTimestamp() != fromTimestamp) { fail("FromTimestamp was incorrect: "+query.getFromTimestamp()); } if (query.getToTimestamp() != (toTimestamp)) { fail("ToTimestamp was incorrect: "+query.getToTimestamp()); } if (!query.getType().equals(TEST_TYPE)) { fail("Type was incorrect: "+query.getType()); } }