public void serialize( ResultSummary summary, List<DashBoardItem> workItems, String columnsDefinition, List<String> labels, String lang, Response response, HttpServletRequest req) throws ClientException { // TODO labels, lang SyndFeed atomFeed = new SyndFeedImpl(); atomFeed.setFeedType(ATOM_TYPE); // XXX TODO : To be translated atomFeed.setTitle(summary.getTitle()); atomFeed.setLink(summary.getLink()); List<SyndEntry> entries = new ArrayList<SyndEntry>(); for (DashBoardItem item : workItems) { entries.add(adaptDashBoardItem(item, req)); } atomFeed.setEntries(entries); SyndFeedOutput output = new SyndFeedOutput(); // Try to return feed try { response.setEntity(output.outputString(atomFeed), MediaType.TEXT_XML); response.getEntity().setCharacterSet(CharacterSet.UTF_8); } catch (FeedException fe) { } }
/** * Parameterized test case to check the message text for the specified number of warnings and * analyses. * * @param numberOfWarnings the number of warnings * @param numberOfanalyses the number of analyses * @param expectedMessage the expected message */ private void checkSummaryText( final int numberOfWarnings, final int numberOfanalyses, final String expectedMessage) { PmdResult result = mock(PmdResult.class); when(result.getNumberOfAnnotations()).thenReturn(numberOfWarnings); when(result.getNumberOfModules()).thenReturn(numberOfanalyses); Assert.assertEquals( "Wrong summary message created.", expectedMessage, ResultSummary.createSummary(result)); }
/** * Parameterized test case to check the message text for the specified number of warnings and * files. * * @param numberOfWarnings the number of warnings * @param numberOfFiles the number of files * @param expectedMessage the expected message */ private void checkSummaryText( final int numberOfWarnings, final int numberOfFiles, final String expectedMessage) { DryResult result = mock(DryResult.class); when(result.getNumberOfAnnotations()).thenReturn(numberOfWarnings); when(result.getNumberOfModules()).thenReturn(numberOfFiles); Assert.assertEquals( "Wrong summary message created.", Messages.DRY_ProjectAction_Name() + expectedMessage, ResultSummary.createSummary(result)); }
/** * Parameterized test case to check the message text for the specified number of warnings and * files. * * @param numberOfFixedWarnings the number of fixed warnings * @param numberOfNewWarnings the number of new warnings * @param expectedMessage the expected message */ private void checkDeltaText( final int numberOfFixedWarnings, final int numberOfNewWarnings, final String expectedMessage) { DryResult result = mock(DryResult.class); when(result.getNumberOfFixedWarnings()).thenReturn(numberOfFixedWarnings); when(result.getNumberOfNewWarnings()).thenReturn(numberOfNewWarnings); Assert.assertEquals( "Wrong delta message created.", expectedMessage, ResultSummary.createDeltaMessage(result)); }
/** {@inheritDoc} */ @Override protected String createDeltaMessage() { return ResultSummary.createDeltaMessage(this); }
/** * Returns a summary message for the summary.jelly file. * * @return the summary message */ public String getSummary() { return ResultSummary.createSummary(this); }