RTGovSituationsProvider implements SituationsProvider, ActiveChangeListener { protected static void configureHeaders(MessageBean mb, ActivityType at) throws UiException { if (at != null) { for (String key : at.getProperties().keySet()) { if (isHeaderFormatProperty(key)) { String format=at.getProperties().get(key); String propName=getPropertyName(key); if (format != null) { mb.getHeaders().put(propName, at.getProperties().get(propName)); mb.getHeaderFormats().put(propName, format); } } } } } 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 testConfigureHeaders() { ActivityType at=new RequestReceived(); at.getProperties().put(ActivityType.HEADER_FORMAT_PROPERTY_PREFIX+"header1", "dom"); at.getProperties().put("header1", "header1value"); at.getProperties().put(ActivityType.HEADER_FORMAT_PROPERTY_PREFIX+"header2", "text"); at.getProperties().put("header2", "header2value"); MessageBean mb=new MessageBean(); try { RTGovSituationsProvider.configureHeaders(mb, at); } catch (Exception e) { fail("Failed to configure headers: "+e.getMessage()); } if (mb.getHeaders().size() != 2) { fail("Expecting 2 headers: "+mb.getHeaders().size()); } String h1=mb.getHeaders().get("header1"); assertEquals("Header 1 not as expected", h1, "header1value"); if (mb.getHeaderFormats().size() != 2) { fail("Expecting 2 header formats: "+mb.getHeaderFormats().size()); } assertEquals("Header 2 format not as expected", mb.getHeaderFormats().get("header2"), "text"); }