summaryrefslogtreecommitdiffstats
path: root/runtime-controlloop
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2021-11-19 15:59:54 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2021-12-02 16:10:51 +0000
commit06499b21fb3a2842d1bbae3eb790c93ea6c9272a (patch)
tree1b8f4f2037c44cb7c8019193009f9c3abccaff21 /runtime-controlloop
parent8f54ee96bb0b86425d9c177eb991b1fd91000ad4 (diff)
Add support transaction
Add support transaction in CommissioningProvider and ControlLoopInstantiationProvider Issue-ID: POLICY-3802 Change-Id: I8ddba4814547e335b7b27342189a3fc5d9dc4582 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-controlloop')
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java40
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java154
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java12
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java4
4 files changed, 96 insertions, 114 deletions
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java
index 7deba651f..382823b19 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java
@@ -52,13 +52,15 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplates;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
-import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
/**
* This class provides the create, read and delete actions on Commissioning of Control Loop concepts in the database to
* the callers.
*/
-@Component
+@Service
+@Transactional
public class CommissioningProvider {
public static final String CONTROL_LOOP_NODE_TYPE = "org.onap.policy.clamp.controlloop.ControlLoop";
private static final String INSTANCE_TEXT = "_Instance";
@@ -69,8 +71,6 @@ public class CommissioningProvider {
private final ParticipantProvider participantProvider;
private final SupervisionHandler supervisionHandler;
- private static final Object lockit = new Object();
-
/**
* Create a commissioning provider.
*
@@ -101,15 +101,11 @@ public class CommissioningProvider {
if (verifyIfInstancePropertiesExists()) {
throw new PfModelException(Status.BAD_REQUEST, "Delete instances, to commission control loop definitions");
}
-
- synchronized (lockit) {
- serviceTemplate = serviceTemplateProvider.createServiceTemplate(serviceTemplate);
- List<Participant> participantList = participantProvider.getParticipants();
- if (!participantList.isEmpty()) {
- supervisionHandler.handleSendCommissionMessage(serviceTemplate.getName(), serviceTemplate.getVersion());
- }
+ serviceTemplate = serviceTemplateProvider.createServiceTemplate(serviceTemplate);
+ List<Participant> participantList = participantProvider.getParticipants();
+ if (!participantList.isEmpty()) {
+ supervisionHandler.handleSendCommissionMessage(serviceTemplate.getName(), serviceTemplate.getVersion());
}
-
var response = new CommissioningResponse();
// @formatter:off
response.setAffectedControlLoopDefinitions(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates()
@@ -135,15 +131,11 @@ public class CommissioningProvider {
if (verifyIfInstancePropertiesExists()) {
throw new PfModelException(Status.BAD_REQUEST, "Delete instances, to commission control loop definitions");
}
-
- synchronized (lockit) {
- List<Participant> participantList = participantProvider.getParticipants();
- if (!participantList.isEmpty()) {
- supervisionHandler.handleSendDeCommissionMessage();
- }
- serviceTemplateProvider.deleteServiceTemplate(name, version);
+ List<Participant> participantList = participantProvider.getParticipants();
+ if (!participantList.isEmpty()) {
+ supervisionHandler.handleSendDeCommissionMessage();
}
-
+ serviceTemplateProvider.deleteServiceTemplate(name, version);
var response = new CommissioningResponse();
response.setAffectedControlLoopDefinitions(List.of(new ToscaConceptIdentifier(name, version)));
@@ -158,6 +150,7 @@ public class CommissioningProvider {
* @return list of control loop node templates
* @throws PfModelException on errors getting control loop definitions
*/
+ @Transactional(readOnly = true)
public List<ToscaNodeTemplate> getControlLoopDefinitions(String clName, String clVersion) throws PfModelException {
// @formatter:off
@@ -179,6 +172,7 @@ public class CommissioningProvider {
* @return a list of the control loop element node templates in a control loop node template
* @throws PfModelException on errors get control loop element node templates
*/
+ @Transactional(readOnly = true)
public List<ToscaNodeTemplate> getControlLoopElementDefinitions(ToscaNodeTemplate controlLoopNodeTemplate)
throws PfModelException {
if (!CONTROL_LOOP_NODE_TYPE.equals(controlLoopNodeTemplate.getType())) {
@@ -221,6 +215,7 @@ public class CommissioningProvider {
* @return the nodes templates with common or instance properties
* @throws PfModelException on errors getting common or instance properties from node_templates
*/
+ @Transactional(readOnly = true)
public Map<String, ToscaNodeTemplate> getNodeTemplatesWithCommonOrInstanceProperties(boolean common, String name,
String version) throws PfModelException {
@@ -249,6 +244,7 @@ public class CommissioningProvider {
* @return the control loop definitions
* @throws PfModelException on errors getting control loop definitions
*/
+ @Transactional(readOnly = true)
public ToscaServiceTemplate getToscaServiceTemplate(String name, String version) throws PfModelException {
return serviceTemplateProvider.getToscaServiceTemplate(name, version);
}
@@ -259,6 +255,7 @@ public class CommissioningProvider {
* @return the control loop definitions
* @throws PfModelException on errors getting control loop definitions
*/
+ @Transactional(readOnly = true)
public List<ToscaServiceTemplate> getAllToscaServiceTemplate() throws PfModelException {
return serviceTemplateProvider.getAllServiceTemplates();
}
@@ -271,8 +268,8 @@ public class CommissioningProvider {
* @return the tosca service template
* @throws PfModelException on errors getting tosca service template
*/
+ @Transactional(readOnly = true)
public String getToscaServiceTemplateReduced(String name, String version) throws PfModelException {
-
var serviceTemplateList = serviceTemplateProvider.getServiceTemplateList(name, version);
List<ToscaServiceTemplate> filteredServiceTemplateList = filterToscaNodeTemplateInstance(serviceTemplateList);
@@ -305,6 +302,7 @@ public class CommissioningProvider {
* @return the specified tosca service template or section Json Schema
* @throws PfModelException on errors with retrieving the classes
*/
+ @Transactional(readOnly = true)
public String getToscaServiceTemplateSchema(String section) throws PfModelException {
var visitor = new SchemaFactoryWrapper();
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java
index 0d7d88803..1bff2d747 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java
@@ -65,12 +65,14 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNameVersion;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
/**
* This class is dedicated to the Instantiation of Commissioned control loop.
*/
-@Component
+@Service
+@Transactional
@AllArgsConstructor
public class ControlLoopInstantiationProvider {
private static final String CONTROL_LOOP_NODE_TYPE = "org.onap.policy.clamp.controlloop.ControlLoop";
@@ -87,8 +89,6 @@ public class ControlLoopInstantiationProvider {
private final CommissioningProvider commissioningProvider;
private final SupervisionHandler supervisionHandler;
private final ParticipantProvider participantProvider;
-
- private static final Object lockit = new Object();
private static final String ENTRY = "entry ";
/**
@@ -181,21 +181,18 @@ public class ControlLoopInstantiationProvider {
* @throws PfModelException on creation errors
*/
public InstantiationResponse createControlLoops(ControlLoops controlLoops) throws PfModelException {
-
- synchronized (lockit) {
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- var checkControlLoopOpt = controlLoopProvider.findControlLoop(controlLoop.getKey().asIdentifier());
- if (checkControlLoopOpt.isPresent()) {
- throw new PfModelException(Response.Status.BAD_REQUEST,
- controlLoop.getKey().asIdentifier() + " already defined");
- }
- }
- BeanValidationResult validationResult = validateControlLoops(controlLoops);
- if (!validationResult.isValid()) {
- throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
+ for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
+ var checkControlLoopOpt = controlLoopProvider.findControlLoop(controlLoop.getKey().asIdentifier());
+ if (checkControlLoopOpt.isPresent()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST,
+ controlLoop.getKey().asIdentifier() + " already defined");
}
- controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
}
+ BeanValidationResult validationResult = validateControlLoops(controlLoops);
+ if (!validationResult.isValid()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
+ }
+ controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
var response = new InstantiationResponse();
response.setAffectedControlLoops(controlLoops.getControlLoopList().stream()
@@ -212,13 +209,11 @@ public class ControlLoopInstantiationProvider {
* @throws PfModelException on update errors
*/
public InstantiationResponse updateControlLoops(ControlLoops controlLoops) throws PfModelException {
- synchronized (lockit) {
- BeanValidationResult validationResult = validateControlLoops(controlLoops);
- if (!validationResult.isValid()) {
- throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
- }
- controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
+ BeanValidationResult validationResult = validateControlLoops(controlLoops);
+ if (!validationResult.isValid()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
}
+ controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
var response = new InstantiationResponse();
response.setAffectedControlLoops(controlLoops.getControlLoopList().stream()
@@ -299,21 +294,18 @@ public class ControlLoopInstantiationProvider {
* @throws PfModelException on deletion errors
*/
public InstantiationResponse deleteControlLoop(String name, String version) throws PfModelException {
- var response = new InstantiationResponse();
- synchronized (lockit) {
- var controlLoopOpt = controlLoopProvider.findControlLoop(name, version);
- if (controlLoopOpt.isEmpty()) {
- throw new PfModelException(Response.Status.NOT_FOUND, "Control Loop not found");
- }
- var controlLoop = controlLoopOpt.get();
- if (!ControlLoopState.UNINITIALISED.equals(controlLoop.getState())) {
- throw new PfModelException(Response.Status.BAD_REQUEST,
- "Control Loop State is still " + controlLoop.getState());
- }
-
- response.setAffectedControlLoops(
- List.of(controlLoopProvider.deleteControlLoop(name, version).getKey().asIdentifier()));
+ var controlLoopOpt = controlLoopProvider.findControlLoop(name, version);
+ if (controlLoopOpt.isEmpty()) {
+ throw new PfModelException(Response.Status.NOT_FOUND, "Control Loop not found");
+ }
+ var controlLoop = controlLoopOpt.get();
+ if (!ControlLoopState.UNINITIALISED.equals(controlLoop.getState())) {
+ throw new PfModelException(Response.Status.BAD_REQUEST,
+ "Control Loop State is still " + controlLoop.getState());
}
+ var response = new InstantiationResponse();
+ response.setAffectedControlLoops(
+ List.of(controlLoopProvider.deleteControlLoop(name, version).getKey().asIdentifier()));
return response;
}
@@ -325,6 +317,7 @@ public class ControlLoopInstantiationProvider {
* @return the control loops
* @throws PfModelException on errors getting control loops
*/
+ @Transactional(readOnly = true)
public ControlLoops getControlLoops(String name, String version) throws PfModelException {
var controlLoops = new ControlLoops();
controlLoops.setControlLoopList(controlLoopProvider.getControlLoops(name, version));
@@ -347,32 +340,30 @@ public class ControlLoopInstantiationProvider {
throw new ControlLoopException(Status.BAD_REQUEST, "ordered state invalid or not specified on command");
}
- synchronized (lockit) {
- var participants = participantProvider.getParticipants();
- if (participants.isEmpty()) {
- throw new ControlLoopException(Status.BAD_REQUEST, "No participants registered");
- }
- var validationResult = new BeanValidationResult("InstantiationCommand", command);
- List<ControlLoop> controlLoops = new ArrayList<>(command.getControlLoopIdentifierList().size());
- for (ToscaConceptIdentifier id : command.getControlLoopIdentifierList()) {
- var controlLoopOpt = controlLoopProvider.findControlLoop(id);
- if (controlLoopOpt.isEmpty()) {
- validationResult.addResult("ToscaConceptIdentifier", id, ValidationStatus.INVALID,
- "ControlLoop with id " + id + " not found");
- } else {
- var controlLoop = controlLoopOpt.get();
- controlLoop.setCascadedOrderedState(command.getOrderedState());
- controlLoops.add(controlLoop);
- }
- }
- if (validationResult.isValid()) {
- validationResult = validateIssueControlLoops(controlLoops, participants);
- }
- if (!validationResult.isValid()) {
- throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
+ var participants = participantProvider.getParticipants();
+ if (participants.isEmpty()) {
+ throw new ControlLoopException(Status.BAD_REQUEST, "No participants registered");
+ }
+ var validationResult = new BeanValidationResult("InstantiationCommand", command);
+ List<ControlLoop> controlLoops = new ArrayList<>(command.getControlLoopIdentifierList().size());
+ for (ToscaConceptIdentifier id : command.getControlLoopIdentifierList()) {
+ var controlLoopOpt = controlLoopProvider.findControlLoop(id);
+ if (controlLoopOpt.isEmpty()) {
+ validationResult.addResult("ToscaConceptIdentifier", id, ValidationStatus.INVALID,
+ "ControlLoop with id " + id + " not found");
+ } else {
+ var controlLoop = controlLoopOpt.get();
+ controlLoop.setCascadedOrderedState(command.getOrderedState());
+ controlLoops.add(controlLoop);
}
- controlLoopProvider.saveControlLoops(controlLoops);
}
+ if (validationResult.isValid()) {
+ validationResult = validateIssueControlLoops(controlLoops, participants);
+ }
+ if (!validationResult.isValid()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST, validationResult.getResult());
+ }
+ controlLoopProvider.saveControlLoops(controlLoops);
supervisionHandler.triggerControlLoopSupervision(command.getControlLoopIdentifierList());
var response = new InstantiationResponse();
@@ -391,8 +382,8 @@ public class ControlLoopInstantiationProvider {
for (ControlLoop controlLoop : controlLoops) {
for (var element : controlLoop.getElements().values()) {
- var subResult = new BeanValidationResult(ENTRY + element.getDefinition().getName(), element);
+ var subResult = new BeanValidationResult(ENTRY + element.getDefinition().getName(), element);
Participant p = participantMap.get(element.getParticipantId());
if (p == null) {
subResult.addResult(new ObjectValidationResult(CONTROL_LOOP_NODE_ELEMENT_TYPE,
@@ -420,6 +411,7 @@ public class ControlLoopInstantiationProvider {
* @return a list of Instantiation Command
* @throws PfModelException on errors getting control loops
*/
+ @Transactional(readOnly = true)
public ControlLoopOrderStateResponse getInstantiationOrderState(String name, String version)
throws PfModelException {
@@ -446,6 +438,7 @@ public class ControlLoopInstantiationProvider {
* @return a list of Instantiation Command
* @throws PfModelException on errors getting control loops
*/
+ @Transactional(readOnly = true)
public ControlLoopPrimedResponse getControlLoopPriming(String name, String version) throws PfModelException {
List<ControlLoop> controlLoops = controlLoopProvider.getControlLoops(name, version);
@@ -474,31 +467,23 @@ public class ControlLoopInstantiationProvider {
private InstancePropertiesResponse saveInstancePropertiesAndControlLoop(ToscaServiceTemplate serviceTemplate,
ControlLoops controlLoops) throws PfModelException {
- var response = new InstancePropertiesResponse();
-
- Map<String, ToscaNodeTemplate> toscaSavedNodeTemplate;
-
- synchronized (lockit) {
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- var checkControlLoopOpt = controlLoopProvider.findControlLoop(controlLoop.getKey().asIdentifier());
- if (checkControlLoopOpt.isPresent()) {
- throw new PfModelException(Response.Status.BAD_REQUEST,
- "Control loop with id " + controlLoop.getKey().asIdentifier() + " already defined");
- }
+ for (var controlLoop : controlLoops.getControlLoopList()) {
+ var checkControlLoopOpt = controlLoopProvider.findControlLoop(controlLoop.getKey().asIdentifier());
+ if (checkControlLoopOpt.isPresent()) {
+ throw new PfModelException(Response.Status.BAD_REQUEST,
+ "Control loop with id " + controlLoop.getKey().asIdentifier() + " already defined");
}
-
- toscaSavedNodeTemplate = controlLoopProvider.saveInstanceProperties(serviceTemplate);
-
- controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
-
}
-
+ Map<String, ToscaNodeTemplate> toscaSavedNodeTemplate =
+ controlLoopProvider.saveInstanceProperties(serviceTemplate);
+ controlLoopProvider.saveControlLoops(controlLoops.getControlLoopList());
List<ToscaConceptIdentifier> affectedControlLoops = controlLoops.getControlLoopList().stream()
.map(cl -> cl.getKey().asIdentifier()).collect(Collectors.toList());
List<ToscaConceptIdentifier> toscaAffectedProperties = toscaSavedNodeTemplate.values().stream()
.map(template -> template.getKey().asIdentifier()).collect(Collectors.toList());
+ var response = new InstancePropertiesResponse();
response.setAffectedInstanceProperties(Stream.of(affectedControlLoops, toscaAffectedProperties)
.flatMap(Collection::stream).collect(Collectors.toList()));
@@ -563,7 +548,7 @@ public class ControlLoopInstantiationProvider {
* @return instanceName
*/
private String generateSequentialInstanceName() {
- List<ToscaNodeTemplate> nodeTemplates = controlLoopProvider.getNodeTemplates(null, null);
+ List<ToscaNodeTemplate> nodeTemplates = controlLoopProvider.getAllNodeTemplates();
int instanceNumber = nodeTemplates.stream().map(ToscaNodeTemplate::getName)
.filter(name -> name.contains(INSTANCE_TEXT)).map(n -> {
@@ -585,7 +570,6 @@ public class ControlLoopInstantiationProvider {
ToscaConceptIdentifier definition = new ToscaConceptIdentifier();
definition.setName(template.getName());
definition.setVersion(template.getVersion());
-
return definition;
}
@@ -602,27 +586,22 @@ public class ControlLoopInstantiationProvider {
definition.setName(template.getName());
definition.setVersion(template.getVersion());
controlLoopElement.setDefinition(definition);
-
LinkedTreeMap<String, Object> participantId =
(LinkedTreeMap<String, Object>) template.getProperties().get(PARTICIPANT_ID_PROPERTY_KEY);
-
if (participantId != null) {
ToscaConceptIdentifier participantIdProperty = new ToscaConceptIdentifier();
participantIdProperty.setName(String.valueOf(participantId.get(CL_ELEMENT_NAME)));
participantIdProperty.setVersion(String.valueOf(participantId.get(CL_ELEMENT_VERSION)));
controlLoopElement.setParticipantId(participantIdProperty);
}
-
LinkedTreeMap<String, Object> participantType =
(LinkedTreeMap<String, Object>) template.getProperties().get(PARTICIPANT_TYPE_PROPERTY_KEY);
-
if (participantType != null) {
ToscaConceptIdentifier participantTypeProperty = new ToscaConceptIdentifier();
participantTypeProperty.setName(String.valueOf(participantType.get(CL_ELEMENT_NAME)));
participantTypeProperty.setVersion(participantType.get(CL_ELEMENT_VERSION).toString());
controlLoopElement.setParticipantType(participantTypeProperty);
}
-
return controlLoopElement;
}
@@ -634,10 +613,7 @@ public class ControlLoopInstantiationProvider {
*/
private Map<String, ToscaNodeTemplate> deepCloneNodeTemplate(ToscaServiceTemplate serviceTemplate) {
String jsonString = GSON.toJson(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates());
-
Type type = new TypeToken<HashMap<String, ToscaNodeTemplate>>() {}.getType();
-
return GSON.fromJson(jsonString, type);
}
-
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java
index cd9309422..2ec438bea 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java
@@ -38,12 +38,14 @@ import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
/**
* This class provides information about statistics data of CL elements and CL Participants in database to callers.
*/
-@Component
+@Service
+@Transactional
@AllArgsConstructor
public class MonitoringProvider {
@@ -94,6 +96,7 @@ public class MonitoringProvider {
* @param endTime end of the timestamp up to which statistics to be filtered
* @return the participant found
*/
+ @Transactional(readOnly = true)
public ParticipantStatisticsList fetchFilteredParticipantStatistics(@NonNull final String name,
final String version, int recordCount, Instant startTime, Instant endTime) {
var participantStatisticsList = new ParticipantStatisticsList();
@@ -114,6 +117,7 @@ public class MonitoringProvider {
* @return All the participant statistics found
* @throws PfModelRuntimeException on errors getting participant statistics
*/
+ @Transactional(readOnly = true)
public ParticipantStatisticsList fetchParticipantStatsPerControlLoop(@NonNull final String controlLoopName,
@NonNull final String controlLoopVersion) {
var statisticsList = new ParticipantStatisticsList();
@@ -145,6 +149,7 @@ public class MonitoringProvider {
* @return the participant found
* @throws PfModelException on errors getting control loop statistics
*/
+ @Transactional(readOnly = true)
public ClElementStatisticsList fetchFilteredClElementStatistics(@NonNull final String name, final String version,
final String id, Instant startTime, Instant endTime, int recordCount) throws PfModelException {
var clElementStatisticsList = new ClElementStatisticsList();
@@ -167,6 +172,7 @@ public class MonitoringProvider {
* @return the clElement statistics found
* @throws PfModelRuntimeException on errors getting control loop statistics
*/
+ @Transactional(readOnly = true)
public ClElementStatisticsList fetchClElementStatsPerControlLoop(@NonNull final String name,
@NonNull final String version) {
var clElementStatisticsList = new ClElementStatisticsList();
@@ -200,6 +206,7 @@ public class MonitoringProvider {
* @return List of participant Id
* @throws PfModelException on errors
*/
+ @Transactional(readOnly = true)
public List<ToscaConceptIdentifier> getAllParticipantIdsPerControlLoop(String name, String version)
throws PfModelException {
List<ToscaConceptIdentifier> participantIds = new ArrayList<>();
@@ -221,6 +228,7 @@ public class MonitoringProvider {
* @return Map of control loop Id and participant details
* @throws PfModelException on errors
*/
+ @Transactional(readOnly = true)
public Map<String, ToscaConceptIdentifier> getAllClElementsIdPerControlLoop(String name, String version)
throws PfModelException {
Map<String, ToscaConceptIdentifier> clElementId = new HashMap<>();
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java
index ebd25c3c1..ea7dde4fe 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java
@@ -302,8 +302,8 @@ class InstantiationControllerTest extends CommonRestController {
instantiationProvider.createControlLoops(controlLoopsFromRsc);
for (ControlLoop controlLoopFromRsc : controlLoopsFromRsc.getControlLoopList()) {
- Invocation.Builder invocationBuilder =
- super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + controlLoopFromRsc.getKey().getName());
+ Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT + "?name="
+ + controlLoopFromRsc.getKey().getName());
Response resp = invocationBuilder.delete();
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus());
}