aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src
diff options
context:
space:
mode:
Diffstat (limited to 'models-tosca/src')
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java10
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java6
-rw-r--r--models-tosca/src/test/resources/onap.policies.NoVersion.yaml30
3 files changed, 38 insertions, 8 deletions
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java
index 28836a981..d9ffec566 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java
@@ -144,19 +144,19 @@ public class ToscaPolicyTypeFilterTest {
List<ToscaPolicyType> filteredList = filter.filter(typeList);
assertEquals(20, filteredList.size());
assertEquals(VERSION_100, filteredList.get(0).getVersion());
- assertEquals(VERSION_000, filteredList.get(11).getVersion());
+ assertEquals(VERSION_100, filteredList.get(11).getVersion());
typeList.get(12).setVersion("2.0.0");
filteredList = filter.filter(typeList);
assertEquals(20, filteredList.size());
assertEquals("2.0.0", filteredList.get(11).getVersion());
- assertEquals(VERSION_000, filteredList.get(18).getVersion());
+ assertEquals(VERSION_100, filteredList.get(18).getVersion());
typeList.get(12).setVersion(VERSION_100);
filteredList = filter.filter(typeList);
assertEquals(20, filteredList.size());
assertEquals(VERSION_100, filteredList.get(0).getVersion());
- assertEquals(VERSION_000, filteredList.get(18).getVersion());
+ assertEquals(VERSION_100, filteredList.get(18).getVersion());
}
@Test
@@ -175,12 +175,12 @@ public class ToscaPolicyTypeFilterTest {
filter = ToscaPolicyTypeFilter.builder().version(VERSION_000).build();
filteredList = filter.filter(typeList);
- assertEquals(9, filteredList.size());
+ assertEquals(1, filteredList.size());
filter = ToscaPolicyTypeFilter.builder().name("onap.policies.optimization.Vim_fit").version(VERSION_000)
.build();
filteredList = filter.filter(typeList);
- assertEquals(1, filteredList.size());
+ assertEquals(0, filteredList.size());
filter = ToscaPolicyTypeFilter.builder().name("onap.policies.optimization.Vim_fit").version("0.0.1").build();
filteredList = filter.filter(typeList);
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java
index d77b52daa..20b8e5d1e 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java
@@ -56,8 +56,8 @@ import org.yaml.snakeyaml.Yaml;
*/
public class AuthorativeToscaProviderPolicyTypeTest {
private static final String VERSION = "version";
- private static final String POLICY_AFFINITY_VERSION0 = "onap.policies.optimization.AffinityPolicy:0.0.0";
- private static final String POLICY_AFFINITY = "onap.policies.optimization.AffinityPolicy";
+ private static final String POLICY_AFFINITY_VERSION0 = "onap.policies.NoVersion:0.0.0";
+ private static final String POLICY_AFFINITY = "onap.policies.NoVersion";
private static final String MISSING_POLICY_TYPES = "no policy types specified on service template";
private static final String DAO_IS_NULL = "dao is marked @NonNull but is null";
private static final String VERSION_000 = "0.0.0";
@@ -74,7 +74,7 @@ public class AuthorativeToscaProviderPolicyTypeTest {
@BeforeClass
public static void readPolicyDefinition() {
String yamlString =
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.AffinityPolicy.yaml");
+ ResourceUtils.getResourceAsString("src/test/resources/onap.policies.NoVersion.yaml");
Object yamlObject = new Yaml().load(yamlString);
yamlAsJsonString = new GsonBuilder().setPrettyPrinting().create().toJson(yamlObject);
diff --git a/models-tosca/src/test/resources/onap.policies.NoVersion.yaml b/models-tosca/src/test/resources/onap.policies.NoVersion.yaml
new file mode 100644
index 000000000..7d1262b7d
--- /dev/null
+++ b/models-tosca/src/test/resources/onap.policies.NoVersion.yaml
@@ -0,0 +1,30 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ onap.policies.NoVersion:
+ derived_from: onap.policies.Optimization
+ properties:
+ applicableResources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - any
+ - all
+ affinityProperties:
+ type: policy.data.affinityProperties_properties
+ required: true
+data_types:
+ policy.data.affinityProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ qualifier:
+ type: string
+ constraints:
+ - valid_values:
+ - same
+ - different
+ category:
+ type: string
+ required: true \ No newline at end of file