diff --git a/code/cucumber/README.md b/code/cucumber/README.md deleted file mode 100644 index 29eda7cf12..0000000000 --- a/code/cucumber/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# QA - Tests - Quality on Demand - -## Prerequisites - -1. Ensure QoD App service is up and running on localhost on port 9091. -2. Ensure that scef/nef server is configured for being available on port 8081. - - -Command for starting service locally using jar file :- -Please check Readme.md file for QoD service - - -The following steps are needed to create and deploy docker image for camara cucumber tests: - -1. ```mvn clean package``` - -2. ```docker build -t cucumber .``` - -3. ```docker run -dp 9091:9091 -p cucumber``` diff --git a/code/cucumber/pom.xml b/code/cucumber/pom.xml deleted file mode 100644 index adb0c681dd..0000000000 --- a/code/cucumber/pom.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - 4.0.0 - - - gitlab-maven - https://mvnrepository.com/artifact/org.apache.maven/maven-core - - - QoD-Api-Tests - QoD-Api-Tests - 0.0.1-SNAPSHOT - jar - - Deutsche Telekom AG - - - 17 - 17 - 17 - apache_v2 - CAMARA Project - 2022 - 2023 - - - - org.apache.httpcomponents - httpclient - 4.5.13 - - - io.rest-assured - rest-assured - 5.3.0 - test - - - io.cucumber - cucumber-jvm-deps - 1.0.6 - provided - - - com.jayway.jsonpath - json-path - 2.7.0 - - - com.fasterxml.jackson.core - jackson-annotations - 2.14.0 - - - com.fasterxml.jackson.core - jackson-core - 2.14.0 - - - com.fasterxml.jackson.core - jackson-databind - 2.14.0 - - - io.cucumber - cucumber-java - 7.11.1 - test - - - io.cucumber - cucumber-junit-platform-engine - 7.11.1 - test - - - org.junit.platform - junit-platform-suite - 1.9.2 - test - - - org.junit.jupiter - junit-jupiter - 5.9.0 - test - - - tech.grasshopper - extentreports-cucumber7-adapter - 1.7.0 - - - com.aventstack - extentreports - 5.0.9 - - - org.springframework - spring-beans - 5.3.24 - - - org.projectlombok - lombok - 1.18.24 - provided - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - 2.14.2 - - - com.github.tomakehurst - wiremock - 2.27.2 - test - - - - - - org.codehaus.mojo - license-maven-plugin - 2.0.0 - - . - THIRD-PARTY.md - templates/third-party.ftl - camara - false - true - **/*.java - src - true - --- - Contributors | ${project.organization.name} to CAMARA a Series of LF Projects, LLC - The contributor of this file confirms his sign-off for the Developer Certificate of Origin - (https://developercertificate.org). - - ---license-start - ---license-end - true - true - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - 17 - 17 - UTF-8 - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M5 - - - - cucumber.junit-platform.naming-strategy=long - - - - - - - diff --git a/code/cucumber/src/test/java/runners/TestRunner.java b/code/cucumber/src/test/java/runners/TestRunner.java deleted file mode 100644 index 96ea56cea5..0000000000 --- a/code/cucumber/src/test/java/runners/TestRunner.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ---license-start - * CAMARA Project - * --- - * Copyright (C) 2022 - 2023 Contributors | Deutsche Telekom AG to CAMARA a Series of LF Projects, LLC - * - * The contributor of this file confirms his sign-off for the - * Developer Certificate of Origin - * (https://developercertificate.org). - * --- - * 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 runners; - -import static io.cucumber.core.options.Constants.FILTER_TAGS_PROPERTY_NAME; -import static io.cucumber.core.options.Constants.GLUE_PROPERTY_NAME; -import static io.cucumber.core.options.Constants.PLUGIN_PROPERTY_NAME; -import static io.cucumber.core.options.Constants.PLUGIN_PUBLISH_QUIET_PROPERTY_NAME; - -import org.junit.platform.suite.api.ConfigurationParameter; -import org.junit.platform.suite.api.ConfigurationParameters; -import org.junit.platform.suite.api.IncludeEngines; -import org.junit.platform.suite.api.SelectClasspathResource; -import org.junit.platform.suite.api.Suite; - -@Suite -@IncludeEngines("cucumber") -@SelectClasspathResource("feature") -@ConfigurationParameters({ - @ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "stepDefinitions"), - @ConfigurationParameter(key = FILTER_TAGS_PROPERTY_NAME, value = "@QoDSanity"), - @ConfigurationParameter(key = PLUGIN_PUBLISH_QUIET_PROPERTY_NAME, value = "true"), - @ConfigurationParameter( - key = PLUGIN_PROPERTY_NAME, - value = "pretty, " - + "html:target/cucumber-reports/Cucumber.html, " - + "json:target/cucumber-reports/Cucumber.json, " - + "junit:target/cucumber-reports/Cucumber.xml, " - + "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:") -}) -public class TestRunner { - -} - diff --git a/code/cucumber/src/test/java/stepDefinitions/AppConfig.java b/code/cucumber/src/test/java/stepDefinitions/AppConfig.java deleted file mode 100644 index 323f45b69d..0000000000 --- a/code/cucumber/src/test/java/stepDefinitions/AppConfig.java +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * ---license-start - * CAMARA Project - * --- - * Copyright (C) 2022 - 2023 Contributors | Deutsche Telekom AG to CAMARA a Series of LF Projects, LLC - * - * The contributor of this file confirms his sign-off for the - * Developer Certificate of Origin - * (https://developercertificate.org). - * --- - * 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 stepDefinitions; - -public class AppConfig { - - public static final String BASE_URL = "http://localhost:9091"; - public static final int SCEF_PORT = Integer.parseInt("8081"); - public static final String SCEF_PATH = "/3gpp-as-session-with-qos/v1/scs"; - - public static final String SESSION_ID = "80a7db98-6d1b-46c8-a602-fd6370fe5a21"; - public static final String JSON_STRING_MANDATORY = """ - { - "duration": 10, - "ueId": { - "msisdn": "12345678901", - "ipv4addr": "192.168.0.0/24" - }, - "asId": { - "ipv4addr": "192.168.0.0/24" - }, - "qos": "QOS_E" - } - """; - - public static final String JSON_STRING_ALL_PARAMS = """ - { - "duration": 10, - "ueId": { - "externalId": "123456789@domain.com", - "msisdn": "1234567812", - "ipv4addr": "192.168.1.0/24" - }, - "asId": { - "ipv4addr": "192.168.1.0/24" - }, - "uePorts": { - "ranges": [ - { - "from": 5010, - "to": 5020 - } - ], - "ports": [ - 5060, - 5070 - ] - }, - "asPorts": { - "ranges": [ - { - "from": 5010, - "to": 5020 - } - ], - "ports": [ - 5060, - 5070 - ] - }, - "qos": "QOS_E", - "notificationUri": "http://127.0.0.1:8000/notifications", - "notificationAuthToken": "c8974e592c2fa383d4a3960714" - } - - """; - public static final String JSON_STRING_MANDATORY_PARAMS = """ - { - "duration": 10, - "ueId": { - "msisdn": "12345678902", - "ipv4addr": "192.168.0.0/24" - }, - "asId": { - "ipv4addr": "192.168.0.0/24" - }, - "qos": "" - } - """; - - - public static final String JSON_STRING_ALL = """ - { - "duration": 10, - "ueId": { - "externalId": "123456789@domain.com", - "msisdn": "1234567812", - "ipv4addr": "192.168.1.0/24" - }, - "asId": { - "ipv4addr": "192.168.1.0/24" - }, - "uePorts": { - "ranges": [ - { - "from": 5010, - "to": 5020 - } - ], - "ports": [ - 5060, - 5070 - ] - }, - "asPorts": { - "ranges": [ - { - "from": 5010, - "to": 5020 - } - ], - "ports": [ - 5060, - 5070 - ] - }, - "qos": "QOS_E", - "notificationUri": "http://127.0.0.1:8000/notifications", - "notificationAuthToken": "c8974e592c2fa383d4a3960714" - } - """; - -} diff --git a/code/cucumber/src/test/java/stepDefinitions/Steps.java b/code/cucumber/src/test/java/stepDefinitions/Steps.java deleted file mode 100644 index 9a332131b3..0000000000 --- a/code/cucumber/src/test/java/stepDefinitions/Steps.java +++ /dev/null @@ -1,164 +0,0 @@ -/*- - * ---license-start - * CAMARA Project - * --- - * Copyright (C) 2022 - 2023 Contributors | Deutsche Telekom AG to CAMARA a Series of LF Projects, LLC - * - * The contributor of this file confirms his sign-off for the - * Developer Certificate of Origin - * (https://developercertificate.org). - * --- - * 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 stepDefinitions; - - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.configureFor; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.github.tomakehurst.wiremock.WireMockServer; -import com.jayway.jsonpath.JsonPath; -import io.cucumber.java.BeforeAll; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import io.restassured.RestAssured; -import io.restassured.specification.RequestSpecification; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.AfterAll; - - -@Slf4j -public class Steps { - - private final static String PATH = "/qod/v0/sessions"; - private static WireMockServer wireMockServer; - private io.restassured.response.Response response; - private RequestSpecification request; - - @BeforeAll - public static void setUp() { - wireMockServer = new WireMockServer(AppConfig.SCEF_PORT); - wireMockServer.start(); - } - - @Given("Use the QoD MOCK URL") - public void useTheQoDMOCKURL() { - RestAssured.reset(); - RestAssured.baseURI = AppConfig.BASE_URL; - request = RestAssured.given(); - log.info("Setting up!"); - configureFor("localhost", AppConfig.SCEF_PORT); - RestAssured.port = AppConfig.SCEF_PORT; - stubFor(post(urlEqualTo(AppConfig.SCEF_PATH + "/subscriptions")) - .willReturn(aResponse() - .withStatus(201) - .withHeader("Content-Type", "application/json") - //QoD Session API needs only subscription-id from response and hence only self is considered - .withBody("{\"self\": \"https://foo.com/subscriptions/123\"}") - ) - ); - log.info("MockServer Started"); - stubFor(delete(urlMatching(AppConfig.SCEF_PATH + "/subscriptions/123")).willReturn( - aResponse().withStatus(204))); - } - - public void postRequestByResource(String requestBody) { - request.header("Content-Type", "application/json"); - log.info(requestBody); - response = request.body(requestBody).post(PATH); - log.info("Response HTTP Status code: " + response.getStatusCode()); - log.info("Response Body: " + response.getBody().asString()); - - } - - @When("Create a new QoD session with mandatory parameters") - public void createSession() { - postRequestByResource(AppConfig.JSON_STRING_MANDATORY); - } - - @When("Delete existing QoD session") - public void deleteExistingQoDSession() { - String sessionId = JsonPath.read(response.asString(), "id"); - log.info(sessionId); - String path = PATH + "/" + sessionId; - response = request.delete(path); - } - - @When("Delete Invalid QoD session") - public void deleteInvalidSession() { - String path = PATH + "/" + AppConfig.SESSION_ID; - response = request.delete(path); - } - - @Then("Response code is {int}") - public void checkResponse(int iResponse) { - assertEquals(iResponse, response.getStatusCode()); - } - - @AfterAll - public static void afterAll() { - System.out.println("Running: tearDown"); - wireMockServer.stop(); - } - - - @When("Create a new QoD session with all parameters") - public void createANewQoDSessionWithAllParameters() { - postRequestByResource(AppConfig.JSON_STRING_ALL); - } - - @When("Get QoD session") - public void getSession() { - String sessionId = JsonPath.read(response.asString(), "id"); - String path = PATH + "/" + sessionId; - response = request.get(path); - log.info("Response HTTP Status code: " + response.getStatusCode()); - } - - @Given("Use the QoD MOCK URL with invalid scenario") - public void useTheQoDMOCKURLWithInvalidScenario() { - RestAssured.reset(); - RestAssured.baseURI = AppConfig.BASE_URL; - request = RestAssured.given(); - log.info("Setting up!"); - configureFor("localhost", AppConfig.SCEF_PORT); - RestAssured.port = AppConfig.SCEF_PORT; - stubFor(post(urlEqualTo(AppConfig.SCEF_PATH + "/subscriptions")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "application/json") - .withBody("{\"self\": \"https://foo.com/subscriptions/\"}") - ) - ); - } - - @When("Create a new QoD session with parameters") - public void createANewQoDSessionWithParameters() { - - postRequestByResource(AppConfig.JSON_STRING_MANDATORY_PARAMS); - } - - @When("Create a new QoD session along with all parameters") - public void createANewQoDSessionAlongWithAllParameters() { - postRequestByResource(AppConfig.JSON_STRING_ALL_PARAMS); - } -} diff --git a/code/cucumber/src/test/resources/extent.properties b/code/cucumber/src/test/resources/extent.properties deleted file mode 100644 index a87b806aee..0000000000 --- a/code/cucumber/src/test/resources/extent.properties +++ /dev/null @@ -1,8 +0,0 @@ -#PDF Report -extent.reporter.pdf.start=true -extent.reporter.pdf.out=target/cucumber-reports/CucumberExtentReport.pdf -#HTML Report -extent.reporter.html.start=true -extent.reporter.html.out=target/cucumber-reports/CucumberExtentReport.html - - diff --git a/code/cucumber/src/test/resources/feature/QoD_API_Test.feature b/code/cucumber/src/test/resources/feature/QoD_API_Test.feature deleted file mode 100644 index fdc6e40750..0000000000 --- a/code/cucumber/src/test/resources/feature/QoD_API_Test.feature +++ /dev/null @@ -1,70 +0,0 @@ -#/*- ---license-start -#* CAMARA Project -#* --- -#* Copyright (C) 2022 - 2023 Contributors | Deutsche Telekom AG to CAMARA a Series of LF Projects, LLC -#* The contributor of this file confirms his sign-off for the -#* Developer Certificate of Origin (http://developercertificate.org). -#* --- -#* 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 -#*/ - -@QoD @QoDSanity -Feature: Automated QoD System Integration Test - - @QQoDSessionCreateGetDelete - Scenario: Create QoD session with mandatory parameters - Given Use the QoD MOCK URL - When Create a new QoD session with mandatory parameters - Then Response code is 201 - When Get QoD session - Then Response code is 200 - When Delete existing QoD session - Then Response code is 204 - - @QoDSessionCreateGetDeleteAllparams - Scenario: Create QoD session with all parameters & Deletion of Session id - Given Use the QoD MOCK URL - When Create a new QoD session with all parameters - Then Response code is 201 - When Get QoD session - Then Response code is 200 - When Delete existing QoD session - Then Response code is 204 - - @QoDCreateSessionDeleteInvalidSession - Scenario: Delete a Invalid QoD session for session id - Given Use the QoD MOCK URL - When Create a new QoD session with mandatory parameters - Then Response code is 201 - When Delete Invalid QoD session - Then Response code is 404 - - - @QoDInvalidCreateSession - Scenario: QoD session with 5XX response - # Test with end point not reachable - Given Use the QoD MOCK URL with invalid scenario - When Create a new QoD session along with all parameters - Then Response code is 500 - - - @QoDInvalidCreateSessionpayload - Scenario: QoD session with invalid payload 4XX - # Test with invalid Payload - Given Use the QoD MOCK URL with invalid scenario - When Create a new QoD session with parameters - Then Response code is 400 - - - diff --git a/code/cucumber/src/test/resources/logback.xml b/code/cucumber/src/test/resources/logback.xml deleted file mode 100644 index 13a47f70c9..0000000000 --- a/code/cucumber/src/test/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %replace(%msg){'[\r\n]', ''}%n - - - - - - - - \ No newline at end of file