2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.openecomp.sdc.ci.tests.api;
23 import static org.testng.AssertJUnit.assertEquals;
24 import static org.testng.AssertJUnit.assertNotNull;
27 import java.io.FileNotFoundException;
28 import java.io.IOException;
29 import java.util.ArrayList;
30 import java.util.Collection;
31 import java.util.Iterator;
32 import java.util.List;
34 import java.util.function.Consumer;
35 import java.util.stream.Collectors;
37 import org.apache.commons.collections.CollectionUtils;
38 import org.apache.commons.io.FileUtils;
39 import org.apache.commons.lang3.tuple.ImmutablePair;
40 import org.apache.commons.lang3.tuple.ImmutableTriple;
41 import org.apache.log4j.Logger;
42 import org.apache.tinkerpop.gremlin.structure.Direction;
43 import org.apache.tinkerpop.gremlin.structure.Vertex;
44 import org.junit.rules.TestName;
45 import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
46 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
47 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
48 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
49 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
50 import org.openecomp.sdc.be.model.Component;
51 import org.openecomp.sdc.be.model.Product;
52 import org.openecomp.sdc.be.model.Resource;
53 import org.openecomp.sdc.be.model.Service;
54 import org.openecomp.sdc.be.model.User;
55 import org.openecomp.sdc.ci.tests.config.Config;
56 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
57 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
58 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
59 import org.openecomp.sdc.ci.tests.utils.Utils;
60 import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils;
61 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
62 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
63 import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils;
64 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
65 import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
66 import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
67 import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
68 import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
69 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
70 import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
71 import org.slf4j.LoggerFactory;
72 import org.testng.ITestContext;
73 import org.testng.ITestResult;
74 import org.testng.annotations.AfterClass;
75 import org.testng.annotations.AfterMethod;
76 import org.testng.annotations.AfterSuite;
77 import org.testng.annotations.BeforeMethod;
78 import org.testng.annotations.BeforeSuite;
80 import com.aventstack.extentreports.ExtentReports;
81 import com.aventstack.extentreports.ExtentTest;
82 import com.aventstack.extentreports.Status;
83 import com.thinkaurelius.titan.core.TitanFactory;
84 import com.thinkaurelius.titan.core.TitanGraph;
85 import com.thinkaurelius.titan.core.TitanVertex;
87 import ch.qos.logback.classic.Level;
88 import ch.qos.logback.classic.LoggerContext;
90 public abstract class ComponentBaseTest {
92 // private static Logger logger = LoggerFactory.getLogger(ComponentBaseTest.class.getName());
94 protected static Logger logger= Logger.getLogger(ComponentBaseTest.class);
97 // public ComponentBaseTest(TestName testName, String className) {
98 // super(testName, className);
101 protected static ExtentReports extentReport;
102 public static final String REPORT_FOLDER = "./ExtentReport/";
103 private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
104 private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html";
105 protected static TitanGraph titanGraph;
106 private static Config myconfig;
107 public static Config config;
111 /**************** METHODS ****************/
112 public static ExtentTest getExtendTest() {
113 return ExtentTestManager.getTest();
116 public static enum ComponentOperationEnum {
117 CREATE_COMPONENT, UPDATE_COMPONENT, GET_COMPONENT, DELETE_COMPONENT, CHANGE_STATE_CHECKIN, CHANGE_STATE_CHECKOUT, CHANGE_STATE_UNDO_CHECKOUT
120 public ComponentBaseTest(TestName name, String name2) {
121 // TODO Auto-generated constructor stub
122 LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
123 lc.getLogger("com.thinkaurelius").setLevel(Level.INFO);
124 lc.getLogger("com.datastax").setLevel(Level.INFO);
125 lc.getLogger("io.netty").setLevel(Level.INFO);
126 lc.getLogger("c.d").setLevel(Level.INFO);
129 @BeforeSuite(alwaysRun = true)
130 public static void openTitan(ITestContext context) throws Exception {
132 logger.info("<<<BeforeSuite>>>");
133 myconfig = Utils.getConfig();
134 config = Utils.getConfig();
136 File dir = new File(REPORT_FOLDER);
138 FileUtils.deleteDirectory(dir);
139 } catch (IOException e) {
143 System.out.println("BeforeSuite - get reporter");
144 extentReport = ExtentManager.getReporter(REPORT_FOLDER + REPORT_FILE_NAME);
146 String onboardVersion = AutomationUtils.getOnboardVersion();
147 String osVersion = AutomationUtils.getOSVersion();
148 String envData = myconfig.getUrl();
149 // TODO: uncomment config file
150 // extentReport.loadConfig(AutomationUtils.getConfigFile(CONFIG_FILE));
152 extentReport.setSystemInfo("Onboard Version", onboardVersion);
153 extentReport.setSystemInfo("OS Version", osVersion);
154 extentReport.setSystemInfo("ExecutedOn", envData);
155 extentReport.setSystemInfo("SuiteName", context.getName());
156 AutomationUtils.createVersionsInfoFile(REPORT_FOLDER + VERSIONS_INFO_FILE_NAME, onboardVersion, osVersion, envData);
158 System.out.println("BeforeSuite - open titan");
161 System.out.println("BeforeSuite - createConsumer");
162 AtomicOperationUtils.createDefaultConsumer(true);
164 System.out.println("BeforeSuite - performClean");
168 protected static void openTitanLogic() throws Exception {
170 logger.trace(config.toString());
171 String titanConfigFilePath = myconfig.getTitanPropertiesFile();
172 titanGraph = TitanFactory.open(titanConfigFilePath);
173 assertNotNull(titanGraph);
177 @AfterClass(alwaysRun = true)
178 public synchronized static void cleanAfterClass() throws Exception{
180 // System.out.println("<<<<<<<<class name>>>>>"+method.getDeclaringClass());
181 // System.out.println("<<<<<<<<class name>>>>>"+method.getName());
184 System.out.println("delete components AfterClass");
185 deleteCreatedComponents(getCatalogAsMap());
186 // extentReport.flush();
190 @AfterSuite(alwaysRun = true)
191 public static void shutdownTitan() throws Exception {
193 System.out.println("AfterSuite - flush report");
194 extentReport.flush();
195 System.out.println("AfterSuite - perform clean");
197 System.out.println("AfterSuite - close report");
198 // extentReport.close();
199 System.out.println("AfterSuite - close titan");
200 shutdownTitanLogic();
201 System.out.println("AfterSuite - suite ended");
204 protected static void shutdownTitanLogic() {
205 if (titanGraph.isOpen()) {
208 CassandraUtils.close();
211 @BeforeMethod(alwaysRun = true)
212 public void beforeState(java.lang.reflect.Method method) throws Exception {
215 ExtentTestManager.startTest(method.getName());
216 String[] parts = this.getClass().getName().toString().split("\\.");
217 String lastOne1 = parts[parts.length-1];
218 String lastOne2 = parts[parts.length-2];
219 getExtendTest().assignCategory(lastOne2 + "-" + lastOne1);
220 getExtendTest().log(Status.INFO, "Test started");
224 @AfterMethod(alwaysRun = true)
225 public void afterState(ITestResult result) throws Exception {
227 String testName = result.getName();
228 Throwable throwable = result.getThrowable();
229 int status = result.getStatus();
232 case ITestResult.SUCCESS:
233 getExtendTest().log(Status.PASS, "Test Result : <span class='label success'>Success</span>");
236 case ITestResult.FAILURE:
237 getExtendTest().log(Status.ERROR, "ERROR - The following exepction occured");
238 getExtendTest().log(Status.ERROR, result.getThrowable());
239 getExtendTest().log(Status.FAIL, "<span class='label failure'>Failure</span>");
242 case ITestResult.SKIP:
243 getExtendTest().log(Status.SKIP, "SKIP - The following exepction occured");
250 ExtentTestManager.endTest();
251 extentReport.flush();
256 protected static void performClean() throws Exception, FileNotFoundException {
257 // cleanComponents();
258 deleteCreatedComponents(getCatalogAsMap());
259 CassandraUtils.truncateAllKeyspaces();
262 public void verifyErrorCode(RestResponse response, String action, int expectedCode) {
263 assertNotNull("check response object is not null after " + action, response);
264 assertNotNull("check error code exists in response after " + action, response.getErrorCode());
265 assertEquals("Check response code after + action" + action, expectedCode, response.getErrorCode().intValue());
268 private static void cleanComponents() throws Exception {
270 // Components to delete
271 List<String> vfResourcesToDelete = new ArrayList<String>();
272 List<String> nonVfResourcesToDelete = new ArrayList<String>();
273 List<String> servicesToDelete = new ArrayList<String>();
274 List<String> productsToDelete = new ArrayList<String>();
276 // Categories to delete
277 List<ImmutableTriple<String, String, String>> productGroupingsToDelete = new ArrayList<>();
278 List<ImmutablePair<String, String>> productSubsToDelete = new ArrayList<>();
279 List<ImmutablePair<String, String>> resourceSubsToDelete = new ArrayList<>();
280 List<String> productCategoriesToDelete = new ArrayList<>();
281 List<String> resourceCategoriesToDelete = new ArrayList<String>();
282 List<String> serviceCategoriesToDelete = new ArrayList<String>();
284 List<String> resourcesNotToDelete = config.getResourcesNotToDelete();
285 List<String> resourceCategoriesNotToDelete = config.getResourceCategoriesNotToDelete();
286 List<String> serviceCategoriesNotToDelete = config.getServiceCategoriesNotToDelete();
288 Iterable<TitanVertex> vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Resource.getName()).vertices();
289 if (vertices != null) {
290 Iterator<TitanVertex> iter = vertices.iterator();
291 while (iter.hasNext()) {
292 Vertex vertex = iter.next();
293 Boolean isAbstract = vertex.value(GraphPropertiesDictionary.IS_ABSTRACT.getProperty());
294 // if (!isAbstract) {
295 String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
296 String version = vertex.value(GraphPropertiesDictionary.VERSION.getProperty());
298 if ((resourcesNotToDelete != null && !resourcesNotToDelete.contains(name)) || (version != null && !version.equals("1.0"))) {
299 String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
300 String resourceType = vertex.value(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty());
301 if (name.startsWith("ci")) {
302 if (resourceType.equals(ResourceTypeEnum.VF.name())) {
303 vfResourcesToDelete.add(id);
305 nonVfResourcesToDelete.add(id);
308 } else if ((resourcesNotToDelete != null && !resourcesNotToDelete.contains(name)) || (version != null && version.equals("1.0"))) {
309 if ((boolean) vertex.value(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) == false) {
310 vertex.property(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), true);
316 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Service.getName()).vertices();
317 if (vertices != null) {
318 Iterator<TitanVertex> iter = vertices.iterator();
319 while (iter.hasNext()) {
320 Vertex vertex = iter.next();
321 String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
322 String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
323 if (name.startsWith("ci")) {
324 servicesToDelete.add(id);
329 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Product.getName()).vertices();
330 if (vertices != null) {
331 Iterator<TitanVertex> iter = vertices.iterator();
332 while (iter.hasNext()) {
333 Vertex vertex = iter.next();
334 String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
335 String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
336 if (name.startsWith("Ci")) {
337 productsToDelete.add(id);
342 // Getting categories
344 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ResourceNewCategory.getName()).vertices();
345 if (vertices != null) {
346 Iterator<TitanVertex> iter = vertices.iterator();
347 while (iter.hasNext()) {
348 Vertex category = iter.next();
349 String name = category.value(GraphPropertiesDictionary.NAME.getProperty());
350 if (!resourceCategoriesNotToDelete.contains(name)) {
351 String catId = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
352 resourceCategoriesToDelete.add(catId);
353 Iterator<Vertex> subs = category.vertices(Direction.OUT, GraphEdgeLabels.SUB_CATEGORY.getProperty());
354 while (subs.hasNext()) {
355 Vertex sub = subs.next();
356 String subCatId = sub.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
357 resourceSubsToDelete.add(new ImmutablePair<String, String>(catId, subCatId));
363 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ServiceNewCategory.getName()).vertices();
364 if (vertices != null) {
365 Iterator<TitanVertex> iter = vertices.iterator();
366 while (iter.hasNext()) {
367 Vertex category = iter.next();
368 String name = category.value(GraphPropertiesDictionary.NAME.getProperty());
369 if (!serviceCategoriesNotToDelete.contains(name)) {
370 String id = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
371 serviceCategoriesToDelete.add(id);
376 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ProductCategory.getName()).vertices();
377 if (vertices != null) {
378 Iterator<TitanVertex> iter = vertices.iterator();
379 while (iter.hasNext()) {
380 Vertex category = iter.next();
381 String catId = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
382 productCategoriesToDelete.add(catId);
383 Iterator<Vertex> subs = category.vertices(Direction.OUT, GraphEdgeLabels.SUB_CATEGORY.getProperty());
384 while (subs.hasNext()) {
385 Vertex sub = subs.next();
386 String subCatId = sub.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
387 productSubsToDelete.add(new ImmutablePair<String, String>(catId, subCatId));
388 Iterator<Vertex> groupings = sub.vertices(Direction.OUT, GraphEdgeLabels.GROUPING.getProperty());
389 while (groupings.hasNext()) {
390 Vertex grouping = groupings.next();
391 String groupId = grouping.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
392 productGroupingsToDelete.add(new ImmutableTriple<String, String, String>(catId, subCatId, groupId));
399 titanGraph.tx().commit();
401 String adminId = UserRoleEnum.ADMIN.getUserId();
402 String productStrategistId = UserRoleEnum.PRODUCT_STRATEGIST1.getUserId();
405 for (String id : productsToDelete) {
406 RestResponse deleteProduct = ProductRestUtils.deleteProduct(id, productStrategistId);
409 for (String id : servicesToDelete) {
410 RestResponse deleteServiceById = ServiceRestUtils.deleteServiceById(id, adminId);
413 for (String id : vfResourcesToDelete) {
414 RestResponse deleteResource = ResourceRestUtils.deleteResource(id, adminId);
418 for (String id : nonVfResourcesToDelete) {
419 RestResponse deleteResource = ResourceRestUtils.deleteResource(id, adminId);
423 // Categories delete - product
424 String componentType = BaseRestUtils.PRODUCT_COMPONENT_TYPE;
425 for (ImmutableTriple<String, String, String> triple : productGroupingsToDelete) {
426 CategoryRestUtils.deleteGrouping(triple.getRight(), triple.getMiddle(), triple.getLeft(), productStrategistId, componentType);
428 for (ImmutablePair<String, String> pair : productSubsToDelete) {
429 CategoryRestUtils.deleteSubCategory(pair.getRight(), pair.getLeft(), productStrategistId, componentType);
431 for (String id : productCategoriesToDelete) {
432 CategoryRestUtils.deleteCategory(id, productStrategistId, componentType);
435 // Categories delete - resource
436 componentType = BaseRestUtils.RESOURCE_COMPONENT_TYPE;
437 for (ImmutablePair<String, String> pair : resourceSubsToDelete) {
438 CategoryRestUtils.deleteSubCategory(pair.getRight(), pair.getLeft(), adminId, componentType);
440 for (String id : resourceCategoriesToDelete) {
441 CategoryRestUtils.deleteCategory(id, adminId, componentType);
443 // Categories delete - resource
444 componentType = BaseRestUtils.SERVICE_COMPONENT_TYPE;
445 for (String id : serviceCategoriesToDelete) {
446 CategoryRestUtils.deleteCategory(id, adminId, componentType);
451 private static void deleteCreatedComponents(Map<String, List<Component>> convertCatalogResponseToJavaObject) throws IOException {
452 final String userId = UserRoleEnum.DESIGNER.getUserId();
454 List<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.PRODUCT_PARAM_NAME);
455 if (resourcesArrayList.size() > 0) {
456 List<String> collect = buildCollectionUniqueId(resourcesArrayList);
457 for (String uId : collect) {
458 ProductRestUtils.deleteProduct(uId, userId);
463 resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.SERVICE_PARAM_NAME);
464 if (resourcesArrayList.size() > 0) {
465 List<String> collect = buildCollectionUniqueId(resourcesArrayList);
466 for (String uId : collect) {
467 ServiceRestUtils.markServiceToDelete(uId, userId);
469 ServiceRestUtils.deleteMarkedServices(userId);
473 resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.RESOURCE_PARAM_NAME);
475 // List<String> collect = resourcesArrayList.stream().filter(s ->
476 // s.getName().startsWith("ci")).map(e ->
477 // e.getUniqueId()).collect(Collectors.toList());
479 // List<Map<String, String>> collect =
480 // resourcesArrayList.stream().filter(s ->
481 // s.getName().startsWith("ci")).map(e ->
482 // e.getAllVersions()).collect(Collectors.toList());
484 * List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")) .flatMap(e -> e.getAllVersions().values().stream()).collect(Collectors.toList());
487 if (!CollectionUtils.isEmpty(resourcesArrayList)) {
488 List<String> collect = buildCollectionUniqueId(resourcesArrayList);
489 for (String uId : collect) {
490 ResourceRestUtils.markResourceToDelete(uId, userId);
492 ResourceRestUtils.deleteMarkedResources(userId);
499 private void deleteCollection(List<Component> componentArrayList, Consumer<String> deleteHandler) {
501 if (componentArrayList.size() > 0) {
502 List<String> collect = buildCollectionUniqueId(componentArrayList);
503 for (String uId : collect) {
504 deleteHandler.accept(uId);
505 // ProductRestUtils.deleteProduct(uId, userId);
510 protected static List<String> buildCollectionUniqueId(List<Component> resourcesArrayList) {
512 // Stream<String> flatMap = resourcesArrayList.stream().filter(s ->
513 // s.getName().startsWith("ci")).map(e -> e.getAllVersions()).map( e ->
514 // e.values()).flatMap( e -> e.stream());
516 // List<String> collect = resourcesArrayList.stream()
518 // .filter(s -> s.getName().startsWith("ci") )
520 // .map(e -> e.getUniqueId())
522 // .map( e -> e.values())
523 // .filter(out -> out!=null )
524 // .flatMap( e -> e.stream())
525 // .collect(Collectors.toList());
527 // List<String> collect = resourcesArrayList.stream().filter(s ->
528 // s.getName().startsWith("ci"))
530 // e.getAllVersions().values().stream()).collect(Collectors.toList());
531 ComponentTypeEnum componentTypeEnum = resourcesArrayList.get(0).getComponentType();
533 List<String> genericCollection = new ArrayList<String>();
535 resourcesArrayList.stream().filter(s -> s.getName().toLowerCase().startsWith("ci") && !s.getName().toLowerCase().equals("cindervolume")).map(e -> e.getUniqueId()).collect(Collectors.toList()).forEach((i) -> {
536 buildCollectionBaseOnComponentType(componentTypeEnum, genericCollection, i);
542 // List<String> collect =
543 // genericCollection.stream().collect(Collectors.toList());
545 return genericCollection;
548 public static void buildCollectionBaseOnComponentType(ComponentTypeEnum componentTypeEnum,
549 List<String> genericCollection, String i) {
551 switch (componentTypeEnum) {
553 RestResponse resource = ResourceRestUtils.getResource(i);
554 Resource convertResourceResponseToJavaObject = ResponseParser.convertResourceResponseToJavaObject(resource.getResponse());
555 Map<String, String> allVersions = convertResourceResponseToJavaObject.getAllVersions();
556 Collection<String> values = allVersions.values();
557 genericCollection.addAll(values);
561 RestResponse service = ServiceRestUtils.getService(i);
562 Service convertServiceResponseToJavaObject = ResponseParser.convertServiceResponseToJavaObject(service.getResponse());
563 allVersions = convertServiceResponseToJavaObject.getAllVersions();
564 values = allVersions.values();
565 genericCollection.addAll(values);
571 RestResponse product = ProductRestUtils.getProduct(i);
572 Product convertProductResponseToJavaObject = ResponseParser.convertProductResponseToJavaObject(product.getResponse());
573 allVersions = convertProductResponseToJavaObject.getAllVersions();
574 values = allVersions.values();
575 genericCollection.addAll(values);
582 } catch (Exception e1) {
583 // TODO Auto-generated catch block
584 e1.printStackTrace();
588 protected static Map<String, List<Component>> getCatalogAsMap() throws Exception {
589 RestResponse catalog = CatalogRestUtils.getCatalog(UserRoleEnum.DESIGNER.getUserId());
590 Map<String, List<Component>> convertCatalogResponseToJavaObject = ResponseParser.convertCatalogResponseToJavaObject(catalog.getResponse());
591 return convertCatalogResponseToJavaObject;
593 protected Resource createVfFromCSAR(User sdncModifierDetails, String csarId) throws Exception {
594 // create new resource from Csar
595 ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
597 resourceDetails.setCsarUUID(csarId);
598 resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
599 RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
600 BaseRestUtils.checkCreateResponse(createResource);
601 Resource createdResource = ResponseParser.convertResourceResponseToJavaObject(createResource.getResponse());
602 return createdResource;