X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Fparser%2FTestArtifactGeneratorToscaParser.java;h=a538373d2b03ac02e06de0bf82ebee802cde8e03;hb=refs%2Fchanges%2F41%2F78241%2F1;hp=d7519c0be12950dc535a7aed9563d3bca8830dd0;hpb=1954294aed95c2db4eb2659dcef91248535de079;p=aai%2Fbabel.git diff --git a/src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java b/src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java index d7519c0..a538373 100644 --- a/src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java +++ b/src/test/java/org/onap/aai/babel/parser/TestArtifactGeneratorToscaParser.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import java.util.List; import org.junit.Test; import org.mockito.Mockito; import org.onap.aai.babel.xml.generator.data.WidgetConfigurationUtil; +import org.onap.aai.babel.xml.generator.data.WidgetMapping; import org.onap.aai.babel.xml.generator.model.Resource; import org.onap.aai.babel.xml.generator.model.Widget.Type; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; @@ -59,7 +60,6 @@ public class TestArtifactGeneratorToscaParser { } /** - * * Add a CR (a type of Resource which is not a Providing Service) to a Resource Model. */ @Test(expected = IllegalArgumentException.class) @@ -70,6 +70,26 @@ public class TestArtifactGeneratorToscaParser { new ArtifactGeneratorToscaParser(null).processResourceModels(dummyResource, nodeTemplateList); } + /** + * Initialise the Artifact Generator Widget Mapping config with incomplete data. + */ + @Test(expected = IllegalArgumentException.class) + public void testToscaMappingWithoutType() { + WidgetMapping invalidMapping = new WidgetMapping(); + invalidMapping.setType(null); + WidgetConfigurationUtil.setWidgetMappings(Collections.singletonList(invalidMapping)); + } + + /** + * Initialise the Artifact Generator Widget Mapping config with incomplete data. + */ + @Test(expected = IllegalArgumentException.class) + public void testToscaMappingWithoutWidget() { + WidgetMapping invalidMapping = new WidgetMapping(); + invalidMapping.setWidget(null); + WidgetConfigurationUtil.setWidgetMappings(Collections.singletonList(invalidMapping)); + } + /** * Process a dummy Group object for a Service Resource. */ @@ -104,9 +124,9 @@ public class TestArtifactGeneratorToscaParser { * sdc-tosca parser. * * @param name - * name of the NodeTemplate + * name of the NodeTemplate * @param type - * type of the NodeTemplate + * type of the NodeTemplate * @return a new NodeTemplate object */ private NodeTemplate buildNodeTemplate(String name, String type) {