View Javadoc

1   /**
2    * Copyright 2010 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  
16  package org.kuali.student.common_test_tester;
17  
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertNotNull;
20  
21  import org.junit.Test;
22  import org.kuali.student.common.test.spring.AbstractTransactionalDaoTest;
23  import org.kuali.student.common.test.spring.Dao;
24  import org.kuali.student.common.test.spring.PersistenceFileLocation;
25  import org.kuali.student.common_test_tester.support.MyDao;
26  import org.kuali.student.common_test_tester.support.Value;
27  
28  @Deprecated
29  @PersistenceFileLocation("classpath:META-INF/test-persistence.xml")
30  public class DaoCommonTest extends AbstractTransactionalDaoTest {
31  
32  	@Dao(value = "org.kuali.student.common_test_tester.support.MyDaoImpl", testDataFile = "classpath:META-INF/load-my-beans.xml", testSqlFile="classpath:test.sql")
33  	private MyDao myDao;
34  
35  	public Value value1;
36  	
37  	@Test
38  	public void test1() {
39  		Value value = new Value("Cheerios");
40  
41  		String id = myDao.createValue(value);
42  		//em.flush();//This is needed for eclipselink for some reason
43  		String result = myDao.findValue(id);
44  		assertEquals("Cheerios", result);
45  		
46  		assertNotNull(myDao.findValueFromValue("Value Number One"));
47  		assertNotNull(myDao.findValue("11223344-1122-1122-1111-000000000000"));
48  	}
49  	
50  	@Test
51  	public void test2() {
52  		Value value = new Value("Cheerios");
53  
54  		String id = myDao.createValue(value);
55  		//em.flush();//This is needed for eclipselink for some reason
56  		String result = myDao.findValue(id);
57  		assertEquals("Cheerios", result);
58  		
59  		assertNotNull(myDao.findValueFromValue("Value Number One"));
60  		assertNotNull(myDao.findValue("11223344-1122-1122-1111-000000000000"));
61  	}
62  }