use of org.rembx.jeeshop.user.model.MailTemplate in project jeeshop by remibantos.
the class MailTemplatesCT method modify_ShouldModify.
@Test
public void modify_ShouldModify() {
MailTemplate detachedMailTemplateToModify = new MailTemplate("TestNewsletter2", "fr_FR", "test2 content", "Test2 Subject");
detachedMailTemplateToModify.setId(testMailTemplate.firstMailTemplate().getId());
service.modify(detachedMailTemplateToModify);
}
use of org.rembx.jeeshop.user.model.MailTemplate in project jeeshop by remibantos.
the class MailTemplatesCT method modifyUnknown_ShouldThrowNotFoundException.
@Test
public void modifyUnknown_ShouldThrowNotFoundException() {
MailTemplate detachedMailTemplate = new MailTemplate();
detachedMailTemplate.setId(9999L);
try {
service.modify(detachedMailTemplate);
fail("should have thrown ex");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
}
}
use of org.rembx.jeeshop.user.model.MailTemplate in project jeeshop by remibantos.
the class TestMailTemplate method getInstance.
public static TestMailTemplate getInstance() {
if (instance != null)
return instance;
EntityManager entityManager = Persistence.createEntityManagerFactory(UserPersistenceUnit.NAME).createEntityManager();
entityManager.getTransaction().begin();
orderConfirmationTpl = new MailTemplate(Mails.orderValidated.name(), "fr_FR", "<html><body>Hello ${gender} ${firstname} ${lastname}. Your order has been registered...</body></html>", "Order Confirmation");
entityManager.persist(orderConfirmationTpl);
entityManager.getTransaction().commit();
instance = new TestMailTemplate();
entityManager.close();
return instance;
}
use of org.rembx.jeeshop.user.model.MailTemplate in project jeeshop by remibantos.
the class TestMailTemplate method getInstance.
public static TestMailTemplate getInstance() {
if (instance != null)
return instance;
EntityManager entityManager = Persistence.createEntityManagerFactory(UserPersistenceUnit.NAME).createEntityManager();
entityManager.getTransaction().begin();
mailTemplate1 = new MailTemplate("Newsletter1", "fr_FR", "<html><body>bla bla...</body></html>", "Hello Subject");
userRegistrationMailTpl = new MailTemplate(Mails.userRegistration.name(), "fr_FR", "<html><body>Welcome ${gender} ${firstname} ${lastname}</body></html>", "New Registration Subject");
ressetPasswordMailTpl = new MailTemplate(Mails.userResetPassword.name(), "fr_FR", "<html><body>Here is the link to reset your password</body></html>", "Reset Password Subject");
changePasswordMailTpl = new MailTemplate(Mails.userChangePassword.name(), "fr_FR", "<html><body>Hello there, your password has changed!</body></html>", "Change Password Subject");
entityManager.persist(mailTemplate1);
entityManager.persist(userRegistrationMailTpl);
entityManager.persist(ressetPasswordMailTpl);
entityManager.persist(changePasswordMailTpl);
entityManager.getTransaction().commit();
instance = new TestMailTemplate();
entityManager.close();
return instance;
}
use of org.rembx.jeeshop.user.model.MailTemplate in project jeeshop by remibantos.
the class MailTemplatesCT method delete_shouldRemove.
@Test
public void delete_shouldRemove() {
entityManager.getTransaction().begin();
MailTemplate mailTemplate = new MailTemplate("TestNewsletter3", "fr_FR", "test content 3", "Test Subject3");
entityManager.persist(mailTemplate);
entityManager.getTransaction().commit();
entityManager.getTransaction().begin();
service.delete(mailTemplate.getId());
entityManager.getTransaction().commit();
assertThat(entityManager.find(MailTemplate.class, mailTemplate.getId())).isNull();
}
Aggregations