Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of #12 and documentation
- update documentation about architecture risk and technical debts and linked issue here. - renamed Start/Stop parts to more dedicated names - e.g. EnableScheduleJobProcessing - sending and handling missing events/messages - added integration test for schedule job processing disable/enable - renamed former named class SchedulerConfig to SchedulingEnabledByConditionConfiguration because no longer name conflict with new config in db On behalf of Daimler TSS GmbH.
- Loading branch information
Showing
31 changed files
with
537 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 0 additions & 69 deletions
69
.../daimler/sechub/domain/administration/schedule/SchedulerAdministrationRestController.java
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
...rc/main/java/com/daimler/sechub/domain/administration/schedule/StartSchedulerService.java
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
...src/main/java/com/daimler/sechub/domain/administration/schedule/StopSchedulerService.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...daimler/sechub/domain/administration/scheduler/SchedulerAdministrationRestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// SPDX-License-Identifier: MIT | ||
package com.daimler.sechub.domain.administration.scheduler; | ||
|
||
import javax.annotation.security.RolesAllowed; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.daimler.sechub.domain.administration.AdministrationAPIConstants; | ||
import com.daimler.sechub.sharedkernel.RoleConstants; | ||
import com.daimler.sechub.sharedkernel.Step; | ||
import com.daimler.sechub.sharedkernel.usecases.admin.schedule.UseCaseAdministratorDisablesSchedulerJobProcessing; | ||
import com.daimler.sechub.sharedkernel.usecases.admin.schedule.UseCaseAdministratorEnablesSchedulerJobProcessing; | ||
|
||
/** | ||
* The rest api for user administration done by a super admin. | ||
* | ||
* @author Albert Tregnaghi | ||
* | ||
*/ | ||
@RestController | ||
@EnableAutoConfiguration | ||
@RolesAllowed(RoleConstants.ROLE_SUPERADMIN) | ||
public class SchedulerAdministrationRestController { | ||
|
||
@Autowired | ||
SwitchSchedulerJobProcessingService switchJobProcessingService; | ||
|
||
@Autowired | ||
TriggerSchedulerStatusRefreshService triggerRefreshService; | ||
|
||
/* @formatter:off */ | ||
@UseCaseAdministratorEnablesSchedulerJobProcessing(@Step(number=1,name="Rest call",description="Administrator wants to start (unpause) scheduler job processing",needsRestDoc=true)) | ||
@RequestMapping(path = AdministrationAPIConstants.API_SCHEDULER_ENABLE_JOB_PROCESSING, method = RequestMethod.POST, produces= {MediaType.APPLICATION_JSON_UTF8_VALUE,MediaType.APPLICATION_JSON_VALUE}) | ||
@ResponseStatus(HttpStatus.OK) | ||
public void enableJobProcessing() { | ||
/* @formatter:on */ | ||
switchJobProcessingService.enableJobProcessing(); | ||
} | ||
|
||
/* @formatter:off */ | ||
@UseCaseAdministratorDisablesSchedulerJobProcessing(@Step(number=1,name="Rest call",description="Administrator wants to stop (pause) scheduler job processing",needsRestDoc=true)) | ||
@RequestMapping(path = AdministrationAPIConstants.API_SCHEDULER_DISABLE_JOB_PROCESSING, method = RequestMethod.POST, produces= {MediaType.APPLICATION_JSON_UTF8_VALUE,MediaType.APPLICATION_JSON_VALUE}) | ||
@ResponseStatus(HttpStatus.OK) | ||
public void disableJobProcessing() { | ||
/* @formatter:on */ | ||
switchJobProcessingService.disableJobProcessing(); | ||
} | ||
|
||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...on/schedule/SchedulerStatusEntryKeys.java → ...n/scheduler/SchedulerStatusEntryKeys.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...m/daimler/sechub/domain/administration/scheduler/SwitchSchedulerJobProcessingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: MIT | ||
package com.daimler.sechub.domain.administration.scheduler; | ||
|
||
import javax.annotation.security.RolesAllowed; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import com.daimler.sechub.sharedkernel.RoleConstants; | ||
import com.daimler.sechub.sharedkernel.Step; | ||
import com.daimler.sechub.sharedkernel.messaging.DomainMessage; | ||
import com.daimler.sechub.sharedkernel.messaging.DomainMessageFactory; | ||
import com.daimler.sechub.sharedkernel.messaging.DomainMessageService; | ||
import com.daimler.sechub.sharedkernel.messaging.IsSendingAsyncMessage; | ||
import com.daimler.sechub.sharedkernel.messaging.MessageID; | ||
import com.daimler.sechub.sharedkernel.usecases.admin.schedule.UseCaseAdministratorEnablesSchedulerJobProcessing; | ||
import com.daimler.sechub.sharedkernel.usecases.admin.schedule.UseCaseAdministratorDisablesSchedulerJobProcessing; | ||
|
||
@Service | ||
@RolesAllowed(RoleConstants.ROLE_SUPERADMIN) | ||
public class SwitchSchedulerJobProcessingService { | ||
|
||
@Autowired | ||
DomainMessageService eventBusService; | ||
|
||
/* @formatter:off */ | ||
@UseCaseAdministratorDisablesSchedulerJobProcessing(@Step(number=2,name="Service call",description="Sends request to scheduler domain to disable scheduler job processing")) | ||
public void disableJobProcessing() { | ||
/* @formatter:on */ | ||
sendDisableSchedulerJobProcessingMessage(); | ||
} | ||
|
||
/* @formatter:off */ | ||
@UseCaseAdministratorEnablesSchedulerJobProcessing(@Step(number=2,name="Service call",description="Sends request to scheduler domain to enable scheduler job processing")) | ||
public void enableJobProcessing() { | ||
/* @formatter:on */ | ||
sendEnableSchedulerJobProcessingMessage(); | ||
} | ||
|
||
@IsSendingAsyncMessage(MessageID.REQUEST_SCHEDULER_ENABLE_JOB_PROCESSING) | ||
private void sendEnableSchedulerJobProcessingMessage() { | ||
DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.REQUEST_SCHEDULER_ENABLE_JOB_PROCESSING); | ||
eventBusService.sendAsynchron(request); | ||
} | ||
|
||
@IsSendingAsyncMessage(MessageID.REQUEST_SCHEDULER_DISABLE_JOB_PROCESSING) | ||
private void sendDisableSchedulerJobProcessingMessage() { | ||
DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.REQUEST_SCHEDULER_DISABLE_JOB_PROCESSING); | ||
eventBusService.sendAsynchron(request); | ||
} | ||
|
||
} |
Oops, something went wrong.