summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/test
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2022-07-12 14:50:18 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2022-07-14 07:39:13 +0000
commita1b6bef1eea5144fb9a6f33b89f2daf914415e08 (patch)
tree47856037c61e76a6b890b367a0251da5d1374cf4 /runtime-acm/src/test
parentd0db79ad9ae0446bba6b5f5dbc6f51c34d7fb4d2 (diff)
Remove usage of jackson libraries from clamp runtime acm
Issue-ID: POLICY-4105 Change-Id: I04488a8a246e4c161e9a9eca86634844aba27872 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/test')
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java56
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/rest/CommissioningControllerTest.java12
2 files changed, 0 insertions, 68 deletions
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 698439d35..4058c68b6 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,9 +29,6 @@ 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.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;
@@ -42,20 +39,13 @@ import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider
import org.onap.policy.clamp.models.acm.persistence.provider.ServiceTemplateProvider;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaRelationshipType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-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).
@@ -170,50 +160,4 @@ class CommissioningProviderTest {
assertThat(parsedServiceTemplate.getToscaTopologyTemplate().getNodeTemplates()).hasSize(7);
}
-
- /**
- * Tests the different schemas being returned from the schema endpoint. As schemas of the different
- * sections of the Tosca Service Templates can be returned by the API, this test must cover all of the
- * different sections.
- *
- */
- @Test
- void testGetToscaServiceTemplateSchema() throws Exception {
- var serviceTemplateProvider = mock(ServiceTemplateProvider.class);
- var acProvider = mock(AutomationCompositionProvider.class);
- var participantProvider = mock(ParticipantProvider.class);
-
- CommissioningProvider provider =
- 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();
-
- mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
-
- Map<String, Class<?>> 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<String, Class<?>> entry : sections.entrySet()) {
- String returnedServiceTemplateSchema = provider.getToscaServiceTemplateSchema(entry.getKey());
- assertThat(returnedServiceTemplateSchema).isNotNull();
-
- 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 5aa2f5a53..0cc2036e7 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
@@ -142,18 +142,6 @@ class CommissioningControllerTest extends CommonRestController {
}
@Test
- void testQueryToscaServiceTemplateSchema() throws Exception {
- createFullEntryInDbWithCommonProps();
-
- Invocation.Builder invocationBuilder =
- super.sendRequest(COMMISSIONING_ENDPOINT + "/toscaServiceTemplateSchema");
- Response rawresp = invocationBuilder.buildGet().invoke();
- assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
- String schema = rawresp.readEntity(String.class);
- assertNotNull(schema);
- }
-
- @Test
void testQueryCommonOrInstanceProperties() throws Exception {
createFullEntryInDbWithCommonProps();