2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * Copyright (c) 2017-2019 European Software Marketing Ltd.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.aai.babel.xml.generator;
24 import static org.junit.Assert.assertTrue;
26 import java.io.IOException;
27 import java.util.Collections;
28 import java.util.List;
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.onap.aai.babel.service.data.BabelArtifact;
32 import org.onap.aai.babel.testdata.CsarTest;
33 import org.onap.aai.babel.util.ArtifactTestUtils;
34 import org.onap.aai.babel.xml.generator.data.Artifact;
37 * Direct tests of the @{link ModelGenerator} implementation class (to improve code coverage). Not all methods are
38 * tested here. Most use cases are covered by direct tests of @{link CsarToXmlConverter}.
40 public class TestModelGenerator {
43 System.setProperty("APP_HOME", ".");
48 new ArtifactTestUtils().setGeneratorSystemProperties();
52 public void testDefaultServiceVersion() throws XmlArtifactGenerationException, IOException {
53 Artifact ymlFile = new Artifact(null, null, null, null);
54 new ModelGenerator().generateArtifacts(CsarTest.SD_WAN_CSAR_FILE.getContent(),
55 Collections.singletonList(ymlFile));
59 public void testSdncPropsParsed() throws XmlArtifactGenerationException, IOException {
60 Artifact ymlFile = new Artifact(null, null, null, null);
61 List<BabelArtifact> babelArtifactList = new ModelGenerator().generateArtifacts(CsarTest.PNF_VENDOR_CSAR.getContent(),
62 Collections.singletonList(ymlFile));
63 assertTrue(babelArtifactList.get(1).getPayload().contains("sdnc-model-name"));