Added new classes for implementing and testing Spring Data for Supervisor objects.
This commit is contained in:
parent
734d7e2777
commit
142b87f65c
src
main/java/se/su/dsv/scipro/springdata/serviceimpls
test/java/se/su/dsv/scipro/springdata
@ -1,28 +1,17 @@
|
||||
package se.su.dsv.scipro.springdata.serviceimpls;
|
||||
|
||||
import com.mysema.query.types.expr.BooleanExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
import se.su.dsv.scipro.match.dataobject.QProjectIdea;
|
||||
import se.su.dsv.scipro.springdata.repos.ProjectIdeaRepo;
|
||||
import se.su.dsv.scipro.springdata.repos.SupervisorRepo;
|
||||
import se.su.dsv.scipro.springdata.services.ProjectIdeaService;
|
||||
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
|
||||
@Service ( "supervisorService" )
|
||||
@Transactional ( readOnly = true )
|
||||
public class SupervisorServiceImpl extends AbstractQueryService<Employee, Long> implements SupervisorService {
|
||||
@ -39,8 +28,7 @@ public class SupervisorServiceImpl extends AbstractQueryService<Employee, Long>
|
||||
|
||||
@Override
|
||||
public List<Employee> findAllEmployees() {
|
||||
List<Employee> employeeList = new ArrayList<Employee>();
|
||||
return employeeList;
|
||||
return supervisorRepo.findAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package se.su.dsv.scipro.springdata;
|
||||
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.springdata.services.SupervisorService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(inheritLocations = false, locations = {
|
||||
"classpath:test-applicationContext.xml"
|
||||
})
|
||||
public class TestSupervisor {
|
||||
|
||||
@Autowired
|
||||
private SupervisorService supervisorService;
|
||||
|
||||
@Before
|
||||
public void startTransaction() throws Exception {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void findAllSupervisorsWithSpringData() {
|
||||
List<Employee> employeeList = new ArrayList<Employee>();
|
||||
employeeList.addAll(supervisorService.findAllEmployees());
|
||||
assertTrue(employeeList.size() > 0);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user