Commit 6e1d0a0b authored by Georgios P. Katsikas's avatar Georgios P. Katsikas Committed by Georgios P. Katsikas
Browse files

fix: policy test

parent eacb5002
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ public class PolicyServiceImpl implements PolicyService {

    @Override
    public Uni<PolicyRuleState> deletePolicy(String policyRuleId) {
        LOGGER.infof("Received %s", policyRuleId);
        LOGGER.infof("Received policy %s for deletion", policyRuleId);

        final var retrievedPolicyRule = contextService.getPolicyRule(policyRuleId);

@@ -250,6 +250,7 @@ public class PolicyServiceImpl implements PolicyService {

    private PolicyRuleState removePolicyFromContext(PolicyRule policyRule) {
        if (policyRule == null) {
            LOGGER.error("Retrieved NULL policy rule from Context");
            return new PolicyRuleState(PolicyRuleStateEnum.POLICY_FAILED, String.format(INVALID_MESSAGE));
        }

@@ -287,6 +288,6 @@ public class PolicyServiceImpl implements PolicyService {
        contextService.removePolicyRule(policyRuleId).subscribe().with(x -> {});

        return new PolicyRuleState(
                PolicyRuleStateEnum.POLICY_FAILED, policyRuleBasic.getExceptionMessage());
                PolicyRuleStateEnum.POLICY_REMOVED, REMOVED_POLICYRULE_STATE.getPolicyRuleStateMessage());
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ public class PolicyRule {

    @Override
    public String toString() {
        return String.format(
                "%s:{configActionEnum:\"%s\", %s}", getClass().getSimpleName(), policyRuleType);
        return String.format("%s:{configActionEnum: %s}", getClass().getSimpleName(), policyRuleType);
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ public class PolicyRuleBasic {
        checkNotNull(policyRuleKPIs, "Policy rule KPIs cannot be NULL.");
        checkArgument(!policyRuleKPIs.isEmpty(), "Policy rule KPIs cannot be empty.");
        this.policyRuleKPIs = policyRuleKPIs;
        this.exceptionMessage = "";
        this.isValid = true;
    }

@@ -97,7 +98,7 @@ public class PolicyRuleBasic {
    @Override
    public String toString() {
        return String.format(
                "%s:{policyRuleId:\"%s\", %s, policyRulePriority:%d, [%s]}",
                "%s:{policyRuleId:\"%s\", %s, policyRulePriority:%d, [%s] [%s]}",
                getClass().getSimpleName(),
                policyRuleId,
                policyRuleState,
+0 −2
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@ public class PolicyRuleService extends PolicyRuleBase {
                    !serviceId.getContextId().isBlank(), "Context ID of Service ID must not be empty.");
            checkArgument(!serviceId.getId().isBlank(), "Service ID must not be empty.");
            this.serviceId = serviceId;
            // TODO If device list not empty
            // checkArgument(!deviceIds.isEmpty(), "Device IDs must not be empty.");
            this.deviceIds = deviceIds;
            this.isValid = true;
            this.exceptionMessage = "";
+0 −2
Original line number Diff line number Diff line
@@ -33,8 +33,6 @@ import org.jboss.logging.Logger;
public class PolicyRuleConditionValidator {

    private static final Logger LOGGER = Logger.getLogger(PolicyRuleConditionValidator.class);
    private static final String INVALID_MESSAGE = "%s is invalid.";
    private static final String VALID_MESSAGE = "%s is valid.";

    private final ContextService contextService;