use of de.tum.in.www1.artemis.domain.participation.TemplateProgrammingExerciseParticipation in project ArTEMiS by ls1intum.
the class UrlServiceTest method testUserIndependentRepositoryUrl.
@Test
public void testUserIndependentRepositoryUrl() {
var solutionProgrammingExerciseParticipation = new SolutionProgrammingExerciseParticipation();
solutionProgrammingExerciseParticipation.setRepositoryUrl(repositoryUrl1.toString());
assertThat(solutionProgrammingExerciseParticipation.getUserIndependentRepositoryUrl()).isEqualTo("https://bitbucket.ase.in.tum.de/scm/EIST2016RME/RMEXERCISE-ab123cd");
var templateProgrammingExerciseParticipation = new TemplateProgrammingExerciseParticipation();
templateProgrammingExerciseParticipation.setRepositoryUrl(repositoryUrl2.toString());
assertThat(templateProgrammingExerciseParticipation.getUserIndependentRepositoryUrl()).isEqualTo("https://repobruegge.in.tum.de/scm/EIST2016RME/RMEXERCISE-ab123cd.git");
var studentParticipation1 = new ProgrammingExerciseStudentParticipation();
studentParticipation1.setRepositoryUrl(repositoryUrl3.toString());
assertThat(studentParticipation1.getUserIndependentRepositoryUrl()).isEqualTo("https://artemistest2gitlab.ase.in.tum.de/TESTADAPTER/testadapter-exercise.git");
var studentParticipation2 = new ProgrammingExerciseStudentParticipation();
studentParticipation2.setRepositoryUrl(repositoryUrl4.toString());
assertThat(studentParticipation2.getUserIndependentRepositoryUrl()).isEqualTo("https://artemistest2gitlab.ase.in.tum.de/FTCSCAGRADING1/ftcscagrading1-username");
assertThat(new ProgrammingExerciseStudentParticipation().getUserIndependentRepositoryUrl()).isNull();
var studentParticipation3 = new ProgrammingExerciseStudentParticipation();
studentParticipation3.setRepositoryUrl("http://localhost:8080/Assignment/rest/words/{name}/protection");
assertThat(studentParticipation3.getUserIndependentRepositoryUrl()).isNull();
}
use of de.tum.in.www1.artemis.domain.participation.TemplateProgrammingExerciseParticipation in project Artemis by ls1intum.
the class ProgrammingExerciseSimulationService method createSubmissionAndResult.
private Result createSubmissionAndResult(AbstractBaseProgrammingExerciseParticipation templateProgrammingExerciseParticipation, String commitHashBase) {
ProgrammingSubmission programmingSubmission = new ProgrammingSubmission();
programmingSubmission.setParticipation(templateProgrammingExerciseParticipation);
programmingSubmission.setSubmitted(true);
programmingSubmission.setType(SubmissionType.MANUAL);
programmingSubmission.setCommitHash(commitHashBase);
programmingSubmission.setSubmissionDate(templateProgrammingExerciseParticipation.getInitializationDate());
programmingSubmissionRepository.save(programmingSubmission);
Result result = new Result();
result.setParticipation(templateProgrammingExerciseParticipation);
result.setSubmission(programmingSubmission);
result.setRated(true);
result.setCompletionDate(templateProgrammingExerciseParticipation.getInitializationDate());
result.setAssessmentType(AssessmentType.AUTOMATIC);
return result;
}
use of de.tum.in.www1.artemis.domain.participation.TemplateProgrammingExerciseParticipation in project Artemis by ls1intum.
the class ProgrammingExerciseSimulationService method setupInitialSubmissionsAndResults.
/**
* This method creates the template and solution submissions and results for the new exercise
* These submissions and results are SIMULATIONS for the testing of programming exercises without a connection to
* the VCS and Continuous Integration server
* @param programmingExercise the new exercise
* This functionality is only for testing purposes (noVersionControlAndContinuousIntegrationAvailable)
*/
public void setupInitialSubmissionsAndResults(ProgrammingExercise programmingExercise) {
var templateProgrammingExerciseParticipation = this.templateProgrammingExerciseParticipationRepository.findByProgrammingExerciseId(programmingExercise.getId()).orElseThrow(() -> new EntityNotFoundException("TemplateProgrammingExerciseParticipation with programming exercise with " + programmingExercise.getId() + " does not exist"));
var solutionProgrammingExerciseParticipation = this.solutionProgrammingExerciseParticipationRepository.findByProgrammingExerciseId(programmingExercise.getId()).orElseThrow(() -> new EntityNotFoundException("SolutionProgrammingExerciseParticipation with programming exercise with " + programmingExercise.getId() + " does not exist"));
String commitHashBase = VCSSimulationUtils.simulateCommitHash();
Result templateResult = createSubmissionAndResult(templateProgrammingExerciseParticipation, commitHashBase);
templateResult.setResultString("0 of 13 passed");
templateResult.setScore(0D);
resultRepository.save(templateResult);
String commitHashSolution = VCSSimulationUtils.simulateCommitHash();
Result solutionResult = createSubmissionAndResult(solutionProgrammingExerciseParticipation, commitHashSolution);
solutionResult.setResultString("13 of 13 passed");
solutionResult.setScore(100D);
resultRepository.save(solutionResult);
}
use of de.tum.in.www1.artemis.domain.participation.TemplateProgrammingExerciseParticipation in project ArTEMiS by ls1intum.
the class ProgrammingExerciseSimulationService method setupInitialSubmissionsAndResults.
/**
* This method creates the template and solution submissions and results for the new exercise
* These submissions and results are SIMULATIONS for the testing of programming exercises without a connection to
* the VCS and Continuous Integration server
* @param programmingExercise the new exercise
* This functionality is only for testing purposes (noVersionControlAndContinuousIntegrationAvailable)
*/
public void setupInitialSubmissionsAndResults(ProgrammingExercise programmingExercise) {
var templateProgrammingExerciseParticipation = this.templateProgrammingExerciseParticipationRepository.findByProgrammingExerciseId(programmingExercise.getId()).orElseThrow(() -> new EntityNotFoundException("TemplateProgrammingExerciseParticipation with programming exercise with " + programmingExercise.getId() + " does not exist"));
var solutionProgrammingExerciseParticipation = this.solutionProgrammingExerciseParticipationRepository.findByProgrammingExerciseId(programmingExercise.getId()).orElseThrow(() -> new EntityNotFoundException("SolutionProgrammingExerciseParticipation with programming exercise with " + programmingExercise.getId() + " does not exist"));
String commitHashBase = VCSSimulationUtils.simulateCommitHash();
Result templateResult = createSubmissionAndResult(templateProgrammingExerciseParticipation, commitHashBase);
templateResult.setResultString("0 of 13 passed");
templateResult.setScore(0D);
resultRepository.save(templateResult);
String commitHashSolution = VCSSimulationUtils.simulateCommitHash();
Result solutionResult = createSubmissionAndResult(solutionProgrammingExerciseParticipation, commitHashSolution);
solutionResult.setResultString("13 of 13 passed");
solutionResult.setScore(100D);
resultRepository.save(solutionResult);
}
use of de.tum.in.www1.artemis.domain.participation.TemplateProgrammingExerciseParticipation in project ArTEMiS by ls1intum.
the class ProgrammingExerciseSimulationService method createSubmissionAndResult.
private Result createSubmissionAndResult(AbstractBaseProgrammingExerciseParticipation templateProgrammingExerciseParticipation, String commitHashBase) {
ProgrammingSubmission programmingSubmission = new ProgrammingSubmission();
programmingSubmission.setParticipation(templateProgrammingExerciseParticipation);
programmingSubmission.setSubmitted(true);
programmingSubmission.setType(SubmissionType.MANUAL);
programmingSubmission.setCommitHash(commitHashBase);
programmingSubmission.setSubmissionDate(templateProgrammingExerciseParticipation.getInitializationDate());
programmingSubmissionRepository.save(programmingSubmission);
Result result = new Result();
result.setParticipation(templateProgrammingExerciseParticipation);
result.setSubmission(programmingSubmission);
result.setRated(true);
result.setCompletionDate(templateProgrammingExerciseParticipation.getInitializationDate());
result.setAssessmentType(AssessmentType.AUTOMATIC);
return result;
}
Aggregations