Search in sources :

Example 1 with Submission

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";
}
Also used : Submission(site.model.Submission) URISyntaxException(java.net.URISyntaxException) MessagingException(javax.mail.MessagingException) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with Submission

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);
}
Also used : Submission(site.model.Submission) Speaker(site.model.Speaker) Before(org.junit.Before)

Example 3 with Submission

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"));
}
Also used : MockMultipartFile(org.springframework.mock.web.MockMultipartFile) Submission(site.model.Submission) Ignore(org.junit.Ignore) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with Submission

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));
}
Also used : VenueHall(site.model.VenueHall) Submission(site.model.Submission) Speaker(site.model.Speaker) Session(site.model.Session) Before(org.junit.Before)

Example 5 with Submission

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()));
}
Also used : Submission(site.model.Submission) DateTime(org.joda.time.DateTime) Session(site.model.Session) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Submission (site.model.Submission)9 IOException (java.io.IOException)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 URISyntaxException (java.net.URISyntaxException)2 MessagingException (javax.mail.MessagingException)2 Before (org.junit.Before)2 Ignore (org.junit.Ignore)2 MockMultipartFile (org.springframework.mock.web.MockMultipartFile)2 Session (site.model.Session)2 Speaker (site.model.Speaker)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 DateTime (org.joda.time.DateTime)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1 MultipartFile (org.springframework.web.multipart.MultipartFile)1 CellProcessor (org.supercsv.cellprocessor.ift.CellProcessor)1 VenueHall (site.model.VenueHall)1