1
|
package eu.dnetlib.uoaadmintools;
|
2
|
|
3
|
import eu.dnetlib.uoaadmintools.dao.*;
|
4
|
import eu.dnetlib.uoaadmintools.entities.Notifications;
|
5
|
import eu.dnetlib.uoaadmintools.entities.Page;
|
6
|
import org.junit.Test;
|
7
|
import org.junit.runner.RunWith;
|
8
|
import org.springframework.beans.factory.annotation.Autowired;
|
9
|
import org.springframework.boot.test.context.SpringBootTest;
|
10
|
import org.springframework.test.context.junit4.SpringRunner;
|
11
|
|
12
|
import java.util.List;
|
13
|
|
14
|
@RunWith(SpringRunner.class)
|
15
|
@SpringBootTest
|
16
|
public class NotificationsTests {
|
17
|
|
18
|
@Autowired
|
19
|
private CommunityDAO communityDAO;
|
20
|
|
21
|
|
22
|
@Autowired
|
23
|
private NotificationsDAO notificationsDAO;
|
24
|
|
25
|
|
26
|
@Test
|
27
|
public void test() {
|
28
|
String mail = "argirokokogiannaki@gmail.com";
|
29
|
String id="rda";
|
30
|
System.out.println(notificationsDAO.findByCommunityPid(id));
|
31
|
|
32
|
Notifications notifications = notificationsDAO.findByManagerEmailAndCommunityPid(mail , id);
|
33
|
if(notifications == null){
|
34
|
notifications = new Notifications();
|
35
|
notifications.setCommunityPid(id);
|
36
|
notifications.setManagerEmail(mail);
|
37
|
}
|
38
|
notifications.setNotifyForNewManagers(false);
|
39
|
notifications.setNotifyForNewSubscribers(false);
|
40
|
|
41
|
notificationsDAO.save(notifications);
|
42
|
System.out.println(notificationsDAO.findByCommunityPid(id));
|
43
|
|
44
|
|
45
|
|
46
|
|
47
|
}
|
48
|
|
49
|
}
|