use of com.thoughtworks.go.server.domain.ZippedArtifact in project gocd by gocd.
the class FileModelAndViewTest method shouldReturnModelWithZipFlagTurnedOnIfZipIsNeeded.
@Test
public void shouldReturnModelWithZipFlagTurnedOnIfZipIsNeeded() throws Exception {
ZippedArtifact zippedArtifact = new ZippedArtifact(existFile.getParentFile(), existFile.getName());
ModelAndView modelAndView = FileModelAndView.createFileView(zippedArtifact, "");
assertThat(modelAndView.getModel().containsKey(FileView.NEED_TO_ZIP), is(true));
}
use of com.thoughtworks.go.server.domain.ZippedArtifact in project gocd by gocd.
the class FileModelAndView method createFileView.
public static ModelAndView createFileView(File file, String sha) throws Exception {
boolean hasChanged = isFileChanged(file, sha);
if (!hasChanged) {
return new ModelAndView(new AbstractView() {
protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
response.getWriter().close();
}
});
} else {
HashMap model = new HashMap();
if (file instanceof ZippedArtifact) {
model.put(FileView.NEED_TO_ZIP, true);
}
model.put("targetFile", file);
return new ModelAndView("fileView", model);
}
}
Aggregations