1 package org.kuali.ole.catalog.bo;
2
3 import org.junit.Test;
4 import org.junit.runner.RunWith;
5 import org.kuali.rice.krad.service.BusinessObjectService;
6 import org.kuali.rice.krad.service.KRADServiceLocator;
7 import org.springframework.test.context.ContextConfiguration;
8 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
9 import org.springframework.test.context.transaction.TransactionConfiguration;
10 import org.springframework.transaction.annotation.Transactional;
11
12 import java.sql.Timestamp;
13
14 import static junit.framework.Assert.assertEquals;
15
16
17
18
19
20
21
22
23
24 @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
25 @RunWith(value = SpringJUnit4ClassRunner.class)
26 @TransactionConfiguration(defaultRollback = true)
27 public class OleSeperateOrCompositeReport_UT {
28
29 private BusinessObjectService boService ;
30
31 @Test
32 @Transactional
33 public void testSave() {
34 OleSeperateOrCompositeReport oleSeperateOrCompositeReport = new OleSeperateOrCompositeReport();
35 oleSeperateOrCompositeReport.setSeperateOrCompositeReportCode("s1");
36 oleSeperateOrCompositeReport.setSeperateOrCompositeReportName("Separate copy report");
37 oleSeperateOrCompositeReport.setSource("Test Source");
38 Timestamp st = new Timestamp(System.currentTimeMillis());
39 oleSeperateOrCompositeReport.setSourceDate(new java.sql.Date(st.getTime()));
40 oleSeperateOrCompositeReport.setActive(true);
41 boService = KRADServiceLocator.getBusinessObjectService();
42 boService.save(oleSeperateOrCompositeReport);
43 OleSeperateOrCompositeReport oleSeperateOrCompositeReportService = boService.findBySinglePrimaryKey(OleSeperateOrCompositeReport.class,oleSeperateOrCompositeReport.getSeperateOrCompositeReportId());
44 assertEquals("s1",oleSeperateOrCompositeReportService.getSeperateOrCompositeReportCode());
45 assertEquals("Separate copy report",oleSeperateOrCompositeReportService.getSeperateOrCompositeReportName());
46 }
47
48 @Test
49 @Transactional
50 public void testSearch() {
51 OleSeperateOrCompositeReport oleSeperateOrCompositeReport = new OleSeperateOrCompositeReport();
52 oleSeperateOrCompositeReport.setSeperateOrCompositeReportCode("c1");
53 oleSeperateOrCompositeReport.setSeperateOrCompositeReportName("Composite copy report");
54 oleSeperateOrCompositeReport.setSource("Test Source");
55 Timestamp st = new Timestamp(System.currentTimeMillis());
56 oleSeperateOrCompositeReport.setSourceDate(new java.sql.Date(st.getTime()));
57 oleSeperateOrCompositeReport.setActive(true);
58 boService = KRADServiceLocator.getBusinessObjectService();
59 boService.save(oleSeperateOrCompositeReport);
60 OleSeperateOrCompositeReport oleSeperateOrCompositeReportService = boService.findBySinglePrimaryKey(OleSeperateOrCompositeReport.class,oleSeperateOrCompositeReport.getSeperateOrCompositeReportId());
61 assertEquals("c1",oleSeperateOrCompositeReportService.getSeperateOrCompositeReportCode());
62 assertEquals("Composite copy report",oleSeperateOrCompositeReportService.getSeperateOrCompositeReportName());
63 }
64 }