2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * 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=========================================================
21 package org.onap.vid.controller;
23 import com.fasterxml.jackson.databind.ObjectMapper;
24 import com.fasterxml.jackson.module.kotlin.KotlinModule;
25 import org.apache.commons.io.IOUtils;
26 import org.apache.log4j.LogManager;
27 import org.apache.log4j.Logger;
28 import org.onap.vid.model.NewServiceModel;
30 import java.io.IOException;
31 import java.io.InputStream;
32 import java.nio.charset.StandardCharsets;
35 * Created by moriya1 on 04/07/2017.
37 public class ToscaParserMockHelper {
38 private static final Logger logger = LogManager.getLogger(ToscaParserMockHelper.class);
40 private static final ObjectMapper om = new ObjectMapper();
41 private final String uuid;
42 private final String filePath;
43 private final NewServiceModel newServiceModel;
45 public ToscaParserMockHelper(String uuid, String filePath) throws IOException {
47 this.filePath = filePath;
49 InputStream jsonFile = this.getClass().getClassLoader().getResourceAsStream(getFilePath());
50 logger.info(jsonFile);
51 String expectedJsonAsString = IOUtils.toString(jsonFile, StandardCharsets.UTF_8.name());
52 om.registerModule(new KotlinModule());
53 this.newServiceModel = om.readValue(expectedJsonAsString, NewServiceModel.class);
56 public String getUuid() {
60 public String getFilePath() {
64 public NewServiceModel getNewServiceModel() {
65 return newServiceModel;