001    /**
002     * Copyright 2010 The Kuali Foundation Licensed under the
003     * Educational Community License, Version 2.0 (the "License"); you may
004     * not use this file except in compliance with the License. You may
005     * obtain a copy of the License at
006     *
007     * http://www.osedu.org/licenses/ECL-2.0
008     *
009     * Unless required by applicable law or agreed to in writing,
010     * software distributed under the License is distributed on an "AS IS"
011     * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012     * or implied. See the License for the specific language governing
013     * permissions and limitations under the License.
014     */
015    
016    package org.kuali.student.common_test_tester;
017    
018    import static org.junit.Assert.assertEquals;
019    import static org.junit.Assert.assertNotNull;
020    
021    import org.junit.Test;
022    import org.kuali.student.common.test.spring.AbstractTransactionalDaoTest;
023    import org.kuali.student.common.test.spring.Dao;
024    import org.kuali.student.common.test.spring.PersistenceFileLocation;
025    import org.kuali.student.common_test_tester.support.MyDao;
026    import org.kuali.student.common_test_tester.support.Value;
027    
028    @Deprecated
029    @PersistenceFileLocation("classpath:META-INF/test-persistence.xml")
030    public class DaoCommonTest extends AbstractTransactionalDaoTest {
031    
032            @Dao(value = "org.kuali.student.common_test_tester.support.MyDaoImpl", testDataFile = "classpath:META-INF/load-my-beans.xml", testSqlFile="classpath:test.sql")
033            private MyDao myDao;
034    
035            public Value value1;
036            
037            @Test
038            public void test1() {
039                    Value value = new Value("Cheerios");
040    
041                    String id = myDao.createValue(value);
042                    //em.flush();//This is needed for eclipselink for some reason
043                    String result = myDao.findValue(id);
044                    assertEquals("Cheerios", result);
045                    
046                    assertNotNull(myDao.findValueFromValue("Value Number One"));
047                    assertNotNull(myDao.findValue("11223344-1122-1122-1111-000000000000"));
048            }
049            
050            @Test
051            public void test2() {
052                    Value value = new Value("Cheerios");
053    
054                    String id = myDao.createValue(value);
055                    //em.flush();//This is needed for eclipselink for some reason
056                    String result = myDao.findValue(id);
057                    assertEquals("Cheerios", result);
058                    
059                    assertNotNull(myDao.findValueFromValue("Value Number One"));
060                    assertNotNull(myDao.findValue("11223344-1122-1122-1111-000000000000"));
061            }
062    }