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.general.FileHandling;
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;
79 import org.testng.annotations.Test;
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 final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator;
102 private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
103 private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html";
104 protected static TitanGraph titanGraph;
105 public static Config config;
106 protected static ITestContext myContext;
110 /**************** METHODS ****************/
111 public static ExtentTest getExtendTest() {
112 return ExtentTestManager.getTest();
115 public static enum ComponentOperationEnum {
116 CREATE_COMPONENT, UPDATE_COMPONENT, GET_COMPONENT, DELETE_COMPONENT, CHANGE_STATE_CHECKIN, CHANGE_STATE_CHECKOUT, CHANGE_STATE_UNDO_CHECKOUT
119 public ComponentBaseTest(TestName name, String name2) {
120 // TODO Auto-generated constructor stub
121 LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
122 lc.getLogger("com.thinkaurelius").setLevel(Level.INFO);
123 lc.getLogger("com.datastax").setLevel(Level.INFO);
124 lc.getLogger("io.netty").setLevel(Level.INFO);
125 lc.getLogger("c.d").setLevel(Level.INFO);
126 lc.getLogger("o.a.h").setLevel(Level.INFO);
127 lc.getLogger("o.o.s.c.t.d.h").setLevel(Level.INFO);
130 public static String getReportFolder() {
131 return REPORT_FOLDER;
134 @BeforeSuite(alwaysRun = true)
135 public void setupBeforeSuite(ITestContext context) throws Exception {
136 config = Utils.getConfig();
138 ExtentManager.initReporter(getReportFolder(), REPORT_FILE_NAME, context);
139 AtomicOperationUtils.createDefaultConsumer(true);
143 String basePath = FileHandling.getBasePath();
144 String csarDir = FileHandling.getCreateDirByName("outputCsar");
145 FileUtils.cleanDirectory(new File(csarDir));
148 @BeforeMethod(alwaysRun = true)
149 public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
152 // String suiteName = ExtentManager.getSuiteName(context);
153 // ExtentTestManager.startTest(method.getName());
154 // ExtentTestManager.assignCategory(this.getClass());
156 boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty();
157 String className = method.getDeclaringClass().getName();
158 System.out.println(" method.getName() " + method.getName());
159 if (!method.getName().equals("onboardVNFShotFlow")) {
160 System.out.println("ExtentReport instance started from BeforeMethod...");
161 ExtentTestManager.startTest(method.getName());
162 ExtentTestManager.assignCategory(this.getClass());
165 System.out.println("ExtentReport instance started from Test...");
171 @AfterMethod(alwaysRun = true)
172 public void quitAfterTest(ITestResult result, ITestContext context) throws Exception {
174 String testName = result.getName();
175 Throwable throwable = result.getThrowable();
176 int status = result.getStatus();
179 case ITestResult.SUCCESS:
180 getExtendTest().log(Status.PASS, "Test Result : <span class='label success'>Success</span>");
183 case ITestResult.FAILURE:
184 getExtendTest().log(Status.ERROR, "ERROR - The following exepction occured");
185 getExtendTest().log(Status.ERROR, result.getThrowable());
186 getExtendTest().log(Status.FAIL, "<span class='label failure'>Failure</span>");
189 case ITestResult.SKIP:
190 getExtendTest().log(Status.SKIP, "SKIP - The following exepction occured");
197 ExtentTestManager.endTest();
202 @AfterClass(alwaysRun = true)
203 public synchronized static void cleanAfterClass() throws Exception{
205 System.out.println("delete components AfterClass");
206 deleteCreatedComponents(getCatalogAsMap());
210 @AfterSuite(alwaysRun = true)
211 public static void shutdownTitan() throws Exception {
214 shutdownTitanLogic();
217 protected static void openTitanLogic() throws Exception {
219 logger.trace(config.toString());
220 String titanConfigFilePath = config.getTitanPropertiesFile();
221 titanGraph = TitanFactory.open(titanConfigFilePath);
222 assertNotNull(titanGraph);
227 protected static void shutdownTitanLogic() {
228 if (titanGraph.isOpen()) {
231 CassandraUtils.close();
236 public void setLog(String fromDataProvider) {
238 String suiteName = ExtentManager.getSuiteName(myContext);
239 ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + " " + fromDataProvider);
240 ExtentTestManager.assignCategory(this.getClass());
244 protected static void performClean() throws Exception, FileNotFoundException {
245 // cleanComponents();
246 deleteCreatedComponents(getCatalogAsMap());
247 CassandraUtils.truncateAllKeyspaces();
250 public void verifyErrorCode(RestResponse response, String action, int expectedCode) {
251 assertNotNull("check response object is not null after " + action, response);
252 assertNotNull("check error code exists in response after " + action, response.getErrorCode());
253 assertEquals("Check response code after + action" + action, expectedCode, response.getErrorCode().intValue());
256 private static void cleanComponents() throws Exception {
258 // Components to delete
259 List<String> vfResourcesToDelete = new ArrayList<String>();
260 List<String> nonVfResourcesToDelete = new ArrayList<String>();
261 List<String> servicesToDelete = new ArrayList<String>();
262 List<String> productsToDelete = new ArrayList<String>();
264 // Categories to delete
265 List<ImmutableTriple<String, String, String>> productGroupingsToDelete = new ArrayList<>();
266 List<ImmutablePair<String, String>> productSubsToDelete = new ArrayList<>();
267 List<ImmutablePair<String, String>> resourceSubsToDelete = new ArrayList<>();
268 List<String> productCategoriesToDelete = new ArrayList<>();
269 List<String> resourceCategoriesToDelete = new ArrayList<String>();
270 List<String> serviceCategoriesToDelete = new ArrayList<String>();
272 List<String> resourcesNotToDelete = config.getResourcesNotToDelete();
273 List<String> resourceCategoriesNotToDelete = config.getResourceCategoriesNotToDelete();
274 List<String> serviceCategoriesNotToDelete = config.getServiceCategoriesNotToDelete();
276 Iterable<TitanVertex> vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Resource.getName()).vertices();
277 if (vertices != null) {
278 Iterator<TitanVertex> iter = vertices.iterator();
279 while (iter.hasNext()) {
280 Vertex vertex = iter.next();
281 Boolean isAbstract = vertex.value(GraphPropertiesDictionary.IS_ABSTRACT.getProperty());
282 // if (!isAbstract) {
283 String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
284 String version = vertex.value(GraphPropertiesDictionary.VERSION.getProperty());
286 if ((resourcesNotToDelete != null && !resourcesNotToDelete.contains(name)) || (version != null && !version.equals("1.0"))) {
287 String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
288 String resourceType = vertex.value(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty());
289 if (name.startsWith("ci")) {
290 if (resourceType.equals(ResourceTypeEnum.VF.name())) {
291 vfResourcesToDelete.add(id);
293 nonVfResourcesToDelete.add(id);
296 } else if ((resourcesNotToDelete != null && !resourcesNotToDelete.contains(name)) || (version != null && version.equals("1.0"))) {
297 if ((boolean) vertex.value(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) == false) {
298 vertex.property(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), true);
304 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Service.getName()).vertices();
305 if (vertices != null) {
306 Iterator<TitanVertex> iter = vertices.iterator();
307 while (iter.hasNext()) {
308 Vertex vertex = iter.next();
309 String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
310 String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
311 if (name.startsWith("ci")) {
312 servicesToDelete.add(id);
317 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.Product.getName()).vertices();
318 if (vertices != null) {
319 Iterator<TitanVertex> iter = vertices.iterator();
320 while (iter.hasNext()) {
321 Vertex vertex = iter.next();
322 String id = vertex.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
323 String name = vertex.value(GraphPropertiesDictionary.NAME.getProperty());
324 if (name.startsWith("Ci")) {
325 productsToDelete.add(id);
330 // Getting categories
332 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ResourceNewCategory.getName()).vertices();
333 if (vertices != null) {
334 Iterator<TitanVertex> iter = vertices.iterator();
335 while (iter.hasNext()) {
336 Vertex category = iter.next();
337 String name = category.value(GraphPropertiesDictionary.NAME.getProperty());
338 if (!resourceCategoriesNotToDelete.contains(name)) {
339 String catId = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
340 resourceCategoriesToDelete.add(catId);
341 Iterator<Vertex> subs = category.vertices(Direction.OUT, GraphEdgeLabels.SUB_CATEGORY.getProperty());
342 while (subs.hasNext()) {
343 Vertex sub = subs.next();
344 String subCatId = sub.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
345 resourceSubsToDelete.add(new ImmutablePair<String, String>(catId, subCatId));
351 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ServiceNewCategory.getName()).vertices();
352 if (vertices != null) {
353 Iterator<TitanVertex> iter = vertices.iterator();
354 while (iter.hasNext()) {
355 Vertex category = iter.next();
356 String name = category.value(GraphPropertiesDictionary.NAME.getProperty());
357 if (!serviceCategoriesNotToDelete.contains(name)) {
358 String id = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
359 serviceCategoriesToDelete.add(id);
364 vertices = titanGraph.query().has(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.ProductCategory.getName()).vertices();
365 if (vertices != null) {
366 Iterator<TitanVertex> iter = vertices.iterator();
367 while (iter.hasNext()) {
368 Vertex category = iter.next();
369 String catId = category.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
370 productCategoriesToDelete.add(catId);
371 Iterator<Vertex> subs = category.vertices(Direction.OUT, GraphEdgeLabels.SUB_CATEGORY.getProperty());
372 while (subs.hasNext()) {
373 Vertex sub = subs.next();
374 String subCatId = sub.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
375 productSubsToDelete.add(new ImmutablePair<String, String>(catId, subCatId));
376 Iterator<Vertex> groupings = sub.vertices(Direction.OUT, GraphEdgeLabels.GROUPING.getProperty());
377 while (groupings.hasNext()) {
378 Vertex grouping = groupings.next();
379 String groupId = grouping.value(GraphPropertiesDictionary.UNIQUE_ID.getProperty());
380 productGroupingsToDelete.add(new ImmutableTriple<String, String, String>(catId, subCatId, groupId));
387 titanGraph.tx().commit();
389 String adminId = UserRoleEnum.ADMIN.getUserId();
390 String productStrategistId = UserRoleEnum.PRODUCT_STRATEGIST1.getUserId();
393 for (String id : productsToDelete) {
394 RestResponse deleteProduct = ProductRestUtils.deleteProduct(id, productStrategistId);
397 for (String id : servicesToDelete) {
398 RestResponse deleteServiceById = ServiceRestUtils.deleteServiceById(id, adminId);
401 for (String id : vfResourcesToDelete) {
402 RestResponse deleteResource = ResourceRestUtils.deleteResource(id, adminId);
406 for (String id : nonVfResourcesToDelete) {
407 RestResponse deleteResource = ResourceRestUtils.deleteResource(id, adminId);
411 // Categories delete - product
412 String componentType = BaseRestUtils.PRODUCT_COMPONENT_TYPE;
413 for (ImmutableTriple<String, String, String> triple : productGroupingsToDelete) {
414 CategoryRestUtils.deleteGrouping(triple.getRight(), triple.getMiddle(), triple.getLeft(), productStrategistId, componentType);
416 for (ImmutablePair<String, String> pair : productSubsToDelete) {
417 CategoryRestUtils.deleteSubCategory(pair.getRight(), pair.getLeft(), productStrategistId, componentType);
419 for (String id : productCategoriesToDelete) {
420 CategoryRestUtils.deleteCategory(id, productStrategistId, componentType);
423 // Categories delete - resource
424 componentType = BaseRestUtils.RESOURCE_COMPONENT_TYPE;
425 for (ImmutablePair<String, String> pair : resourceSubsToDelete) {
426 CategoryRestUtils.deleteSubCategory(pair.getRight(), pair.getLeft(), adminId, componentType);
428 for (String id : resourceCategoriesToDelete) {
429 CategoryRestUtils.deleteCategory(id, adminId, componentType);
431 // Categories delete - resource
432 componentType = BaseRestUtils.SERVICE_COMPONENT_TYPE;
433 for (String id : serviceCategoriesToDelete) {
434 CategoryRestUtils.deleteCategory(id, adminId, componentType);
439 private static void deleteCreatedComponents(Map<String, List<Component>> convertCatalogResponseToJavaObject) throws IOException {
440 final String userId = UserRoleEnum.DESIGNER.getUserId();
442 List<Component> resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.PRODUCT_PARAM_NAME);
443 if (resourcesArrayList.size() > 0) {
444 List<String> collect = buildCollectionUniqueId(resourcesArrayList);
445 for (String uId : collect) {
446 ProductRestUtils.deleteProduct(uId, userId);
451 resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.SERVICE_PARAM_NAME);
452 if (resourcesArrayList.size() > 0) {
453 List<String> collect = buildCollectionUniqueId(resourcesArrayList);
454 for (String uId : collect) {
455 ServiceRestUtils.markServiceToDelete(uId, userId);
457 ServiceRestUtils.deleteMarkedServices(userId);
461 resourcesArrayList = convertCatalogResponseToJavaObject.get(ComponentTypeEnum.RESOURCE_PARAM_NAME);
463 // List<String> collect = resourcesArrayList.stream().filter(s ->
464 // s.getName().startsWith("ci")).map(e ->
465 // e.getUniqueId()).collect(Collectors.toList());
467 // List<Map<String, String>> collect =
468 // resourcesArrayList.stream().filter(s ->
469 // s.getName().startsWith("ci")).map(e ->
470 // e.getAllVersions()).collect(Collectors.toList());
472 * List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")) .flatMap(e -> e.getAllVersions().values().stream()).collect(Collectors.toList());
475 if (!CollectionUtils.isEmpty(resourcesArrayList)) {
476 List<String> collect = buildCollectionUniqueId(resourcesArrayList);
477 for (String uId : collect) {
478 ResourceRestUtils.markResourceToDelete(uId, userId);
480 ResourceRestUtils.deleteMarkedResources(userId);
487 private void deleteCollection(List<Component> componentArrayList, Consumer<String> deleteHandler) {
489 if (componentArrayList.size() > 0) {
490 List<String> collect = buildCollectionUniqueId(componentArrayList);
491 for (String uId : collect) {
492 deleteHandler.accept(uId);
493 // ProductRestUtils.deleteProduct(uId, userId);
498 protected static List<String> buildCollectionUniqueId(List<Component> resourcesArrayList) {
500 // Stream<String> flatMap = resourcesArrayList.stream().filter(s ->
501 // s.getName().startsWith("ci")).map(e -> e.getAllVersions()).map( e ->
502 // e.values()).flatMap( e -> e.stream());
504 // List<String> collect = resourcesArrayList.stream()
506 // .filter(s -> s.getName().startsWith("ci") )
508 // .map(e -> e.getUniqueId())
510 // .map( e -> e.values())
511 // .filter(out -> out!=null )
512 // .flatMap( e -> e.stream())
513 // .collect(Collectors.toList());
515 // List<String> collect = resourcesArrayList.stream().filter(s ->
516 // s.getName().startsWith("ci"))
518 // e.getAllVersions().values().stream()).collect(Collectors.toList());
519 ComponentTypeEnum componentTypeEnum = resourcesArrayList.get(0).getComponentType();
521 List<String> genericCollection = new ArrayList<String>();
523 resourcesArrayList.stream().filter(s -> s.getName().toLowerCase().startsWith("ci") && !s.getName().toLowerCase().equals("cindervolume")).map(e -> e.getUniqueId()).collect(Collectors.toList()).forEach((i) -> {
524 buildCollectionBaseOnComponentType(componentTypeEnum, genericCollection, i);
530 // List<String> collect =
531 // genericCollection.stream().collect(Collectors.toList());
533 return genericCollection;
536 public static void buildCollectionBaseOnComponentType(ComponentTypeEnum componentTypeEnum,
537 List<String> genericCollection, String i) {
539 switch (componentTypeEnum) {
541 RestResponse resource = ResourceRestUtils.getResource(i);
542 Resource convertResourceResponseToJavaObject = ResponseParser.convertResourceResponseToJavaObject(resource.getResponse());
543 Map<String, String> allVersions = convertResourceResponseToJavaObject.getAllVersions();
544 Collection<String> values = allVersions.values();
545 genericCollection.addAll(values);
549 RestResponse service = ServiceRestUtils.getService(i);
550 Service convertServiceResponseToJavaObject = ResponseParser.convertServiceResponseToJavaObject(service.getResponse());
551 allVersions = convertServiceResponseToJavaObject.getAllVersions();
552 values = allVersions.values();
553 genericCollection.addAll(values);
559 RestResponse product = ProductRestUtils.getProduct(i);
560 Product convertProductResponseToJavaObject = ResponseParser.convertProductResponseToJavaObject(product.getResponse());
561 allVersions = convertProductResponseToJavaObject.getAllVersions();
562 values = allVersions.values();
563 genericCollection.addAll(values);
570 } catch (Exception e1) {
571 // TODO Auto-generated catch block
572 e1.printStackTrace();
576 protected static Map<String, List<Component>> getCatalogAsMap() throws Exception {
577 RestResponse catalog = CatalogRestUtils.getCatalog(UserRoleEnum.DESIGNER.getUserId());
578 Map<String, List<Component>> convertCatalogResponseToJavaObject = ResponseParser.convertCatalogResponseToJavaObject(catalog.getResponse());
579 return convertCatalogResponseToJavaObject;
581 protected Resource createVfFromCSAR(User sdncModifierDetails, String csarId) throws Exception {
582 // create new resource from Csar
583 ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource();
585 resourceDetails.setCsarUUID(csarId);
586 resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
587 RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncModifierDetails);
588 BaseRestUtils.checkCreateResponse(createResource);
589 Resource createdResource = ResponseParser.convertResourceResponseToJavaObject(createResource.getResponse());
590 return createdResource;