use of de.tum.in.www1.artemis.domain.Team in project Artemis by ls1intum.
the class TeamImportIntegrationTest method testImportTeamsIntoExerciseWithConflictsUsingPurgeExistingStrategy.
private void testImportTeamsIntoExerciseWithConflictsUsingPurgeExistingStrategy(ImportType type, List<Team> body, List<Team> addedTeams) throws Exception {
TeamImportStrategyType strategyType = TeamImportStrategyType.PURGE_EXISTING;
database.addTeamsForExercise(destinationExercise, "sameShortName", 2, tutor);
// imported source teams = destination teams after
testImportTeamsIntoExercise(type, strategyType, body, addedTeams);
}
use of de.tum.in.www1.artemis.domain.Team in project Artemis by ls1intum.
the class TeamImportIntegrationTest method testImportTeamsIntoExercise.
private void testImportTeamsIntoExercise(ImportType type, TeamImportStrategyType importStrategyType, List<Team> body, List<Team> addedTeams) throws Exception {
TeamImportStrategyType importStrategy = TeamImportStrategyType.CREATE_ONLY;
if (importStrategyType != null) {
importStrategy = importStrategyType;
}
String url = importFromSourceExerciseUrl(importStrategy);
if (type == ImportType.FROM_LIST) {
url = importFromListUrl(importStrategy);
}
List<Team> destinationTeamsAfter = request.putWithResponseBodyList(url, body, Team.class, HttpStatus.OK);
assertCorrectnessOfImport(addedTeams, destinationTeamsAfter);
}
use of de.tum.in.www1.artemis.domain.Team in project Artemis by ls1intum.
the class TeamImportIntegrationTest method getTeamsIntoOneIdentifierTeams.
private List<Team> getTeamsIntoOneIdentifierTeams(List<Team> teams, String identifier) {
return teams.stream().map(team -> {
Team newTeam = new Team();
newTeam.setName(team.getName());
newTeam.setShortName(team.getShortName());
newTeam.setOwner(team.getOwner());
List<User> newStudents = team.getStudents().stream().map(student -> {
User newStudent = new User();
newStudent.setFirstName(student.getFirstName());
newStudent.setLastName(student.getLastName());
if ("login".equals(identifier)) {
newStudent.setLogin(student.getLogin());
} else if ("registrationNumber".equals(identifier)) {
newStudent.setVisibleRegistrationNumber(student.getRegistrationNumber());
}
return newStudent;
}).toList();
newTeam.setStudents(new HashSet<>(newStudents));
return newTeam;
}).collect(Collectors.toList());
}
use of de.tum.in.www1.artemis.domain.Team in project Artemis by ls1intum.
the class TeamImportIntegrationTest method testImportTeamsIntoExerciseWithTeamShortNameConflictsUsingCreateOnlyStrategy.
private void testImportTeamsIntoExerciseWithTeamShortNameConflictsUsingCreateOnlyStrategy(ImportType type, List<Team> body, List<Team> teamsWithoutConflict) throws Exception {
TeamImportStrategyType strategyType = TeamImportStrategyType.CREATE_ONLY;
List<Team> destinationTeamsBefore = database.addTeamsForExercise(destinationExercise, "sameShortName", 3, tutor);
// destination teams before + conflict-free source teams = destination teams after
testImportTeamsIntoExercise(type, strategyType, body, addLists(destinationTeamsBefore, teamsWithoutConflict));
}
use of de.tum.in.www1.artemis.domain.Team in project Artemis by ls1intum.
the class TeamImportIntegrationTest method testImportTeamsIntoExerciseWithNoConflictsUsingCreateOnlyStrategy.
private void testImportTeamsIntoExerciseWithNoConflictsUsingCreateOnlyStrategy(ImportType type, List<Team> body, List<Team> addedTeams) throws Exception {
TeamImportStrategyType strategyType = TeamImportStrategyType.CREATE_ONLY;
List<Team> destinationTeamsBefore = database.addTeamsForExercise(destinationExercise, 1, tutor);
// destination teams before + source teams = destination teams after
testImportTeamsIntoExercise(type, strategyType, body, addLists(destinationTeamsBefore, addedTeams));
}
Aggregations