m2u-upass-admin / test / AdminGroupTest.java @ 85:b21ea78dfbb4
History | View | Annotate | Download (2.24 KB)
1 | 0:ea666cc7880e | hadi | import java.util.Date; |
---|---|---|---|
2 | |||
3 | import net.penril.ibss.core.AdminGroupDAO; |
||
4 | import net.penril.ibss.core.hibernate.AdminGroup; |
||
5 | |||
6 | import org.junit.After; |
||
7 | import org.junit.AfterClass; |
||
8 | import org.junit.Before; |
||
9 | import org.junit.BeforeClass; |
||
10 | import org.junit.Test; |
||
11 | |||
12 | import com.ib.ibss.hibernate.tables.DAOFactory; |
||
13 | |||
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 AdminGroupTest |
||
40 | { |
||
41 | public static AdminGroupDAO dao; |
||
42 | public static long seq; |
||
43 | |||
44 | /**
|
||
45 | * @throws java.lang.Exception
|
||
46 | */
|
||
47 | @BeforeClass
|
||
48 | public static void setUpBeforeClass() throws Exception |
||
49 | { |
||
50 | |||
51 | } |
||
52 | |||
53 | /**
|
||
54 | * @throws java.lang.Exception
|
||
55 | */
|
||
56 | @AfterClass
|
||
57 | public static void tearDownAfterClass() throws Exception |
||
58 | { |
||
59 | |||
60 | } |
||
61 | |||
62 | /**
|
||
63 | * @throws java.lang.Exception
|
||
64 | */
|
||
65 | @Before
|
||
66 | public void setUp() throws Exception |
||
67 | { |
||
68 | DAOFactory factory = DAOFactory.instance (DAOFactory.HIBERNATE); |
||
69 | dao = factory.getAdminGroupDAO (); |
||
70 | } |
||
71 | |||
72 | /**
|
||
73 | * @throws java.lang.Exception
|
||
74 | */
|
||
75 | @After
|
||
76 | public void tearDown() throws Exception |
||
77 | { |
||
78 | |||
79 | } |
||
80 | |||
81 | @Test
|
||
82 | public void testAddGroup() throws Exception |
||
83 | { |
||
84 | // seq = dao.getNextSequenceNumber ("SQ_ADMIN_GROUP");
|
||
85 | |||
86 | AdminGroup group = new AdminGroup();
|
||
87 | group.setCategory (new Long(1)); |
||
88 | // group.setGroupId (seq);
|
||
89 | group.setGroupCreatedBy (0);
|
||
90 | group.setGroupCreationDate (new Date()); |
||
91 | group.setGroupName ("TESTER");
|
||
92 | group.setGroupUpdatedBy (0);
|
||
93 | group.setGroupUpdatedDate (new Date()); |
||
94 | group.setGroupDescription ("Testing 123 group");
|
||
95 | |||
96 | dao.createNewGroup (group); |
||
97 | } |
||
98 | |||
99 | // @Test
|
||
100 | public void testDeleteGroup() throws Exception |
||
101 | { |
||
102 | AdminGroup group = dao.getGroupByIdentifier (seq); |
||
103 | dao.deleteGroup (group); |
||
104 | } |
||
105 | } |