1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole;
17
18 import org.apache.jackrabbit.core.TransientRepository;
19 import org.junit.After;
20 import org.junit.Before;
21 import org.junit.Ignore;
22 import org.junit.Test;
23
24 import javax.jcr.Session;
25
26 import static junit.framework.Assert.assertNotNull;
27 import static org.junit.Assert.assertTrue;
28
29
30
31
32
33
34
35
36 @Ignore
37 @Deprecated
38 public class RepositoryManager_UT
39 extends BaseTestCase {
40
41 @Before
42 public void setUp() {
43 System.getProperties().put("app.environment", "local");
44 }
45
46 @After
47 public void tearDown() throws Exception {
48 System.getProperties().remove("app.environment");
49 RepositoryManager.getRepositoryManager().shutdown();
50 }
51
52
53 @Test
54 public void testGetRepositoryManager() throws Exception {
55 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
56 assertNotNull(repositoryManager);
57 }
58
59 @Test
60 public void testGetSession() throws Exception {
61 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
62 Session session = repositoryManager.getSession();
63 repositoryManager.logout(session);
64 assertNotNull(session);
65 }
66
67 @Test
68 public void testGetSessionWithUserName() throws Exception {
69 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
70 Session session = repositoryManager.getSession("mockUser", "test");
71 repositoryManager.logout(session);
72 assertNotNull(session);
73 }
74
75 @Test
76 public void testGetMultipleSessions() throws Exception {
77 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
78 Session session = repositoryManager.getSession();
79 Session session1 = repositoryManager.getSession();
80 assertNotNull(session);
81 repositoryManager.logout(session);
82 repositoryManager.logout(session1);
83 assertTrue(!session.isLive());
84 assertTrue(!session1.isLive());
85 }
86
87 @Test
88 public void testGetMultipleSessionsWithMultipleUsers() throws Exception {
89 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
90 Session session = repositoryManager.getSession("mockUser", "test");
91 Session session1 = repositoryManager.getSession("mockUser1", "test");
92 assertNotNull(session);
93 repositoryManager.logout(session);
94 repositoryManager.logout(session1);
95 assertTrue(!session.isLive());
96 assertTrue(!session1.isLive());
97 }
98
99 @Test
100 public void testLogout() throws Exception {
101 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
102 Session session = repositoryManager.getSession();
103 repositoryManager.logout(session);
104 assertTrue(!session.isLive());
105 }
106
107 @Test
108 public void testGetTransientRepository() throws Exception {
109 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
110 TransientRepository transientRepository = repositoryManager.getTransientRepository();
111 assertNotNull(transientRepository);
112 }
113
114 @Test
115 public void testShutdownRepository() throws Exception {
116 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
117 repositoryManager.shutdownRepository();
118 }
119 }