From 7b5adac8cdcf61522644e201c50bb2ff6c4c72c8 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 22 Dec 2020 10:10:40 -0500 Subject: Allow wild-card in supportedPolicyTypes Changes to the validation code broke the validation check for the supportedPolicyTypes field in PdpSubGroup - it no longer supports wild- cards in the name. Modified the validation annotation in PfSearchableKey to allow wild-card names. Issue-ID: POLICY-2648 Change-Id: Ibd2853025ce72ed88697dd9a7d6d5eed2b28475e Signed-off-by: Jim Hahn --- .../src/main/java/org/onap/policy/models/base/PfSearchableKey.java | 2 +- .../src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'models-base') diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java index 3ff4160a3..902d19869 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfSearchableKey.java @@ -43,7 +43,7 @@ public class PfSearchableKey extends PfKeyImpl { public static final String WILDCARD_NAME_REGEXP = "^[A-Za-z0-9\\-_\\.]+(?:\\.\\*)?$"; @Column(name = NAME_TOKEN, length = 120) - @Pattern(regexp = NAME_REGEXP) + @Pattern(regexp = WILDCARD_NAME_REGEXP) private String name; @Column(name = VERSION_TOKEN, length = 20) diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java index e3a0e3338..f4f4bacb7 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java @@ -21,6 +21,7 @@ package org.onap.policy.models.base; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -73,5 +74,6 @@ public class PfSearchableKeyTest { PfSearchableKey someKey4 = new PfSearchableKey("my-name.*", VERSION001); assertEquals("my-name.*", someKey4.getName()); assertEquals(VERSION001, someKey4.getVersion()); + assertThat(someKey4.validate("").getResult()).isNull(); } } -- cgit 1.2.3-korg