Merge branch 'repos' into develop
This commit is contained in:
commit
207f7065fc
src
main/java/se/su/dsv/scipro/springdata
repos
serviceimpls
services
test/java/se/su/dsv/scipro/springdata
@ -0,0 +1,17 @@
|
||||
package se.su.dsv.scipro.springdata.repos;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public interface MatchRepo extends JpaRepository<Match, Long>, QueryDslPredicateExecutor<Match> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package se.su.dsv.scipro.springdata.repos;
|
||||
|
||||
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.Role;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public interface RoleRepo extends JpaRepository<Role, Long>, QueryDslPredicateExecutor<Role> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package se.su.dsv.scipro.springdata.repos;
|
||||
|
||||
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.User;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public interface UserRepo extends JpaRepository<User, Long>, QueryDslPredicateExecutor<User> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package se.su.dsv.scipro.springdata.serviceimpls;
|
||||
|
||||
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.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.springdata.repos.MatchRepo;
|
||||
import se.su.dsv.scipro.springdata.services.MatchService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Service ( "matchService" )
|
||||
@Transactional ( readOnly = true )
|
||||
public class MatchServiceImpl extends AbstractQueryService<Match, Long> implements MatchService {
|
||||
|
||||
@Resource
|
||||
private MatchRepo matchRepo;
|
||||
|
||||
@Autowired
|
||||
public MatchServiceImpl(
|
||||
@Qualifier("matchRepo")
|
||||
MatchRepo matchRepo) {
|
||||
super(matchRepo, matchRepo);
|
||||
System.out.println("BLA BLA");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package se.su.dsv.scipro.springdata.serviceimpls;
|
||||
|
||||
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.Role;
|
||||
import se.su.dsv.scipro.springdata.repos.RoleRepo;
|
||||
import se.su.dsv.scipro.springdata.services.RoleService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Service ( "roleService" )
|
||||
@Transactional ( readOnly = true )
|
||||
public class RoleServiceImpl extends AbstractQueryService<Role, Long> implements RoleService {
|
||||
|
||||
@Resource
|
||||
private RoleRepo roleRepo;
|
||||
|
||||
@Autowired
|
||||
public RoleServiceImpl(
|
||||
@Qualifier("roleRepo")
|
||||
RoleRepo roleRepo) {
|
||||
super(roleRepo, roleRepo);
|
||||
System.out.println("BLA BLA");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package se.su.dsv.scipro.springdata.serviceimpls;
|
||||
|
||||
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.User;
|
||||
import se.su.dsv.scipro.springdata.repos.UserRepo;
|
||||
import se.su.dsv.scipro.springdata.services.UserService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
@Service ( "userService" )
|
||||
@Transactional ( readOnly = true )
|
||||
public class UserServiceImpl extends AbstractQueryService<User, Long> implements UserService {
|
||||
|
||||
@Resource
|
||||
private UserRepo userRepo;
|
||||
|
||||
@Autowired
|
||||
public UserServiceImpl(
|
||||
@Qualifier("userRepo")
|
||||
UserRepo userRepo) {
|
||||
super(userRepo, userRepo);
|
||||
System.out.println("BLA BLA");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package se.su.dsv.scipro.springdata.services;
|
||||
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
public interface MatchService extends CrudService<Match, Long>, QueryService<Match, Long> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package se.su.dsv.scipro.springdata.services;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.Role;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
public interface RoleService extends CrudService<Role, Long>, QueryService<Role, Long> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package se.su.dsv.scipro.springdata.services;
|
||||
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
|
||||
/**
|
||||
* @author: fred-fri
|
||||
* date: 2012 03 26
|
||||
*/
|
||||
public interface UserService extends CrudService<User, Long>, QueryService<User, Long> {
|
||||
|
||||
//nothing here yet
|
||||
|
||||
}
|
@ -10,18 +10,14 @@ 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.RoleDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.UserDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Employee;
|
||||
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.match.dao.interfaces.MatchDao;
|
||||
import se.su.dsv.scipro.match.dataobject.ApplicationPeriod;
|
||||
import se.su.dsv.scipro.match.dataobject.Match;
|
||||
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
|
||||
import se.su.dsv.scipro.match.facade.ApplicationPeriodFacade;
|
||||
import se.su.dsv.scipro.springdata.services.ProjectClassService;
|
||||
import se.su.dsv.scipro.springdata.services.ProjectIdeaService;
|
||||
import se.su.dsv.scipro.springdata.services.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -33,17 +29,17 @@ import java.util.Set;
|
||||
public class TestProjectIdea {
|
||||
|
||||
@Autowired
|
||||
private UserDao userDao;
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private ProjectIdeaService projectIdeaService;
|
||||
@Autowired
|
||||
private ProjectClassService projectClassService;
|
||||
@Autowired
|
||||
private RoleDao roleDao;
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private ApplicationPeriodFacade applicationPeriodFacade;
|
||||
@Autowired
|
||||
private MatchDao matchDao;
|
||||
private MatchService matchService;
|
||||
|
||||
private ProjectIdea projectIdea1;
|
||||
private User employee1;
|
||||
@ -71,11 +67,11 @@ public class TestProjectIdea {
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
employee1 = new User();
|
||||
employee1 = userDao.save(employee1);
|
||||
employee1 = userService.save(employee1);
|
||||
|
||||
employee1Role = new Employee();
|
||||
employee1Role.setUser(employee1);
|
||||
employee1Role = (Employee) roleDao.save(employee1Role);
|
||||
employee1Role = (Employee) roleService.save(employee1Role);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +96,13 @@ public class TestProjectIdea {
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
matchDao.save(match1);
|
||||
|
||||
System.out.println("ÖÖÖÖÖÖ " + matchService.count() + " XXXXXX");
|
||||
match1 = matchService.save(match1);
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
System.out.println("ÅÅÅÅÅÅ " + matchService.count() + " XXXXXX");
|
||||
|
||||
Long l = new Long(1);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatus(Match.Status.UNMATCHED));
|
||||
@ -117,7 +119,10 @@ public class TestProjectIdea {
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
matchDao.save(match1);
|
||||
match1 = matchService.save(match1);
|
||||
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
Long l = new Long(0);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatus(Match.Status.CONFIRMED));
|
||||
@ -145,7 +150,10 @@ public class TestProjectIdea {
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
matchDao.save(match1);
|
||||
matchService.save(match1);
|
||||
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
Long l = new Long(1);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.UNMATCHED, bachelor));
|
||||
@ -162,7 +170,10 @@ public class TestProjectIdea {
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
matchDao.save(match1);
|
||||
matchService.save(match1);
|
||||
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
Long l = new Long(0);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.CONFIRMED, bachelor));
|
||||
@ -179,7 +190,10 @@ public class TestProjectIdea {
|
||||
match1.setProjectIdea(projectIdea1);
|
||||
match1.setStatus(Match.Status.UNMATCHED);
|
||||
match1.setCreatedBy(employee1);
|
||||
matchDao.save(match1);
|
||||
matchService.save(match1);
|
||||
|
||||
projectIdea1.setMatch(match1);
|
||||
projectIdea1 = projectIdeaService.save(projectIdea1);
|
||||
|
||||
Long l = new Long(0);
|
||||
Assert.assertEquals(l, projectIdeaService.countProjectIdeaByMatchStatusAndProjectClass(Match.Status.UNMATCHED, master));
|
||||
|
Loading…
x
Reference in New Issue
Block a user