diff options
49 files changed, 3 insertions, 5590 deletions
diff --git a/vid-automation/pom.xml b/vid-automation/pom.xml index 708bffb06..0a6769c89 100644 --- a/vid-automation/pom.xml +++ b/vid-automation/pom.xml @@ -67,11 +67,6 @@ </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - <version>4.4.13</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> <artifactId>httpmime</artifactId> <version>${apachehttp.version}</version> </dependency> diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/api/BaseRestUtils.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/api/BaseRestUtils.java deleted file mode 100644 index 987e09e61..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/api/BaseRestUtils.java +++ /dev/null @@ -1,264 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.api; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.codec.binary.Base64; -import org.apache.http.HttpEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.onap.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.onap.sdc.ci.tests.datatypes.http.HttpRequest; -import org.onap.sdc.ci.tests.datatypes.http.RestResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class BaseRestUtils { - public static final String contentTypeHeaderData = "application/json"; - public static final String acceptHeaderData = "application/json"; - public static final String acceptJsonHeader = "application/json"; - public static final String acceptOctetHeader = "application/octet-stream"; - public static final String authorizationHeader = "Basic " + Base64.encodeBase64String("ci:123456".getBytes()); - public static final String acceptOctetStream = "application/octet-stream"; - public static final String ecomp = "onap"; - public static final String authorizationPrefixString = "Basic "; - - public static final String RESOURCE_COMPONENT_TYPE = "resources"; - public static final String PRODUCT_COMPONENT_TYPE = "products"; - public static final String SERVICE_COMPONENT_TYPE = "services"; - - public static final int STATUS_CODE_SUCCESS = 200; - public static final int STATUS_CODE_CREATED = 201; - public static final int STATUS_CODE_DELETE = 204; - public static final int STATUS_CODE_NOT_FOUND = 404; - public static final int STATUS_CODE_SUCCESS_NO_CONTENT = 204; - public static final int STATUS_CODE_SUCCESS_DELETE = 204; - public static final int STATUS_CODE_INVALID_CONTENT = 400; - public static final int STATUS_CODE_MISSING_DATA = 400; - public static final int STATUS_CODE_MISSING_INFORMATION = 403; - public static final int STATUS_CODE_RESTRICTED_ACCESS = 403; - public static final int STATUS_CODE_ALREADY_EXISTS = 409; - public static final int STATUS_CODE_RESTRICTED_OPERATION = 409; - public static final int STATUS_CODE_COMPONENT_NAME_EXCEEDS_LIMIT = 400; - public static final int STATUS_CODE_MISSING_COMPONENT_NAME = 400; - public static final int STATUS_CODE_UNSUPPORTED_ERROR = 400; - public static final int STATUS_CODE_IMPORT_SUCCESS = 201; - public static final int STATUS_CODE_UPDATE_SUCCESS = 200; - public static final int RESTRICTED_OPERATION = 409; - public static final int STATUS_CODE_GET_SUCCESS = 200; - - public static final String SUCCESS_MESSAGE = "OK"; - private static Logger logger = LoggerFactory.getLogger(BaseRestUtils.class.getName()); - - private static byte[] encodeBase64; - - // ************* PRIVATE METHODS ************************ - - protected static Map<String, String> prepareHeadersMap(String userId) { - return prepareHeadersMap(userId, acceptHeaderData); - } - - protected static Map<String, String> prepareHeadersMap(String userId, String accept) { - Map<String, String> headersMap = new HashMap<String, String>(); - if (contentTypeHeaderData != null) { - headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), contentTypeHeaderData); - } - if (accept != null) { - headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), accept); - } - if (userId != null) { - headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId); - } - - return headersMap; - } - - // send request - // GET - protected static RestResponse sendGet(String url, String userId) throws IOException { - return sendGet(url, userId, null); - } - - protected static RestResponse sendGet(String url, String userId, Map<String, String> additionalHeaders) - throws IOException { - Map<String, String> headersMap = prepareHeadersMap(userId); - if (additionalHeaders != null) { - headersMap.putAll(additionalHeaders); - } - - HttpRequest http = new HttpRequest(); - RestResponse getResourceResponse = http.httpSendGet(url, headersMap); - return getResourceResponse; - } - - public static RestResponse sendGetAndRemoveHeaders(String url, String userId, List<String> headersToRemove) - throws IOException { - Map<String, String> headersMap = prepareHeadersMap(userId); - if (headersToRemove != null) { - for (String header : headersToRemove) { - headersMap.remove(header); - } - } - - HttpRequest http = new HttpRequest(); - RestResponse getResourceResponse = http.httpSendGet(url, headersMap); - return getResourceResponse; - } - - // PUT - protected static RestResponse sendPut(String url, String userBodyJson, String userId, String cont) - throws IOException { - Map<String, String> headersMap = prepareHeadersMap(userId, cont); - - HttpRequest http = new HttpRequest(); - RestResponse updateResourceResponse = http.httpSendByMethod(url, "PUT", userBodyJson, headersMap); - return updateResourceResponse; - } - - // POST - public static RestResponse sendPost(String url, String userBodyJson, String userId, String accept) - throws IOException { - return sendPost(url, userBodyJson, userId, accept, null); - } - - protected static RestResponse sendPost(String url, String userBodyJson, String userId, String accept, - Map<String, String> additionalHeaders) throws IOException { - Map<String, String> headersMap = prepareHeadersMap(userId, accept); - if (additionalHeaders != null) { - headersMap.putAll(additionalHeaders); - } - HttpRequest http = new HttpRequest(); - RestResponse postResourceResponse = http.httpSendPost(url, userBodyJson, headersMap); - return postResourceResponse; - } - - // used form complex requests like import categories.. - protected static RestResponse sendPost(String url, HttpEntity entity, String userId, String accept) - throws IOException { - RestResponse postResponse = new RestResponse(); - CloseableHttpResponse response = null; - CloseableHttpClient client = null; - try { - client = HttpClients.createDefault(); - HttpPost httpPost = new HttpPost(url); - - httpPost.addHeader("USER_ID", userId); - httpPost.setEntity(entity); - response = client.execute(httpPost); - HttpEntity responseEntity = response.getEntity(); - int statusCode = response.getStatusLine().getStatusCode(); - - postResponse.setStatusCode(statusCode); - StringBuffer sb = new StringBuffer(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader(responseEntity.getContent())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - sb.append(inputLine); - } - in.close(); - } catch (Exception e) { - logger.debug("response body is null"); - } - postResponse.setResponse(sb.toString()); - } finally { - try { - if (response != null) { - response.close(); - } - - } catch (IOException e) { - logger.debug("failed to close client or response: ", e); - } - try { - if (client != null) { - client.close(); - } - } catch (IOException e) { - logger.debug("failed to close client or response: ", e); - } - } - return postResponse; - } - - // DELETE - protected static RestResponse sendDelete(String url, String userId) throws IOException { -// Map<String, String> headersMap = prepareHeadersMap(userId); - - return sendDelete(url, userId, null); - } - - protected static RestResponse sendDelete(String url, String userId, Map<String, String> additionalHeaders) throws IOException { - Map<String, String> headersMap = prepareHeadersMap(userId); - if (additionalHeaders != null) { - headersMap.putAll(additionalHeaders); - } - - HttpRequest http = new HttpRequest(); - RestResponse deleteResourceResponse = http.httpSendDelete(url, headersMap); - return deleteResourceResponse; - } - - /* - * // ------ protected static Boolean checkErrorCode(RestResponse - * deleteResponse) { if (deleteResponse.getErrorCode() == - * STATUS_CODE_SUCCESS || deleteResponse.getErrorCode() == - * STATUS_CODE_DELETE) { return true; } return false; } - * - * // *** STATUS CODE VALIDATION UTIITIES **** public static void - * checkStatusCode(RestResponse response, String assertMessage, boolean AND, - * int... statuses) { int statusCode = response.getErrorCode(); for (int - * status : statuses) { if (AND && statusCode != status) { - * Assert.fail(assertMessage + " status: " + statusCode); } else if - * (statusCode == status) { return; } } if (!AND) { - * Assert.fail(assertMessage + " status: " + statusCode); } } - * - * public static void checkDeleteResponse(RestResponse response) { - * checkStatusCode(response,"delete request failed",false,STATUS_CODE_DELETE - * ,STATUS_CODE_NOT_FOUND, STATUS_CODE_SUCCESS); // STATUS_CODE_SUCCESS for - * deActivate user } - * - * public static void checkCreateResponse(RestResponse response) { - * checkStatusCode(response, "create request failed", false, - * STATUS_CODE_CREATED); } - */ - public static String encodeUrlForDownload(String url) { - return url.replaceAll(" ", "%20"); - } - - public static Map<String, String> addAuthorizeHeader(String userName, String password) { - String userCredentials = userName + ":" + password; - encodeBase64 = Base64.encodeBase64(userCredentials.getBytes()); - String encodedUserCredentials = authorizationPrefixString + new String(encodeBase64); - Map<String, String> authorizationHeader = new HashMap<String, String>(); - authorizationHeader.put(HttpHeaderEnum.AUTHORIZATION.getValue(), encodedUserCredentials); - return authorizationHeader; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ArtifactAssetStructure.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ArtifactAssetStructure.java deleted file mode 100644 index 8eb4fa38b..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ArtifactAssetStructure.java +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -public class ArtifactAssetStructure { - - String artifactName; - String artifactType; - String artifactURL; - String artifactDescription; - int artifactTimeout;// optional - String artifactChecksum; - String artifactUUID; - String artifactVersion; - String generatedFromUUID;// optional - - public ArtifactAssetStructure(String artifactName, String artifactType, String artifactURL, - String artifactDescription, int artifactTimeout, String artifactChecksum, String artifactUUID, - String artifactVersion, String generatedFromUUID) { - super(); - this.artifactName = artifactName; - this.artifactType = artifactType; - this.artifactURL = artifactURL; - this.artifactDescription = artifactDescription; - this.artifactTimeout = artifactTimeout; - this.artifactChecksum = artifactChecksum; - this.artifactUUID = artifactUUID; - this.artifactVersion = artifactVersion; - this.generatedFromUUID = generatedFromUUID; - } - - public ArtifactAssetStructure() { - super(); - // TODO Auto-generated constructor stub - } - - public String getArtifactName() { - return artifactName; - } - - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; - } - - public String getArtifactURL() { - return artifactURL; - } - - public void setArtifactURL(String artifactURL) { - this.artifactURL = artifactURL; - } - - public String getArtifactDescription() { - return artifactDescription; - } - - public void setArtifactDescription(String artifactDescription) { - this.artifactDescription = artifactDescription; - } - - public int getArtifactTimeout() { - return artifactTimeout; - } - - public void setArtifactTimeout(int artifactTimeout) { - this.artifactTimeout = artifactTimeout; - } - - public String getArtifactChecksum() { - return artifactChecksum; - } - - public void setArtifactChecksum(String artifactChecksum) { - this.artifactChecksum = artifactChecksum; - } - - public String getArtifactUUID() { - return artifactUUID; - } - - public void setArtifactUUID(String artifactUUID) { - this.artifactUUID = artifactUUID; - } - - public String getArtifactVersion() { - return artifactVersion; - } - - public void setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; - } - - public String getGeneratedFromUUID() { - return generatedFromUUID; - } - - public void setGeneratedFromUUID(String generatedFromUUID) { - this.generatedFromUUID = generatedFromUUID; - } - - @Override - public String toString() { - return "ArtifactAssetStructure [artifactName=" + artifactName + ", artifactType=" + artifactType - + ", artifactURL=" + artifactURL + ", artifactDescription=" + artifactDescription + ", artifactTimeout=" - + artifactTimeout + ", artifactChecksum=" + artifactChecksum + ", artifactUUID=" + artifactUUID - + ", artifactVersion=" + artifactVersion + ", generatedFromUUID=" + generatedFromUUID + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/AssetStructure.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/AssetStructure.java deleted file mode 100644 index 345181d6c..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/AssetStructure.java +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -public class AssetStructure { - - private String uuid; - private String invariantUUID; - private String name; - private String version; - private String toscaModelURL; - private String category; - private String lifecycleState; - private String lastUpdaterUserId; - - public AssetStructure() { - super(); - } - - public AssetStructure(String uuid, String invariantUUID, String name, String version, String toscaModelURL, - String category, String lifecycleState, String lastUpdaterUserId) { - super(); - this.uuid = uuid; - this.invariantUUID = invariantUUID; - this.name = name; - this.version = version; - this.toscaModelURL = toscaModelURL; - this.category = category; - this.lifecycleState = lifecycleState; - this.lastUpdaterUserId = lastUpdaterUserId; - } - - @Override - public String toString() { - return "AssetStructure [uuid=" + uuid + ", invariantUUID=" + invariantUUID + ", name=" + name + ", version=" - + version + ", toscaModelURL=" + toscaModelURL + ", category=" + category + ", lifecycleState=" - + lifecycleState + ", lastUpdaterUserId=" + lastUpdaterUserId + "]"; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getInvariantUUID() { - return invariantUUID; - } - - public void setInvariantUUID(String invariantUUID) { - this.invariantUUID = invariantUUID; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getToscaModelURL() { - return toscaModelURL; - } - - public void setToscaModelURL(String toscaModelURL) { - this.toscaModelURL = toscaModelURL; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CanvasElement.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CanvasElement.java deleted file mode 100644 index a17c38c7f..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CanvasElement.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; - -public final class CanvasElement { - private final String uniqueId; - private ImmutablePair<Integer, Integer> location; - private LeftPanelCanvasItems normativeElementType; - private String elementType; - - CanvasElement(String name, ImmutablePair<Integer, Integer> location, LeftPanelCanvasItems canvasItem) { - super(); - this.uniqueId = name; - this.location = location; - normativeElementType = canvasItem; - } - - CanvasElement(String name, ImmutablePair<Integer, Integer> location, String canvasItem) { - super(); - this.uniqueId = name; - this.location = location; - elementType = canvasItem; - } - - public String getUniqueId() { - return uniqueId; - } - - public ImmutablePair<Integer, Integer> getLocation() { - return location; - } - - public void setLocation(ImmutablePair<Integer, Integer> location) { - this.location = location; - } - - public LeftPanelCanvasItems getNormativeElementType() { - return normativeElementType; - } - - public String getElementType() { - return elementType; - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CanvasManager.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CanvasManager.java deleted file mode 100644 index 999a63bb3..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CanvasManager.java +++ /dev/null @@ -1,268 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; -import org.onap.sdc.ci.tests.execute.setup.ExtentTestActions; -import org.onap.sdc.ci.tests.execute.setup.SetupCDTest; -import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.By; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; -import org.testng.Assert; - -import com.aventstack.extentreports.Status; - -public final class CanvasManager { - private Map<String, CanvasElement> canvasElements; - private Actions actions; - private WebElement canvas; - private int reduceCanvasWidthFactor; - private CanvasElement canvasElement; - // Offsets Are used to find upper right corner of canvas element in order to - // connect links - private static final int CANVAS_ELEMENT_Y_OFFSET = 30; - private static final int CANVAS_ELEMENT_X_OFFSET = 18; // 14 - 27 - - private CanvasManager() { - canvasElements = new HashMap<>(); - actions = new Actions(GeneralUIUtils.getDriver()); - canvas = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); - try { - WebElement webElement = GeneralUIUtils - .getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); - reduceCanvasWidthFactor = webElement.getSize().width; - } catch (Exception e) { - reduceCanvasWidthFactor = 0; - } - } - - public static CanvasManager getCanvasManager() { - return new CanvasManager(); - } - - public List<CanvasElement> getCanvasElements() { - return canvasElements.values().stream().collect(Collectors.toList()); - } - - private void addCanvasElement(CanvasElement element) { - canvasElements.put(element.getUniqueId(), element); - } - - private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation) - throws Exception { - GeneralUIUtils.waitForLoader(); - actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); - actions.clickAndHold(); - actions.moveToElement(canvas, newLocation.left, newLocation.right); - actions.release(); - actions.perform(); - canvasElement.setLocation(newLocation); - GeneralUIUtils.waitForLoader(); - - } - - public void moveToFreeLocation(String containerName) { - int maxWait = 5000; - int sumOfWaiting = 0; - int napPeriod = 200; - boolean isKeepWaiting = false; - while (!isKeepWaiting) { - ImmutablePair<Integer, Integer> freePosition = getFreePosition(); - actions.moveToElement(canvas, freePosition.left, freePosition.right); - actions.clickAndHold(); - actions.release(); - actions.perform(); - isKeepWaiting = GeneralUIUtils.getWebElementByTestID("selectedCompTitle").getText() - .equals(containerName); - sumOfWaiting += napPeriod; - if (sumOfWaiting > maxWait) { - Assert.fail("Can't click on VF"); - } - } - } - - public void clickOnCanvaElement(CanvasElement canvasElement) { - actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); - actions.clickAndHold(); - actions.release(); - actions.perform(); - actions.click().perform(); - GeneralUIUtils.ultimateWait(); - ExtentTestActions.log(Status.INFO, String.format("Canvas element %s selected", canvasElement.getElementType())); - } - - public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception { - moveElementOnCanvas(canvasElement, getFreePosition()); - } - - public void deleteElementFromCanvas(CanvasElement canvasElement) throws Exception { - GeneralUIUtils.waitForLoader(); - actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); - actions.click(); - actions.perform(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue()) - .click(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click(); - canvasElements.remove(canvasElement.getUniqueId()); - GeneralUIUtils.ultimateWait(); - if (canvasElement.getElementType().contains("-")){ - ExtentTestActions.log(Status.INFO, String.format("Canvas element %s removed", canvasElement.getElementType().split("-")[4])); - } - else{ - ExtentTestActions.log(Status.INFO, String.format("Canvas element %s removed", canvasElement.getElementType())); - } - } - - private WebElement findClickElement(String dataTestId) { - int attempts = 0; - while (attempts < 2) { - try { - return GeneralUIUtils.getWebElementByTestID(dataTestId); - } catch (StaleElementReferenceException e) { - } - attempts++; - } - return null; - } - - public CanvasElement createElementOnCanvas(String elementName) throws Exception { - String actionDuration = GeneralUIUtils.getActionDuration(() -> { - try { - canvasElement = createElementOnCanvasWithoutDuration(elementName); - } catch (Exception e) { - e.printStackTrace(); - } - }); - - if (canvasElement != null){ - ExtentTestActions.log(Status.INFO, String.format("The element %s should now be on the canvas", elementName), actionDuration); - } - return canvasElement; - } - - private CanvasElement createElementOnCanvasWithoutDuration(String elementDataTestId) throws Exception { - try { - WebElement element = findClickElement(elementDataTestId); - ImmutablePair<Integer, Integer> freePosition = getFreePosition(); - actions.moveToElement(element, 20, 20); - actions.clickAndHold(); - actions.moveToElement(canvas, freePosition.left, freePosition.right); - actions.release(); - actions.perform(); - GeneralUIUtils.ultimateWait(); - String uniqueId = elementDataTestId + "_" + UUID.randomUUID().toString(); - CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, elementDataTestId); - addCanvasElement(canvasElement); - GeneralUIUtils.ultimateWait(); - return canvasElement; - } - catch (Exception e) { - System.out.println("Can't create element on canvas"); - e.printStackTrace(); - } - return null; - } - - public CanvasElement createElementOnCanvas(LeftPanelCanvasItems canvasItem) throws Exception { - return createElementOnCanvas(canvasItem.getValue()); - } - - private ImmutablePair<Integer, Integer> getFreePosition() { - ImmutablePair<Integer, Integer> randomPosition = null; - boolean freePosition = false; - int minSpace = 150; - while (!freePosition) { - ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition(); - freePosition = !canvasElements.values().stream().map(e -> e.getLocation()) - .filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace - && Math.abs(e.right - tempRandomPosition.right) < minSpace) - .findAny().isPresent(); - randomPosition = tempRandomPosition; - } - return randomPosition; - } - - private ImmutablePair<Integer, Integer> getRandomPosition() { - int edgeBuffer = 50; - Random random = new Random(); - int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer; - int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer; - return new ImmutablePair<Integer, Integer>(xElement, yElement); - } - - public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception { - ExtentTestActions.log(Status.INFO, String.format("Linking between the %s instance and the %s instance.", firstElement.getElementType(), secondElement.getElementType())); - drawSimpleLink(firstElement, secondElement); - selectReqAndCapAndConnect(); - ExtentTestActions.log(Status.INFO, String.format("The instances %s and %s should now be connected.", firstElement.getElementType(), secondElement.getElementType())); - } - - private void selectReqAndCapAndConnect() throws Exception { - // Select First Cap - GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click(); - // Select First Req - GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click(); - // Connect - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); - - GeneralUIUtils.waitForLoader(); - } - - private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) throws Exception { - int yOffset = CANVAS_ELEMENT_Y_OFFSET; - int xOffset = CANVAS_ELEMENT_X_OFFSET; - - actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, - firstElement.getLocation().right - yOffset); - - actions.clickAndHold(); - actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, secondElement.getLocation().right - yOffset); - actions.release(); - actions.perform(); - GeneralUIUtils.ultimateWait(); - } - - public String updateElementNameInCanvas(CanvasElement canvasElement, String newInstanceName) throws Exception { - GeneralUIUtils.ultimateWait();; - clickOnCanvaElement(canvasElement); - WebElement updateInstanceName = GeneralUIUtils.getWebElementBy(By.id("editPencil")); - updateInstanceName.click(); - WebElement instanceNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.INSTANCE_NAME_FIELD.getValue()); - String oldInstanceName = instanceNameField.getAttribute("value"); - instanceNameField.clear(); - instanceNameField.sendKeys(newInstanceName); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click(); - GeneralUIUtils.ultimateWait(); - GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("w-sdc-modal-resource-instance-name")); - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", oldInstanceName, newInstanceName)); - return oldInstanceName; - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ComponentReqDetails.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ComponentReqDetails.java deleted file mode 100644 index 86d23e870..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ComponentReqDetails.java +++ /dev/null @@ -1,272 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.ArrayList; -import java.util.List; - -import org.onap.sdc.ci.tests.devObjects.CategoryDefinition; -import org.onap.sdc.ci.tests.devObjects.LifecycleStateEnum; -import org.onap.sdc.ci.tests.devObjects.SubCategoryDefinition; - -public abstract class ComponentReqDetails { - - protected String name; - protected String description; - protected List<String> tags = new ArrayList<>(); - protected String contactId; - protected String icon; - protected String uniqueId; - protected String creatorUserId; - protected String creatorFullName; - protected String lastUpdaterUserId; - protected String lastUpdaterFullName; - protected Long creationDate; - protected Long lastUpdateDate; - protected LifecycleStateEnum lifecycleState; - protected String version; - protected String UUID; - protected List<CategoryDefinition> categories; - protected String projectCode; - protected String csarUUID; - protected String csarVersion; - protected String importedToscaChecksum; - protected String invariantUUID; - - public String getCsarVersion() { - return csarVersion; - } - - public void setCsarVersion(String csarVersion) { - this.csarVersion = csarVersion; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - tags.add(name); - } - - public List<String> getTags() { - return tags; - } - - public void setTags(List<String> tags) { - this.tags = tags; - } - - // public String getCategory() { - // return category; - // } - // - public String getContactId() { - return contactId; - } - - public void setContactId(String contactId) { - this.contactId = contactId; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public void setCreatorUserId(String creatorUserId) { - this.creatorUserId = creatorUserId; - } - - public void setCreatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public void setCreationDate(Long creationDate) { - this.creationDate = creationDate; - } - - public void setLastUpdateDate(Long lastUpdateDate) { - this.lastUpdateDate = lastUpdateDate; - } - - public void setLifecycleState(LifecycleStateEnum lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public void setUUID(String uUID) { - this.UUID = uUID; - } - - public String getCreatorUserId() { - return creatorUserId; - } - - public String getCreatorFullName() { - return creatorFullName; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public Long getCreationDate() { - return creationDate; - } - - public Long getLastUpdateDate() { - return lastUpdateDate; - } - - public LifecycleStateEnum getLifecycleState() { - return lifecycleState; - } - - public String getUUID() { - return UUID; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public List<CategoryDefinition> getCategories() { - return categories; - } - - public void setCategories(List<CategoryDefinition> categories) { - this.categories = categories; - } - - public void removeAllCategories() { - this.categories = new ArrayList<>(); - } - - public void addCategoryChain(String category, String subCategory) { - if (category != null || subCategory != null) { - if (categories == null) { - categories = new ArrayList<>(); - } - CategoryDefinition selectedCategory = null; - for (CategoryDefinition categoryDef : categories) { - if (categoryDef.getName().equals(category)) { - selectedCategory = categoryDef; - } - } - if (selectedCategory == null) { - selectedCategory = new CategoryDefinition(); - selectedCategory.setName(category); - categories.add(selectedCategory); - } - if (subCategory != null) { - List<SubCategoryDefinition> subcategories = selectedCategory.getSubcategories(); - if (subcategories == null) { - subcategories = new ArrayList<>(); - selectedCategory.setSubcategories(subcategories); - } - SubCategoryDefinition selectedSubcategory = null; - for (SubCategoryDefinition subcategory : subcategories) { - if (subcategory.getName().equals(subCategory)) { - selectedSubcategory = subcategory; - } - } - if (selectedSubcategory == null) { - selectedSubcategory = new SubCategoryDefinition(); - selectedSubcategory.setName(subCategory); - subcategories.add(selectedSubcategory); - } - } - } - } - - public void addCategory(String category) { - addCategoryChain(category, null); - } - - public String getProjectCode() { - return projectCode; - } - - public void setProjectCode(String projectCode) { - this.projectCode = projectCode; - } - - public String getCsarUUID() { - return csarUUID; - } - - public void setCsarUUID(String csarUUID) { - this.csarUUID = csarUUID; - } - - public String getImportedToscaChecksum() { - return importedToscaChecksum; - } - - public void setImportedToscaChecksum(String importedToscaChecksum) { - this.importedToscaChecksum = importedToscaChecksum; - } - - public String getInvariantUUID() { - return invariantUUID; - } - - public void setInvariantUUID(String invariantUUID) { - this.invariantUUID = invariantUUID; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CsarArtifacts.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CsarArtifacts.java deleted file mode 100644 index 43dd8dfe3..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/CsarArtifacts.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -public class CsarArtifacts { - - private String artifactType; - private String artifactName; - - public CsarArtifacts() { - super(); - } - - public CsarArtifacts(String artifactName, String artifactType) { - super(); - this.artifactName = artifactName; - this.artifactType = artifactType; - } - - @Override - public String toString() { - return "AssetStructure [artifactName=" + artifactName + ", artifactType=" + artifactType + "]"; - } - - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; - } - - public String getArtifactName() { - return artifactName; - } - - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/LocalLoginFieldsIds.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/LocalLoginFieldsIds.java deleted file mode 100644 index a3ede39cb..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/LocalLoginFieldsIds.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.onap.sdc.ci.tests.datatypes; - -public class LocalLoginFieldsIds { - - private String userIdFieldName; - private String passwordFieldName; - - - public LocalLoginFieldsIds(String userIdFieldName, String passwordFieldName) { - super(); - this.userIdFieldName = userIdFieldName; - this.passwordFieldName = passwordFieldName; - } - - - public String getUserIdFieldName() { - return userIdFieldName; - } - public void setUserIdFieldName(String userIdFieldName) { - this.userIdFieldName = userIdFieldName; - } - public String getPasswordFieldName() { - return passwordFieldName; - } - public void setPasswordFieldName(String passwordFieldName) { - this.passwordFieldName = passwordFieldName; - } - - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/PropertyHeatMetaDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/PropertyHeatMetaDefinition.java deleted file mode 100644 index a39dffc13..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/PropertyHeatMetaDefinition.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -public class PropertyHeatMetaDefinition { - - String name; - boolean value; - - public PropertyHeatMetaDefinition() { - super(); - } - - - - public String getName() { - return name; - } - - - - public void setName(String name) { - this.name = name; - } - - - - public boolean getValue() { - return value; - } - - - - public void setValue(boolean value) { - this.value = value; - } - - - - @Override - public String toString() { - return "PropertyHeatMetaDefinition [name=" + name + ", value=" + value + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceAssetStructure.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceAssetStructure.java deleted file mode 100644 index 3fef99183..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceAssetStructure.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -public class ResourceAssetStructure extends AssetStructure { - - private String subCategory; - private String resourceType; - protected String lastUpdaterFullName; - protected String toscaResourceName; - - public ResourceAssetStructure() { - super(); - } - - public ResourceAssetStructure(String uuid, String invariantUUID, String name, String version, String toscaModelURL, - String category, String lifecycleState, String lastUpdaterUserId) { - super(uuid, invariantUUID, name, version, toscaModelURL, category, lifecycleState, lastUpdaterUserId); - } - - @Override - public String toString() { - return "ResourceAssetStructure [subCategory=" + subCategory + ", resourceType=" + resourceType + "]"; - } - - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public String getToscaResourceName() { - return toscaResourceName; - } - - public void setToscaResourceName(String toscaResourceName) { - this.toscaResourceName = toscaResourceName; - } - - public String getSubCategory() { - return subCategory; - } - - public void setSubCategory(String subCategory) { - this.subCategory = subCategory; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceDetailedAssetStructure.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceDetailedAssetStructure.java deleted file mode 100644 index 7d5914b00..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceDetailedAssetStructure.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.List; - -public class ResourceDetailedAssetStructure extends ResourceAssetStructure { - - private List<ResourceInstanceAssetStructure> resources; - private List<ArtifactAssetStructure> artifacts; - - public ResourceDetailedAssetStructure() { - super(); - } - - public ResourceDetailedAssetStructure(String lastUpdaterFullName, String toscaResourceName, - List<ResourceInstanceAssetStructure> resources, List<ArtifactAssetStructure> artifacts) { - super(); - this.lastUpdaterFullName = lastUpdaterFullName; - this.toscaResourceName = toscaResourceName; - this.resources = resources; - this.artifacts = artifacts; - } - - public List<ResourceInstanceAssetStructure> getResources() { - return resources; - } - - public void setResources(List<ResourceInstanceAssetStructure> resources) { - this.resources = resources; - } - - public List<ArtifactAssetStructure> getArtifacts() { - return artifacts; - } - - public void setArtifacts(List<ArtifactAssetStructure> artifacts) { - this.artifacts = artifacts; - } - - @Override - public String toString() { - return "ResourceDetailedAssetStructure [lastUpdaterFullName=" + lastUpdaterFullName + ", toscaResourceName=" - + toscaResourceName + ", resources=" + resources + ", artifacts=" + artifacts + ", toString()=" - + super.toString() + ", getSubCategory()=" + getSubCategory() + ", getResourceType()=" - + getResourceType() + ", getUuid()=" + getUuid() + ", getInvariantUUID()=" + getInvariantUUID() - + ", getName()=" + getName() + ", getVersion()=" + getVersion() + ", getToscaModelURL()=" - + getToscaModelURL() + ", getCategory()=" + getCategory() + ", getLifecycleState()=" - + getLifecycleState() + ", getLastUpdaterUserId()=" + getLastUpdaterUserId() + ", getClass()=" - + getClass() + ", hashCode()=" + hashCode() + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java deleted file mode 100644 index f6d354c1e..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.List; - -import org.onap.sdc.ci.tests.devObjects.ResourceTypeEnum; - -public class ResourceExternalReqDetails extends ComponentReqDetails { - String vendorName; - String vendorRelease; - String category; - String subcategory; - - private String resourceType = ResourceTypeEnum.VFC.toString(); // Default - // value - public ResourceExternalReqDetails() { - super(); - } - - - public ResourceExternalReqDetails(String resourceName, String description, List<String> tags, - String vendorName, String vendorRelease, String contactId, String icon, - String resourceType, String resourceCategory, String resourceSubcategory) { - super(); - this.resourceType = resourceType; - this.name = resourceName; - this.description = description; - this.tags = tags; - this.vendorName = vendorName; - this.vendorRelease = vendorRelease; - this.contactId = contactId; - this.icon = icon; - this.category = resourceCategory; - this.subcategory = resourceSubcategory; - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; - } - - public String getVendorRelease() { - return vendorRelease; - } - - public void setVendorRelease(String vendorRelease) { - this.vendorRelease = vendorRelease; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getSubcategory() { - return subcategory; - } - - public void setSubcategory(String subcategory) { - this.subcategory = subcategory; - } - - - @Override - public String toString() { - return "ResourceReqDetails [name=" + name + ", vendorName=" + vendorName - + ", vendorRelease=" + vendorRelease + ", version=" + version - + ", resourceType=" + resourceType + ", category=" + category + ", subcategory=" + subcategory +"]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceInstanceAssetStructure.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceInstanceAssetStructure.java deleted file mode 100644 index 5019d19b7..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceInstanceAssetStructure.java +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.List; - -public class ResourceInstanceAssetStructure { - - String resourceInstanceName; - String resourceName; - String resourceInvariantUUID; - String resourceVersion; - String resoucreType; - String resourceUUID; - List<ArtifactAssetStructure> artifacts; - - public ResourceInstanceAssetStructure() { - super(); - } - - public ResourceInstanceAssetStructure(String resourceInstanceName, String resourceName, - String resourceInvariantUUID, String resourceVersion, String resoucreType, String resourceUUID, - List<ArtifactAssetStructure> artifacts) { - super(); - this.resourceInstanceName = resourceInstanceName; - this.resourceName = resourceName; - this.resourceInvariantUUID = resourceInvariantUUID; - this.resourceVersion = resourceVersion; - this.resoucreType = resoucreType; - this.resourceUUID = resourceUUID; - this.artifacts = artifacts; - } - - public String getResourceInstanceName() { - return resourceInstanceName; - } - - public void setResourceInstanceName(String resourceInstanceName) { - this.resourceInstanceName = resourceInstanceName; - } - - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceInvariantUUID() { - return resourceInvariantUUID; - } - - public void setResourceInvariantUUID(String resourceInvariantUUID) { - this.resourceInvariantUUID = resourceInvariantUUID; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public String getResoucreType() { - return resoucreType; - } - - public void setResoucreType(String resoucreType) { - this.resoucreType = resoucreType; - } - - public String getResourceUUID() { - return resourceUUID; - } - - public void setResourceUUID(String resourceUUID) { - this.resourceUUID = resourceUUID; - } - - public List<ArtifactAssetStructure> getArtifacts() { - return artifacts; - } - - public void setArtifacts(List<ArtifactAssetStructure> artifacts) { - this.artifacts = artifacts; - } - - @Override - public String toString() { - return "ResourceInstanceAssetStructure [resourceInstanceName=" + resourceInstanceName + ", resourceName=" - + resourceName + ", resourceInvariantUUID=" + resourceInvariantUUID + ", resourceVersion=" - + resourceVersion + ", resoucreType=" + resoucreType + ", resourceUUID=" + resourceUUID + ", artifacts=" - + artifacts + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceReqDetails.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceReqDetails.java deleted file mode 100644 index 7a3dbd469..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceReqDetails.java +++ /dev/null @@ -1,194 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.List; - -import org.onap.sdc.ci.tests.devObjects.ResourceTypeEnum; - -public class ResourceReqDetails extends ComponentReqDetails { - List<String> derivedFrom; - String vendorName; - String vendorRelease; - - // Unsettable/unupdatable fields - - Boolean isAbstract; - Boolean isHighestVersion; - String cost; - String licenseType; - String toscaResourceName; - - private String resourceType = ResourceTypeEnum.VFC.toString(); // Default - // value - - public ResourceReqDetails() { - super(); - } - - - public ResourceReqDetails(String resourceName, String description, List<String> tags, String category, - List<String> derivedFrom, String vendorName, String vendorRelease, String contactId, String icon) { - this(resourceName, description, tags, category, derivedFrom, vendorName, vendorRelease, contactId, icon, - ResourceTypeEnum.VFC.toString()); - } - - // new - public ResourceReqDetails(String resourceName, String description, List<String> tags, String category, - List<String> derivedFrom, String vendorName, String vendorRelease, String contactId, String icon, - String resourceType) { - super(); - this.resourceType = resourceType; - this.name = resourceName; - this.description = description; - this.tags = tags; - // this.category = category; - this.derivedFrom = derivedFrom; - this.vendorName = vendorName; - this.vendorRelease = vendorRelease; - this.contactId = contactId; - this.icon = icon; - if (category != null) { - String[] arr = category.split("/"); - if (arr.length == 2) { - addCategoryChain(arr[0], arr[1]); - } - } - this.toscaResourceName = resourceName; - } - - public ResourceReqDetails(ResourceReqDetails originalResource, String version) { - super(); - this.name = originalResource.getName(); - this.description = originalResource.getDescription(); - this.tags = originalResource.getTags(); - // this.category = originalResource.getCategory(); - this.derivedFrom = originalResource.getDerivedFrom(); - this.vendorName = originalResource.getVendorName(); - this.vendorRelease = originalResource.getVendorRelease(); - this.contactId = originalResource.getContactId(); - this.icon = originalResource.getIcon(); - this.version = version; - this.uniqueId = originalResource.getUniqueId(); - this.categories = originalResource.getCategories(); - this.toscaResourceName = originalResource.getToscaResourceName(); - this.resourceType = originalResource.getResourceType(); - } - - public ResourceReqDetails(String resourceName, List<String> derivedFrom, String vendorName, String vendorRelease, - String resourceVersion, Boolean isAbstract, Boolean isHighestVersion, String cost, String licenseType, - String resourceType) { - super(); - this.name = resourceName; - this.derivedFrom = derivedFrom; - this.vendorName = vendorName; - this.vendorRelease = vendorRelease; - this.version = resourceVersion; - this.isAbstract = isAbstract; - this.isHighestVersion = isHighestVersion; - this.cost = cost; - this.licenseType = licenseType; - this.resourceType = resourceType; - this.toscaResourceName = resourceName; - } - - public String getToscaResourceName() { - return toscaResourceName; - } - - public void setToscaResourceName(String toscaResourceName) { - this.toscaResourceName = toscaResourceName; - } - - public List<String> getDerivedFrom() { - return derivedFrom; - } - - public void setDerivedFrom(List<String> derivedFrom) { - this.derivedFrom = derivedFrom; - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; - } - - public String getVendorRelease() { - return vendorRelease; - } - - public void setVendorRelease(String vendorRelease) { - this.vendorRelease = vendorRelease; - } - - public String getCost() { - return cost; - } - - public void setCost(String cost) { - this.cost = cost; - } - - public String getLicenseType() { - return licenseType; - } - - public void setLicenseType(String licenseType) { - this.licenseType = licenseType; - } - - // Unupdatable fields - to check that they are not updated - public void setIsAbstract(Boolean isAbstract) { - this.isAbstract = isAbstract; - } - - public void setIsHighestVersion(Boolean isHighestVersion) { - this.isHighestVersion = isHighestVersion; - } - - public Boolean getIsAbstract() { - return isAbstract; - } - - public Boolean getIsHighestVersion() { - return isHighestVersion; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - @Override - public String toString() { - return "ResourceReqDetails [name=" + name + ", derivedFrom=" + derivedFrom + ", vendorName=" + vendorName - + ", vendorRelease=" + vendorRelease + ", version=" + version + ", isAbstract=" + isAbstract - + ", isHighestVersion=" + isHighestVersion + ", cost=" + cost + ", licenseType=" + licenseType - + ", resourceType=" + resourceType + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceRespJavaObject.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceRespJavaObject.java deleted file mode 100644 index 525ca794c..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ResourceRespJavaObject.java +++ /dev/null @@ -1,369 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.List; - -import org.onap.sdc.ci.tests.devObjects.CategoryDefinition; - -public class ResourceRespJavaObject { - String uniqueId; - String name; - String version; - String creatorUserId; - String creatorFullName; - String lastUpdaterUserId; - String lastUpdaterFullName; - String description; - String icon; - List<String> tags; - String isHighestVersion; - String creationDate; - String lastUpdateDate; - // String category; - String lifecycleState; - List<String> derivedFrom; - String vendorName; - String vendorRelease; - String contactId; - String abstractt; - String highestVersion; - List<String> artifacts; - List<String> interfaces; - String uuid; - String cost; - String licenseType; - String resourceType; - List<CategoryDefinition> categories; - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public ResourceRespJavaObject(String uniqueId, String resourceName, String resourceVersion, String creatorUserId, - String creatorFullName, String lastUpdaterUserId, String lastUpdaterFullName, String description, - String icon, List<String> tags, String isHighestVersion, String creationDate, String lastUpdateDate, - String category, String lifecycleState, List<String> derivedFrom, String vendorName, String vendorRelease, - String contactId, String abstractt, String highestVersion, List<String> artifacts, List<String> interfaces, - String uuid, String cost, String licenseType, String resourceType) { - super(); - this.uniqueId = uniqueId; - this.name = resourceName; - this.version = resourceVersion; - this.creatorUserId = creatorUserId; - this.creatorFullName = creatorFullName; - this.lastUpdaterUserId = lastUpdaterUserId; - this.lastUpdaterFullName = lastUpdaterFullName; - this.description = description; - this.icon = icon; - this.tags = tags; - this.isHighestVersion = isHighestVersion; - this.creationDate = creationDate; - this.lastUpdateDate = lastUpdateDate; - // this.category = category; - this.lifecycleState = lifecycleState; - this.derivedFrom = derivedFrom; - this.vendorName = vendorName; - this.vendorRelease = vendorRelease; - this.contactId = contactId; - this.abstractt = abstractt; - this.highestVersion = highestVersion; - this.artifacts = artifacts; - this.interfaces = interfaces; - this.uuid = uuid; - this.cost = cost; - this.licenseType = licenseType; - this.resourceType = resourceType; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getCost() { - return cost; - } - - public void setCost(String cost) { - this.cost = cost; - } - - public String getLicenseType() { - return licenseType; - } - - public void setLicenseType(String licenseType) { - this.licenseType = licenseType; - } - - public String getUuid() { - return uuid; - } - - public String setUuid() { - return uuid; - } - - public List<String> getInterfaces() { - return interfaces; - } - - public void setInterfaces(List<String> interfaces) { - this.interfaces = interfaces; - } - - public List<String> getArtifacts() { - return artifacts; - } - - public void setArtifacts(List<String> artifacts) { - this.artifacts = artifacts; - } - - public ResourceRespJavaObject() { - super(); - // TODO Auto-generated constructor stub - } - - // public ResourceRespJavaObject(String uniqueId, String resourceName, - // String resourceVersion, String creatorUserId, - // String creatorFullName, String lastUpdaterUserId, - // String lastUpdaterFullName, String description, String icon, - // List<String> tags, String isHighestVersion, String creationDate, - // String lastUpdateDate, String category, String lifecycleState, - // List<String> derivedFrom, String vendorName, String vendorRelease, - // String contactId, String abstractt, String highestVersion) { - // super(); - // this.uniqueId = uniqueId; - // this.resourceName = resourceName; - // this.resourceVersion = resourceVersion; - // this.creatorUserId = creatorUserId; - // this.creatorFullName = creatorFullName; - // this.lastUpdaterUserId = lastUpdaterUserId; - // this.lastUpdaterFullName = lastUpdaterFullName; - // this.description = description; - // this.icon = icon; - // this.tags = tags; - // this.isHighestVersion = isHighestVersion; - // this.creationDate = creationDate; - // this.lastUpdateDate = lastUpdateDate; - // this.category = category; - // this.lifecycleState = lifecycleState; - // this.derivedFrom = derivedFrom; - // this.vendorName = vendorName; - // this.vendorRelease = vendorRelease; - // this.contactId = contactId; - // this.abstractt = abstractt; - // this.highestVersion = highestVersion; - // } - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public String getName() { - return name; - } - - public void setName(String resourceName) { - this.name = resourceName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String resourceVersion) { - this.version = resourceVersion; - } - - public String getCreatorUserId() { - return creatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - this.creatorUserId = creatorUserId; - } - - public String getCreatorFullName() { - return creatorFullName; - } - - public void setCreatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public List<String> getTags() { - return tags; - } - - public void setTags(List<String> tags) { - this.tags = tags; - } - - public String getIsHighestVersion() { - return isHighestVersion; - } - - public void setIsHighestVersion(String isHighestVersion) { - this.isHighestVersion = isHighestVersion; - } - - public String getCreationDate() { - return creationDate; - } - - public void setCreationDate(String creationDate) { - this.creationDate = creationDate; - } - - public String getLastUpdateDate() { - return lastUpdateDate; - } - - public void setLastUpdateDate(String lastUpdateDate) { - this.lastUpdateDate = lastUpdateDate; - } - - // public String getCategory() { - // return category; - // } - // public void setCategory(String category) { - // this.category = category; - // } - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public List<String> getDerivedFrom() { - return derivedFrom; - } - - public void setDerivedFrom(List<String> derivedFrom) { - this.derivedFrom = derivedFrom; - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; - } - - public String getVendorRelease() { - return vendorRelease; - } - - public void setVendorRelease(String vendorRelease) { - this.vendorRelease = vendorRelease; - } - - public String getContactId() { - return contactId; - } - - public void setContactId(String contactId) { - this.contactId = contactId; - } - - public String getAbstractt() { - return abstractt; - } - - public void setAbstractt(String abstractt) { - this.abstractt = abstractt; - } - - public String getHighestVersion() { - return highestVersion; - } - - public void setHighestVersion(String highestVersion) { - this.highestVersion = highestVersion; - } - - public List<CategoryDefinition> getCategories() { - return categories; - } - - public void setCategories(List<CategoryDefinition> categories) { - this.categories = categories; - } - - @Override - public String toString() { - return "ResourceRespJavaObject [uniqueId=" + uniqueId + ", resourceName=" + name + ", resourceVersion=" - + version + ", creatorUserId=" + creatorUserId + ", creatorFullName=" + creatorFullName - + ", lastUpdaterUserId=" + lastUpdaterUserId + ", lastUpdaterFullName=" + lastUpdaterFullName - + ", description=" + description + ", icon=" + icon + ", tags=" + tags + ", isHighestVersion=" - + isHighestVersion + ", creationDate=" + creationDate + ", lastUpdateDate=" + lastUpdateDate - + ", lifecycleState=" + lifecycleState + ", derivedFrom=" + derivedFrom + ", vendorName=" + vendorName - + ", vendorRelease=" + vendorRelease + ", contactId=" + contactId + ", abstractt=" + abstractt - + ", highestVersion=" + highestVersion + ", artifacts=" + artifacts + ", interfaces=" + interfaces - + ", uuid=" + uuid + ", cost=" + cost + ", licenseType=" + licenseType + ", resourceType=" - + resourceType + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceAssetStructure.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceAssetStructure.java deleted file mode 100644 index cfe7addbe..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceAssetStructure.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -public class ServiceAssetStructure extends AssetStructure { - - private String distributionStatus; - - public ServiceAssetStructure() { - super(); - } - - public ServiceAssetStructure(String uuid, String invariantUUID, String name, String version, String toscaModelURL, - String category, String lifecycleState, String lastUpdaterUserId) { - super(uuid, invariantUUID, name, version, toscaModelURL, category, lifecycleState, lastUpdaterUserId); - } - - @Override - public String toString() { - return "ServiceAssetStructure [distributionStatus=" + distributionStatus + "]"; - } - - public String getDistributionStatus() { - return distributionStatus; - } - - public void setDistributionStatus(String distributionStatus) { - this.distributionStatus = distributionStatus; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceDetailedAssetStructure.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceDetailedAssetStructure.java deleted file mode 100644 index f699aa3f0..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceDetailedAssetStructure.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.List; - -public class ServiceDetailedAssetStructure extends ServiceAssetStructure { - - String lastUpdaterFullName; - List<ResourceInstanceAssetStructure> resources; - List<ArtifactAssetStructure> artifacts; - - public ServiceDetailedAssetStructure() { - super(); - } - - public ServiceDetailedAssetStructure(String uuid, String invariantUUID, String name, String version, - String toscaModelURL, String category, String lifecycleState, String lastUpdaterUserId) { - super(uuid, invariantUUID, name, version, toscaModelURL, category, lifecycleState, lastUpdaterUserId); - } - - public ServiceDetailedAssetStructure(String lastUpdaterFullName, List<ResourceInstanceAssetStructure> resources, - List<ArtifactAssetStructure> artifacts) { - super(); - this.lastUpdaterFullName = lastUpdaterFullName; - this.resources = resources; - this.artifacts = artifacts; - } - - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public List<ResourceInstanceAssetStructure> getResources() { - return resources; - } - - public void setResources(List<ResourceInstanceAssetStructure> resources) { - this.resources = resources; - } - - public List<ArtifactAssetStructure> getArtifacts() { - return artifacts; - } - - public void setArtifacts(List<ArtifactAssetStructure> artifacts) { - this.artifacts = artifacts; - } - - @Override - public String toString() { - return "ServiceDetailedAssetStructure [lastUpdaterFullName=" + lastUpdaterFullName + ", resources=" + resources - + ", artifacts=" + artifacts + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceDistributionStatus.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceDistributionStatus.java deleted file mode 100644 index 783e0175d..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceDistributionStatus.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -public class ServiceDistributionStatus { - - private String distributionID; - private String timestamp; - private String userId; - private String deployementStatus; - - public ServiceDistributionStatus() { - super(); - // TODO Auto-generated constructor stub - } - - public ServiceDistributionStatus(String distributionID, String timestamp, String userId, String deployementStatus) { - super(); - this.distributionID = distributionID; - this.timestamp = timestamp; - this.userId = userId; - this.deployementStatus = deployementStatus; - } - - @Override - public String toString() { - return "ServiceDistributionStatus [distributionID=" + distributionID + ", timestamp=" + timestamp + ", userId=" + userId + ", deployementStatus=" + deployementStatus + "]"; - } - - public String getDistributionID() { - return distributionID; - } - - public void setDistributionID(String distributionID) { - this.distributionID = distributionID; - } - - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getDeployementStatus() { - return deployementStatus; - } - - public void setDeployementStatus(String deployementStatus) { - this.deployementStatus = deployementStatus; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceReqDetails.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceReqDetails.java deleted file mode 100644 index 6dc804987..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceReqDetails.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.ArrayList; - -import org.onap.sdc.ci.tests.devObjects.CategoryDefinition; - -public class ServiceReqDetails extends ComponentReqDetails { - - public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description, - String contactId, String icon) { - this.name = serviceName; - // this.category = category; - this.tags = tags; - this.description = description; - this.contactId = contactId; - this.icon = icon; - projectCode = "12345"; - CategoryDefinition categoryDefinition = new CategoryDefinition(); - categoryDefinition.setName(category); - categories = new ArrayList<>(); - categories.add(categoryDefinition); - - } - - public ServiceReqDetails() { - contactId = "aa1234"; - projectCode = "12345"; - } - - public ServiceReqDetails(ServiceReqDetails a, String newServiceName) { - a.setName(newServiceName); - } - - @Override - public String toString() { - return "ServiceDetails [name=" + name + ", category=" + getCategory() + ", tags=" + tags + ", description=" - + description + ", contactId=" + contactId + ", icon=" + icon + "]"; - } - - public ServiceReqDetails(ServiceReqDetails aService) { - this(aService.getName(), aService.getCategory(), (ArrayList<String>) aService.getTags(), - aService.getDescription(), aService.getContactId(), aService.getIcon()); - uniqueId = aService.getUniqueId(); - version = aService.getVersion(); - } - - public String getCategory() { - if (categories != null && categories.size() >= 1) { - return categories.get(0).getName(); - } - return null; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceRespJavaObject.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceRespJavaObject.java deleted file mode 100644 index c401c4ec0..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/ServiceRespJavaObject.java +++ /dev/null @@ -1,267 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -import java.util.ArrayList; - -public class ServiceRespJavaObject { - - String category; - String creatorUserId; - String creatorFullName; - String lastUpdaterUserId; - String lastUpdaterFullName; - String serviceName; - String version; - String creationDate; - String icon; - String name; - String description; - ArrayList<String> tags; - String uniqueId; - String lastUpdateDate; - String contactId; - String vendorName; - String vendorRelease; - String lifecycleState; - String highestVersion; - ArrayList<String> artifacts; - ArrayList<String> ResourceInstances; - ArrayList<String> ResourceInstancesRelations; - - public ServiceRespJavaObject() { - super(); - // TODO Auto-generated constructor stub - } - - public ServiceRespJavaObject(String category, String creatorUserId, String creatorFullName, - String lastUpdaterUserId, String lastUpdaterFullName, String serviceName, String version, - String creationDate, String icon, String name, String description, ArrayList<String> tags, String uniqueId, - String lastUpdateDate, String contactId, String vendorName, String vendorRelease, String lifecycleState, - String highestVersion, ArrayList<String> artifacts, ArrayList<String> resourceInstances, - ArrayList<String> resourceInstancesRelations) { - super(); - this.category = category; - this.creatorUserId = creatorUserId; - this.creatorFullName = creatorFullName; - this.lastUpdaterUserId = lastUpdaterUserId; - this.lastUpdaterFullName = lastUpdaterFullName; - this.serviceName = serviceName; - this.version = version; - this.creationDate = creationDate; - this.icon = icon; - this.name = name; - this.description = description; - this.tags = tags; - this.uniqueId = uniqueId; - this.lastUpdateDate = lastUpdateDate; - this.contactId = contactId; - this.vendorName = vendorName; - this.vendorRelease = vendorRelease; - this.lifecycleState = lifecycleState; - this.highestVersion = highestVersion; - this.artifacts = artifacts; - ResourceInstances = resourceInstances; - ResourceInstancesRelations = resourceInstancesRelations; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getCreatorUserId() { - return creatorUserId; - } - - public void setCreatorUserId(String creatorUserId) { - this.creatorUserId = creatorUserId; - } - - public String getCreatorFullName() { - return creatorFullName; - } - - public void setCreatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - } - - public String getLastUpdaterUserId() { - return lastUpdaterUserId; - } - - public void setLastUpdaterUserId(String lastUpdaterUserId) { - this.lastUpdaterUserId = lastUpdaterUserId; - } - - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getCreationDate() { - return creationDate; - } - - public void setCreationDate(String creationDate) { - this.creationDate = creationDate; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public ArrayList<String> getTags() { - return tags; - } - - public void setTags(ArrayList<String> tags) { - this.tags = tags; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public String getLastUpdateDate() { - return lastUpdateDate; - } - - public void setLastUpdateDate(String lastUpdateDate) { - this.lastUpdateDate = lastUpdateDate; - } - - public String getContactId() { - return contactId; - } - - public void setContactId(String contactId) { - this.contactId = contactId; - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; - } - - public String getVendorRelease() { - return vendorRelease; - } - - public void setVendorRelease(String vendorRelease) { - this.vendorRelease = vendorRelease; - } - - public String getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(String lifecycleState) { - this.lifecycleState = lifecycleState; - } - - public String getHighestVersion() { - return highestVersion; - } - - public void setHighestVersion(String highest) { - this.highestVersion = highest; - } - - public ArrayList<String> getArtifacts() { - return artifacts; - } - - public void setArtifacts(ArrayList<String> artifacts) { - this.artifacts = artifacts; - } - - public ArrayList<String> getResourceInstances() { - return ResourceInstances; - } - - public void setResourceInstances(ArrayList<String> resourceInstances) { - ResourceInstances = resourceInstances; - } - - public ArrayList<String> getResourceInstancesRelations() { - return ResourceInstancesRelations; - } - - public void setResourceInstancesRelations(ArrayList<String> resourceInstancesRelations) { - ResourceInstancesRelations = resourceInstancesRelations; - } - - @Override - public String toString() { - return "ServiceRespJavaObject [category=" + category + ", creatorUserId=" + creatorUserId + ", creatorFullName=" - + creatorFullName + ", lastUpdaterUserId=" + lastUpdaterUserId + ", lastUpdaterFullName=" - + lastUpdaterFullName + ", serviceName=" + serviceName + ", version=" + version + ", creationDate=" - + creationDate + ", icon=" + icon + ", name=" + name + ", description=" + description + ", tags=" + tags - + ", uniqueId=" + uniqueId + ", lastUpdateDate=" + lastUpdateDate + ", contactId=" + contactId - + ", vendorName=" + vendorName + ", vendorRelease=" + vendorRelease + ", lifecycleState=" - + lifecycleState + ", lifecycleState=" + lifecycleState + ", artifacts=" + artifacts - + ", ResourceInstances=" + ResourceInstances + ", ResourceInstancesRelations=" - + ResourceInstancesRelations + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java deleted file mode 100644 index f688d33b0..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes; - -public enum TopMenuButtonsEnum { - - HOME("main-menu-button-home"), CATALOG("main-menu-button-catalog"), ON_BOARDING("main-menu-button-onboard"); - - private String value; - private String value2; - - public String getButton() { - return value; - } - - private TopMenuButtonsEnum(String value) { - this.value = value; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HeaderData.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HeaderData.java deleted file mode 100644 index 4dfdbad8b..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HeaderData.java +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes.http; - -public class HeaderData { - String contentMd5; - String contentType; - String HttpCspUserId; - String HttpCspFirstName; - String HttpCspLastName; - String HttpCspWsType; - String HttpIvRemoteAddress; - String HttpIvUser; - - public HeaderData() { - super(); - } - - public HeaderData(String contentMd5, String contentType, String httpCspUserId, String httpCspFirstName, - String httpCspLastName, String httpCspWsType, String httpIvRemoteAddress, String httpIvUser) { - super(); - this.contentMd5 = contentMd5; - this.contentType = contentType; - HttpCspUserId = httpCspUserId; - HttpCspFirstName = httpCspFirstName; - HttpCspLastName = httpCspLastName; - HttpCspWsType = httpCspWsType; - HttpIvRemoteAddress = httpIvRemoteAddress; - HttpIvUser = httpIvUser; - } - - public String getContentMd5() { - return contentMd5; - } - - public void setContentMd5(String contentMd5) { - this.contentMd5 = contentMd5; - } - - public String getContentType() { - return contentType; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - public String getHttpCspUserId() { - return HttpCspUserId; - } - - public void setHttpCspUserId(String httpCspUserId) { - HttpCspUserId = httpCspUserId; - } - - public String getHttpCspFirstName() { - return HttpCspFirstName; - } - - public void setHttpCspFirstName(String httpCspFirstName) { - HttpCspFirstName = httpCspFirstName; - } - - public String getHttpCspLastName() { - return HttpCspLastName; - } - - public void setHttpCspLastName(String httpCspLastName) { - HttpCspLastName = httpCspLastName; - } - - public String getHttpCspWsType() { - return HttpCspWsType; - } - - public void setHttpCspWsType(String httpCspWsType) { - HttpCspWsType = httpCspWsType; - } - - public String getHttpIvRemoteAddress() { - return HttpIvRemoteAddress; - } - - public void setHttpIvRemoteAddress(String httpIvRemoteAddress) { - HttpIvRemoteAddress = httpIvRemoteAddress; - } - - public String getHttpIvUser() { - return HttpIvUser; - } - - public void setHttpIvUser(String httpIvUser) { - HttpIvUser = httpIvUser; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HeaderValue.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HeaderValue.java deleted file mode 100644 index e09a97251..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HeaderValue.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes.http; - -public enum HeaderValue { - - APPLICATION_JSON("application/json"); - - String value; - - private HeaderValue(String value) { - this.value = value; - } - - public String getValue() { - - return value; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HttpHeaderEnum.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HttpHeaderEnum.java deleted file mode 100644 index e57c5a449..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HttpHeaderEnum.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes.http; - -public enum HttpHeaderEnum { - - Content_MD5("Content-MD5"), - USER_ID("USER_ID"), - HTTP_CSP_FIRSTNAME("HTTP_CSP_FIRSTNAME"), - HTTP_CSP_LASTNAME("HTTP_CSP_LASTNAME"), - HTTP_CSP_WSTYPE("HTTP_CSP_WSTYPE"), - HTTP_IV_REMOTE_ADDRESS("HTTP_IV_REMOTE_ADDRESS"), - HTTP_IV_USER("HTTP_IV_USER"), - HTTP_CSP_EMAIL("HTTP_CSP_EMAIL"), - CONTENT_TYPE("Content-Type"), - ACCEPT("Accept"), - X_ECOMP_REQUEST_ID_HEADER("X-ECOMP-RequestID"), - CACHE_CONTROL("Cache-Control"), - X_ECOMP_INSTANCE_ID("X-ECOMP-InstanceID"), - AUTHORIZATION("Authorization"), - CONTENT_LENGTH("Content-Length"), - CONTENT_DISPOSITION("Content-Disposition"), - HOST("Host"), - X_ECOMP_SERVICE_ID_HEADER("X-ECOMP-ServiceID"), - WWW_AUTHENTICATE("WWW-Authenticate"), - ECOMP_PASSWORD("password"), - ECOMP_USERNAME("username"); - - String value; - - private HttpHeaderEnum(String value) { - this.value = value; - } - - public String getValue() { - - return value; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HttpRequest.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HttpRequest.java deleted file mode 100644 index bc62e6673..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/HttpRequest.java +++ /dev/null @@ -1,888 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes.http; - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.net.HttpURLConnection; -import java.net.URI; -import java.net.URL; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Scanner; - -import javax.net.ssl.HttpsURLConnection; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpEntity; -import org.apache.http.annotation.NotThreadSafe; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.entity.mime.content.StringBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gson.Gson; - -public class HttpRequest { - static Logger logger = LoggerFactory.getLogger(HttpRequest.class.getName()); - - public RestResponse httpSendGet(String url, Map<String, String> headers) throws IOException { - - RestResponse restResponse = new RestResponse(); - url = url.replaceAll("\\s", "%20"); - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - // optional default is GET - con.setRequestMethod("GET"); - // add request header - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - - } - - int responseCode = con.getResponseCode(); - logger.debug("Send GET http request, url: {}",url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - String result; - - try { - - result = IOUtils.toString(con.getInputStream()); - response.append(result); - - } catch (Exception e) { - } - - try { - - result = IOUtils.toString(con.getErrorStream()); - response.append(result); - - } catch (Exception e) { - } - - logger.debug("Response body: {}" ,response); - - // print result - - restResponse.setStatusCode(responseCode); - - if (response != null) { - restResponse.setResponse(response.toString()); - } - - restResponse.setStatusCode(responseCode); - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - - return restResponse; - } - - public RestResponse httpsSendGet(String url, Map<String, String> headers) throws IOException { - - RestResponse restResponse = new RestResponse(); - URL obj = new URL(url); - HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); - // optional default is GET - con.setRequestMethod("GET"); - // add request header - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - - } - - int responseCode = con.getResponseCode(); - logger.debug("Send GET http request, url: {}",url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } catch (Exception e) { - logger.debug("response body is null"); - } - - String result; - - try { - - result = IOUtils.toString(con.getErrorStream()); - response.append(result); - - } catch (Exception e2) { - // result = null; - } - logger.debug("Response body: {}",response); - - // print result - - restResponse.setStatusCode(responseCode); - - if (response != null) { - restResponse.setResponse(response.toString()); - } - - restResponse.setStatusCode(responseCode); - // restResponse.setResponse(result); - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - - return restResponse; - } - - public RestResponse httpSendByMethod(String url, String method, String body, Map<String, String> headers) - throws IOException { - - RestResponse restResponse = new RestResponse(); - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - - // add request method - con.setRequestMethod(method); - - // add request headers - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - - } - if (body != null && !body.isEmpty() && !method.equals("DELETE")) { - // Send post request - con.setDoOutput(true); - DataOutputStream wr = new DataOutputStream(con.getOutputStream()); - wr.writeBytes(body); - wr.flush(); - wr.close(); - } - - // con.connect(); - - int responseCode = con.getResponseCode(); - logger.debug("Send {} http request, url: {}",method,url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - - try { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } catch (Exception e) { - // response = null; - logger.debug("response body is null"); - } - - String result; - try { - - result = IOUtils.toString(con.getErrorStream()); - response.append(result); - - } catch (Exception e2) { - result = null; - } - logger.debug("Response body: {}",response); - - // print result - - restResponse.setStatusCode(responseCode); - // if (response == null) { - // restResponse.setResponse(null); - // } else { - // restResponse.setResponse(response.toString()); - // } - - if (response != null) { - restResponse.setResponse(response.toString()); - } - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - return restResponse; - - } - - public RestResponse sendHttpPost(String url, String body, Map<String, String> headers) throws IOException { - - RestResponse restResponse = new RestResponse(); - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - - // add request method - con.setRequestMethod("POST"); - - // add request headers - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - } - - // Send post request - if (body != null) { - con.setDoOutput(true); - DataOutputStream wr = new DataOutputStream(con.getOutputStream()); - wr.writeBytes(body); - wr.flush(); - wr.close(); - } - - // con.connect(); - - int responseCode = con.getResponseCode(); - logger.debug("Send POST http request, url: {}",url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } catch (Exception e) { - logger.debug("response body is null"); - } - - String result; - - try { - - result = IOUtils.toString(con.getErrorStream()); - response.append(result); - - } catch (Exception e2) { - result = null; - } - logger.debug("Response body: {}",response); - - // print result - - restResponse.setStatusCode(responseCode); - - if (response != null) { - restResponse.setResponse(response.toString()); - } - - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - return restResponse; - - } - - public RestResponse httpSendPost(String url, String body, Map<String, String> headers) throws IOException { - return httpSendPost(url, body, headers, "POST"); - } - - public RestResponse httpSendPut(String url, String body, Map<String, String> headers) throws IOException { - return httpSendPost(url, body, headers, "PUT"); - } - - public RestResponse httpSendPost(String url, String body, Map<String, String> headers, String methodType) - throws IOException { - - RestResponse restResponse = new RestResponse(); - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - - // add request method - con.setRequestMethod(methodType); - - // add request headers - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - } - - // Send post request - if (body != null) { - con.setDoOutput(true); - DataOutputStream wr = new DataOutputStream(con.getOutputStream()); - wr.writeBytes(body); - wr.flush(); - wr.close(); - } - - // con.connect(); - - int responseCode = con.getResponseCode(); - logger.debug("Send POST http request, url: {}",url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } catch (Exception e) { - logger.debug("response body is null"); - } - - String result; - - try { - - result = IOUtils.toString(con.getErrorStream()); - response.append(result); - - } catch (Exception e2) { - result = null; - } - logger.debug("Response body: {}",response); - - // print result - - restResponse.setStatusCode(responseCode); - - if (response != null) { - restResponse.setResponse(response.toString()); - } - - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - return restResponse; - - } - - public RestResponse httpSendDeleteWithBody2(String url, String body, Map<String, String> headers) - throws ClientProtocolException, IOException { - - CloseableHttpClient httpclient = HttpClients.createDefault(); - RestResponse restResponse = new RestResponse(); - HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(url); - - // add request headers - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - httpDelete.addHeader(key, value); - } - } - - // add body to request - StringEntity input = new StringEntity(body, ContentType.APPLICATION_JSON); - httpDelete.setEntity(input); - - // execute request - CloseableHttpResponse response = httpclient.execute(httpDelete); - - restResponse.setStatusCode(response.getStatusLine().getStatusCode()); - - return restResponse; - } - - public RestResponse httpSendDeleteWithBody(String url, String body, Map<String, String> headers) - throws IOException { - - RestResponse restResponse = new RestResponse(); - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - - // add request method - con.setRequestMethod("DELETE"); - - // add request headers - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - } - - // Send post request - con.setDoOutput(true); - DataOutputStream wr = new DataOutputStream(con.getOutputStream()); - wr.writeBytes(body); - wr.flush(); - wr.close(); - - // con.connect(); - - int responseCode = con.getResponseCode(); - logger.debug("Send DELETE http request, url: {}",url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } catch (Exception e) { - logger.debug("response body is null"); - } - - String result; - - try { - - result = IOUtils.toString(con.getErrorStream()); - response.append(result); - - } catch (Exception e2) { - result = null; - } - logger.debug("Response body: {}", response); - - // print result - - restResponse.setStatusCode(responseCode); - - if (response != null) { - restResponse.setResponse(response.toString()); - } - - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - return restResponse; - - } - - public RestResponse httpSendPostWithOutBody(String url, Map<String, String> headers) throws IOException { - - RestResponse restResponse = new RestResponse(); - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - - // add request method - con.setRequestMethod("POST"); - - // add request headers - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - } - - // con.connect(); - - int responseCode = con.getResponseCode(); - logger.debug("Send POST http request, url: {}",url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - - try { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } catch (Exception e) { - // response = null; - logger.debug("response body is null"); - } - - String result; - try { - - result = IOUtils.toString(con.getErrorStream()); - response.append(result); - - } catch (Exception e2) { - result = null; - } - logger.debug("Response body: {}",response); - - // print result - - restResponse.setStatusCode(responseCode); - // if (response == null) { - // restResponse.setResponse(null); - // } else { - // restResponse.setResponse(response.toString()); - // } - - if (response != null) { - restResponse.setResponse(response.toString()); - } - - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - return restResponse; - - } - - public RestResponse httpSendPostMultipart(String url, Map<String, String> headers, String jsonLocation, - String zipLocation) throws IOException { - - Gson gson = new Gson(); - String gsonToSend = null; - RestResponse restResponse = new RestResponse(); - BufferedReader br = null; - // - // - // - // - // try { - // - // String sCurrentLine; - // - // br = new BufferedReader(new FileReader(jsonLocation)); - // - // while ((sCurrentLine = br.readLine()) != null) { - // System.out.println(sCurrentLine); - // } - // - // } catch (IOException e) { - // e.printStackTrace(); - // } finally { - // try { - // if (br != null)br.close(); - // gsonToSend = br.toString(); - // } catch (IOException ex) { - // ex.printStackTrace(); - // } - // } - - gsonToSend = new Scanner(new File(jsonLocation)).useDelimiter("\\Z").next(); - logger.debug("gsonToSend: {}",gsonToSend); - - MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create(); - mpBuilder.addPart("resourceZip", new FileBody(new File(zipLocation))); - mpBuilder.addPart("resourceMetadata", new StringBody(gsonToSend, ContentType.APPLICATION_JSON)); - - HttpPost httpPost = new HttpPost(url); - httpPost.addHeader("USER_ID", "adminid"); - httpPost.setEntity(mpBuilder.build()); - - CloseableHttpClient client = HttpClients.createDefault(); - CloseableHttpResponse response = client.execute(httpPost); - try { - logger.debug("----------------------------------------"); - logger.debug("response.getStatusLine(): {}",response.getStatusLine()); - HttpEntity resEntity = response.getEntity(); - if (resEntity != null) { - logger.debug("Response content length: {}",resEntity.getContentLength()); - } - EntityUtils.consume(resEntity); - } finally { - - response.close(); - client.close(); - } - - restResponse.setStatusCode(response.getStatusLine().getStatusCode()); - restResponse.setResponse(response.getEntity().toString()); - - return restResponse; - - } - - public RestResponse httpSendPostWithAuth(String url, String body, Map<String, String> headers, String username, - String password) throws IOException { - - String userPassword = username + ":" + password; - String encoding = Base64.encodeBase64String(userPassword.getBytes()); - RestResponse restResponse = new RestResponse(); - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - - // add request method - con.setRequestMethod("POST"); - - con.setRequestProperty("Authorization", "Basic " + encoding); - - // add request headers - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - - } - - // Send post request - con.setDoOutput(true); - DataOutputStream wr = new DataOutputStream(con.getOutputStream()); - wr.writeBytes(body); - wr.flush(); - wr.close(); - - // con.connect(); - - int responseCode = con.getResponseCode(); - logger.debug("Send POST http request, url: {}",url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } catch (Exception e) { - response = null; - - } - logger.debug("Response body: {}",response); - - // print result - - restResponse.setStatusCode(responseCode); - if (response == null) { - restResponse.setResponse(null); - } else { - restResponse.setResponse(response.toString()); - } - - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - return restResponse; - - } - - public RestResponse httpSendDelete(String url, Map<String, String> headers) throws IOException { - - RestResponse restResponse = new RestResponse(); - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - - if (headers != null) { - for (Entry<String, String> header : headers.entrySet()) { - String key = header.getKey(); - String value = header.getValue(); - con.setRequestProperty(key, value); - } - - } - - con.setDoOutput(true); - con.setRequestMethod("DELETE"); - int responseCode = con.getResponseCode(); - logger.debug("Send DELETE http request, url: {}",url); - logger.debug("Response Code: {}",responseCode); - - StringBuffer response = new StringBuffer(); - - try { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } catch (Exception e) { - logger.debug("response body is null"); - } - - String result; - - try { - - result = IOUtils.toString(con.getErrorStream()); - response.append(result); - - } catch (Exception e2) { - result = null; - } - logger.debug("Response body: {}",response); - - // print result - - restResponse.setStatusCode(responseCode); - - if (response != null) { - restResponse.setResponse(response.toString()); - } - - restResponse.setStatusCode(con.getResponseCode()); - Map<String, List<String>> headerFields = con.getHeaderFields(); - restResponse.setHeaderFields(headerFields); - String responseMessage = con.getResponseMessage(); - restResponse.setResponseMessage(responseMessage); - - con.disconnect(); - - return restResponse; - } - - public static RestResponse sendHttpPostWithEntity(HttpEntity requestEntity, String url, Map<String, String> headers) - throws IOException, ClientProtocolException { - CloseableHttpResponse response = null; - CloseableHttpClient client = HttpClients.createDefault(); - try { - HttpPost httpPost = new HttpPost(url); - RestResponse restResponse = new RestResponse(); - for (Entry<String, String> entry : headers.entrySet()) { - httpPost.addHeader(entry.getKey(), entry.getValue()); - } - - httpPost.setEntity(requestEntity); - response = client.execute(httpPost); - HttpEntity responseEntity = response.getEntity(); - String responseBody = null; - if (responseEntity != null) { - InputStream instream = responseEntity.getContent(); - StringWriter writer = new StringWriter(); - IOUtils.copy(instream, writer); - responseBody = writer.toString(); - try { - - } finally { - instream.close(); - } - } - - restResponse.setStatusCode(response.getStatusLine().getStatusCode()); - restResponse.setResponse(responseBody); - - return restResponse; - - } finally { - closeResponse(response); - closeHttpClient(client); - - } - } - - private static void closeHttpClient(CloseableHttpClient client) { - try { - if (client != null) { - client.close(); - } - } catch (IOException e) { - logger.debug("failed to close client or response: ", e); - } - } - - private static void closeResponse(CloseableHttpResponse response) { - try { - if (response != null) { - response.close(); - } - } catch (IOException e) { - logger.debug("failed to close client or response: ", e); - } - } - - @NotThreadSafe - class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase { - public static final String METHOD_NAME = "DELETE"; - - public String getMethod() { - return METHOD_NAME; - } - - public HttpDeleteWithBody(final String uri) { - super(); - setURI(URI.create(uri)); - } - - public HttpDeleteWithBody(final URI uri) { - super(); - setURI(uri); - } - - public HttpDeleteWithBody() { - super(); - } - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/MustHeaders.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/MustHeaders.java deleted file mode 100644 index e9a87ed1d..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/MustHeaders.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes.http; - -import java.util.HashMap; -import java.util.Map; - -public class MustHeaders { - - private Map<String, String> headers = new HashMap<String, String>(); - - public MustHeaders(HeaderData headerData) { - - super(); - headers.put(HttpHeaderEnum.Content_MD5.getValue(), headerData.getContentMd5()); - headers.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), headerData.getContentType()); - headers.put(HttpHeaderEnum.ACCEPT.getValue(), headerData.getContentType()); - headers.put(HttpHeaderEnum.USER_ID.getValue(), headerData.getHttpCspUserId()); - headers.put(HttpHeaderEnum.HTTP_CSP_FIRSTNAME.getValue(), headerData.getHttpCspFirstName()); - headers.put(HttpHeaderEnum.HTTP_CSP_LASTNAME.getValue(), headerData.getHttpCspLastName()); - headers.put(HttpHeaderEnum.HTTP_CSP_WSTYPE.getValue(), headerData.getHttpCspWsType()); - headers.put(HttpHeaderEnum.HTTP_IV_REMOTE_ADDRESS.getValue(), headerData.getHttpIvRemoteAddress()); - headers.put(HttpHeaderEnum.HTTP_IV_USER.getValue(), headerData.getHttpIvUser()); - - } - - public MustHeaders() { - super(); - } - - public Map<String, String> getMap() { - return headers; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/RestResponse.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/RestResponse.java deleted file mode 100644 index 8974b74c1..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/datatypes/http/RestResponse.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.datatypes.http; - -import java.util.List; -import java.util.Map; - -public class RestResponse { - - Integer statusCode; - String response; - Map<String, List<String>> headerFields; - String responseMessage; - - public RestResponse() { - super(); - } - - public RestResponse(Integer errorCode, String response, Map<String, List<String>> headerFields, - String responseMessage) { - super(); - this.statusCode = errorCode; - this.response = response; - this.headerFields = headerFields; - this.responseMessage = responseMessage; - } - - public Integer getStatusCode() { - return statusCode; - } - - public void setStatusCode(Integer errorCode) { - this.statusCode = errorCode; - } - - public String getResponse() { - return response; - } - - public void setResponse(String response) { - this.response = response; - } - - public Map<String, List<String>> getHeaderFields() { - return headerFields; - } - - public void setHeaderFields(Map<String, List<String>> headerFields) { - this.headerFields = headerFields; - } - - public String getResponseMessage() { - return responseMessage; - } - - public void setResponseMessage(String responseMessage) { - this.responseMessage = responseMessage; - } - - @Override - public String toString() { - return "RestResponse [errorCode=" + statusCode + ", response=" + response + ", headerFields=" + headerFields - + ", responseMessage=" + responseMessage + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDataDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDataDefinition.java deleted file mode 100644 index 0c673e62d..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDataDefinition.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.onap.sdc.ci.tests.devObjects; - - -import java.io.Serializable; -import java.util.List; - -public class CategoryDataDefinition extends ToscaDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 2882352060242714427L; - - private String name; - private String normalizedName; - private String uniqueId; - private List<String> icons; - - public CategoryDataDefinition() { - - } - - public CategoryDataDefinition(CategoryDataDefinition c) { - this.name = c.name; - this.normalizedName = c.normalizedName; - this.uniqueId = c.uniqueId; - this.icons = c.icons; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public List<String> getIcons() { - return icons; - } - - public void setIcons(List<String> icons) { - this.icons = icons; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((icons == null) ? 0 : icons.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CategoryDataDefinition other = (CategoryDataDefinition) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (normalizedName == null) { - if (other.normalizedName != null) - return false; - } else if (!normalizedName.equals(other.normalizedName)) - return false; - if (uniqueId == null) { - if (other.uniqueId != null) - return false; - } else if (!uniqueId.equals(other.uniqueId)) - return false; - if (icons == null) { - if (other.icons != null) - return false; - } else if (!icons.equals(other.icons)) - return false; - return true; - } - - @Override - public String toString() { - return "CategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId - + ", icons=" + icons + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDefinition.java deleted file mode 100644 index ef65a2de2..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/CategoryDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.devObjects; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -public class CategoryDefinition extends CategoryDataDefinition implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 6552733796860992476L; - - List<SubCategoryDefinition> subcategories; - - public CategoryDefinition() { - super(); - } - - public CategoryDefinition(CategoryDataDefinition c) { - super(c); - } - - public List<SubCategoryDefinition> getSubcategories() { - return subcategories; - } - - public void setSubcategories(List<SubCategoryDefinition> subcategories) { - this.subcategories = subcategories; - } - - public void addSubCategory(SubCategoryDefinition subcategory) { - if (subcategories == null) { - subcategories = new ArrayList<SubCategoryDefinition>(); - } - subcategories.add(subcategory); - } - - @Override - public String toString() { - return super.toString() + " CategoryDefinition [subcategories=" + subcategories + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GraphPropertyEnum.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GraphPropertyEnum.java deleted file mode 100644 index b393b9160..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GraphPropertyEnum.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.onap.sdc.ci.tests.devObjects; - -import java.util.ArrayList; -import java.util.List; - - - -public enum GraphPropertyEnum { -// field name class type unique indexed -// stored in graph index - UNIQUE_ID ("uid", String.class, true, true), - LABEL ("nodeLabel", String.class, false, true), - JSON ("json", String.class, false, false), - METADATA ("metadata", String.class, false, false), - VERSION ("version", String.class, false, true), - STATE ("state", String.class, false, true), - IS_HIGHEST_VERSION ("highestVersion", Boolean.class, false, true), - IS_DELETED ("deleted", Boolean.class, false, true), - NORMALIZED_NAME ("normalizedName", String.class, false, true), - NAME ("name", String.class, false, true), - TOSCA_RESOURCE_NAME ("toscaResourceName", String.class, false, true), - DISTRIBUTION_STATUS ("distributionStatus", String.class, false, false), - RESOURCE_TYPE ("resourceType", String.class, false, true), - COMPONENT_TYPE ("componentType", String.class, false, true), - UUID ("uuid", String.class, false, true), - SYSTEM_NAME ("systemName", String.class, false, true), - IS_ABSTRACT ("abstract", Boolean.class, false, true), - INVARIANT_UUID ("invariantUuid", String.class, false, true), - CSAR_UUID ("csarUuid", String.class, false, true), - //used for user (old format, no json for users) - USERID ("userId", String.class, true, true), - ROLE ("role", String.class, false, false), - FIRST_NAME ("firstName", String.class, false, false), - LAST_NAME ("lastName", String.class, false, false), - EMAIL ("email", String.class, false, false), - LAST_LOGIN_TIME ("lastLoginTime", Long.class, false, false), - //used for category (old format, no json for categories) - ICONS ("icons", String.class, false, false); - - private String property; - private Class clazz; - private boolean unique; - private boolean indexed; - - GraphPropertyEnum(String property, Class clazz, boolean unique, boolean indexed) { - this.property = property; - this.clazz = clazz; - this.unique = unique; - this.indexed = indexed; - } - - public static GraphPropertyEnum getByProperty(String property){ - for(GraphPropertyEnum currProperty :GraphPropertyEnum.values()){ - if(currProperty.getProperty().equals(property)){ - return currProperty; - } - } - return null; - } - - public String getProperty() { - return property; - } - - public void setProperty(String property) { - this.property = property; - } - - public Class getClazz() { - return clazz; - } - - public void setClazz(Class clazz) { - this.clazz = clazz; - } - - public boolean isUnique() { - return unique; - } - - public void setUnique(boolean unique) { - this.unique = unique; - } - - public boolean isIndexed() { - return indexed; - } - - public void setIndexed(boolean indexed) { - this.indexed = indexed; - } - - public static List<String> getAllProperties() { - - List<String> arrayList = new ArrayList<String>(); - - for (GraphPropertyEnum graphProperty : GraphPropertyEnum.values()) { - arrayList.add(graphProperty.getProperty()); - } - - return arrayList; - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDataDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDataDefinition.java deleted file mode 100644 index cdb45c5c6..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDataDefinition.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.devObjects; - -import java.io.Serializable; - -public class GroupingDataDefinition extends ToscaDataDefinition implements Serializable { - /** - * - */ - private static final long serialVersionUID = 2641475929148843849L; - - private String name; - private String normalizedName; - private String uniqueId; - - public GroupingDataDefinition() { - - } - - public GroupingDataDefinition(GroupingDataDefinition c) { - this.name = c.name; - this.normalizedName = c.normalizedName; - this.uniqueId = c.uniqueId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - GroupingDataDefinition other = (GroupingDataDefinition) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (normalizedName == null) { - if (other.normalizedName != null) - return false; - } else if (!normalizedName.equals(other.normalizedName)) - return false; - if (uniqueId == null) { - if (other.uniqueId != null) - return false; - } else if (!uniqueId.equals(other.uniqueId)) - return false; - return true; - } - - @Override - public String toString() { - return "GroupingDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId - + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDefinition.java deleted file mode 100644 index 7b04d2307..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/GroupingDefinition.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.devObjects; - -public class GroupingDefinition extends GroupingDataDefinition { - - public GroupingDefinition() { - super(); - } - - public GroupingDefinition(GroupingDataDefinition g) { - super(g); - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/JsonPresentationFields.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/JsonPresentationFields.java deleted file mode 100644 index d17755207..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/JsonPresentationFields.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.onap.sdc.ci.tests.devObjects; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - - -//@JsonDeserialize(using = MyDeserializer.class) - -public enum JsonPresentationFields { - UNIQUE_ID ("uniqueId", GraphPropertyEnum.UNIQUE_ID), - HIGHEST_VERSION ("highestVersion", GraphPropertyEnum.IS_HIGHEST_VERSION), - LIFECYCLE_STATE ("lifecycleState", GraphPropertyEnum.STATE), - CREATION_DATE ("creationDate", null), - LAST_UPDATE_DATE ("lastUpdateDate", null), - SYSTEM_NAME ("systemName", GraphPropertyEnum.SYSTEM_NAME), - NAME ("name", GraphPropertyEnum.NAME), - VERSION ("version", GraphPropertyEnum.VERSION), - NORMALIZED_NAME ("normalizedName", GraphPropertyEnum.NORMALIZED_NAME), - UUID ("UUID", GraphPropertyEnum.UUID), - RESOURCE_TYPE ("resourceType", GraphPropertyEnum.RESOURCE_TYPE), - COMPONENT_TYPE ("componentType", GraphPropertyEnum.COMPONENT_TYPE), - IS_DELETED ("isDeleted", GraphPropertyEnum.IS_DELETED), - ECOMP_GENERATED_NAMING ("ecompGeneratedNaming", null), - NAMING_POLICY ("namingPolicy", null), - TOSCA_RESOURCE_NAME ("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME), - DESCRIPTION ("description", null), - TYPE ("type", null), - DERIVED_FROM ("derivedFrom", null), - VENDOR_NAME ("vendorName", null), - VENDOR_RELEASE ("vendorRelease", null), - CONFORMANCE_LEVEL ("conformanceLevel", null), - ICON ("icon", null), - TAGS ("tags", null), - INVARIANT_UUID ("invariantUuid", GraphPropertyEnum.INVARIANT_UUID), - CSAR_UUID ("csarUuid", GraphPropertyEnum.CSAR_UUID), - CSAR_VERSION ("csarVersion", null), - IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", null), - CONTACT_ID ("contactId", null), - PROJECT_CODE ("projectCode", null), - DISTRIBUTION_STATUS ("distributionStatus", GraphPropertyEnum.DISTRIBUTION_STATUS), - DERIVED_FROM_GENERIC_TYPE ("derivedFromGenericType", null), - DERIVED_FROM_GENERIC_VERSION ("derivedFromGenericVersion", null), - - ////Artifact - ARTIFACT_TYPE ("artifactType", null), - ARTIFACT_REF ("artifactRef", null), - ARTIFACT_REPOSITORY ("artifactRepository", null), - ARTIFACT_CHECKSUM ("artifactChecksum", null), - ARTIFACT_CREATOR ("artifactCreator", null), - USER_ID_CREATOR ("userIdCreator", null), - USER_ID_LAST_UPDATER ("userIdLastUpdater", null), - CREATOR_FULL_NAME ("creatorFullName", null), - UPDATER_FULL_NAME ("updaterFullName", null), - - ES_ID ("esId", null), - ARTIFACT_LABEL ("artifactLabel", null), - IS_ABSTRACT ("mandatory", null), - ARTIFACT_DISPLAY_NAME ("artifactDisplayName", null), - API_URL ("apiUrl", null), - SERVICE_API ("serviceApi", null), - ARTIFACT_VERSION ("artifactVersion", null), - ARTIFACT_UUID ("artifactUUID", null), - PAYLOAD_UPDATE_DATE ("payloadUpdateDate", null), - HEAT_PARAMS_UPDATE_DATE ("heatParamsUpdateDate", null), - GENERATED ("generated", null), - ARTIFACT_GROUP_TYPE ("artifactGroupType", null), - ARTIFACT_TIMEOUT ("timeout", null), - REQUIRED_ARTIFACTS ("requiredArtifacts", null), - DUPLICATED ("duplicated", null), - HEAT_PARAMETERS ("heatParameters", null), - GENERATED_FROM_ID ("generatedFromId", null), - - - // end artifacts - - - //property - DEFINITION ("definition", null), - DEFAULT_VALUE ("defaultValue", null), - REQUIRED ("required", null), - PASSWORD ("password", null), - CONSTRAINTS ("constraints", null), - PROPERTIES ("properties", null), - PROPERTY ("property", null), - SCHEMA ("schema", null), - VALUE ("value", null), - PARENT_UNIQUE_ID ("parentUniqueId", null), - - COMPONENT_INSTANCES ("componentInstances", null), - RELATIONS ("relations", null), - - //attribute - STATUS ("status", null), - //capability - VALID_SOURCE_TYPE ("validSourceTypes", null), - CREATION_TIME ("creationTime", null), - MODIFICATION_TIME ("modificationTime", null), - CAPABILITY_SOURCES ("capabilitySources", null), - MAX_OCCURRENCES ("maxOccurrences", null), - MIN_OCCURRENCES ("minOccurrences", null), - OWNER_NAME ("ownerName", null), - OWNER_ID ("ownerId", null), - LEFT_OCCURRENCES ("leftOccurences", null), - CAPABILITY_ID ("capabiltyId", null), - PATH ("path", null), - SOURCE ("source", null), - - //Requirement - CAPAPILITY ("capability", null), - NODE ("node", null), - RELATIONSHIP ("relationship", null), - VALID_SOURCE_TYPES ("validSourceTypes", null), - REQUIREMENT_ID ("requirementId", null), - - //Relation - CAPABILTY_OWNER_ID ("capabilityOwnerId", null), - REQUIREMENT_OWNER_ID ("requirementOwnerId", null), - FROM_ID ("fromId", null), - TO_ID ("toId", null), - REQUIREMENT ("requirement", null), - - //Groups - - GROUP_INVARIANT_UUID ("invariantUUID", null), - GROUP_UUID ("groupUUID", null), - GROUP_MEMBER ("members", null), - GROUP_ARTIFACTS ("artifacts", null), - GROUP_ARTIFACTS_UUID ("artifactsUuid", null), - GROUP_PROPERTIES ("properties", null), - GROUP_UNIQUE_ID ("groupUid", null), - POS_X ("posX", null), - POS_Y ("posY", null), - PROPERTY_VALUE_COUNTER ("propertyValueCounter", null), - CUSTOMIZATION_UUID ("customizationUUID", null), - GROUP_NAME ("groupName", null), - GROUP_INSTANCE_ARTIFACTS ("groupInstanceArtifacts", null), - GROUP_INSTANCE_ARTIFACTS_UUID ("groupInstanceArtifactsUuid", null), - GROUP_INSTANCE_PROPERTIES ("groupInstancesProperties", null), - - ; - - - private String presentation; - private GraphPropertyEnum storedAs; - - JsonPresentationFields(String presentation, GraphPropertyEnum storedAs) { - this.presentation = presentation; - this.storedAs = storedAs; - } - - @JsonValue - public String getPresentation() { - return presentation; - } - - public void setPresentation(String presentation) { - this.presentation = presentation; - } - - public GraphPropertyEnum getStoredAs() { - return storedAs; - } - - public void setStoredAs(GraphPropertyEnum storedAs) { - this.storedAs = storedAs; - } - - public static String getPresentationByGraphProperty(GraphPropertyEnum property) { - for(JsonPresentationFields currPresentation : JsonPresentationFields.values()){ - if(currPresentation.getStoredAs() == property){ - return currPresentation.getPresentation(); - } - } - return null; - } - - @Override - public String toString() { - // TODO Auto-generated method stub - return presentation; - } - - @JsonCreator - public static JsonPresentationFields getByPresentation(String presentation) { - for (JsonPresentationFields inst : JsonPresentationFields.values()) { - if (inst.getPresentation().equals(presentation)) { - return inst; - } - } - return null; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/LifecycleStateEnum.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/LifecycleStateEnum.java deleted file mode 100644 index e17222cf2..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/LifecycleStateEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.devObjects; - -public enum LifecycleStateEnum { - - READY_FOR_CERTIFICATION, - - CERTIFICATION_IN_PROGRESS, - - CERTIFIED, - - NOT_CERTIFIED_CHECKIN, - - NOT_CERTIFIED_CHECKOUT; - - public static LifecycleStateEnum findState(String state) { - - for (LifecycleStateEnum lifecycleStateEnum : LifecycleStateEnum.values()) { - if (lifecycleStateEnum.name().equals(state)) { - return lifecycleStateEnum; - } - } - return null; - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ResourceTypeEnum.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ResourceTypeEnum.java deleted file mode 100644 index 549968205..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ResourceTypeEnum.java +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.devObjects; - -/** - * Resource Type Enum - * @author mshitrit - * - */ -public enum ResourceTypeEnum { - - VFC("VFC (Virtual Function Component)"), VF("VF"/* (Virtual Function)" */), CP("CP (Connection Point)"), - VL( "VL (Virtual Link)"), VFCMT("VFCMT (VFC Monitoring Template)"), ABSTRACT("Abstract (Generic VFC/VF/Service Type)"); - - private String value; - - private ResourceTypeEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - public static ResourceTypeEnum getType(String type) { - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().equals(type)) { - return e; - } - } - return null; - } - - public static ResourceTypeEnum getTypeByName(String type) { - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().equalsIgnoreCase(type)) { - return e; - } - } - return null; - } -/** - * Returns ResourceTypeEnum matching to received String ignore case - * @param type - * @return - */ - public static ResourceTypeEnum getTypeIgnoreCase(String type) { - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().toLowerCase().equals(type.toLowerCase())) { - return e; - } - } - return null; - } - /** - * Checks if enum exist with given type - * @param type - * @return - */ - public static boolean containsName(String type) { - - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().equals(type)) { - return true; - } - } - return false; - } - /** - * Checks if enum exist with given type ignare case - * @param type - * @return - */ - public static boolean containsIgnoreCase(String type) { - - for (ResourceTypeEnum e : ResourceTypeEnum.values()) { - if (e.name().toLowerCase().equals(type.toLowerCase())) { - return true; - } - } - return false; - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDataDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDataDefinition.java deleted file mode 100644 index 0eb76014e..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDataDefinition.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.devObjects; - -import java.io.Serializable; -import java.util.List; - -public class SubCategoryDataDefinition extends ToscaDataDefinition implements Serializable { - /** - * - */ - private static final long serialVersionUID = 8279397988497086676L; - - private String name; - private String normalizedName; - private String uniqueId; - private List<String> icons; - - public SubCategoryDataDefinition() { - - } - - public SubCategoryDataDefinition(SubCategoryDataDefinition c) { - this.name = c.name; - this.normalizedName = c.normalizedName; - this.uniqueId = c.uniqueId; - this.icons = c.icons; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public List<String> getIcons() { - return icons; - } - - public void setIcons(List<String> icons) { - this.icons = icons; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((icons == null) ? 0 : icons.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SubCategoryDataDefinition other = (SubCategoryDataDefinition) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (normalizedName == null) { - if (other.normalizedName != null) - return false; - } else if (!normalizedName.equals(other.normalizedName)) - return false; - if (uniqueId == null) { - if (other.uniqueId != null) - return false; - } else if (!uniqueId.equals(other.uniqueId)) - return false; - if (icons == null) { - if (other.icons != null) - return false; - } else if (!icons.equals(other.icons)) - return false; - return true; - } - - @Override - public String toString() { - return "SubCategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" - + uniqueId + ", icons=" + icons + "]"; - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDefinition.java deleted file mode 100644 index b45ce4fa1..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/SubCategoryDefinition.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.devObjects; - -import java.util.ArrayList; -import java.util.List; - -public class SubCategoryDefinition extends SubCategoryDataDefinition { - - private List<GroupingDefinition> groupings; - - public SubCategoryDefinition() { - super(); - } - - public SubCategoryDefinition(SubCategoryDataDefinition subCategory) { - super(subCategory); - } - - public List<GroupingDefinition> getGroupings() { - return groupings; - } - - public void setGroupings(List<GroupingDefinition> groupingDefinitions) { - this.groupings = groupingDefinitions; - } - - public void addGrouping(GroupingDefinition groupingDefinition) { - if (groupings == null) { - groupings = new ArrayList<GroupingDefinition>(); - } - groupings.add(groupingDefinition); - } - - @Override - public String toString() { - return super.toString() + " SubCategoryDefinition [groupings=" + groupings + "]"; - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ToscaDataDefinition.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ToscaDataDefinition.java deleted file mode 100644 index c4fa53b5d..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/devObjects/ToscaDataDefinition.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.onap.sdc.ci.tests.devObjects; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import fj.data.Either; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; - -public abstract class ToscaDataDefinition { - - protected Map<String, Object> toscaPresentation; - - - public ToscaDataDefinition(){ - toscaPresentation = new HashMap<String, Object>(); - } - @JsonCreator - public ToscaDataDefinition(Map<String, Object> art){ - toscaPresentation = art; - } - @JsonValue - public Object getToscaPresentationValue(JsonPresentationFields name) { - if (toscaPresentation != null && toscaPresentation.containsKey(name.getPresentation())) { - return toscaPresentation.get(name.getPresentation()); - } - return null; - } - - public void setToscaPresentationValue(JsonPresentationFields name, Object value) { - if (toscaPresentation == null && value !=null) { - toscaPresentation = new HashMap<String, Object>(); - } - toscaPresentation.put(name.getPresentation(), value); - - } - public void setOwnerIdIfEmpty(String ownerId){ - if ( getOwnerId() == null ){ - setOwnerId(ownerId); - } - } - public void setOwnerId(String ownerId){ - setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); - } - - public String getOwnerId(){ - return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); - } - - - //default merge function for merging data maps - implement where needed and use mergeDataMaps method where applicable instead of map1.putAll(map2) - public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride){ - other.setOwnerId(getOwnerId()); - return other; - } - - public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2){ - return mergeDataMaps(map1, map2, false); - } - - //return Either.right(item key) if an illegal merge was attempted (overriding data type is forbidden) - public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2, boolean allowDefaultValueOverride){ - for(Entry<String, T> entry : map2.entrySet()){ - map1.merge(entry.getKey(), entry.getValue(), (item1, item2) -> item1.mergeFunction(item2, allowDefaultValueOverride)); - //validate merge success - if(!map1.containsKey(entry.getKey())) - return Either.right(entry.getKey()); - } - return Either.left(map1); - } - - public static <T extends ToscaDataDefinition> Map<String, T> listToMapByName(List<T> dataList) { - return null == dataList? new HashMap<>() : dataList.stream() - .collect(Collectors.toMap(p -> (String)p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p)); - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/CanvasElement.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/CanvasElement.java deleted file mode 100644 index 2ff28dabd..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/CanvasElement.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.utilities; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openqa.selenium.WebElement; - -public final class CanvasElement { - private final String uniqueId; - private ImmutablePair<Integer, Integer> location; - private WebElement elementType; - - CanvasElement(String name, ImmutablePair<Integer, Integer> location, WebElement canvasItem) { - super(); - this.uniqueId = name; - this.location = location; - elementType = canvasItem; - } - - public String getUniqueId() { - return uniqueId; - } - - public ImmutablePair<Integer, Integer> getLocation() { - return location; - } - - public void setLocation(ImmutablePair<Integer, Integer> location) { - this.location = location; - } - - public WebElement getElementType() { - return elementType; - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/CanvasManager.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/CanvasManager.java deleted file mode 100644 index 91011f333..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/CanvasManager.java +++ /dev/null @@ -1,179 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.utilities; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; - -public final class CanvasManager { - private Map<String, CanvasElement> canvasElements; - private Actions actions; - private WebElement canvas; - private int reduceCanvasWidthFactor; - // Offsets Are used to find upper right corner of canvas element in order to - // connect links - private static final int CANVAS_ELEMENT_Y_OFFSET = 40; - private static final int CANVAS_ELEMENT_X_OFFSET = 21; // 14 - 27 - - private CanvasManager() { - canvasElements = new HashMap<>(); - actions = new Actions(GeneralUIUtils.getDriver()); - canvas = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); - try { - WebElement webElement = GeneralUIUtils - .getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); - reduceCanvasWidthFactor = webElement.getSize().width; - } catch (Exception e) { - reduceCanvasWidthFactor = 0; - } - } - - public static CanvasManager getCanvasManager() { - return new CanvasManager(); - } - - public List<CanvasElement> getCanvasElements() { - return canvasElements.values().stream().collect(Collectors.toList()); - } - - private void addCanvasElement(CanvasElement element) { - canvasElements.put(element.getUniqueId(), element); - } - - private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation) - throws Exception { - GeneralUIUtils.waitForLoader(); - Thread.sleep(500); - actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); - actions.clickAndHold(); - actions.moveToElement(canvas, newLocation.left, newLocation.right); - actions.release(); - actions.perform(); - canvasElement.setLocation(newLocation); - GeneralUIUtils.waitForLoader(); - - } - - public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception { - moveElementOnCanvas(canvasElement, getFreePosition()); - } - - public void deleteElementFromCanvas(CanvasElement canvasElement) throws Exception { - GeneralUIUtils.waitForLoader(); - actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); - actions.click(); - actions.perform(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue()) - .click(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click(); - canvasElements.remove(canvasElement.getUniqueId()); - GeneralUIUtils.waitForLoader(); - } - - private String getItemName(WebElement canvasItem) { - String canvasItemName = canvasItem.getAttribute("data-tests-id"); - - return canvasItemName.substring(canvasItemName.lastIndexOf("-")); - } - - public CanvasElement createElementOnCanvas(WebElement canvasItem) throws Exception { - GeneralUIUtils.waitForLoader(); - ImmutablePair<Integer, Integer> freePosition = getFreePosition(); - actions.moveToElement(canvasItem, 0, 0); - actions.clickAndHold(); - actions.moveToElement(canvas, freePosition.left, freePosition.right); - actions.release(); - actions.perform(); - - String uniqueId = getItemName(canvasItem) + "_" + UUID.randomUUID().toString(); - CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, canvasItem); - addCanvasElement(canvasElement); - GeneralUIUtils.waitForLoader(); - return canvasElement; - } - - private ImmutablePair<Integer, Integer> getFreePosition() { - // TODO mshitrit use better method - ImmutablePair<Integer, Integer> randomPosition = null; - boolean freePosition = false; - int minSpace = 150; - while (!freePosition) { - ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition(); - freePosition = !canvasElements.values().stream().map(e -> e.getLocation()) - .filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace - && Math.abs(e.right - tempRandomPosition.right) < minSpace) - .findAny().isPresent(); - randomPosition = tempRandomPosition; - } - return randomPosition; - } - - private ImmutablePair<Integer, Integer> getRandomPosition() { - int edgeBuffer = 50; - Random random = new Random(); - int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer; - int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer; - return new ImmutablePair<Integer, Integer>(xElement, yElement); - } - - public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception { - GeneralUIUtils.waitForLoader(); - drawSimpleLink(firstElement, secondElement); - - selectReqAndCapAndConnect(); - - GeneralUIUtils.waitForLoader(); - - } - - private void selectReqAndCapAndConnect() { - // Select First Cap - GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click(); - // Select First Req - GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click(); - // Connect - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); - } - - private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) { - - int yOffset = CANVAS_ELEMENT_Y_OFFSET; - int xOffset = CANVAS_ELEMENT_X_OFFSET; - - actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, - firstElement.getLocation().right - yOffset); - - actions.clickAndHold(); - actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, - secondElement.getLocation().right - yOffset); - actions.release(); - actions.perform(); - } -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/Decoder.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/Decoder.java deleted file mode 100644 index 049302e54..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/Decoder.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.utilities; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.IOException; - -import org.apache.commons.codec.binary.Base64; - -public class Decoder { - - public static String encode(byte[] byteArrayToEncode) { - - byte[] bytesEncoded = Base64.encodeBase64(byteArrayToEncode); - String strEncoded = new String(bytesEncoded); - return strEncoded; - } - - public static String decode(String strEncoded) throws IOException { - - byte[] byteDecoded = Base64.decodeBase64(strEncoded); - String decoded = new String(byteDecoded); - - return decoded; - - } - - public static String readFileToString(String file) throws IOException { - - BufferedReader reader = new BufferedReader(new FileReader(file)); - String line = null; - StringBuilder stringBuilder = new StringBuilder(); - String ls = System.getProperty("line.separator"); - - while ((line = reader.readLine()) != null) { - stringBuilder.append(line); - stringBuilder.append(ls); - } - reader.close(); - return stringBuilder.toString(); - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java deleted file mode 100644 index 97938c741..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.onap.sdc.ci.tests.utilities; - -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; - -public class EcompPortalUtilities { - - public static void swichFrames(By by){ - WebElement appImage = GeneralUIUtils.getClickableButtonBy(by, 3 * 60); - appImage.click(); - GeneralUIUtils.getDriver().switchTo().frame(1); - GeneralUIUtils.waitForAngular(); - GeneralUIUtils.getWebElementByClassName("applicationWindow"); - } - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/FileHandling.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/FileHandling.java index 029555a91..71e9b1c86 100644 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/FileHandling.java +++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/FileHandling.java @@ -22,6 +22,7 @@ package org.onap.sdc.ci.tests.utilities; import static org.testng.AssertJUnit.assertTrue; +import com.aventstack.extentreports.Status; import java.io.BufferedOutputStream; import java.io.BufferedWriter; import java.io.File; @@ -43,14 +44,11 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; - import org.apache.commons.io.FileUtils; import org.onap.sdc.ci.tests.execute.setup.ExtentTestActions; import org.onap.sdc.ci.tests.execute.setup.SetupCDTest; import org.yaml.snakeyaml.Yaml; -import com.aventstack.extentreports.Status; - public class FileHandling { // ------------------yaml parser methods---------------------------- @@ -312,12 +310,6 @@ public class FileHandling { return flag; } - public static String getMD5OfFile(File file) throws IOException { - String content = FileUtils.readFileToString(file); - String md5 = GeneralUtility.calculateMD5ByString(content); - return md5; - } - public static File createEmptyFile(String fileToCreate) { File file= new File(fileToCreate); try { diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/FindUtils.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/FindUtils.java deleted file mode 100644 index 2b0ca66da..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/FindUtils.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.utilities; - -import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.onap.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openqa.selenium.WebElement; -import org.testng.Assert; - -import com.aventstack.extentreports.Status; - -public final class FindUtils { - - - public static void findComponentAndClick(String componentName) throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "finding component " + componentName); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()).sendKeys(componentName); - WebElement foundComp = null; - try { - foundComp = GeneralUIUtils.getWebElementByTestID(componentName); - foundComp.click(); - GeneralUIUtils.waitForLoader(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); - } catch (Exception e) { - String msg = String.format("DID NOT FIND A COMPONENT NAMED %s", componentName); - SetupCDTest.getExtendTest().log(Status.FAIL, msg); - System.out.println(msg); - Assert.fail(msg); - } - } - - - -} diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUtility.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUtility.java deleted file mode 100644 index f2e834e03..000000000 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUtility.java +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.ci.tests.utilities; - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.regex.Pattern; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.FileUtils; - -public class GeneralUtility { - - public static boolean generateTextFile(String fileName, String fileData) { - boolean isSuccessfull = true; - try { - FileUtils.writeStringToFile(new File(fileName), fileData); - } catch (IOException e) { - isSuccessfull = false; - } - return isSuccessfull; - } - - /** - * Use with care, usage is not advised!!! - * The method only checks if String does not contain special characters + length divided by 4 with no remainder. - * The methods contained in other common libraries do the same. - */ - public static boolean isBase64Encoded(byte[] data) { - return Base64.isBase64(data); - } - - /** - *Use with care, usage is not advised!!! - * The method only checks if String does not contain special characters + length divided by 4 with no remainder. - * The methods contained in other common libraries do the same. - */ - public static boolean isBase64Encoded(String str) { - boolean isEncoded = false; - try { - // checks if the string was properly padded to the - isEncoded = ((str.length() % 4 == 0) && (Pattern.matches("\\A[a-zA-Z0-9/+]+={0,2}\\z", str))); - if (isEncoded) { - // If no exception is caught, then it is possibly a base64 - // encoded string - byte[] data = Base64.decodeBase64(str); - } - - } catch (Exception e) { - // If exception is caught, then it is not a base64 encoded string - isEncoded = false; - } - return isEncoded; - } - - /** - * Checks whether the passed string exceeds a limit of number of characters. - * - * @param str - * @param limit - * @return the result of comparison, or false if str is null. - */ - public static boolean isExceedingLimit(String str, int limit) { - if (str == null) { - return false; - } - return str.length() > limit; - } - - /** - * Checks the passed string list whether the cumulative length of strings and delimiters between them exceeds a limit of number of characters. For example for list ("one","two","three") with delimiter "," the length of list is calculated - * 3+1+3+1+5=13 - * - * @param strList - * @param limit - * @param delimiterLength - * - 0 if there is no delimeter. - * @return the result of comparison, or false if strList is null. - */ - public static boolean isExceedingLimit(List<String> strList, int limit, int delimiterLength) { - if (strList == null || strList.isEmpty()) { - return false; - } - int sum = 0; - int size = strList.size(); - for (int i = 0; i < size - 1; i++) { - String str = strList.get(i); - if (str != null) { - sum += str.length(); - } - sum += delimiterLength; - } - String str = strList.get(size - 1); - if (str != null) { - sum += str.length(); - } - return sum > limit; - } - - /** - * Return the extension as the substring from the last dot. For input "kuku.txt", "txt" will be returned. If no dot is found or input is null, empty string is returned. - * - * @param fileName - * @return extension - */ - public static String getFilenameExtension(String fileName) { - String res = Constants.EMPTY_STRING; - if (fileName != null) { - int indexOf = fileName.lastIndexOf('.'); - if (indexOf != -1 && indexOf < (fileName.length() - 1)) { - res = fileName.substring(indexOf + 1); - } - } - return res; - } - - public static String calculateMD5ByByteArray(byte[] payload) { - String decodedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(payload); - byte[] encodeMd5 = Base64.encodeBase64(decodedMd5.getBytes()); - return new String(encodeMd5); - - } - - /** - * - * @param data - * @return - */ - public static String calculateMD5ByString(String data) { - String calculatedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(data); - - // encode base-64 result - byte[] encodeBase64 = Base64.encodeBase64(calculatedMd5.getBytes()); - return new String(encodeBase64); - } -} diff --git a/vid-webpack-master/cypress/integration/iFrames/collectionResource.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/collectionResource.e2e.ts index 1a925b3d8..b6be8a1ba 100644 --- a/vid-webpack-master/cypress/integration/iFrames/collectionResource.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/collectionResource.e2e.ts @@ -117,7 +117,7 @@ describe('Drawing board : Collection resource', function () { const expectedComponentInfo: { [key: string]: any } = { 'node-ce8c98bc-4691-44fb-8ff0-7a47487c11c4-undefined': { labelsAndValues: [ - //['Model version', "5.0"] //to add once fix in code + ['Model version', "5.0"] , ['Instance ID', '84a351ae-3601-45e2-98df-878d6c816abc'], ['In maintenance', 'false'] ], diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts index 951145870..252a58d37 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.spec.ts @@ -73,7 +73,7 @@ describe('NCF Model Info', () => { expect(ncfTreeNode).toMatchObject(expected); }); - test('get modelInformation shall return Model version, role, Collection function, Number of networks', () => { + test('get modelInformation shall return Role, Collection function, Number of networks', () => { const ncf = { trackById: "6b3536cf-3a12-457f-abb5-fa2203e0d923", instanceGroupRole: "SUB_INTERFACE", @@ -84,7 +84,6 @@ describe('NCF Model Info', () => { const actualModelInformationItems = ncfModel.getInfo(null, ncf); const expected = [ - ModelInformationItem.createInstance('Model version', '35'), ModelInformationItem.createInstance('Role', 'SUB_INTERFACE'), ModelInformationItem.createInstance('Collection function', 'vTSBC Customer Landing Network Collection'), ModelInformationItem.createInstance('Number of networks', 1), diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts index 650d975c9..f019daaab 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/ncf/ncf.model.info.ts @@ -111,7 +111,6 @@ export class NcfModelInfo implements ILevelNodeInfo { } return [ - ModelInformationItem.createInstance("Model version", instance.modelVersion), ModelInformationItem.createInstance('Role', instance.instanceGroupRole), ModelInformationItem.createInstance('Collection function', instance.instanceGroupFunction), ModelInformationItem.createInstance('Number of networks', instance.numberOfNetworks), |