Merge branch 'develop' of git.dsv.su.se:/git/scipro/scipro into develop
This commit is contained in:
commit
abdabe0d88
6
pom.xml
6
pom.xml
@ -24,6 +24,11 @@
|
||||
<name>Spring Maven MILESTONE Repository</name>
|
||||
<url>http://repo.springsource.org/libs-milestone</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-roo-repository</id>
|
||||
<name>Spring Roo Repository</name>
|
||||
<url>http://spring-roo-repository.springsource.org/release</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<!-- WICKET DEPENDENCIES -->
|
||||
@ -401,6 +406,7 @@
|
||||
<version>1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!--<phase>generated-sources</phase>-->
|
||||
<goals>
|
||||
<goal>process</goal>
|
||||
</goals>
|
||||
|
@ -4,7 +4,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
|
@ -1,46 +1,34 @@
|
||||
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 {
|
||||
|
||||
|
||||
@Resource
|
||||
private SupervisorRepo supervisorRepo;
|
||||
@Resource
|
||||
private SupervisorRepo supervisorRepo;
|
||||
|
||||
@Autowired
|
||||
public SupervisorServiceImpl(@Qualifier("supervisorRepo") SupervisorRepo supervisorRepo) {
|
||||
super(supervisorRepo, supervisorRepo);
|
||||
System.out.println("BLA BLA");
|
||||
}
|
||||
@Autowired
|
||||
public SupervisorServiceImpl(@Qualifier("supervisorRepo") SupervisorRepo supervisorRepo) {
|
||||
super(supervisorRepo, supervisorRepo);
|
||||
System.out.println("BLA BLA");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public List<Employee> findAllEmployees() {
|
||||
List<Employee> employeeList = new ArrayList<Employee>();
|
||||
return employeeList;
|
||||
return supervisorRepo.findAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
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.dao.interfaces.UserDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UsernameDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.data.dataobjects.Username;
|
||||
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;
|
||||
|
||||
@Autowired
|
||||
private UserDao userDao;
|
||||
|
||||
@SuppressWarnings("EmptyMethod")
|
||||
@Before
|
||||
public void startTransaction() throws Exception {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for implementing a supervisorService with Spring Data
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback
|
||||
public void findAllSupervisorsWithSpringData() {
|
||||
List<Employee> employeeList = new ArrayList<Employee>();
|
||||
User davidH = new User();
|
||||
davidH.setFirstName("David");
|
||||
davidH.setLastName("Hallberg");
|
||||
davidH.setEmailAddress("dhallb@dsv.su.se");
|
||||
davidH = userDao.save(davidH);
|
||||
|
||||
Employee supervisor = new Employee();
|
||||
supervisor.setUser(davidH);
|
||||
supervisorService.save(supervisor);
|
||||
// employeeList.addAll(supervisorService.findAllEmployees());
|
||||
// assertTrue(employeeList.size() == 1);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user