Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Trace ID Validation to Integration Tests for Organization Management Error Responses #20895

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void testGetOrganizationsWithInvalidOperator() {
String filterQuery = "?filter=name ca G&limit=10&recursive=false";
String endpointURL = ORGANIZATION_MANAGEMENT_API_BASE_PATH + filterQuery;
Response response = getResponseOfGetWithOAuth2(endpointURL, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_BAD_REQUEST, "ORG-60059");
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "ORG-60059");
}

@Test(dependsOnMethods = "testGetOrganizationsWithInvalidOperator")
Expand All @@ -144,7 +144,7 @@ public void testGetOrganizationsWithUnsupportedAttribute() {
String filterQuery = "?filter=attribute.Country co S&limit=10&recursive=false";
String endpointURL = ORGANIZATION_MANAGEMENT_API_BASE_PATH + filterQuery;
Response response = getResponseOfGetWithOAuth2(endpointURL, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_BAD_REQUEST, "ORG-60023");
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "ORG-60023");
}

@Test(dependsOnMethods = "testGetOrganizationsWithUnsupportedAttribute")
Expand All @@ -153,7 +153,7 @@ public void testGetOrganizationsMetaAttributesWithInvalidOperator() {
String filterQuery = "?filter=attributes ca C&limit=10&recursive=false";
String endpointURL = ORGANIZATION_MANAGEMENT_API_BASE_PATH + "/meta-attributes" + filterQuery;
Response response = getResponseOfGetWithOAuth2(endpointURL, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_BAD_REQUEST, "ORG-60059");
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "ORG-60059");
}

@Test(dependsOnMethods = "testGetOrganizationsMetaAttributesWithInvalidOperator")
Expand All @@ -162,7 +162,7 @@ public void testGetOrganizationsMetaAttributesWithUnsupportedAttribute() {
String filterQuery = "?filter=attribute co S&limit=10&recursive=false";
String endpointURL = ORGANIZATION_MANAGEMENT_API_BASE_PATH + "/meta-attributes" + filterQuery;
Response response = getResponseOfGetWithOAuth2(endpointURL, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_BAD_REQUEST, "ORG-60023");
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "ORG-60023");
}

@Test(dependsOnMethods = "testGetOrganizationsMetaAttributesWithUnsupportedAttribute")
Expand All @@ -180,7 +180,7 @@ public void testAddDiscoveryAttributesWithoutAddingConfig() throws IOException {
String requestBody = readResource("add-discovery-attributes-request-body.json");
requestBody = requestBody.replace("${organizationID}", organizationIDs.get(0));
Response response = getResponseOfPostWithOAuth2(endpointURL, requestBody, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_BAD_REQUEST, "ORG-60080");
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "ORG-60080");
}

@Test(dependsOnMethods = "testAddDiscoveryAttributesWithoutAddingConfig")
Expand Down Expand Up @@ -237,8 +237,7 @@ public void testAddDiscoveryAttributesToNonExistingOrganization() throws IOExcep
String requestBody = readResource("add-discovery-attributes-request-body.json");
requestBody = requestBody.replace("${organizationID}", invalidOrganizationID);
Response response = getResponseOfPostWithOAuth2(endpointURL, requestBody, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_NOT_FOUND, "ORG-60015",
invalidOrganizationID);
validateErrorResponse(response, HttpStatus.SC_NOT_FOUND, "ORG-60015", invalidOrganizationID);
}

@Test(dependsOnMethods = "testAddDiscoveryAttributesToNonExistingOrganization")
Expand All @@ -260,8 +259,7 @@ public void testAddDiscoveryAttributesWhenAlreadyAdded() throws IOException {
Response firstResponse = getResponseOfPostWithOAuth2(endpointURL, requestBody, m2mToken);
validateHttpStatusCode(firstResponse, HttpStatus.SC_CREATED);
Response secondResponse = getResponseOfPostWithOAuth2(endpointURL, requestBody, m2mToken);
validateErrorResponseWithoutTraceId(secondResponse, HttpStatus.SC_BAD_REQUEST, "ORG-60085",
organizationIDs.get(0));
validateErrorResponse(secondResponse, HttpStatus.SC_BAD_REQUEST, "ORG-60085", organizationIDs.get(0));
}

@Test(dependsOnMethods = "testAddDiscoveryAttributesWhenAlreadyAdded")
Expand All @@ -278,8 +276,7 @@ public void testGetDiscoveryAttributesOfNonExistingOrganization() {
String endpointURL = ORGANIZATION_MANAGEMENT_API_BASE_PATH + PATH_SEPARATOR + invalidOrganizationID
+ ORGANIZATION_DISCOVERY_API_PATH;
Response response = getResponseOfGetWithOAuth2(endpointURL, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_NOT_FOUND, "ORG-60015",
invalidOrganizationID);
validateErrorResponse(response, HttpStatus.SC_NOT_FOUND, "ORG-60015", invalidOrganizationID);
}

@Test(dependsOnMethods = "testGetDiscoveryAttributesOfNonExistingOrganization")
Expand All @@ -297,8 +294,7 @@ public void testDeleteDiscoveryAttributesOfNonExistingOrganization() {
String endpointURL = ORGANIZATION_MANAGEMENT_API_BASE_PATH + PATH_SEPARATOR + invalidOrganizationID
+ ORGANIZATION_DISCOVERY_API_PATH;
Response response = getResponseOfDeleteWithOAuth2(endpointURL, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_NOT_FOUND, "ORG-60015",
invalidOrganizationID);
validateErrorResponse(response, HttpStatus.SC_NOT_FOUND, "ORG-60015", invalidOrganizationID);
}

@Test(dependsOnMethods = "testDeleteDiscoveryAttributesOfNonExistingOrganization")
Expand All @@ -321,7 +317,7 @@ public void testUpdateWithUnavailableDiscoveryAttributes() throws IOException {
Response firstResponse = getResponseOfPutWithOAuth2(firstEndpointURL, requestBody, m2mToken);
validateHttpStatusCode(firstResponse, HttpStatus.SC_OK);
Response secondResponse = getResponseOfPutWithOAuth2(secondEndpointURL, requestBody, m2mToken);
validateErrorResponseWithoutTraceId(secondResponse, HttpStatus.SC_BAD_REQUEST, "ORG-60083");
validateErrorResponse(secondResponse, HttpStatus.SC_BAD_REQUEST, "ORG-60083");
}

@Test(dependsOnMethods = "testUpdateWithUnavailableDiscoveryAttributes")
Expand All @@ -331,8 +327,7 @@ public void testUpdateDiscoveryAttributesOfNonExistingOrganization() throws IOEx
+ ORGANIZATION_DISCOVERY_API_PATH;
String requestBody = readResource("update-discovery-attributes-request-body.json");
Response response = getResponseOfPutWithOAuth2(endpointURL, requestBody, m2mToken);
validateErrorResponseWithoutTraceId(response, HttpStatus.SC_NOT_FOUND, "ORG-60015",
invalidOrganizationID);
validateErrorResponse(response, HttpStatus.SC_NOT_FOUND, "ORG-60015", invalidOrganizationID);
}

@Test(dependsOnMethods = "testUpdateDiscoveryAttributesOfNonExistingOrganization")
Expand Down