Project implements Serializable, Runnable { protected Map<String, String> getProjectPropertiesMap(final Date now) { final Map<String, String> buildProperties = new HashMap<String, String>(); buildProperties.put("projectname", name); buildProperties.put("label", label); buildProperties.put("cvstimestamp", CVSDateUtil.formatCVSDate(now)); buildProperties.put("cctimestamp", DateUtil.getFormattedTime(now)); buildProperties.put("cclastgoodbuildtimestamp", getLastSuccessfulBuild()); buildProperties.put("cclastbuildtimestamp", getLastBuild()); buildProperties.put("lastbuildsuccessful", String.valueOf(isLastBuildSuccessful())); buildProperties.put("buildforced", String.valueOf(getBuildForced())); if (projectConfig.getModificationSet() != null) { buildProperties.putAll(projectConfig.getModificationSet().getProperties()); } if (additionalProperties != null && !additionalProperties.isEmpty()) { buildProperties.putAll(additionalProperties); additionalProperties.clear(); additionalProperties = null; } return buildProperties; } 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 testGetProjectPropertiesMap() throws CruiseControlException { final String label = "labeL.1"; project.setLabel(label); final String lastBuild = "20000101120000"; project.setLastBuild(lastBuild); final String lastGoodBuild = "19990101120000"; project.setLastSuccessfulBuild(lastGoodBuild); project.setWasLastBuildSuccessful(true); final TimeZone cest = TimeZone.getTimeZone("Europe/Copenhagen"); final Calendar now = new GregorianCalendar(cest); now.set(2005, Calendar.AUGUST, 10, 13, 7, 43); final String cvstimestamp = "2005-08-10 11:07:43 GMT"; projectConfig.add(new MockSchedule()); project.init(); final String cctimestamp = DateUtil.getFormattedTime(now.getTime()); final Map<String, String> map = project.getProjectPropertiesMap(now.getTime()); assertEquals(project.getName(), map.get("projectname")); assertEquals(label, map.get("label")); assertEquals(cctimestamp, map.get("cctimestamp")); assertEquals(lastGoodBuild, map.get("cclastgoodbuildtimestamp")); assertEquals(lastBuild, map.get("cclastbuildtimestamp")); assertEquals("true", map.get("lastbuildsuccessful")); assertEquals(cvstimestamp, map.get("cvstimestamp")); assertEquals(String.valueOf(project.getBuildForced()), map.get("buildforced")); assertEquals(8, map.keySet().size()); }