From c3fb95f45239453d8765d6e51118f49dc5f90444 Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Wed, 27 Apr 2022 10:32:51 +0100 Subject: Fix Issue when serialization into JSON Schema Issue-ID: POLICY-4104 Change-Id: Iab42134820fc547429a988b43a0bd6edb344c3db Signed-off-by: FrancescoFioraEst --- .../commissioning/CommissioningProvider.java | 98 +++++++++++----------- .../commissioning/CommissioningProviderTest.java | 70 ++++++++-------- .../rest/CommissioningControllerTest.java | 36 +++----- 3 files changed, 91 insertions(+), 113 deletions(-) (limited to 'runtime-acm/src') diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java index e0027d36b..726fcba5c 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java @@ -21,10 +21,11 @@ package org.onap.policy.clamp.acm.runtime.commissioning; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializer; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -69,11 +70,11 @@ public class CommissioningProvider { private final ServiceTemplateProvider serviceTemplateProvider; private final AutomationCompositionProvider acProvider; + private final ObjectMapper mapper = new ObjectMapper(); private final ParticipantProvider participantProvider; private final SupervisionHandler supervisionHandler; - private static final Map sections = new HashMap<>(); - private Gson gson = new Gson(); + private static final Map sections = new HashMap<>(); /** * Create a commissioning provider. @@ -84,12 +85,13 @@ public class CommissioningProvider { * @param participantProvider the Participant Provider */ public CommissioningProvider(ServiceTemplateProvider serviceTemplateProvider, - AutomationCompositionProvider acProvider, SupervisionHandler supervisionHandler, - ParticipantProvider participantProvider) { + AutomationCompositionProvider acProvider, SupervisionHandler supervisionHandler, + ParticipantProvider participantProvider) { this.serviceTemplateProvider = serviceTemplateProvider; this.acProvider = acProvider; this.supervisionHandler = supervisionHandler; this.participantProvider = participantProvider; + mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); } /** @@ -98,34 +100,15 @@ public class CommissioningProvider { */ @EventListener(ApplicationReadyEvent.class) public void initialize() { - GsonBuilder builder = new GsonBuilder(); - builder.registerTypeAdapter(ToscaServiceTemplate.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.registerTypeAdapter(ToscaDataType.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.registerTypeAdapter(ToscaCapabilityType.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.registerTypeAdapter(ToscaNodeType.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.registerTypeAdapter(ToscaRelationshipType.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.registerTypeAdapter(ToscaPolicyType.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.registerTypeAdapter(ToscaTopologyTemplate.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.registerTypeAdapter(ToscaNodeTemplate.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.setPrettyPrinting(); - gson = builder.create(); - - sections.put("data_types", gson.toJson(new ToscaDataType())); - sections.put("capability_types", gson.toJson(new ToscaCapabilityType())); - sections.put("node_types", gson.toJson(new ToscaNodeType())); - sections.put("relationship_types", gson.toJson(new ToscaRelationshipType())); - sections.put("policy_types", gson.toJson(new ToscaPolicyType())); - sections.put("topology_template", gson.toJson(new ToscaTopologyTemplate())); - sections.put("node_templates", gson.toJson(new ToscaNodeTemplate())); - sections.put("all", gson.toJson(new ToscaServiceTemplate())); + sections.put("data_types", mapper.constructType(ToscaDataType.class)); + sections.put("capability_types", mapper.constructType(ToscaCapabilityType.class)); + sections.put("node_types", mapper.constructType(ToscaNodeType.class)); + sections.put("relationship_types", mapper.constructType(ToscaRelationshipType.class)); + sections.put("policy_types", mapper.constructType(ToscaPolicyType.class)); + sections.put("topology_template", mapper.constructType(ToscaTopologyTemplate.class)); + sections.put("node_templates", + mapper.getTypeFactory().constructCollectionType(List.class, ToscaNodeTemplate.class)); + sections.put("all", mapper.constructType(ToscaServiceTemplate.class)); } /** @@ -136,11 +119,11 @@ public class CommissioningProvider { * @throws PfModelException on creation errors */ public CommissioningResponse createAutomationCompositionDefinitions(ToscaServiceTemplate serviceTemplate) - throws PfModelException { + throws PfModelException { if (verifyIfInstancePropertiesExists()) { throw new PfModelException(Status.BAD_REQUEST, - "Delete instances, to commission automation composition definitions"); + "Delete instances, to commission automation composition definitions"); } serviceTemplate = serviceTemplateProvider.createServiceTemplate(serviceTemplate); List participantList = participantProvider.getParticipants(); @@ -169,11 +152,11 @@ public class CommissioningProvider { * @throws PfModelException on deletion errors */ public CommissioningResponse deleteAutomationCompositionDefinition(String name, String version) - throws PfModelException { + throws PfModelException { if (verifyIfInstancePropertiesExists()) { throw new PfModelException(Status.BAD_REQUEST, - "Delete instances, to commission automation composition definitions"); + "Delete instances, to commission automation composition definitions"); } List participantList = participantProvider.getParticipants(); if (!participantList.isEmpty()) { @@ -196,7 +179,7 @@ public class CommissioningProvider { */ @Transactional(readOnly = true) public List getAutomationCompositionDefinitions(String acName, String acVersion) - throws PfModelException { + throws PfModelException { // @formatter:off ToscaTypedEntityFilter nodeTemplateFilter = ToscaTypedEntityFilter @@ -219,7 +202,7 @@ public class CommissioningProvider { */ @Transactional(readOnly = true) public List getAutomationCompositionElementDefinitions( - ToscaNodeTemplate automationCompositionNodeTemplate) throws PfModelException { + ToscaNodeTemplate automationCompositionNodeTemplate) throws PfModelException { if (!AUTOMATION_COMPOSITION_NODE_TYPE.equals(automationCompositionNodeTemplate.getType())) { return Collections.emptyList(); } @@ -230,7 +213,7 @@ public class CommissioningProvider { @SuppressWarnings("unchecked") List> automationCompositionElements = - (List>) automationCompositionNodeTemplate.getProperties().get("elements"); + (List>) automationCompositionNodeTemplate.getProperties().get("elements"); if (CollectionUtils.isEmpty(automationCompositionElements)) { return Collections.emptyList(); @@ -262,23 +245,23 @@ public class CommissioningProvider { */ @Transactional(readOnly = true) public Map getNodeTemplatesWithCommonOrInstanceProperties(boolean common, String name, - String version) throws PfModelException { + String version) throws PfModelException { if (common && verifyIfInstancePropertiesExists()) { throw new PfModelException(Status.BAD_REQUEST, - "Cannot create or edit common properties, delete all the instantiations first"); + "Cannot create or edit common properties, delete all the instantiations first"); } var serviceTemplateList = serviceTemplateProvider.getServiceTemplateList(name, version); var commonOrInstanceNodeTypeProps = - serviceTemplateProvider.getCommonOrInstancePropertiesFromNodeTypes(common, serviceTemplateList.get(0)); + serviceTemplateProvider.getCommonOrInstancePropertiesFromNodeTypes(common, serviceTemplateList.get(0)); var serviceTemplates = new ToscaServiceTemplates(); serviceTemplates.setServiceTemplates(filterToscaNodeTemplateInstance(serviceTemplateList)); return serviceTemplateProvider.getDerivedCommonOrInstanceNodeTemplates( - serviceTemplates.getServiceTemplates().get(0).getToscaTopologyTemplate().getNodeTemplates(), - commonOrInstanceNodeTypeProps); + serviceTemplates.getServiceTemplates().get(0).getToscaTopologyTemplate().getNodeTemplates(), + commonOrInstanceNodeTypeProps); } /** @@ -332,7 +315,12 @@ public class CommissioningProvider { template.put("node_types", fullTemplate.getNodeTypes()); template.put("topology_template", fullTemplate.getToscaTopologyTemplate()); - return gson.toJson(template); + try { + return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(template); + + } catch (JsonProcessingException e) { + throw new PfModelException(Status.BAD_REQUEST, "Converion to Json Schema failed", e); + } } /** @@ -343,7 +331,15 @@ public class CommissioningProvider { * @throws PfModelException on errors with retrieving the classes */ public String getToscaServiceTemplateSchema(String section) throws PfModelException { - return sections.getOrDefault(section, sections.get("all")); + var visitor = new SchemaFactoryWrapper(); + var sectionMapper = sections.getOrDefault(section, sections.get("all")); + try { + mapper.acceptJsonFormatVisitor(sectionMapper, visitor); + var jsonSchema = visitor.finalSchema(); + return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonSchema); + } catch (JsonProcessingException e) { + throw new PfModelException(Status.BAD_REQUEST, "Converion to Json Schema failed", e); + } } private List filterToscaNodeTemplateInstance(List serviceTemplates) { @@ -376,7 +372,7 @@ public class CommissioningProvider { */ private boolean verifyIfInstancePropertiesExists() { return acProvider.getAllNodeTemplates().stream() - .anyMatch(nodeTemplate -> nodeTemplate.getKey().getName().contains(HYPHEN)); + .anyMatch(nodeTemplate -> nodeTemplate.getKey().getName().contains(HYPHEN)); } } diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java index bcdb4ddd6..71aadccb9 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java @@ -29,10 +29,9 @@ import static org.mockito.Mockito.when; import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVICE_TEMPLATE_YAML; import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_ST_TEMPLATE_YAML; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper; import java.util.List; import java.util.Map; import java.util.Objects; @@ -56,6 +55,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate; class CommissioningProviderTest { private static final Coder CODER = new StandardCoder(); + private final ObjectMapper mapper = new ObjectMapper(); /** * Test the fetching of automation composition definitions (ToscaServiceTemplates). @@ -69,13 +69,13 @@ class CommissioningProviderTest { var serviceTemplateProvider = mock(ServiceTemplateProvider.class); CommissioningProvider provider = - new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); + new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); List listOfTemplates = provider.getAutomationCompositionDefinitions(null, null); assertThat(listOfTemplates).isEmpty(); when(acProvider.getFilteredNodeTemplates(any())) - .thenReturn(List.of(new ToscaNodeTemplate(), new ToscaNodeTemplate())); + .thenReturn(List.of(new ToscaNodeTemplate(), new ToscaNodeTemplate())); listOfTemplates = provider.getAutomationCompositionDefinitions(null, null); assertThat(listOfTemplates).hasSize(2); } @@ -92,7 +92,7 @@ class CommissioningProviderTest { var participantProvider = mock(ParticipantProvider.class); CommissioningProvider provider = - new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); + new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); List listOfTemplates = provider.getAutomationCompositionDefinitions(null, null); assertThat(listOfTemplates).isEmpty(); @@ -102,11 +102,11 @@ class CommissioningProviderTest { // Response should return the number of node templates present in the service template List affectedDefinitions = provider - .createAutomationCompositionDefinitions(serviceTemplate).getAffectedAutomationCompositionDefinitions(); + .createAutomationCompositionDefinitions(serviceTemplate).getAffectedAutomationCompositionDefinitions(); assertThat(affectedDefinitions).hasSize(13); when(acProvider.getFilteredNodeTemplates(any())) - .thenReturn(List.of(new ToscaNodeTemplate(), new ToscaNodeTemplate())); + .thenReturn(List.of(new ToscaNodeTemplate(), new ToscaNodeTemplate())); listOfTemplates = provider.getAutomationCompositionDefinitions(null, null); assertThat(listOfTemplates).hasSize(2); @@ -124,9 +124,8 @@ class CommissioningProviderTest { var participantProvider = mock(ParticipantProvider.class); CommissioningProvider provider = - new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); - ToscaServiceTemplate serviceTemplate = - InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML); + new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); + ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML); when(serviceTemplateProvider.createServiceTemplate(serviceTemplate)).thenReturn(serviceTemplate); provider.createAutomationCompositionDefinitions(serviceTemplate); @@ -138,7 +137,7 @@ class CommissioningProviderTest { assertThat(returnedServiceTemplate).isNotNull(); Map nodeTemplates = - returnedServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); + returnedServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); assertThat(nodeTemplates).hasSize(8); } @@ -155,15 +154,14 @@ class CommissioningProviderTest { var participantProvider = mock(ParticipantProvider.class); CommissioningProvider provider = - new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); - ToscaServiceTemplate serviceTemplate = - InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML); + new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); + ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML); when(serviceTemplateProvider.createServiceTemplate(serviceTemplate)).thenReturn(serviceTemplate); provider.createAutomationCompositionDefinitions(serviceTemplate); - when(serviceTemplateProvider.getServiceTemplateList(any(), any())).thenReturn(List.of( - Objects.requireNonNull(serviceTemplate))); + when(serviceTemplateProvider.getServiceTemplateList(any(), any())) + .thenReturn(List.of(Objects.requireNonNull(serviceTemplate))); String returnedServiceTemplate = provider.getToscaServiceTemplateReduced(null, null); assertThat(returnedServiceTemplate).isNotNull(); @@ -185,36 +183,36 @@ class CommissioningProviderTest { var participantProvider = mock(ParticipantProvider.class); CommissioningProvider provider = - new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); - ToscaServiceTemplate serviceTemplate = - InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML); + new CommissioningProvider(serviceTemplateProvider, acProvider, null, participantProvider); + ToscaServiceTemplate serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML); when(serviceTemplateProvider.createServiceTemplate(serviceTemplate)).thenReturn(serviceTemplate); provider.createAutomationCompositionDefinitions(serviceTemplate); provider.initialize(); - final Map> sections = Map.of("all", ToscaServiceTemplate.class, - "data_types", ToscaDataType.class, "capability_types", ToscaCapabilityType.class, - "node_types", ToscaNodeType.class, "relationship_types", - ToscaRelationshipType.class, "policy_types", ToscaPolicyType.class, "topology_template", - ToscaTopologyTemplate.class, "node_templates", List.class); + mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); - String localServiceTemplateSchema = new String(); - Gson gson = new Gson(); - GsonBuilder builder = new GsonBuilder(); - builder.registerTypeAdapter(ToscaTopologyTemplate.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.setPrettyPrinting(); - gson = builder.create(); + Map> sections = Map.of("all", ToscaServiceTemplate.class, "data_types", ToscaDataType.class, + "capability_types", ToscaCapabilityType.class, "node_types", ToscaNodeType.class, "relationship_types", + ToscaRelationshipType.class, "policy_types", ToscaPolicyType.class, "topology_template", + ToscaTopologyTemplate.class, "node_templates", List.class); for (Map.Entry> entry : sections.entrySet()) { String returnedServiceTemplateSchema = provider.getToscaServiceTemplateSchema(entry.getKey()); assertThat(returnedServiceTemplateSchema).isNotNull(); - if (entry.getKey().equals("topology_template")) { - localServiceTemplateSchema = gson.toJson(new ToscaTopologyTemplate()); - assertThat(localServiceTemplateSchema).isEqualTo(returnedServiceTemplateSchema); + var visitor = new SchemaFactoryWrapper(); + + if (entry.getKey().equals("node_templates")) { + mapper.acceptJsonFormatVisitor( + mapper.getTypeFactory().constructCollectionType(List.class, ToscaNodeTemplate.class), visitor); + } else { + mapper.acceptJsonFormatVisitor(mapper.constructType(entry.getValue()), visitor); } + + var jsonSchema = visitor.finalSchema(); + String localServiceTemplateSchema = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonSchema); + assertThat(localServiceTemplateSchema).isEqualTo(returnedServiceTemplateSchema); } } } diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java index f9a7b20e4..87633dfd4 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java @@ -29,12 +29,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVICE_TEMPLATE_YAML; import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_ST_TEMPLATE_YAML; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializer; import java.util.List; import java.util.Map; import javax.ws.rs.client.Entity; @@ -82,8 +76,7 @@ class CommissioningControllerTest extends CommonRestController { @BeforeAll public static void setUpBeforeClass() { serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); - commonPropertiesServiceTemplate = - InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML); + commonPropertiesServiceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_ST_TEMPLATE_YAML); } @BeforeEach @@ -143,18 +136,9 @@ class CommissioningControllerTest extends CommonRestController { Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT + "/toscaservicetemplate"); Response rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); - String template = rawresp.readEntity(String.class); - final JsonObject jsonObject = new JsonParser().parse(template).getAsJsonObject(); - - Gson gson = new Gson(); - GsonBuilder builder = new GsonBuilder(); - builder.registerTypeAdapter(ToscaNodeTemplate.class, - (JsonSerializer) (src, typeOfSrc, context) -> new JsonPrimitive(src.toString())); - builder.setPrettyPrinting(); - gson = builder.create(); - - ToscaNodeTemplate toscaNodeTemplate = gson.fromJson(jsonObject, ToscaNodeTemplate.class); - assertNotNull(toscaNodeTemplate); + ToscaServiceTemplate template = rawresp.readEntity(ToscaServiceTemplate.class); + assertNotNull(template); + assertThat(template.getNodeTypes()).hasSize(7); } @Test @@ -162,7 +146,7 @@ class CommissioningControllerTest extends CommonRestController { createFullEntryInDbWithCommonProps(); Invocation.Builder invocationBuilder = - super.sendRequest(COMMISSIONING_ENDPOINT + "/toscaServiceTemplateSchema"); + super.sendRequest(COMMISSIONING_ENDPOINT + "/toscaServiceTemplateSchema"); Response rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); String schema = rawresp.readEntity(String.class); @@ -174,7 +158,7 @@ class CommissioningControllerTest extends CommonRestController { createFullEntryInDbWithCommonProps(); Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT - + "/getCommonOrInstanceProperties" + "?common=true&name=ToscaServiceTemplateSimple&version=1.0.0"); + + "/getCommonOrInstanceProperties" + "?common=true&name=ToscaServiceTemplateSimple&version=1.0.0"); Response rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); @@ -209,7 +193,7 @@ class CommissioningControllerTest extends CommonRestController { assertThat(commissioningResponse.getAffectedAutomationCompositionDefinitions()).hasSize(13); for (String nodeTemplateName : serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().keySet()) { assertTrue(commissioningResponse.getAffectedAutomationCompositionDefinitions().stream() - .anyMatch(ac -> ac.getName().equals(nodeTemplateName))); + .anyMatch(ac -> ac.getName().equals(nodeTemplateName))); } } @@ -250,8 +234,8 @@ class CommissioningControllerTest extends CommonRestController { void testQueryElements() throws Exception { createEntryInDB(); - Invocation.Builder invocationBuilder = super.sendRequest( - COMMISSIONING_ENDPOINT + "/elements" + "?name=org.onap.domain.pmsh.PMSHAutomationCompositionDefinition"); + Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT + "/elements" + + "?name=org.onap.domain.pmsh.PMSHAutomationCompositionDefinition"); Response rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); List entityList = rawresp.readEntity(List.class); @@ -274,7 +258,7 @@ class CommissioningControllerTest extends CommonRestController { var serviceTemplateCreated = createEntryInDB(); Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT + "?name=" - + serviceTemplateCreated.getName() + "&version=" + serviceTemplateCreated.getVersion()); + + serviceTemplateCreated.getName() + "&version=" + serviceTemplateCreated.getVersion()); // Call delete with no info Response resp = invocationBuilder.delete(); assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus()); -- cgit 1.2.3-korg