Execute TestDataPopulators
This commit is contained in:
parent
4276dc15b1
commit
7a59844cb7
@ -34,13 +34,16 @@ import se.su.dsv.scipro.security.auth.roles.Roles;
|
|||||||
import se.su.dsv.scipro.system.*;
|
import se.su.dsv.scipro.system.*;
|
||||||
import se.su.dsv.scipro.util.Pair;
|
import se.su.dsv.scipro.util.Pair;
|
||||||
|
|
||||||
public class DataInitializer implements Lifecycle {
|
public class DataInitializer implements Lifecycle, BaseData, Factory {
|
||||||
|
|
||||||
public static final int APPLICATION_PERIOD_START_MINUS_DAYS = 1;
|
public static final int APPLICATION_PERIOD_START_MINUS_DAYS = 1;
|
||||||
public static final int APPLICATION_PERIOD_END_PLUS_DAYS = 3;
|
public static final int APPLICATION_PERIOD_END_PLUS_DAYS = 3;
|
||||||
public static final int APPLICATION_PERIOD_COURSE_START_PLUS_DAYS = 5;
|
public static final int APPLICATION_PERIOD_COURSE_START_PLUS_DAYS = 5;
|
||||||
public static final long RESEARCH_AREA_ID = 12L;
|
public static final long RESEARCH_AREA_ID = 12L;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Collection<TestDataPopulator> testDataPopulators = new ArrayList<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
@ -120,6 +123,9 @@ public class DataInitializer implements Lifecycle {
|
|||||||
createTarget();
|
createTarget();
|
||||||
createStudentIdea();
|
createStudentIdea();
|
||||||
createRoughDraftApproval();
|
createRoughDraftApproval();
|
||||||
|
for (TestDataPopulator testDataPopulator : testDataPopulators) {
|
||||||
|
testDataPopulator.populate(this, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (profile.getCurrentProfile() == Profiles.DEV && noAdminUser()) {
|
if (profile.getCurrentProfile() == Profiles.DEV && noAdminUser()) {
|
||||||
createAdmin();
|
createAdmin();
|
||||||
@ -243,13 +249,18 @@ public class DataInitializer implements Lifecycle {
|
|||||||
sofia_student = createStudent("Sofia", 17);
|
sofia_student = createStudent("Sofia", 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
private User createStudent(String firstName, int identifier) {
|
private User createStudent(String firstName) {
|
||||||
User user = createUser(firstName, STUDENT_LAST);
|
User user = createUser(firstName, STUDENT_LAST);
|
||||||
user.setIdentifier(identifier);
|
|
||||||
createBeta(user);
|
createBeta(user);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private User createStudent(String firstName, int identifier) {
|
||||||
|
User user = createStudent(firstName);
|
||||||
|
user.setIdentifier(identifier);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
private User createEmployee(String firstName) {
|
private User createEmployee(String firstName) {
|
||||||
User user = createUser(firstName, EMPLOYEE_LAST);
|
User user = createUser(firstName, EMPLOYEE_LAST);
|
||||||
Unit u = createUnit();
|
Unit u = createUnit();
|
||||||
@ -2087,6 +2098,36 @@ public class DataInitializer implements Lifecycle {
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProjectType bachelor() {
|
||||||
|
return bachelorClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProjectType magister() {
|
||||||
|
return magisterClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProjectType master() {
|
||||||
|
return masterClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User createAuthor(String firstName) {
|
||||||
|
return createStudent(firstName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User createSupervisor(String firstName) {
|
||||||
|
return createEmployee(firstName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User createReviewer(String firstName) {
|
||||||
|
return createEmployee(firstName);
|
||||||
|
}
|
||||||
|
|
||||||
private static final class SimpleTextFile implements FileUpload {
|
private static final class SimpleTextFile implements FileUpload {
|
||||||
|
|
||||||
private final User uploader;
|
private final User uploader;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user