Skip to content

Commit

Permalink
chore: Rename to highlight service functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
kaancayli committed Dec 16, 2024
1 parent c269687 commit 77a10be
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import de.tum.cit.aet.artemis.atlas.repository.CompetencyRepository;
import de.tum.cit.aet.artemis.core.exception.BadRequestAlertException;
import de.tum.cit.aet.artemis.core.repository.UserRepository;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventPublisher;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventPublisherService;
import de.tum.cit.aet.artemis.iris.service.pyris.event.CompetencyJolSetEvent;

/**
Expand All @@ -45,10 +45,10 @@ public class CompetencyJolService {

private final UserRepository userRepository;

private final Optional<PyrisEventPublisher> pyrisEventPublisher;
private final Optional<PyrisEventPublisherService> pyrisEventPublisher;

public CompetencyJolService(CompetencyJolRepository competencyJolRepository, CompetencyRepository competencyRepository,
CompetencyProgressRepository competencyProgressRepository, UserRepository userRepository, Optional<PyrisEventPublisher> pyrisEventPublisher) {
CompetencyProgressRepository competencyProgressRepository, UserRepository userRepository, Optional<PyrisEventPublisherService> pyrisEventPublisher) {
this.competencyJolRepository = competencyJolRepository;
this.competencyRepository = competencyRepository;
this.competencyProgressRepository = competencyProgressRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
*/
@Service
@Profile(PROFILE_IRIS)
public class PyrisEventPublisher {
public class PyrisEventPublisherService {

private static final Logger log = LoggerFactory.getLogger(PyrisEventPublisher.class);
private static final Logger log = LoggerFactory.getLogger(PyrisEventPublisherService.class);

private final ApplicationEventPublisher eventPublisher;

private final IrisSettingsService irisSettingsService;

public PyrisEventPublisher(ApplicationEventPublisher eventPublisher, IrisSettingsService irisSettingsService) {
public PyrisEventPublisherService(ApplicationEventPublisher eventPublisher, IrisSettingsService irisSettingsService) {
this.eventPublisher = eventPublisher;
this.irisSettingsService = irisSettingsService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import de.tum.cit.aet.artemis.exercise.domain.participation.StudentParticipation;
import de.tum.cit.aet.artemis.exercise.dto.SubmissionDTO;
import de.tum.cit.aet.artemis.exercise.repository.TeamRepository;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventPublisher;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventPublisherService;
import de.tum.cit.aet.artemis.iris.service.pyris.event.NewResultEvent;
import de.tum.cit.aet.artemis.lti.service.LtiNewResultService;
import de.tum.cit.aet.artemis.programming.domain.ProgrammingExercise;
Expand All @@ -51,11 +51,11 @@ public class ProgrammingMessagingService {

private final TeamRepository teamRepository;

private final Optional<PyrisEventPublisher> pyrisEventPublisher;
private final Optional<PyrisEventPublisherService> pyrisEventPublisher;

public ProgrammingMessagingService(GroupNotificationService groupNotificationService, WebsocketMessagingService websocketMessagingService,
ResultWebsocketService resultWebsocketService, Optional<LtiNewResultService> ltiNewResultService, TeamRepository teamRepository,
Optional<PyrisEventPublisher> pyrisEventPublisher) {
Optional<PyrisEventPublisherService> pyrisEventPublisher) {
this.groupNotificationService = groupNotificationService;
this.websocketMessagingService = websocketMessagingService;
this.resultWebsocketService = resultWebsocketService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import de.tum.cit.aet.artemis.iris.domain.settings.event.IrisEventType;
import de.tum.cit.aet.artemis.iris.repository.IrisSettingsRepository;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventProcessingException;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventPublisher;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventPublisherService;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisEventService;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisJobService;
import de.tum.cit.aet.artemis.iris.service.pyris.PyrisStatusUpdateService;
Expand Down Expand Up @@ -75,7 +75,7 @@ class PyrisEventSystemIntegrationTest extends AbstractIrisIntegrationTest {
private SubmissionTestRepository submissionRepository;

@Autowired
private PyrisEventPublisher pyrisEventPublisher;
private PyrisEventPublisherService pyrisEventPublisherService;

@Autowired
private ParticipationUtilService participationUtilService;
Expand Down Expand Up @@ -193,7 +193,7 @@ void testShouldFireProgressStalledEvent() {
pipelineDone.set(true);
});

pyrisEventPublisher.publishEvent(new NewResultEvent(this, result));
pyrisEventPublisherService.publishEvent(new NewResultEvent(this, result));
verify(irisExerciseChatSessionService, times(1)).onNewResult(eq(result));

await().atMost(2, TimeUnit.SECONDS).until(() -> pipelineDone.get());
Expand All @@ -213,7 +213,7 @@ void testShouldFireBuildFailedEvent() {
pipelineDone.set(true);
});

pyrisEventPublisher.publishEvent(new NewResultEvent(this, result));
pyrisEventPublisherService.publishEvent(new NewResultEvent(this, result));
verify(irisExerciseChatSessionService, times(1)).onBuildFailure(eq(result));

await().atMost(2, TimeUnit.SECONDS).until(() -> pipelineDone.get());
Expand Down Expand Up @@ -251,7 +251,7 @@ void testShouldNotFireProgressStalledEventWithEventDisabled() {
createSubmissionWithScore(studentParticipation, 40);
createSubmissionWithScore(studentParticipation, 40);
var result = createSubmissionWithScore(studentParticipation, 40);
pyrisEventPublisher.publishEvent(new NewResultEvent(this, result));
pyrisEventPublisherService.publishEvent(new NewResultEvent(this, result));

verify(irisExerciseChatSessionService, times(0)).onNewResult(any(Result.class));
verify(pyrisPipelineService, times(0)).executeExerciseChatPipeline(any(), any(), any(), any(), any());
Expand All @@ -268,7 +268,7 @@ void testShouldNotFireBuildFailedEventWhenEventSettingDisabled() {
irisExerciseChatSessionService.createChatSessionForProgrammingExercise(exercise, userUtilService.getUserByLogin(TEST_PREFIX + "student1"));
// Create a failing submission for the student.
var result = createFailingSubmission(studentParticipation);
pyrisEventPublisher.publishEvent(new NewResultEvent(this, result));
pyrisEventPublisherService.publishEvent(new NewResultEvent(this, result));

verify(irisExerciseChatSessionService, times(0)).onBuildFailure(any(Result.class));
verify(pyrisPipelineService, times(0)).executeExerciseChatPipeline(any(), any(), any(), any(), any());
Expand All @@ -285,13 +285,13 @@ void testShouldShouldNotFireProgressStalledEventWithExistingSuccessfulSubmission
createSubmissionWithScore(studentParticipation, 100);
var result = createSubmissionWithScore(studentParticipation, 50);

pyrisEventPublisher.publishEvent(new NewResultEvent(this, result));
pyrisEventPublisherService.publishEvent(new NewResultEvent(this, result));

await().atMost(2, TimeUnit.SECONDS);

result = createSubmissionWithScore(studentParticipation, 50);

pyrisEventPublisher.publishEvent(new NewResultEvent(this, result));
pyrisEventPublisherService.publishEvent(new NewResultEvent(this, result));
await().atMost(2, TimeUnit.SECONDS);

verify(irisExerciseChatSessionService, times(2)).onNewResult(any(Result.class));
Expand All @@ -306,7 +306,7 @@ void testShouldNotFireProgressStalledEventWithLessThanThreeSubmissions() {
createSubmissionWithScore(studentParticipation, 20);
var result = createSubmissionWithScore(studentParticipation, 20);

pyrisEventPublisher.publishEvent(new NewResultEvent(this, result));
pyrisEventPublisherService.publishEvent(new NewResultEvent(this, result));

verify(irisExerciseChatSessionService, times(1)).onNewResult(any(Result.class));
verify(pyrisPipelineService, times(0)).executeExerciseChatPipeline(any(), any(), any(), any(), any());
Expand All @@ -321,7 +321,7 @@ void testShouldNotFireProgressStalledEventWithIncreasingScores() {
createSubmissionWithScore(studentParticipation, 30);
var result = createSubmissionWithScore(studentParticipation, 40);

pyrisEventPublisher.publishEvent(new NewResultEvent(this, result));
pyrisEventPublisherService.publishEvent(new NewResultEvent(this, result));

verify(irisExerciseChatSessionService, times(1)).onNewResult(any(Result.class));
verify(pyrisPipelineService, times(0)).executeExerciseChatPipeline(any(), any(), any(), any(), any());
Expand Down

0 comments on commit 77a10be

Please sign in to comment.