Search in sources :

Example 6 with User

use of org.eclipse.vorto.repository.account.impl.User in project vorto by eclipse.

the class NotificationServiceTest method testSendRegistrationEmail.

@Test
public void testSendRegistrationEmail() throws Exception {
    User user = new User();
    user.setEmail("alexander.edelmann@bosch-si.com");
    user.setUsername("aedelmann");
    notificationService.sendNotification(new RegistrationMessage(user));
    assertEquals(1, wiser.getMessages().size());
    assertTrue(((String) wiser.getMessages().get(0).getMimeMessage().getContent()).contains("registration"));
    assertTrue(((String) wiser.getMessages().get(0).getMimeMessage().getContent()).contains("Dear aedelmann"));
}
Also used : User(org.eclipse.vorto.repository.account.impl.User) RegistrationMessage(org.eclipse.vorto.repository.notification.message.RegistrationMessage) Test(org.junit.Test)

Example 7 with User

use of org.eclipse.vorto.repository.account.impl.User in project vorto by eclipse.

the class NotificationServiceTest method testSendCheckedModelEmail.

@Test
public void testSendCheckedModelEmail() throws Exception {
    User user = new User();
    user.setEmail("alexander.edelmann@bosch-si.com");
    user.setUsername("aedelmann");
    ModelInfo resource = new ModelInfo(new ModelId("Fridge", "org.eclipse.vorto.examples", "1.0.0"), ModelType.Functionblock);
    resource.setAuthor("andreas");
    resource.setCreationDate(new Date());
    resource.setDescription("A fridge keeps groceries fresh");
    notificationService.sendNotification(new CheckinMessage(user, resource));
    assertEquals(1, wiser.getMessages().size());
    assertTrue(((String) wiser.getMessages().get(0).getMimeMessage().getContent()).contains("A new model has just been checked into the Vorto Repository"));
    assertTrue(((String) wiser.getMessages().get(0).getMimeMessage().getContent()).contains("Dear aedelmann"));
}
Also used : ModelInfo(org.eclipse.vorto.repository.api.ModelInfo) User(org.eclipse.vorto.repository.account.impl.User) CheckinMessage(org.eclipse.vorto.repository.notification.message.CheckinMessage) ModelId(org.eclipse.vorto.repository.api.ModelId) Date(java.util.Date) Test(org.junit.Test)

Aggregations

User (org.eclipse.vorto.repository.account.impl.User)7 Test (org.junit.Test)4 ApiOperation (io.swagger.annotations.ApiOperation)2 Timestamp (java.sql.Timestamp)2 ArrayList (java.util.ArrayList)2 AbstractIntegrationTest (org.eclipse.vorto.repository.AbstractIntegrationTest)2 UploadModelResult (org.eclipse.vorto.repository.api.upload.UploadModelResult)2 ClassPathResource (org.springframework.core.io.ClassPathResource)2 ResponseEntity (org.springframework.http.ResponseEntity)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ApiResponses (io.swagger.annotations.ApiResponses)1 Date (java.util.Date)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ModelId (org.eclipse.vorto.repository.api.ModelId)1 ModelInfo (org.eclipse.vorto.repository.api.ModelInfo)1 CheckinMessage (org.eclipse.vorto.repository.notification.message.CheckinMessage)1 RegistrationMessage (org.eclipse.vorto.repository.notification.message.RegistrationMessage)1 VortoUser (org.eclipse.vorto.repository.web.security.VortoUser)1 GrantedAuthority (org.springframework.security.core.GrantedAuthority)1