mirror of
https://github.com/fabioformosa/quartz-manager.git
synced 2026-01-08 10:33:18 +09:00
#78 fixed some smells
This commit is contained in:
@@ -40,7 +40,7 @@ public class OpenApiConfig {
|
||||
public GroupedOpenApi quartzManagerStoreOpenApi(@Autowired(required = false) @Qualifier("quartzManagerOpenApiCustomiser") Optional<OpenApiCustomiser> openApiCustomiser) {
|
||||
String[] paths = {QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/**"};
|
||||
GroupedOpenApi.Builder groupedOpenApiBuilder = GroupedOpenApi.builder().group("quartz-manager").pathsToMatch(paths);
|
||||
openApiCustomiser.ifPresent(oaCustomizer -> groupedOpenApiBuilder.addOpenApiCustomiser(oaCustomizer));
|
||||
openApiCustomiser.ifPresent(groupedOpenApiBuilder::addOpenApiCustomiser);
|
||||
return groupedOpenApiBuilder.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,10 @@ public class SimpleTriggerCommandDTOToSimpleTrigger implements Converter<SimpleT
|
||||
|
||||
setTheMisfireInstruction(triggerCommandDTO, scheduleBuilder);
|
||||
|
||||
SimpleTrigger newSimpleTrigger = triggerTriggerBuilder.withSchedule(
|
||||
return triggerTriggerBuilder.withSchedule(
|
||||
scheduleBuilder
|
||||
)
|
||||
.withIdentity(triggerCommandDTO.getTriggerName()).build();
|
||||
|
||||
return newSimpleTrigger;
|
||||
}
|
||||
|
||||
private static void setTheMisfireInstruction(SimpleTriggerCommandDTO triggerCommandDTO, SimpleScheduleBuilder scheduleBuilder) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.ToString;
|
||||
@Getter
|
||||
public class TriggerNotFoundException extends Exception {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TriggerNotFoundException(String name) {
|
||||
super("Trigger with name " + name + " not found!");
|
||||
|
||||
@@ -35,9 +35,6 @@ public class SimpleTriggerService extends AbstractSchedulerService {
|
||||
}
|
||||
|
||||
public TriggerDTO rescheduleSimpleTrigger(SimpleTriggerCommandDTO triggerCommandDTO) throws SchedulerException {
|
||||
//Optional<TriggerKey> optionalTriggerKey = getTriggerByKey(name);
|
||||
// TriggerKey triggerKey = optionalTriggerKey.orElse(TriggerKey.triggerKey(name));
|
||||
|
||||
SimpleTrigger newSimpleTrigger = conversionService.convert(triggerCommandDTO, SimpleTrigger.class);
|
||||
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(triggerCommandDTO.getTriggerName());
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.test.context.TestPropertySource;
|
||||
"quartz-manager.security.accounts.in-memory.users[0].password=bar",
|
||||
"quartz-manager.security.accounts.in-memory.users[0].roles[0]=admin",
|
||||
})
|
||||
public class SecurityLoginViaCookieTest extends AbstractSecurityLoginTest {
|
||||
class SecurityLoginViaCookieTest extends AbstractSecurityLoginTest {
|
||||
|
||||
@Test
|
||||
void givenAnAnonymousUser_whenTheLoginIsSubmitted_thenShouldReturn2xx() {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.springframework.test.context.TestPropertySource;
|
||||
"quartz-manager.security.accounts.in-memory.users[0].password=bar",
|
||||
"quartz-manager.security.accounts.in-memory.users[0].roles[0]=admin",
|
||||
})
|
||||
public class SecurityLoginViaDefaultStrategyTest extends AbstractSecurityLoginTest {
|
||||
class SecurityLoginViaDefaultStrategyTest extends AbstractSecurityLoginTest {
|
||||
|
||||
@Test
|
||||
void givenAnAnonymousUser_whenTheLoginIsSubmitted_thenShouldReturn2xx() {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.test.context.TestPropertySource;
|
||||
"quartz-manager.security.accounts.in-memory.users[0].password=bar",
|
||||
"quartz-manager.security.accounts.in-memory.users[0].roles[0]=admin",
|
||||
})
|
||||
public class SecurityLoginViaHeaderAndLoginFilterTest extends AbstractSecurityLoginTest {
|
||||
class SecurityLoginViaHeaderAndLoginFilterTest extends AbstractSecurityLoginTest {
|
||||
|
||||
@Test
|
||||
void givenAnAnonymousUser_whenTheLoginIsSubmitted_thenShouldReturn2xx() {
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.test.context.TestPropertySource;
|
||||
"quartz-manager.security.accounts.in-memory.users[0].password=bar",
|
||||
"quartz-manager.security.accounts.in-memory.users[0].roles[0]=admin",
|
||||
})
|
||||
public class SecurityLoginViaHeaderTest extends AbstractSecurityLoginTest {
|
||||
class SecurityLoginViaHeaderTest extends AbstractSecurityLoginTest {
|
||||
|
||||
@Test
|
||||
void givenAnAnonymousUser_whenTheLoginIsSubmitted_thenShouldReturn2xx() {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class InMemoryUsersValidationControllerTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("it.fabioformosa.quartzmanager.api.security.properties.InMemoryUsersValidationControllerTest#getNotValidInMemoryProps")
|
||||
void givenAMissingUsername_whenThePropertyValidationIsApplied_thenShouldRaiseValidationError(Map<String, String> properties) throws Exception {
|
||||
void givenAMissingUsername_whenThePropertyValidationIsApplied_thenShouldRaiseValidationError(Map<String, String> properties) {
|
||||
ConfigurationPropertySource source = new MapConfigurationPropertySource(properties);
|
||||
|
||||
Binder binder = new Binder(source);
|
||||
@@ -54,7 +54,7 @@ public class InMemoryUsersValidationControllerTest {
|
||||
Assertions.assertThat(result.isBound()).isTrue();
|
||||
|
||||
InMemoryAccountProperties inMemoryAccountProperties = result.get();
|
||||
Assertions.assertThat(propertyValidator.validate(inMemoryAccountProperties).size()).isPositive();
|
||||
Assertions.assertThat(propertyValidator.validate(inMemoryAccountProperties)).isNotEmpty();
|
||||
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class InMemoryUsersValidationControllerTest {
|
||||
Assertions.assertThat(result.isBound()).isTrue();
|
||||
|
||||
InMemoryAccountProperties inMemoryAccountProperties = result.get();
|
||||
Assertions.assertThat(propertyValidator.validate(inMemoryAccountProperties).size()).isZero();
|
||||
Assertions.assertThat(propertyValidator.validate(inMemoryAccountProperties)).isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class WebShowcaseOpenApiConfig {
|
||||
|
||||
@Bean
|
||||
public OpenAPI webshowcaseOpenAPI() {
|
||||
OpenAPI openAPI = new OpenAPI()
|
||||
return new OpenAPI()
|
||||
.info(new Info()
|
||||
.title("QUARTZ MANAGER DEMO API")
|
||||
.description("Quartz Manager- DEMO - REST API")
|
||||
@@ -20,7 +20,6 @@ public class WebShowcaseOpenApiConfig {
|
||||
.license(new License()
|
||||
.name("Apache License 2.0")
|
||||
.url("https://github.com/fabioformosa/quartz-manager/blob/master/LICENSE")));
|
||||
return openAPI;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user