View Javadoc

1   package org.kuali.ole.location;
2   
3   import org.junit.Before;
4   import org.junit.Test;
5   import org.junit.runner.RunWith;
6   import org.kuali.ole.ingest.LoadDefaultIngestProfileBean;
7   import org.kuali.ole.location.bo.OleLocation;
8   import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
9   import org.kuali.rice.krad.service.BusinessObjectService;
10  import org.kuali.rice.krad.service.KRADServiceLocator;
11  import org.springframework.test.context.ContextConfiguration;
12  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
13  import org.springframework.test.context.transaction.TransactionConfiguration;
14  
15  import java.util.Collection;
16  import java.util.Iterator;
17  
18  import static junit.framework.Assert.assertNotNull;
19  import static junit.framework.Assert.assertTrue;
20  
21  /**
22   * Created with IntelliJ IDEA.
23   * User: peris
24   * Date: 10/31/12
25   * Time: 9:16 AM
26   * To change this template use File | Settings | File Templates.
27   */
28  @ContextConfiguration(locations = {"classpath:/SpringBeans.xml"})
29  @RunWith(value = SpringJUnit4ClassRunner.class)
30  @TransactionConfiguration(defaultRollback = true)
31  public class LoadDefaultLocationsBean_UT {
32      protected LoadDefaultLocationsBean loadDefaultLocationsBean;
33      private BusinessObjectService businessObjectService;
34  
35      @Before
36      public void setUp() throws Exception {
37          businessObjectService = KRADServiceLocator.getBusinessObjectService();
38          loadDefaultLocationsBean = GlobalResourceLoader.getService("loadDefaultLocationsBean");
39      }
40  
41      @Test
42      public void loadDefaultLocations() throws Exception {
43          loadDefaultLocationsBean.loadDefaultLocations();
44          Collection<OleLocation> locations = businessObjectService.findAll(OleLocation.class);
45          assertNotNull(locations);
46          assertTrue(!locations.isEmpty());
47      }
48  }