diff options
6 files changed, 10 insertions, 17 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java index f0a5382de..e2aa81ff9 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java @@ -303,8 +303,7 @@ public interface PolicyModelsProvider extends AutoCloseable { * @return the list of nodeTemplates found * @throws PfModelException on errors getting node template */ - public List<Map<PfConceptKey, ToscaNodeTemplate>> getToscaNodeTemplate(final String name, - final String version) + public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version) throws PfModelException; /** diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractPolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractPolicyModelsProvider.java index 6747d9c49..ebd9dc472 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractPolicyModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractPolicyModelsProvider.java @@ -221,8 +221,7 @@ public abstract class AbstractPolicyModelsProvider implements PolicyModelsProvid } @Override - public List<Map<PfConceptKey, ToscaNodeTemplate>> getToscaNodeTemplate(final String name, - final String version) + public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version) throws PfModelException { assertInitialized(); return new AuthorativeToscaProvider().getToscaNodeTemplate(getPfDao(), name, version); diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java index 84331e905..0d7f7f0fd 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java @@ -158,8 +158,7 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override - public List<Map<PfConceptKey, ToscaNodeTemplate>> getToscaNodeTemplate(final String name, - final String version) + public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version) throws PfModelException { return null; } diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java index 4b8f1b866..5634b0ff1 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java @@ -203,8 +203,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public List<Map<PfConceptKey, ToscaNodeTemplate>> getToscaNodeTemplate(final String name, - final String version) + public List<ToscaNodeTemplate> getToscaNodeTemplate(final String name, final String version) throws PfModelException { return new ArrayList<>(); } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java index 2ec9ee2c8..b3284d987 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java @@ -652,15 +652,15 @@ public class AuthorativeToscaProvider { * @return the node templates found * @throws PfModelException on errors getting tosca node templates */ - public List<Map<PfConceptKey, ToscaNodeTemplate>> getToscaNodeTemplate( + public List<ToscaNodeTemplate> getToscaNodeTemplate( @NonNull final PfDao dao, final String name, final String version) throws PfModelException { LOGGER.debug("->getNodeTemplate: name={}, version={}", name, version); - List<Map<PfConceptKey, ToscaNodeTemplate>> nodeTemplates = new ArrayList<>(); + List<ToscaNodeTemplate> nodeTemplates = new ArrayList<>(); synchronized (providerLockObject) { new SimpleToscaProvider().getToscaNodeTemplates(dao, name, version) - .getConceptMap().forEach((key, value) -> nodeTemplates.add(Map.of(key, value.toAuthorative()))); + .getConceptMap().forEach((key, value) -> nodeTemplates.add(value.toAuthorative())); } LOGGER.debug("<-getNodeTemplate: name={}, version={}, nodeTemplates={}", name, version, diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderNodeTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderNodeTemplateTest.java index 21559344f..2370779af 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderNodeTemplateTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderNodeTemplateTest.java @@ -129,9 +129,6 @@ public class AuthorativeToscaProviderNodeTemplateTest { assertNotNull(toscaServiceTemplate); authorativeToscaProvider.createToscaNodeTemplates(pfDao, toscaServiceTemplate); - List<Map<PfConceptKey, ToscaNodeTemplate>> gotPolicyMetadataSets1 = authorativeToscaProvider - .getToscaNodeTemplate(pfDao, null, null); - assertEquals(3, gotPolicyMetadataSets1.size()); //Fetch all metadataSet if id is null List<Map<ToscaEntityKey, Map<String, Object>>> gotPolicyMetadataSets = authorativeToscaProvider @@ -160,17 +157,17 @@ public class AuthorativeToscaProviderNodeTemplateTest { authorativeToscaProvider.createToscaNodeTemplates(pfDao, toscaServiceTemplate); //Fetch all node templates if id is null - List<Map<PfConceptKey, ToscaNodeTemplate>> gotToscaNodeTemplates = authorativeToscaProvider + List<ToscaNodeTemplate> gotToscaNodeTemplates = authorativeToscaProvider .getToscaNodeTemplate(pfDao, null, null); assertEquals(3, gotToscaNodeTemplates.size()); // Get filtered node templates - List<Map<PfConceptKey, ToscaNodeTemplate>> filteredNodeTemplates = authorativeToscaProvider + List<ToscaNodeTemplate> filteredNodeTemplates = authorativeToscaProvider .getToscaNodeTemplate(pfDao, "apexMetadata_adaptive", "2.3.1"); assertEquals(1, filteredNodeTemplates.size()); //Get invalid node template - List<Map<PfConceptKey, ToscaNodeTemplate>> filteredNodeTemplatesInvalid = authorativeToscaProvider + List<ToscaNodeTemplate> filteredNodeTemplatesInvalid = authorativeToscaProvider .getToscaNodeTemplate(pfDao, "invalidname", "1.0.0"); assertThat(filteredNodeTemplatesInvalid).isEmpty(); } |