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 @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
24 @RunWith(value = SpringJUnit4ClassRunner.class)
25 @TransactionConfiguration(defaultRollback = true)
26 public class OleShelvingOrder_UT {
27
28 private BusinessObjectService boService ;
29
30 @Test
31 @Transactional
32 public void testSave() {
33 OleShelvingOrder oleShelvingOrder = new OleShelvingOrder();
34 oleShelvingOrder.setShelvingOrderCode("n1");
35 oleShelvingOrder.setShelvingOrderName("No information provided");
36 oleShelvingOrder.setSource("Test Source");
37 Timestamp st = new Timestamp(System.currentTimeMillis());
38 oleShelvingOrder.setSourceDate(new java.sql.Date(st.getTime()));
39 oleShelvingOrder.setActive(true);
40 boService = KRADServiceLocator.getBusinessObjectService();
41 boService.save(oleShelvingOrder);
42 OleShelvingOrder oleShelvingOrderService = boService.findBySinglePrimaryKey(OleShelvingOrder.class,oleShelvingOrder.getShelvingOrderId());
43 assertEquals("n1",oleShelvingOrderService.getShelvingOrderCode());
44 assertEquals("No information provided",oleShelvingOrderService.getShelvingOrderName());
45 }
46
47 @Test
48 @Transactional
49 public void testSearch() {
50 OleShelvingOrder oleShelvingOrder = new OleShelvingOrder();
51 oleShelvingOrder.setShelvingOrderCode("01");
52 oleShelvingOrder.setShelvingOrderName("Not enumeration");
53 oleShelvingOrder.setSource("Test Source");
54 Timestamp st = new Timestamp(System.currentTimeMillis());
55 oleShelvingOrder.setSourceDate(new java.sql.Date(st.getTime()));
56 oleShelvingOrder.setActive(true);
57 boService = KRADServiceLocator.getBusinessObjectService();
58 boService.save(oleShelvingOrder);
59 OleShelvingOrder oleShelvingOrderService = boService.findBySinglePrimaryKey(OleShelvingOrder.class,oleShelvingOrder.getShelvingOrderId());
60 assertEquals("01",oleShelvingOrderService.getShelvingOrderCode());
61 assertEquals("Not enumeration",oleShelvingOrderService.getShelvingOrderName());
62 }
63 }