#78 fixed some smells

This commit is contained in:
Fabio Formosa
2022-11-08 23:53:24 +01:00
parent 018c0f18dc
commit e42b26fa73
10 changed files with 11 additions and 17 deletions

View File

@@ -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();
}

View File

@@ -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) {

View File

@@ -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!");

View File

@@ -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());

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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();
}
}

View File

@@ -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