View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.time.assignment.service;
17  
18  import java.sql.Date;
19  import java.util.List;
20  
21  import org.apache.log4j.Logger;
22  import org.joda.time.DateTime;
23  import org.joda.time.DateTimeZone;
24  import org.junit.Assert;
25  import org.junit.Before;
26  import org.junit.Test;
27  import org.kuali.hr.test.KPMETestCase;
28  import org.kuali.hr.time.assignment.Assignment;
29  import org.kuali.hr.time.assignment.dao.AssignmentDao;
30  import org.kuali.hr.time.service.base.TkServiceLocator;
31  import org.kuali.hr.time.util.TKUtils;
32  
33  public class AssignmentServiceImplTest extends KPMETestCase {
34  
35  	private static final Logger LOG = Logger.getLogger(AssignmentServiceImplTest.class);
36  	AssignmentDao assignmentDao = null;
37  	AssignmentService assignmentService = null;
38  
39  	@Before
40  	public void setUp() throws Exception {
41  		super.setUp();
42  		assignmentDao = TkServiceLocator.getAssignmentDao();
43  		assignmentService=TkServiceLocator.getAssignmentService();
44  	}
45  
46  	@Test
47  	public void testGetAssignments() throws Exception {
48  		List<Assignment> assignments = assignmentService.getAssignments("admin", new Date((new DateTime(2010,8,5,1,0,0,0, TKUtils.getSystemDateTimeZone())).getMillis()));
49  		Assert.assertNotNull("Null assignment list", assignments);
50  		Assert.assertTrue("No assignments found", assignments.size() > 0);
51  
52  		for(Assignment assign : assignments){
53  			Assert.assertNotNull("Null job found", assign.getJob());
54  			Assert.assertTrue("Job number is same", assign.getJob().getJobNumber().compareTo(assign.getJobNumber())==0);
55  		}
56  
57  	}
58  
59  }