Skip to content

Commit

Permalink
Auto commit generated client changes - Wed May 29 12:59:14 UTC 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
equinix-labs@auto-commit-workflow committed May 29, 2024
1 parent 383891f commit 6a1d39e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
import com.fasterxml.jackson.databind.ObjectWriter;
import com.google.gson.reflect.TypeToken;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Type;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -62,11 +60,11 @@ public ApiClient generateToken() {
return apiClient;
}

protected PortDto getPort(com.equinix.openapi.fabric.v4.api.AbstractTest.JsonFiles jsonFile) {
protected PortDto getPort(EnvVariable envVariable) {
ObjectMapper mapper = new ObjectMapper();
String path = new File(System.getProperty("user.dir")).getParent() + "/json/" + jsonFile.value;
String json = System.getenv(envVariable.value);
try {
return mapper.readValue(Paths.get(path).toFile(), PortDto.class);
return mapper.readValue(json, PortDto.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand All @@ -83,13 +81,12 @@ protected void printJson(Object object) {
}
}

public enum JsonFiles {
PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION("port-2-private-service-profile-connection.json"),
PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION("port-2-public-service-profile-connection.json");
public enum EnvVariable {
QINQ_PORT("TEST_DATA_UAT_QINQ_PORT");

private String value;

JsonFiles(String value) {
EnvVariable(String value) {
this.value = value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void getPortByUuidTest() throws ApiException {
*/
@Test
public void getPortsTest() throws ApiException {
PortDto portDto = getPort(JsonFiles.PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION);
PortDto portDto = getPort(EnvVariable.QINQ_PORT);
AllPortsResponse response = api.getPorts(portDto.getName());
assertEquals(200, api.getApiClient().getStatusCode());
assertEquals(portDto.getName(), response.getData().get(0).getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void getPortStatsTest() throws ApiException {
*/
@Test
public void getPortStatsByPortUuidTest() throws ApiException {
PortDto portDto = getPort(JsonFiles.PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION);
PortDto portDto = getPort(EnvVariable.QINQ_PORT);
OffsetDateTime startDate = OffsetDateTime.now().minusMonths(3).withOffsetSameLocal(ZoneOffset.UTC).truncatedTo(ChronoUnit.SECONDS);
OffsetDateTime endDate = OffsetDateTime.now().withOffsetSameLocal(ZoneOffset.UTC).truncatedTo(ChronoUnit.SECONDS);

Expand Down

0 comments on commit 6a1d39e

Please sign in to comment.