Search in sources :

Example 1 with TemplateProgrammingExerciseParticipation

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();
}
Also used : ProgrammingExerciseStudentParticipation(de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation) TemplateProgrammingExerciseParticipation(de.tum.in.www1.artemis.domain.participation.TemplateProgrammingExerciseParticipation) SolutionProgrammingExerciseParticipation(de.tum.in.www1.artemis.domain.participation.SolutionProgrammingExerciseParticipation) Test(org.junit.jupiter.api.Test) AbstractSpringIntegrationBambooBitbucketJiraTest(de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)

Example 2 with TemplateProgrammingExerciseParticipation

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;
}
Also used : ProgrammingSubmission(de.tum.in.www1.artemis.domain.ProgrammingSubmission) Result(de.tum.in.www1.artemis.domain.Result)

Example 3 with TemplateProgrammingExerciseParticipation

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);
}
Also used : EntityNotFoundException(de.tum.in.www1.artemis.web.rest.errors.EntityNotFoundException) Result(de.tum.in.www1.artemis.domain.Result)

Example 4 with TemplateProgrammingExerciseParticipation

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);
}
Also used : EntityNotFoundException(de.tum.in.www1.artemis.web.rest.errors.EntityNotFoundException) Result(de.tum.in.www1.artemis.domain.Result)

Example 5 with TemplateProgrammingExerciseParticipation

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;
}
Also used : ProgrammingSubmission(de.tum.in.www1.artemis.domain.ProgrammingSubmission) Result(de.tum.in.www1.artemis.domain.Result)

Aggregations

Result (de.tum.in.www1.artemis.domain.Result)4 AbstractSpringIntegrationBambooBitbucketJiraTest (de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)2 ProgrammingSubmission (de.tum.in.www1.artemis.domain.ProgrammingSubmission)2 ProgrammingExerciseStudentParticipation (de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation)2 SolutionProgrammingExerciseParticipation (de.tum.in.www1.artemis.domain.participation.SolutionProgrammingExerciseParticipation)2 TemplateProgrammingExerciseParticipation (de.tum.in.www1.artemis.domain.participation.TemplateProgrammingExerciseParticipation)2 EntityNotFoundException (de.tum.in.www1.artemis.web.rest.errors.EntityNotFoundException)2 Test (org.junit.jupiter.api.Test)2