2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 * ECOMP and OpenECOMP are trademarks
21 * and service marks of AT&T Intellectual Property.
23 package org.openecomp.modelloader.entity.model;
25 import static org.junit.Assert.assertTrue;
27 import java.nio.file.Files;
28 import java.nio.file.Paths;
29 import java.util.List;
31 import org.junit.Test;
32 import org.openecomp.modelloader.entity.Artifact;
34 public class NamedQueryArtifactParserTest {
37 public void testParseNamedQuery() throws Exception {
38 final String MODEL_FILE = "src/test/resources/models/named-query-wan-connector.xml";
41 byte[] xmlBytes = Files.readAllBytes(Paths.get(MODEL_FILE));
43 NamedQueryArtifactParser parser = new NamedQueryArtifactParser();
44 List<Artifact> modelList = parser.parse(xmlBytes, "test-artifact");
46 assertTrue(modelList.size() == 1);
48 NamedQueryArtifact model = (NamedQueryArtifact) modelList.get(0);
49 System.out.println(model.toString());
51 assertTrue(model.getNamedQueryUuid().equalsIgnoreCase("94cac189-8d88-4d63-a194-f44214e080ff"));
52 assertTrue(model.getType().toString().equalsIgnoreCase("NAMED_QUERY"));
53 assertTrue(model.getDependentModelIds().size() == 4);
54 assertTrue(model.getDependentModelIds().contains("d09dd9da-0148-46cd-a947-591afc844d24"));
55 assertTrue(model.getDependentModelIds().contains("997fc7-fca1-451f-b953-9a1e6197b4d6"));
56 assertTrue(model.getDependentModelIds().contains("897df7ea-8938-42b0-bc57-46e913a4d93b"));
57 assertTrue(model.getDependentModelIds().contains("f2b24d95-c582-48d5-b2d6-c5b3a94ce812"));
58 } catch (Exception e) {