diff options
Diffstat (limited to 'src')
8 files changed, 78 insertions, 93 deletions
diff --git a/src/main/java/org/onap/clamp/clds/ClampInUserAuditorAware.java b/src/main/java/org/onap/clamp/clds/ClampInUserAuditorAware.java index d18e7ebf3..9351db23c 100644 --- a/src/main/java/org/onap/clamp/clds/ClampInUserAuditorAware.java +++ b/src/main/java/org/onap/clamp/clds/ClampInUserAuditorAware.java @@ -24,10 +24,9 @@ package org.onap.clamp.clds; import java.util.Optional; - +import org.onap.clamp.authorization.AuthorizationController; import org.springframework.data.domain.AuditorAware; import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component; @Component @@ -35,12 +34,7 @@ public class ClampInUserAuditorAware implements AuditorAware<String> { @Override public Optional<String> getCurrentAuditor() { - if (SecurityContextHolder.getContext().getAuthentication() != null - && SecurityContextHolder.getContext().getAuthentication().getPrincipal() != null) { - return Optional.of(((UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()) - .getUsername()); - } - return Optional.of(""); + return Optional.of(AuthorizationController.getPrincipalName(SecurityContextHolder.getContext())); } } diff --git a/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java b/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java index 2302cc891..02e2dd0b6 100644 --- a/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java +++ b/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java @@ -25,24 +25,19 @@ package org.onap.clamp.clds.client; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; - import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; - import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.builder.ExchangeBuilder; import org.onap.clamp.clds.config.ClampProperties; import org.onap.clamp.clds.sdc.controller.installer.BlueprintMicroService; import org.onap.clamp.loop.template.PolicyModel; -import org.onap.clamp.loop.template.PolicyModelId; -import org.onap.clamp.loop.template.PolicyModelsRepository; +import org.onap.clamp.loop.template.PolicyModelsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; import org.yaml.snakeyaml.Yaml; @@ -58,7 +53,7 @@ import org.yaml.snakeyaml.Yaml; public class PolicyEngineServices { private final CamelContext camelContext; - private final PolicyModelsRepository policyModelsRepository; + private final PolicyModelsService policyModelsSService; private static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyEngineServices.class); private static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); @@ -74,18 +69,18 @@ public class PolicyEngineServices { * * @param camelContext Camel context bean * @param clampProperties ClampProperties bean - * @param policyModelsRepository policyModel repository bean + * @param policyModelsSService policyModel repository bean */ @Autowired public PolicyEngineServices(CamelContext camelContext, ClampProperties clampProperties, - PolicyModelsRepository policyModelsRepository) { + PolicyModelsService policyModelsSService) { this.camelContext = camelContext; - this.policyModelsRepository = policyModelsRepository; + this.policyModelsSService = policyModelsSService; if (clampProperties.getStringValue(POLICY_RETRY_LIMIT) != null) { - retryLimit = Integer.valueOf(clampProperties.getStringValue(POLICY_RETRY_LIMIT)); + retryLimit = Integer.parseInt(clampProperties.getStringValue(POLICY_RETRY_LIMIT)); } if (clampProperties.getStringValue(POLICY_RETRY_INTERVAL) != null) { - retryInterval = Integer.valueOf(clampProperties.getStringValue(POLICY_RETRY_INTERVAL)); + retryInterval = Integer.parseInt(clampProperties.getStringValue(POLICY_RETRY_INTERVAL)); } } @@ -111,19 +106,6 @@ public class PolicyEngineServices { } /** - * Thie method creates an PolicyModel in Db if it does not exist. - * - * @param policyModel The policyModel to save - */ - @Transactional(propagation = Propagation.REQUIRES_NEW) - public void createPolicyInDbIfNeeded(PolicyModel policyModel) { - if (!policyModelsRepository - .existsById(new PolicyModelId(policyModel.getPolicyModelType(), policyModel.getVersion()))) { - policyModelsRepository.save(policyModel); - } - } - - /** * This method synchronize the clamp database and the policy engine. * So it creates the required PolicyModel. */ @@ -140,7 +122,7 @@ public class PolicyEngineServices { policyTypesList.parallelStream().forEach(policyType -> { Map.Entry<String, Object> policyTypeEntry = (Map.Entry<String, Object>) new ArrayList(policyType.entrySet()).get(0); - createPolicyInDbIfNeeded( + policyModelsSService.createPolicyInDbIfNeeded( createPolicyModelFromPolicyEngine(policyTypeEntry.getKey(), ((String) ((LinkedHashMap<String, Object>) policyTypeEntry.getValue()).get("version")))); }); @@ -151,7 +133,6 @@ public class PolicyEngineServices { * policy engine. * * @return A yaml containing all policy Types and all data types - * @throws InterruptedException In case of issue when sleeping during the retry */ public String downloadAllPolicies() { return callCamelRoute(ExchangeBuilder.anExchange(camelContext).build(), "direct:get-all-policy-models"); @@ -163,7 +144,6 @@ public class PolicyEngineServices { * @param policyType The policy type (id) * @param policyVersion The policy version * @return A string with the whole policy tosca model - * @throws InterruptedException In case of issue when sleeping during the retry */ public String downloadOnePolicy(String policyType, String policyVersion) { return callCamelRoute(ExchangeBuilder.anExchange(camelContext).withProperty("policyModelName", policyType) diff --git a/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java b/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java index ad9ce7078..eb83c6608 100644 --- a/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java +++ b/src/main/java/org/onap/clamp/loop/template/PolicyModelsService.java @@ -32,6 +32,8 @@ import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor; import org.onap.clamp.util.SemanticVersioning; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; @Service public class PolicyModelsService { @@ -122,4 +124,17 @@ public class PolicyModelsService { return policyModelsRepository.findById(new PolicyModelId(type, version)).orElse(new PolicyModel()) .getPolicyModelTosca(); } + + /** + * This method creates an PolicyModel in Db if it does not exist. + * + * @param policyModel The policyModel to save + */ + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void createPolicyInDbIfNeeded(PolicyModel policyModel) { + if (!policyModelsRepository + .existsById(new PolicyModelId(policyModel.getPolicyModelType(), policyModel.getVersion()))) { + policyModelsRepository.save(policyModel); + } + } } diff --git a/src/main/java/org/onap/clamp/policy/downloader/PolicyEngineController.java b/src/main/java/org/onap/clamp/policy/downloader/PolicyEngineController.java index 50be035b2..bd20eccb6 100644 --- a/src/main/java/org/onap/clamp/policy/downloader/PolicyEngineController.java +++ b/src/main/java/org/onap/clamp/policy/downloader/PolicyEngineController.java @@ -27,10 +27,6 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import java.time.Instant; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map.Entry; import org.onap.clamp.clds.client.PolicyEngineServices; import org.onap.clamp.loop.template.PolicyModelsRepository; @@ -38,7 +34,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; -import org.yaml.snakeyaml.Yaml; /** * This class implements a periodic job that is done in the background to diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html index 74322f36b..16938529b 100644 --- a/src/main/resources/META-INF/resources/swagger.html +++ b/src/main/resources/META-INF/resources/swagger.html @@ -444,25 +444,25 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </li> <li><a href="#_paths">2. Paths</a> <ul class="sectlevel2"> -<li><a href="#_route92">2.1. GET /v1/healthcheck</a> +<li><a href="#_route123">2.1. GET /v1/healthcheck</a> <ul class="sectlevel3"> <li><a href="#_responses">2.1.1. Responses</a></li> <li><a href="#_produces">2.1.2. Produces</a></li> </ul> </li> -<li><a href="#_route93">2.2. GET /v1/user/getUser</a> +<li><a href="#_route124">2.2. GET /v1/user/getUser</a> <ul class="sectlevel3"> <li><a href="#_responses_2">2.2.1. Responses</a></li> <li><a href="#_produces_2">2.2.2. Produces</a></li> </ul> </li> -<li><a href="#_route80">2.3. GET /v2/dictionary</a> +<li><a href="#_route111">2.3. GET /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_responses_3">2.3.1. Responses</a></li> <li><a href="#_produces_3">2.3.2. Produces</a></li> </ul> </li> -<li><a href="#_route82">2.4. PUT /v2/dictionary</a> +<li><a href="#_route113">2.4. PUT /v2/dictionary</a> <ul class="sectlevel3"> <li><a href="#_parameters">2.4.1. Parameters</a></li> <li><a href="#_responses_4">2.4.2. Responses</a></li> @@ -491,7 +491,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_7">2.7.4. Produces</a></li> </ul> </li> -<li><a href="#_route84">2.8. DELETE /v2/dictionary/{name}</a> +<li><a href="#_route115">2.8. DELETE /v2/dictionary/{name}</a> <ul class="sectlevel3"> <li><a href="#_parameters_4">2.8.1. Parameters</a></li> <li><a href="#_responses_8">2.8.2. Responses</a></li> @@ -505,75 +505,75 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_9">2.9.3. Produces</a></li> </ul> </li> -<li><a href="#_route76">2.10. PUT /v2/loop/delete/{loopName}</a> +<li><a href="#_route107">2.10. PUT /v2/loop/delete/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_6">2.10.1. Parameters</a></li> <li><a href="#_responses_10">2.10.2. Responses</a></li> </ul> </li> -<li><a href="#_route70">2.11. PUT /v2/loop/deploy/{loopName}</a> +<li><a href="#_route101">2.11. PUT /v2/loop/deploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_7">2.11.1. Parameters</a></li> <li><a href="#_responses_11">2.11.2. Responses</a></li> <li><a href="#_produces_10">2.11.3. Produces</a></li> </ul> </li> -<li><a href="#_route64">2.12. GET /v2/loop/getAllNames</a> +<li><a href="#_route95">2.12. GET /v2/loop/getAllNames</a> <ul class="sectlevel3"> <li><a href="#_responses_12">2.12.1. Responses</a></li> <li><a href="#_produces_11">2.12.2. Produces</a></li> </ul> </li> -<li><a href="#_route77">2.13. GET /v2/loop/getstatus/{loopName}</a> +<li><a href="#_route108">2.13. GET /v2/loop/getstatus/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_8">2.13.1. Parameters</a></li> <li><a href="#_responses_13">2.13.2. Responses</a></li> <li><a href="#_produces_12">2.13.3. Produces</a></li> </ul> </li> -<li><a href="#_route71">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> +<li><a href="#_route102">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_9">2.14.1. Parameters</a></li> <li><a href="#_responses_14">2.14.2. Responses</a></li> <li><a href="#_produces_13">2.14.3. Produces</a></li> </ul> </li> -<li><a href="#_route74">2.15. PUT /v2/loop/restart/{loopName}</a> +<li><a href="#_route105">2.15. PUT /v2/loop/restart/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_10">2.15.1. Parameters</a></li> <li><a href="#_responses_15">2.15.2. Responses</a></li> <li><a href="#_produces_14">2.15.3. Produces</a></li> </ul> </li> -<li><a href="#_route73">2.16. PUT /v2/loop/stop/{loopName}</a> +<li><a href="#_route104">2.16. PUT /v2/loop/stop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_11">2.16.1. Parameters</a></li> <li><a href="#_responses_16">2.16.2. Responses</a></li> <li><a href="#_produces_15">2.16.3. Produces</a></li> </ul> </li> -<li><a href="#_route75">2.17. PUT /v2/loop/submit/{loopName}</a> +<li><a href="#_route106">2.17. PUT /v2/loop/submit/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_12">2.17.1. Parameters</a></li> <li><a href="#_responses_17">2.17.2. Responses</a></li> <li><a href="#_produces_16">2.17.3. Produces</a></li> </ul> </li> -<li><a href="#_route66">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> +<li><a href="#_route97">2.18. GET /v2/loop/svgRepresentation/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_13">2.18.1. Parameters</a></li> <li><a href="#_responses_18">2.18.2. Responses</a></li> <li><a href="#_produces_17">2.18.3. Produces</a></li> </ul> </li> -<li><a href="#_route72">2.19. PUT /v2/loop/undeploy/{loopName}</a> +<li><a href="#_route103">2.19. PUT /v2/loop/undeploy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_14">2.19.1. Parameters</a></li> <li><a href="#_responses_19">2.19.2. Responses</a></li> <li><a href="#_produces_18">2.19.3. Produces</a></li> </ul> </li> -<li><a href="#_route67">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> +<li><a href="#_route98">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_15">2.20.1. Parameters</a></li> <li><a href="#_responses_20">2.20.2. Responses</a></li> @@ -581,7 +581,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_19">2.20.4. Produces</a></li> </ul> </li> -<li><a href="#_route69">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> +<li><a href="#_route100">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_16">2.21.1. Parameters</a></li> <li><a href="#_responses_21">2.21.2. Responses</a></li> @@ -589,7 +589,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_20">2.21.4. Produces</a></li> </ul> </li> -<li><a href="#_route68">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> +<li><a href="#_route99">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_17">2.22.1. Parameters</a></li> <li><a href="#_responses_22">2.22.2. Responses</a></li> @@ -597,14 +597,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_21">2.22.4. Produces</a></li> </ul> </li> -<li><a href="#_route65">2.23. GET /v2/loop/{loopName}</a> +<li><a href="#_route96">2.23. GET /v2/loop/{loopName}</a> <ul class="sectlevel3"> <li><a href="#_parameters_18">2.23.1. Parameters</a></li> <li><a href="#_responses_23">2.23.2. Responses</a></li> <li><a href="#_produces_22">2.23.3. Produces</a></li> </ul> </li> -<li><a href="#_route87">2.24. GET /v2/policyToscaModels</a> +<li><a href="#_route118">2.24. GET /v2/policyToscaModels</a> <ul class="sectlevel3"> <li><a href="#_responses_24">2.24.1. Responses</a></li> <li><a href="#_produces_23">2.24.2. Produces</a></li> @@ -624,7 +624,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_25">2.26.3. Produces</a></li> </ul> </li> -<li><a href="#_route88">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> +<li><a href="#_route119">2.27. PUT /v2/policyToscaModels/{policyModelType}</a> <ul class="sectlevel3"> <li><a href="#_parameters_21">2.27.1. Parameters</a></li> <li><a href="#_responses_27">2.27.2. Responses</a></li> @@ -632,7 +632,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <li><a href="#_produces_26">2.27.4. Produces</a></li> </ul> </li> -<li><a href="#_route91">2.28. GET /v2/templates</a> +<li><a href="#_route122">2.28. GET /v2/templates</a> <ul class="sectlevel3"> <li><a href="#_responses_28">2.28.1. Responses</a></li> <li><a href="#_produces_27">2.28.2. Produces</a></li> @@ -692,7 +692,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <div class="sect2"> <h3 id="_uri_scheme"><a class="anchor" href="#_uri_scheme"></a><a class="link" href="#_uri_scheme">1.2. URI scheme</a></h3> <div class="paragraph"> -<p><em>Host</em> : localhost:33631<br> +<p><em>Host</em> : localhost:32977<br> <em>BasePath</em> : /restservices/clds/<br> <em>Schemes</em> : HTTP</p> </div> @@ -703,7 +703,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b <h2 id="_paths"><a class="anchor" href="#_paths"></a><a class="link" href="#_paths">2. Paths</a></h2> <div class="sectionbody"> <div class="sect2"> -<h3 id="_route92"><a class="anchor" href="#_route92"></a><a class="link" href="#_route92">2.1. GET /v1/healthcheck</a></h3> +<h3 id="_route123"><a class="anchor" href="#_route123"></a><a class="link" href="#_route123">2.1. GET /v1/healthcheck</a></h3> <div class="sect3"> <h4 id="_responses"><a class="anchor" href="#_responses"></a><a class="link" href="#_responses">2.1.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -740,7 +740,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route93"><a class="anchor" href="#_route93"></a><a class="link" href="#_route93">2.2. GET /v1/user/getUser</a></h3> +<h3 id="_route124"><a class="anchor" href="#_route124"></a><a class="link" href="#_route124">2.2. GET /v1/user/getUser</a></h3> <div class="sect3"> <h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a><a class="link" href="#_responses_2">2.2.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -774,7 +774,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route80"><a class="anchor" href="#_route80"></a><a class="link" href="#_route80">2.3. GET /v2/dictionary</a></h3> +<h3 id="_route111"><a class="anchor" href="#_route111"></a><a class="link" href="#_route111">2.3. GET /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a><a class="link" href="#_responses_3">2.3.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -811,7 +811,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route82"><a class="anchor" href="#_route82"></a><a class="link" href="#_route82">2.4. PUT /v2/dictionary</a></h3> +<h3 id="_route113"><a class="anchor" href="#_route113"></a><a class="link" href="#_route113">2.4. PUT /v2/dictionary</a></h3> <div class="sect3"> <h4 id="_parameters"><a class="anchor" href="#_parameters"></a><a class="link" href="#_parameters">2.4.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1060,7 +1060,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route84"><a class="anchor" href="#_route84"></a><a class="link" href="#_route84">2.8. DELETE /v2/dictionary/{name}</a></h3> +<h3 id="_route115"><a class="anchor" href="#_route115"></a><a class="link" href="#_route115">2.8. DELETE /v2/dictionary/{name}</a></h3> <div class="sect3"> <h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a><a class="link" href="#_parameters_4">2.8.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1184,7 +1184,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route76"><a class="anchor" href="#_route76"></a><a class="link" href="#_route76">2.10. PUT /v2/loop/delete/{loopName}</a></h3> +<h3 id="_route107"><a class="anchor" href="#_route107"></a><a class="link" href="#_route107">2.10. PUT /v2/loop/delete/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a><a class="link" href="#_parameters_6">2.10.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1233,7 +1233,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route70"><a class="anchor" href="#_route70"></a><a class="link" href="#_route70">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> +<h3 id="_route101"><a class="anchor" href="#_route101"></a><a class="link" href="#_route101">2.11. PUT /v2/loop/deploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a><a class="link" href="#_parameters_7">2.11.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1295,7 +1295,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route64"><a class="anchor" href="#_route64"></a><a class="link" href="#_route64">2.12. GET /v2/loop/getAllNames</a></h3> +<h3 id="_route95"><a class="anchor" href="#_route95"></a><a class="link" href="#_route95">2.12. GET /v2/loop/getAllNames</a></h3> <div class="sect3"> <h4 id="_responses_12"><a class="anchor" href="#_responses_12"></a><a class="link" href="#_responses_12">2.12.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1332,7 +1332,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route77"><a class="anchor" href="#_route77"></a><a class="link" href="#_route77">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> +<h3 id="_route108"><a class="anchor" href="#_route108"></a><a class="link" href="#_route108">2.13. GET /v2/loop/getstatus/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a><a class="link" href="#_parameters_8">2.13.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1394,7 +1394,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route71"><a class="anchor" href="#_route71"></a><a class="link" href="#_route71">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> +<h3 id="_route102"><a class="anchor" href="#_route102"></a><a class="link" href="#_route102">2.14. PUT /v2/loop/refreshOpPolicyJsonSchema/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a><a class="link" href="#_parameters_9">2.14.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1456,7 +1456,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route74"><a class="anchor" href="#_route74"></a><a class="link" href="#_route74">2.15. PUT /v2/loop/restart/{loopName}</a></h3> +<h3 id="_route105"><a class="anchor" href="#_route105"></a><a class="link" href="#_route105">2.15. PUT /v2/loop/restart/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a><a class="link" href="#_parameters_10">2.15.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1518,7 +1518,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route73"><a class="anchor" href="#_route73"></a><a class="link" href="#_route73">2.16. PUT /v2/loop/stop/{loopName}</a></h3> +<h3 id="_route104"><a class="anchor" href="#_route104"></a><a class="link" href="#_route104">2.16. PUT /v2/loop/stop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a><a class="link" href="#_parameters_11">2.16.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1580,7 +1580,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route75"><a class="anchor" href="#_route75"></a><a class="link" href="#_route75">2.17. PUT /v2/loop/submit/{loopName}</a></h3> +<h3 id="_route106"><a class="anchor" href="#_route106"></a><a class="link" href="#_route106">2.17. PUT /v2/loop/submit/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a><a class="link" href="#_parameters_12">2.17.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1642,7 +1642,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route66"><a class="anchor" href="#_route66"></a><a class="link" href="#_route66">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> +<h3 id="_route97"><a class="anchor" href="#_route97"></a><a class="link" href="#_route97">2.18. GET /v2/loop/svgRepresentation/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a><a class="link" href="#_parameters_13">2.18.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1704,7 +1704,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route72"><a class="anchor" href="#_route72"></a><a class="link" href="#_route72">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> +<h3 id="_route103"><a class="anchor" href="#_route103"></a><a class="link" href="#_route103">2.19. PUT /v2/loop/undeploy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a><a class="link" href="#_parameters_14">2.19.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1766,7 +1766,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route67"><a class="anchor" href="#_route67"></a><a class="link" href="#_route67">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> +<h3 id="_route98"><a class="anchor" href="#_route98"></a><a class="link" href="#_route98">2.20. POST /v2/loop/updateGlobalProperties/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a><a class="link" href="#_parameters_15">2.20.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1844,7 +1844,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route69"><a class="anchor" href="#_route69"></a><a class="link" href="#_route69">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> +<h3 id="_route100"><a class="anchor" href="#_route100"></a><a class="link" href="#_route100">2.21. POST /v2/loop/updateMicroservicePolicy/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a><a class="link" href="#_parameters_16">2.21.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -1922,7 +1922,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route68"><a class="anchor" href="#_route68"></a><a class="link" href="#_route68">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> +<h3 id="_route99"><a class="anchor" href="#_route99"></a><a class="link" href="#_route99">2.22. POST /v2/loop/updateOperationalPolicies/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a><a class="link" href="#_parameters_17">2.22.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2000,7 +2000,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route65"><a class="anchor" href="#_route65"></a><a class="link" href="#_route65">2.23. GET /v2/loop/{loopName}</a></h3> +<h3 id="_route96"><a class="anchor" href="#_route96"></a><a class="link" href="#_route96">2.23. GET /v2/loop/{loopName}</a></h3> <div class="sect3"> <h4 id="_parameters_18"><a class="anchor" href="#_parameters_18"></a><a class="link" href="#_parameters_18">2.23.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2062,7 +2062,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route87"><a class="anchor" href="#_route87"></a><a class="link" href="#_route87">2.24. GET /v2/policyToscaModels</a></h3> +<h3 id="_route118"><a class="anchor" href="#_route118"></a><a class="link" href="#_route118">2.24. GET /v2/policyToscaModels</a></h3> <div class="sect3"> <h4 id="_responses_24"><a class="anchor" href="#_responses_24"></a><a class="link" href="#_responses_24">2.24.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2223,7 +2223,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route88"><a class="anchor" href="#_route88"></a><a class="link" href="#_route88">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> +<h3 id="_route119"><a class="anchor" href="#_route119"></a><a class="link" href="#_route119">2.27. PUT /v2/policyToscaModels/{policyModelType}</a></h3> <div class="sect3"> <h4 id="_parameters_21"><a class="anchor" href="#_parameters_21"></a><a class="link" href="#_parameters_21">2.27.1. Parameters</a></h4> <table class="tableblock frame-all grid-all stretch"> @@ -2301,7 +2301,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b </div> </div> <div class="sect2"> -<h3 id="_route91"><a class="anchor" href="#_route91"></a><a class="link" href="#_route91">2.28. GET /v2/templates</a></h3> +<h3 id="_route122"><a class="anchor" href="#_route122"></a><a class="link" href="#_route122">2.28. GET /v2/templates</a></h3> <div class="sect3"> <h4 id="_responses_28"><a class="anchor" href="#_responses_28"></a><a class="link" href="#_responses_28">2.28.1. Responses</a></h4> <table class="tableblock frame-all grid-all stretch"> diff --git a/src/main/resources/clds/camel/routes/loop-flows.xml b/src/main/resources/clds/camel/routes/loop-flows.xml index c4e9fee6d..48febfc07 100644 --- a/src/main/resources/clds/camel/routes/loop-flows.xml +++ b/src/main/resources/clds/camel/routes/loop-flows.xml @@ -153,7 +153,7 @@ <simple>${body}</simple> </setProperty> <setProperty propertyName="dcaeComponent"> - <simple>${exchangeProperty[loopObject].getComponent('DCAE_' + ${exchangeProperty[microServicePolicy].getName())}</simple> + <simple>${exchangeProperty[loopObject].getComponent('DCAE_' + ${exchangeProperty[microServicePolicy].getName()})}</simple> </setProperty> <when> <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()} != null diff --git a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java index e6c477b44..fa4909cb4 100644 --- a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java +++ b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java @@ -226,8 +226,8 @@ public class LoopRepositoriesItCase { // createdDate should have NOT been changed assertThat(loopInDbRetrievedUpdated.getCreatedDate()).isEqualTo(loopInDb.getCreatedDate()); // other audit are the same - assertThat(loopInDbRetrievedUpdated.getCreatedBy()).isEqualTo(""); - assertThat(loopInDbRetrievedUpdated.getUpdatedBy()).isEqualTo(""); + assertThat(loopInDbRetrievedUpdated.getCreatedBy()).isEqualTo("Not found"); + assertThat(loopInDbRetrievedUpdated.getUpdatedBy()).isEqualTo("Not found"); // Attempt to delete the object and check it has well been cascaded diff --git a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java index ce1181d33..abeecd1b2 100644 --- a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java +++ b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java @@ -29,9 +29,7 @@ import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import java.util.stream.Collectors; - import javax.transaction.Transactional; - import org.junit.Test; import org.junit.runner.RunWith; import org.onap.clamp.clds.Application; @@ -74,6 +72,9 @@ public class PolicyModelServiceItCase { return policyModel; } + /** + * This test the create policy Model. + */ @Test @Transactional public void shouldCreatePolicyModel() { @@ -90,11 +91,11 @@ public class PolicyModelServiceItCase { .findById(new PolicyModelId(actualPolicyModel.getPolicyModelType(), actualPolicyModel.getVersion())) .get()); assertThat(actualPolicyModel.getPolicyModelType()).isEqualTo(policyModel.getPolicyModelType()); - assertThat(actualPolicyModel.getCreatedBy()).isEqualTo(""); + assertThat(actualPolicyModel.getCreatedBy()).isEqualTo("Not found"); assertThat(actualPolicyModel.getCreatedDate()).isNotNull(); assertThat(actualPolicyModel.getPolicyAcronym()).isEqualTo(policyModel.getPolicyAcronym()); assertThat(actualPolicyModel.getPolicyModelTosca()).isEqualTo(policyModel.getPolicyModelTosca()); - assertThat(actualPolicyModel.getUpdatedBy()).isEqualTo(""); + assertThat(actualPolicyModel.getUpdatedBy()).isEqualTo("Not found"); assertThat(actualPolicyModel.getUpdatedDate()).isNotNull(); assertThat(actualPolicyModel.getVersion()).isEqualTo(policyModel.getVersion()); |