use of site.model.Submission in project jprime by bgjug.
the class SubmissionController method accept.
@RequestMapping(value = "/accept/{submissionId}", method = RequestMethod.GET)
public String accept(@PathVariable("submissionId") Long submissionId) {
Submission submission = adminFacade.findOneSubmission(submissionId);
adminFacade.acceptSubmission(submission);
try {
sendEmails(submission, "/acceptSubmission.html");
} catch (Exception e) {
logger.error("Could not send accept email", e);
}
return REDIRECT + "/admin/submission/view";
}
use of site.model.Submission in project jprime by bgjug.
the class SubmissionControllerTest method setUp.
@Before
public void setUp() throws Exception {
final SubmissionController bean = wac.getBean(SubmissionController.class);
this.mailer = new MailServiceMock();
bean.setMailFacade(mailer);
mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
Speaker brianGoetz = new Speaker("Brian", "Goetz", "brian@oracle.com", "The Java Language Architect", "@briangoetz", true, true);
Speaker ivanIvanov = new Speaker("Ivan St.", "Ivanov", "ivan@jprime.io", "JBoss Forge", "@ivan_stefanov", false, true);
Speaker naydenGochev = new Speaker("Nayden", "Gochev", "nayden@jprio.io", "The Spring Guy", "@gochev", false, true);
Speaker ivanIvanov2 = new Speaker("Ivan St.", "Ivanov", "ivan@forge.com", "JBoss Forge", "@ivan_stefanov", false, true);
valhalla = submissionRepository.save(new Submission("Project Valhalla", "Primitives in Generics", SessionLevel.ADVANCED, SessionType.ConferenceSession, brianGoetz));
valhalla.setBranch(Globals.CURRENT_BRANCH);
forge = submissionRepository.save(new Submission("JBoss Forge", "Productivity for Java EE", SessionLevel.INTERMEDIATE, SessionType.ConferenceSession, ivanIvanov));
forge.setBranch(Globals.CURRENT_BRANCH);
bootAddon = submissionRepository.save(new Submission("Spring Boot Forge Addon", "We are not hipsters", SessionLevel.BEGINNER, SessionType.ConferenceSession, naydenGochev, ivanIvanov2));
bootAddon.setBranch(Branch.YEAR_2016);
}
use of site.model.Submission in project jprime by bgjug.
the class CfpControllerTest method shouldSubmitSessionWithCoSpeaker.
@Test
@Ignore("ignored since adding captcha, has to be updated")
public void shouldSubmitSessionWithCoSpeaker() throws Exception {
mockMvc.perform(fileUpload("/cfp").file(new MockMultipartFile("speakerImage", new byte[] {})).file(new MockMultipartFile("coSpeakerImage", new byte[] {})).param("title", "Boot Forge Addon").param("description", "Forge supports Spring").param("level", SessionLevel.BEGINNER.toString().toUpperCase()).param("speaker.firstName", "Nayden").param("speaker.lastName", "Gochev").param("speaker.email", "nayden@jprime.io").param("speaker.twitter", "@gochev").param("speaker.bio", "Spring nerd").param("coSpeaker.firstName", "Ivan").param("coSpeaker.lastName", "Ivanov").param("coSpeaker.email", "ivan@jprime.io").param("coSpeaker.twitter", "@ivan_stefanov").param("coSpeaker.bio", "Ordinary decent nerd")).andExpect(status().isFound()).andExpect(view().name("redirect:/"));
final List<Submission> allSubmissions = submissionRepository.findAll();
assertThat(allSubmissions.size(), is(1));
Submission submission = allSubmissions.get(0);
assertThat(submission.getTitle(), is("Boot Forge Addon"));
assertThat(submission.getStatus(), is(SubmissionStatus.SUBMITTED));
assertThat(submission.getSpeaker().getEmail(), is("nayden@jprime.io"));
assertThat(submission.getCoSpeaker().getEmail(), is("ivan@jprime.io"));
assertThat(mailer.recipientAddresses.size(), is(3));
assertThat(mailer.recipientAddresses, contains("nayden@jprime.io", "ivan@jprime.io", "conference@jprime.io"));
}
use of site.model.Submission in project jprime by bgjug.
the class SessionControllerTest method setup.
@Before
public void setup() throws Exception {
mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
this.forgeSubmission = submissionRepository.save(new Submission("Forge with me", "Forge is the best", SessionLevel.BEGINNER, SessionType.ConferenceSession, new Speaker("Ivan St.", "Ivanov", "ivan.st.ivanov@example.com", "The Forge Guy", "@forge", false, true)));
forgeSubmission.setStatus(SubmissionStatus.ACCEPTED);
Submission bootSubmission = submissionRepository.save(new Submission("Spring Boot", "Bootiful or what?", SessionLevel.BEGINNER, SessionType.ConferenceSession, new Speaker("Nayden", "Gochev", "nayden.gochev@example.com", "The Spring Guy", "@sprink", true, true)));
bootSubmission.setStatus(SubmissionStatus.ACCEPTED);
this.betaHall = venueHallRepository.save(new VenueHall("Beta", "600 seats"));
venueHallRepository.save(new VenueHall("Alpha", "400 seats"));
this.bootSession = sessionRepository.save(new Session(bootSubmission, DateTime.now(), DateTime.now(), betaHall));
}
use of site.model.Submission in project jprime by bgjug.
the class SessionControllerTest method shouldEditSession.
@Test
public void shouldEditSession() throws Exception {
Submission bootSubmission = bootSession.getSubmission();
mockMvc.perform(post("/admin/session/add").param("submission", bootSubmission.getId() + "").param("startTime", "27.05.2017 10:15").param("endTime", "27.05.2017 11:15").param("title", "").param("hall", betaHall.getId() + "").param("id", bootSession.getId() + "")).andExpect(status().isFound()).andExpect(view().name("redirect:/admin/session/view"));
List<Session> sessions = sessionRepository.findAll();
assertThat(sessions.size(), is(1));
Session session = sessions.get(0);
assertThat(session.getSubmission().getTitle(), is(bootSubmission.getTitle()));
assertThat(session.getStartTime(), is(new DateTime().withYear(2017).withMonthOfYear(5).withDayOfMonth(27).withHourOfDay(10).withMinuteOfHour(15).withSecondOfMinute(0).withMillisOfSecond(0)));
assertThat(session.getEndTime(), is(new DateTime().withYear(2017).withMonthOfYear(5).withDayOfMonth(27).withHourOfDay(11).withMinuteOfHour(15).withSecondOfMinute(0).withMillisOfSecond(0)));
assertThat(session.getHall().getName(), is(betaHall.getName()));
}
Aggregations