m2u-upass-admin / test / BusinessRoleTest.java @ 151:a88b09ea76c3
History | View | Annotate | Download (2.68 KB)
1 |
|
---|---|
2 |
import java.util.Date; |
3 |
|
4 |
import net.penril.ibss.core.RoleDAO; |
5 |
import net.penril.ibss.core.hibernate.IbRole; |
6 |
|
7 |
import org.junit.After; |
8 |
import org.junit.AfterClass; |
9 |
import org.junit.Before; |
10 |
import org.junit.BeforeClass; |
11 |
import org.junit.Test; |
12 |
|
13 |
import com.ib.ibss.hibernate.tables.DAOFactory; |
14 |
|
15 |
/**
|
16 |
* Copyright (M) 2009 Penril Datability (M) Sdn Bhd All rights reserved.
|
17 |
*
|
18 |
* This software is copyrighted. Under the copyright laws, this software
|
19 |
* may not be copied, in whole or in part, without prior written consent
|
20 |
* of Penril Datability (M) Sdn Bhd or its assignees. This software is
|
21 |
* provided under the terms of a license between Penril Datability (M)
|
22 |
* Sdn Bhd and the recipient, and its use is subject to the terms of that
|
23 |
* license.
|
24 |
*/
|
25 |
|
26 |
/**
|
27 |
* PROGRAMMER: Danniell
|
28 |
* CHANGE-NO:
|
29 |
* TASK-NO:
|
30 |
* DATE CREATED: Dec 5, 2010
|
31 |
* TAG AS:
|
32 |
* REASON(S):
|
33 |
* MODIFICATION:
|
34 |
*/
|
35 |
|
36 |
/**
|
37 |
* <Class description>
|
38 |
*/
|
39 |
public class BusinessRoleTest |
40 |
{ |
41 |
private static final String TEST_ROLE_NAME = "Test business role" +Long.toHexString(System.currentTimeMillis()); |
42 |
|
43 |
public static RoleDAO dao; |
44 |
// public static long seq;
|
45 |
|
46 |
/**
|
47 |
* <Method description>
|
48 |
*
|
49 |
* @throws java.lang.Exception
|
50 |
*/
|
51 |
@BeforeClass
|
52 |
public static void setUpBeforeClass () throws Exception |
53 |
{ |
54 |
} |
55 |
|
56 |
/**
|
57 |
* <Method description>
|
58 |
*
|
59 |
* @throws java.lang.Exception
|
60 |
*/
|
61 |
@AfterClass
|
62 |
public static void tearDownAfterClass () throws Exception |
63 |
{ |
64 |
} |
65 |
|
66 |
/**
|
67 |
* <Method description>
|
68 |
*
|
69 |
* @throws java.lang.Exception
|
70 |
*/
|
71 |
@Before
|
72 |
public void setUp () throws Exception |
73 |
{ |
74 |
DAOFactory factory = DAOFactory.instance (DAOFactory.HIBERNATE); |
75 |
dao = factory.getRoleDAO (); |
76 |
} |
77 |
|
78 |
/**
|
79 |
* <Method description>
|
80 |
*
|
81 |
* @throws java.lang.Exception
|
82 |
*/
|
83 |
@After
|
84 |
public void tearDown () throws Exception |
85 |
{ |
86 |
} |
87 |
|
88 |
@Test
|
89 |
public void testCreateRole() throws Exception |
90 |
{ |
91 |
// seq = dao.getNextSequenceNumber ("SQ_IB_ROLE");
|
92 |
IbRole role = new IbRole();
|
93 |
// role.setRoleId (seq);
|
94 |
role.setRoleCreatedBy (0);
|
95 |
role.setRoleCreationDate (new Date()); |
96 |
role.setRoleUpdatedBy (0);
|
97 |
role.setRoleUpdatedDate (new Date()); |
98 |
role.setRoleName (TEST_ROLE_NAME); |
99 |
role.setRoleDescription ("TEsting Description for this business role");
|
100 |
dao.createNewRole (role); |
101 |
} |
102 |
|
103 |
// @Test
|
104 |
// public void getRoleInfo() throws Exception
|
105 |
// {
|
106 |
// IbRole role = dao.getRoleProfile (seq);
|
107 |
// System.out.println ("Role Name: "+role.getRoleName ());
|
108 |
// System.out.println ("Role ID: "+role.getRoleId ());
|
109 |
// System.out.println ("Creator: "+role.getCreatorName ());
|
110 |
// System.out.println ("Updater: "+role.getUpdaterName ());
|
111 |
// System.out.println ("Description: "+role.getRoleDescription ());
|
112 |
// }
|
113 |
} |