diff options
author | Jerry Flood <jflood@att.com> | 2019-04-26 12:54:02 -0400 |
---|---|---|
committer | Jerry Flood <jflood@att.com> | 2019-04-26 12:54:12 -0400 |
commit | f2fa64b013de2f55367bf9b8471949b72adc27b0 (patch) | |
tree | 6da9354aad40be7dd8aec4e98d85caf53d84ec11 | |
parent | 131273f73ec21a5632de9069f8b04f75631ce790 (diff) |
More robot tests for CC
Issue-ID: OPTFRA-474
Change-Id: I8288c9094a9a56b882994f784c26231df5a47a89
Signed-off-by: Jerry Flood <jflood@att.com>
4 files changed, 104 insertions, 5 deletions
diff --git a/cmso-robot/robot/resources/scheduler_requests/approval_requests.robot b/cmso-robot/robot/resources/scheduler_requests/approval_requests.robot index c971017..d732f4e 100644 --- a/cmso-robot/robot/resources/scheduler_requests/approval_requests.robot +++ b/cmso-robot/robot/resources/scheduler_requests/approval_requests.robot @@ -23,10 +23,10 @@ Wait For Pending Approval Send Tier2 Approval [Documentation] Sends an approval post request for the given schedule using the UUID and User given and checks that request worked - [Arguments] ${uuid} ${user} ${status} + [Arguments] ${uuid} ${user} ${status} ${status_code}=204 ${approval}= Create Dictionary approvalUserId=${user} approvalType=Tier 2 approvalStatus=${status} ${resp}= Post Change Management auth schedules/${uuid}/approvals data=${approval} - Should Be Equal As Strings ${resp.status_code} 204 + Should Be Equal As Strings ${resp.status_code} ${status_code} Send Invalid Approval diff --git a/cmso-robot/robot/testsuites/ChangeManagementQuery.robot b/cmso-robot/robot/testsuites/ChangeManagementQuery.robot new file mode 100644 index 0000000..f6ef3e9 --- /dev/null +++ b/cmso-robot/robot/testsuites/ChangeManagementQuery.robot @@ -0,0 +1,76 @@ +*** Settings *** +Documentation Verifies queries + +Library StringTemplater +Library UUID +Library Collections + +Resource ../resources/test_templates/change_management_ete.robot + +Suite Setup Create Scheduler Request +Suite Teardown Delete Scheduler Request + +*** Variables *** +${QUERY_TEST_UUID} "" + +*** Test Cases *** +Change Management Query Simple + [Tags] ete query + ${query}= Catenate schedules/scheduleDetails?request.scheduleId=${QUERY_TEST_UUID} + ${response}= Get Change Management alias ${query} + Row Count Should Be ${response} 3 + +Change Management Query In + [Tags] ete query + ${query}= Catenate schedules/scheduleDetails?request.scheduleId=${QUERY_TEST_UUID}&vnfName=node1&vnfName=node3&WorkflowName=Replace + ${response}= Get Change Management alias ${query} + Row Count Should Be ${response} 2 + +Change Management Query Like + [Tags] ete query + ${query}= Catenate schedules/scheduleDetails?request.scheduleId=${QUERY_TEST_UUID}&vnfName=node%&request.createDateTime=2018-01-01T00:00:00Z + ${response}= Get Change Management alias ${query} + Row Count Should Be ${response} 3 + +Change Management Not Found + [Tags] ete query + ${query}= Catenate schedules/scheduleDetails?request.scheduleId=${QUERY_TEST_UUID}&vnfName=NoNode&request.createDateTime=2018-01-01T00:00:00Z,2018-01-01T01:00:00Z + ${response}= Get Change Management alias ${query} + Should Be Equal As Strings ${response.status_code} 404 + +Change Management Invalid Argument + [Tags] ete query + ${query}= Catenate schedules/scheduleDetails?request.scheduleId=${QUERY_TEST_UUID}&bad=NoNode + ${response}= Get Change Management alias ${query} + Should Be Equal As Strings ${response.status_code} 400 + +Change Management Invalid Date + [Tags] ete query + ${query}= Catenate schedules/scheduleDetails?request.scheduleId=${QUERY_TEST_UUID}&request.createDateTime=2018-01-010 + ${response}= Get Change Management alias ${query} + Should Be Equal As Strings ${response.status_code} 400 + +*** Keywords *** +Row Count Should Be + [Arguments] ${response} ${count} + Should Be Equal As Strings ${response.status_code} 200 + ${json}= Set Variable ${response.json()} + Log ${json} + ${length}= Get Length ${json} + Should be Equal as Integers ${count} ${length} + + +Create Scheduler Request + [Documentation] Creates a future request, runs query, deletes request + ${QUERY_TEST_UUID}= Generate UUID + Set Suite Variable ${QUERY_TEST_UUID} ${QUERY_TEST_UUID} + ${request_file}= Catenate OneGroupMultipleVNFsOneChangeWindow.json.template + ${workflow}= Catenate Replace + ${template_folder}= Catenate ${TEMPLATES}/changemanagement + ${resp}= Create Schedule ${QUERY_TEST_UUID} ${request_file} ${template_folder} workflow=${workflow} + Should Be Equal as Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 600s 30s Wait For Pending Approval ${QUERY_TEST_UUID} + +Delete Scheduler Request + [Documentation] Creates a future request, runs query, deletes request + Delete Change Management auth schedules/${QUERY_TEST_UUID} diff --git a/cmso-robot/robot/testsuites/MiscTests.robot b/cmso-robot/robot/testsuites/MiscTests.robot index 12da302..987f7d6 100755 --- a/cmso-robot/robot/testsuites/MiscTests.robot +++ b/cmso-robot/robot/testsuites/MiscTests.robot @@ -9,6 +9,7 @@ Resource ../resources/optimizer_common.robot Resource ../resources/scheduler_common.robot
Resource ../resources/ticketmgt_common.robot
Resource ../resources/topology_common.robot
+Resource ../resources/scheduler_requests/approval_requests.robot
# Test Setup
# Test Teardown
@@ -63,25 +64,45 @@ Test CMSO Topology Health Test CMSO Optimizer Policies
[Tags] ete
${response}= Get Optimizer alias policies
+ Should Be Equal As Strings ${response.status_code} 200
##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
Test CMSO Optimizer Get Schedule
[Tags] ete
${response}= Get Optimizer alias optimize/schedule/id1
+ Should Be Equal As Strings ${response.status_code} 200
##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
Test CMSO Optimizer Delete Schedule
[Tags] ete
${response}= Delete Optimizer alias optimize/schedule/id1
+ Should Be Equal As Strings ${response.status_code} 204
##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
Test CMSO Ticket Mgt Get Tickets
[Tags] ete
${response}= Get Ticket Mgt alias tickets
+ Should Be Equal As Strings ${response.status_code} 200
##Dictionary Should Contain Item ${response.json()} healthy True
Test CMSO Ticket Mgt Get Ticket
[Tags] ete
${response}= Get Ticket Mgt alias ticket/none
+ Should Be Equal As Strings ${response.status_code} 200
##Dictionary Should Contain Item ${response.json()} healthy True
+
+Get Not Found Schedule
+ [Tags] ete
+ ${response}= Get Change Management alias schedules/doesNotExist
+ Should Be Equal As Strings ${response.status_code} 404
+
+Delete Not Found Schedule
+ [Tags] ete
+ ${response}= Delete Change Management alias schedules/doesNotExist
+ Should Be Equal As Strings ${response.status_code} 404
+
+Approve Not Found Schedule
+ [Tags] ete
+ Send Tier2 Approval DoesNotExist jf9860 Accespted status_code=400
+
\ No newline at end of file diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java index 442abe3..1e4a46a 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java @@ -223,11 +223,13 @@ public class CmQueryParameters { }
private static DateTime convertDate(String utcDate, String urlName) throws CmsoException {
- DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
- if (dateTime != null) {
+ try {
+ DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
return dateTime;
}
- throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
+ catch (Exception e) {
+ throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
+ }
}
// public static void main(String argv[])
|