- public void testSerialization() {
- try {
- // TCA
- JpaToscaServiceTemplate tcaServiceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_YAML);
- String serializedServiceTemplateTca = serializeMonitoringServiceTemplate(tcaServiceTemplateFromYaml);
-
- ToscaServiceTemplate toscaServiceTemplateFromJsonTca =
- coder.decode(serializedServiceTemplateTca, ToscaServiceTemplate.class);
-
- JpaToscaServiceTemplate serviceTemplateFromJsonTca = new JpaToscaServiceTemplate();
- serviceTemplateFromJsonTca.fromAuthorative(toscaServiceTemplateFromJsonTca);
- String serializedServiceTemplateTcaOut = serializeMonitoringServiceTemplate(serviceTemplateFromJsonTca);
- assertEquals(serializedServiceTemplateTca, serializedServiceTemplateTcaOut);
-
- // Collector
- JpaToscaServiceTemplate collectorServiceTemplateFromYaml =
- deserializeMonitoringInputYaml(MONITORING_COLLECTORS_YAML);
- String serializedServiceTemplateCollector =
- serializeMonitoringServiceTemplate(collectorServiceTemplateFromYaml);
- ToscaServiceTemplate toscaServiceTemplateFromJsonCollector =
- coder.decode(serializedServiceTemplateCollector, ToscaServiceTemplate.class);
- JpaToscaServiceTemplate serviceTemplateFromJsonCollector = new JpaToscaServiceTemplate();
- serviceTemplateFromJsonCollector.fromAuthorative(toscaServiceTemplateFromJsonCollector);
- String serializedServiceTemplateCollectorsOut =
- serializeMonitoringServiceTemplate(serviceTemplateFromJsonCollector);
- assertEquals(serializedServiceTemplateCollector, serializedServiceTemplateCollectorsOut);
-
- } catch (Exception e) {
- LOGGER.warn("No exception should be thrown", e);
- fail("No exception should be thrown");
- }
+ public void testSerialization() throws Exception {
+ // TCA v1
+ JpaToscaServiceTemplate tcaServiceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_YAML);
+ String serializedServiceTemplateTca = serializeMonitoringServiceTemplate(tcaServiceTemplateFromYaml);
+
+ ToscaServiceTemplate toscaServiceTemplateFromJsonTca =
+ coder.decode(serializedServiceTemplateTca, ToscaServiceTemplate.class);
+
+ JpaToscaServiceTemplate serviceTemplateFromJsonTca = new JpaToscaServiceTemplate();
+ serviceTemplateFromJsonTca.fromAuthorative(toscaServiceTemplateFromJsonTca);
+ String serializedServiceTemplateTcaOut = serializeMonitoringServiceTemplate(serviceTemplateFromJsonTca);
+ assertEquals(serializedServiceTemplateTca, serializedServiceTemplateTcaOut);
+
+ // TCA v2
+ tcaServiceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_V2_YAML);
+ serializedServiceTemplateTca = serializeMonitoringServiceTemplate(tcaServiceTemplateFromYaml);
+
+ toscaServiceTemplateFromJsonTca =
+ coder.decode(serializedServiceTemplateTca, ToscaServiceTemplate.class);
+
+ serviceTemplateFromJsonTca = new JpaToscaServiceTemplate();
+ serviceTemplateFromJsonTca.fromAuthorative(toscaServiceTemplateFromJsonTca);
+ serializedServiceTemplateTcaOut = serializeMonitoringServiceTemplate(serviceTemplateFromJsonTca);
+ assertEquals(serializedServiceTemplateTca, serializedServiceTemplateTcaOut);
+
+ // Collector
+ JpaToscaServiceTemplate collectorServiceTemplateFromYaml =
+ deserializeMonitoringInputYaml(MONITORING_COLLECTORS_YAML);
+ String serializedServiceTemplateCollector =
+ serializeMonitoringServiceTemplate(collectorServiceTemplateFromYaml);
+ ToscaServiceTemplate toscaServiceTemplateFromJsonCollector =
+ coder.decode(serializedServiceTemplateCollector, ToscaServiceTemplate.class);
+ JpaToscaServiceTemplate serviceTemplateFromJsonCollector = new JpaToscaServiceTemplate();
+ serviceTemplateFromJsonCollector.fromAuthorative(toscaServiceTemplateFromJsonCollector);
+ String serializedServiceTemplateCollectorsOut =
+ serializeMonitoringServiceTemplate(serviceTemplateFromJsonCollector);
+ assertEquals(serializedServiceTemplateCollector, serializedServiceTemplateCollectorsOut);