1 /*
2 * Copyright 2011-2013 The Kuali Foundation Licensed under the
3 * Educational Community License, Version 2.0 (the "License"); you may
4 * not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
6 *
7 * http://www.osedu.org/licenses/ECL-2.0
8 *
9 * Unless required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on an "AS IS"
11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15 package org.kuali.mobility.dining.controllers;
16
17 import org.apache.log4j.Logger;
18 import org.junit.AfterClass;
19 import org.junit.Test;
20 import static org.junit.Assert.*;
21 import org.junit.BeforeClass;
22 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.context.ApplicationContext;
24 import org.springframework.context.support.FileSystemXmlApplicationContext;
25 import org.springframework.ui.ExtendedModelMap;
26
27 /**
28 *
29 * @author Joe Swanson <joseswan@umich.edu>
30 */
31 public class DiningControllerTest {
32
33 private static final Logger LOG = Logger.getLogger( DiningControllerTest.class );
34
35 @Autowired
36 private static ApplicationContext applicationContext;
37
38 /**
39 * @return the applicationContext
40 */
41 public static ApplicationContext getApplicationContext() {
42 return applicationContext;
43 }
44
45 /**
46 * @param aApplicationContext the applicationContext to set
47 */
48 public static void setApplicationContext(ApplicationContext aApplicationContext) {
49 applicationContext = aApplicationContext;
50 }
51
52 @BeforeClass
53 public static void setUpClass() throws Exception {
54 DiningControllerTest.setApplicationContext(new FileSystemXmlApplicationContext(getConfigLocations()));
55 }
56
57 private static String[] getConfigLocations() {
58 return new String[] { "classpath:/DiningSpringBeans.xml" };
59 }
60
61 @AfterClass
62 public static void tearDownClass() throws Exception {
63 }
64
65 // @Test
66 // public void testGetJsonData() {
67 // assertTrue( "Failed to find application context.", null != getApplicationContext() );
68 // DiningController controller = (DiningController)getApplicationContext().getBean("diningController");
69 //
70 // String jsonData = controller.getMenusJson( "Bursley Dining Hall", null);
71 //
72 // LOG.debug( "JSON: "+jsonData );
73 //
74 // assertTrue( "Failed to find json data.", jsonData != null && !jsonData.isEmpty() );
75 //
76 // jsonData = controller.getMenusJson( "Bursley Dining Hall", "");
77 //
78 // LOG.debug( "JSON: "+jsonData );
79 //
80 // assertTrue( "Failed to find json data.", jsonData != null && !jsonData.isEmpty() );
81 // }
82 }