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.execute.product;
23 import static org.testng.AssertJUnit.assertEquals;
25 import org.junit.rules.TestName;
26 import org.openecomp.sdc.be.model.Product;
27 import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
28 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
29 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
30 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
31 import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
32 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
33 import org.testng.annotations.BeforeMethod;
35 public abstract class ProductLifecycleTest extends ProductBaseTest {
37 protected static final String CHECKIN_ACTION = "Checkin";
38 protected static final String CHECKOUT_ACTION = "Checkout";
39 protected static final String UNDO_CHECKOUT_ACTION = "UndoCheckout";
41 protected Product expectedProduct;
43 public ProductLifecycleTest(TestName testName, String className) {
44 super(testName, className);
48 public void init() throws Exception {
49 ProductReqDetails defaultProduct = ElementFactory.getDefaultProduct(defaultCategories);
50 RestResponse createProduct = ProductRestUtils.createProduct(defaultProduct, productManager1);
51 assertEquals("Check response code after create Product", BaseRestUtils.STATUS_CODE_CREATED,
52 createProduct.getErrorCode().intValue());
53 expectedProduct = ResponseParser.parseToObjectUsingMapper(createProduct.getResponse(), Product.class);