Skip to content

Commit

Permalink
fix(impl): [#199] fix PMD errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmf committed Apr 10, 2024
1 parent da16713 commit 3ba862f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public CreatePoliciesResponse registerAllowedPolicy(@Valid @RequestBody final Cr
description = "Returns the policies as map of BPN to list of policies.",
content = { @Content(mediaType = APPLICATION_JSON_VALUE,
examples = @ExampleObject(
value = PolicyResponse.BPN_TO_POLICY_MAP_EXAMPLE),
PolicyResponse.BPN_TO_POLICY_MAP_EXAMPLE),
schema = @Schema(
description = "Map of BPN to list of policies"))
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@
})
public class PolicyStoreService implements AcceptedPoliciesProvider {

private final List<Policy> allowedPoliciesFromConfig;

private final PolicyPersistence persistence;

private final EdcTransformer edcTransformer;

private final Clock clock;

private static final String MISSING_REQUEST_FIELD_MESSAGE =
"Request does not contain all required fields. " + "Missing: %s";

private static final String DEFAULT = "default";

/**
* Constants for the configured default policy.
*/
Expand All @@ -85,19 +98,6 @@ private static final class ConfiguredDefaultPolicy {
public static final int DEFAULT_POLICY_LIFETIME_YEARS = 5;
}

private final List<Policy> allowedPoliciesFromConfig;

private final PolicyPersistence persistence;

private final EdcTransformer edcTransformer;

private final Clock clock;

private static final String MISSING_REQUEST_FIELD_MESSAGE =
"Request does not contain all required fields. " + "Missing: %s";

static final String DEFAULT = "default";

public PolicyStoreService(final DefaultAcceptedPoliciesConfig defaultAcceptedPoliciesConfig,
final PolicyPersistence persistence, final EdcTransformer edcTransformer, final Clock clock) {
this.allowedPoliciesFromConfig = createDefaultPolicyFromConfig(defaultAcceptedPoliciesConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class BusinessPartnerNumberListValidator
private static final Pattern PATTERN = Pattern.compile(BPN_REGEX);

@Override
public boolean isValid(List<String> value, ConstraintValidatorContext context) {
public boolean isValid(final List<String> value, final ConstraintValidatorContext context) {

// allow null and empty here (in order to allow flexible combination with @NotNull and @NotEmpty)
if (value == null || value.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void getAcceptedPolicies_whenNoPoliciesAssociatedWithTheGivenBpn_shouldReturnThe
// this overrides the configured default policy (see the previous test above)
final String defaultPolicyId1 = "registered-default-policy-1";
final String defaultPolicyId2 = "registered-default-policy-2";
when(persistenceMock.readAll(PolicyStoreService.DEFAULT)).thenReturn(List.of(
when(persistenceMock.readAll("default")).thenReturn(List.of(
// default policy 1
createPolicy(defaultPolicyId1),
// default policy 2
Expand Down

0 comments on commit 3ba862f

Please sign in to comment.