1 /*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5 package org.kuali.mobility.events.dao;
6
7 import static org.junit.Assert.assertTrue;
8
9 import org.junit.BeforeClass;
10 import org.junit.Test;
11 import org.springframework.context.ApplicationContext;
12 import org.springframework.context.support.ClassPathXmlApplicationContext;
13
14 /**
15 *
16 * @author joseswan
17 */
18 public class EventsDaoImplTest {
19
20 private static ApplicationContext applicationContext;
21
22 @BeforeClass
23 public static void createApplicationContext() throws Exception
24 {
25 setApplicationContext(new ClassPathXmlApplicationContext( getConfigLocations() ));
26 }
27
28 private static String[] getConfigLocations() {
29 return new String[] { "classpath:/SpringBeans.xml","classpath:/webmvc-config.xml" };
30 }
31
32 /**
33 * Test of initData method, of class EventsDaoImpl.
34 */
35 @Test
36 public void testInitData_3args() {
37 }
38
39 /**
40 * Test of initData method, of class EventsDaoImpl.
41 */
42 // @Test
43 // public void testInitData_String_String() {
44 // EventsDao dao = (EventsDao)getApplicationContext().getBean("eventDao");
45 //// dao.initData( null );
46 //
47 // int eventCount = 0;
48 //
49 //// dao.initData( null, "14" );
50 ////
51 //// assertTrue( "Failed to load events.", dao.getEvents() != null && dao.getEvents().size() > 0 );
52 ////
53 //// eventCount = dao.getEvents().size();
54 //// System.out.append( "Events list length: " + eventCount );
55 // dao.initData( null, "8" );
56 //
57 // assertTrue( "Failed to load events1.", dao.getEvents() != null && dao.getEvents().size() > eventCount );
58 //
59 // eventCount = dao.getEvents().size();
60 // System.out.println( "Events list length: " + eventCount );
61 //
62 // dao.initData( null, "8" );
63 //
64 // assertTrue( "Failed to load events2.", dao.getEvents() != null && dao.getEvents().size() > 0 );
65 // assertTrue( "Event list improperly removed duplicates.", dao.getEvents().size() == eventCount );
66 //
67 // eventCount = dao.getEvents().size();
68 // System.out.println( "Events list length: " + eventCount );
69 // }
70 //
71 // /**
72 // * Test of initData method, of class EventsDaoImpl.
73 // */
74 // @Test
75 // public void testInitData_String() {
76 // EventsDaoImpl dao = (EventsDaoImpl)getApplicationContext().getBean("eventDao");
77 //
78 // dao.initData( null );
79 //
80 // assertTrue( "Failed to load categories.", dao.getCategories() != null && dao.getCategories().size() > 0 );
81 // }
82
83 /**
84 * @return the applicationContext
85 */
86 public static ApplicationContext getApplicationContext() {
87 return applicationContext;
88 }
89
90 /**
91 * @param aApplicationContext the applicationContext to set
92 */
93 public static void setApplicationContext(ApplicationContext aApplicationContext) {
94 applicationContext = aApplicationContext;
95 }
96
97 }