Project implements Serializable, Runnable { protected void publish(final Log buildLog) throws CruiseControlException { setState(ProjectState.PUBLISHING); for (final Publisher publisher : projectConfig.getPublishers()) { try { publisher.publish(buildLog.getContent()); } catch (Throwable t) { final StringBuilder message = new StringBuilder("exception publishing results"); message.append(" with ").append(publisher.getClass().getName()); message.append(" for project ").append(name); LOG.error(message.toString(), t); } } } Project(); void execute(); void run(); void forceBuildWithTarget(String buildTarget); void forceBuildWithTarget(String buildTarget, Map<String, String> addedProperties); void serializeProject(); void setLabelIncrementer(final LabelIncrementer incrementer); LabelIncrementer getLabelIncrementer(); void setName(final String projectName); String getName(); void setLabel(final String newLabel); String getLabel(); void setLastBuild(final String newLastBuild); void setLastSuccessfulBuild(final String newLastSuccessfulBuild); String getLastBuild(); boolean getBuildForced(); void setBuildForced(boolean forceNewBuildNow); String getLastSuccessfulBuild(); String getLogDir(); long getBuildInterval(); void overrideBuildInterval(final long sleepMillis); boolean isPaused(); void setPaused(final boolean paused); void setBuildAfterFailed(final boolean rebuildEvenWithNoNewModifications); String getStatus(); String getStatusWithQueuePosition(); ProjectState getState(); void setBuildQueue(final BuildQueue buildQueue); String getBuildStartTime(); Log getLog(); boolean isLastBuildSuccessful(); void start(); void stop(); String toString(); void addBuildProgressListener(final BuildProgressListener listener); void addBuildResultListener(final BuildResultListener listener); void setProjectConfig(final ProjectConfig projectConfig); boolean equals(final Object arg0); int hashCode(); void register(final MBeanServer server); ProjectConfig getProjectConfig(); Date getLastBuildDate(); Progress getProgress(); List<String> getLogLabels(); String[] getLogLabelLines(final String logLabel, final int firstLine);  }
@Test public void testPublish() throws CruiseControlException { MockSchedule sched = new MockSchedule(); projectConfig.add(sched); MockPublisher publisher = new MockPublisher(); Publisher exceptionThrower = new MockPublisher() { private static final long serialVersionUID = -8476214888230413824L; public void publish(Element log) throws CruiseControlException { throw new CruiseControlException("exception"); } }; ProjectConfig.Publishers publishers = new ProjectConfig.Publishers(); publishers.add(publisher); publishers.add(exceptionThrower); publishers.add(publisher); projectConfig.add(publishers); project.setName("projectName"); project.setLabel("label.1"); projectConfig.add(new DefaultLabelIncrementer()); projectConfig.add(new Log()); project.init(); project.publish(projectConfig.getLog()); assertEquals(2, publisher.getPublishCount()); }