-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
051aabd
commit 3477ace
Showing
4 changed files
with
25 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,92 +120,6 @@ void getMicrofrontend_shouldReturnMicrofrontend() { | |
|
||
} | ||
|
||
/** | ||
* Scenario: Receives microfrontend (mfe) by app-id successfully. | ||
* Given | ||
* When I query GET endpoint with an existing id | ||
* Then I get a 'OK' response code back | ||
* AND associated mfe is returned | ||
*/ | ||
@Test | ||
void getMicrofrontendByAppId_shouldReturnMicrofrontend() { | ||
|
||
OffsetDateTime offsetDateTime = OffsetDateTime.parse("2023-11-30T13:53:03.688710200+01:00"); | ||
OffsetDateTimeMapper mapper = new OffsetDateTimeMapper(); | ||
Set<String> classificationSet = new HashSet<>(); | ||
classificationSet.add("some"); | ||
classificationSet.add("another"); | ||
List<UIEndpoint> uiEndpointSet = new ArrayList<>(); | ||
UIEndpoint uiEndpointItem = new UIEndpoint(); | ||
uiEndpointItem.setName("Search"); | ||
uiEndpointItem.setPath("/search"); | ||
uiEndpointSet.add(uiEndpointItem); | ||
|
||
Microfrontend data = createMicrofrontend("7a0ee705-8fd0-47b0-8205-b2a5f6540b9e", offsetDateTime, "csommer", | ||
offsetDateTime, "csommer", 1, false, "App-ID", "1.0.0", | ||
"AppName", "some description", "", "https://localhost/mfe/core/ah-mgmt/", | ||
"https://localhost/mfe/core/ah-mgmt/remoteEntry.js", "ProductName", classificationSet, | ||
"[email protected]", "sun", "some notes", "/AnnouncementManagementModule", uiEndpointSet); | ||
|
||
// create mock rest endpoint | ||
mockServerClient | ||
.when(request().withPath(PRODUCT_STORE_SVC_INTERNAL_API_BASE_PATH + "/appId/" + data.getAppId()) | ||
.withMethod(HttpMethod.GET)) | ||
.respond(httpRequest -> response().withStatusCode(Response.Status.OK.getStatusCode()) | ||
.withContentType(MediaType.APPLICATION_JSON) | ||
.withBody(JsonBody.json(data))); | ||
|
||
var response = given() | ||
.when() | ||
.auth().oauth2(keycloakClient.getAccessToken(ADMIN)) | ||
.header(APM_HEADER_PARAM, ADMIN) | ||
.contentType(APPLICATION_JSON) | ||
.get("appId/" + data.getAppId()) | ||
.then() | ||
.statusCode(Response.Status.OK.getStatusCode()) | ||
.contentType(APPLICATION_JSON) | ||
.extract().as(MicrofrontendDTO.class); | ||
|
||
Assertions.assertEquals(data.getId(), response.getId()); | ||
Assertions.assertEquals(data.getCreationUser(), response.getCreationUser()); | ||
Assertions.assertEquals(mapper.map(data.getCreationDate()), mapper.map(response.getCreationDate())); | ||
Assertions.assertEquals(mapper.map(data.getModificationDate()), mapper.map(response.getModificationDate())); | ||
Assertions.assertEquals(data.getModificationUser(), response.getModificationUser()); | ||
Assertions.assertEquals(data.getModificationCount(), response.getModificationCount()); | ||
Assertions.assertEquals(data.getOperator(), response.getOperator()); | ||
Assertions.assertEquals(data.getAppId(), response.getAppId()); | ||
Assertions.assertEquals(data.getAppVersion(), response.getAppVersion()); | ||
Assertions.assertEquals(data.getAppName(), response.getAppName()); | ||
Assertions.assertEquals(data.getDescription(), response.getDescription()); | ||
Assertions.assertEquals(data.getRemoteBaseUrl(), response.getRemoteBaseUrl()); | ||
Assertions.assertEquals(data.getRemoteEntry(), response.getRemoteEntry()); | ||
Assertions.assertEquals(data.getProductName(), response.getProductName()); | ||
|
||
Assertions.assertEquals(data.getContact(), response.getContact()); | ||
Assertions.assertEquals(data.getIconName(), response.getIconName()); | ||
Assertions.assertEquals(data.getNote(), response.getNote()); | ||
Assertions.assertEquals(data.getExposedModule(), response.getExposedModule()); | ||
Assertions.assertEquals(data.getEndpoints().size(), response.getEndpoints().size()); | ||
Assertions.assertEquals(data.getEndpoints().get(0).getName(), response.getEndpoints().get(0).getName()); | ||
Assertions.assertEquals(data.getEndpoints().get(0).getPath(), response.getEndpoints().get(0).getPath()); | ||
|
||
// create mock rest endpoint | ||
mockServerClient | ||
.when(request().withPath(PRODUCT_STORE_SVC_INTERNAL_API_BASE_PATH + "/appId/not-existing") | ||
.withMethod(HttpMethod.GET)) | ||
.respond(httpRequest -> response().withStatusCode(Response.Status.NOT_FOUND.getStatusCode())); | ||
|
||
//expect not found for non-existing appId | ||
given() | ||
.when() | ||
.auth().oauth2(keycloakClient.getAccessToken(ADMIN)) | ||
.header(APM_HEADER_PARAM, ADMIN) | ||
.contentType(APPLICATION_JSON) | ||
.get("/appId/not-existing") | ||
.then() | ||
.statusCode(Response.Status.NOT_FOUND.getStatusCode()); | ||
} | ||
|
||
/** | ||
* Scenario: Receive 404 Not Found when microfrontend (mfe) is not existing in backend service. | ||
* Given | ||
|