Skip to content

Commit

Permalink
finalizando consumo dos indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigos0ares committed Aug 7, 2021
1 parent 3346bea commit 89eb731
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 61 deletions.
21 changes: 15 additions & 6 deletions bff/src/main/java/org/worldbank/indicator/Indicator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class Indicator {

@JsonProperty("iso2Code")
@JsonProperty("countryiso3code")
private String code;
private String name;
private Integer date;
private Double value;

public String getCode() {
return code;
Expand All @@ -18,11 +19,19 @@ public void setCode(String code) {
this.code = code;
}

public String getName() {
return name;
public Integer getDate() {
return date;
}

public void setName(String name) {
this.name = name;
public void setDate(Integer date) {
this.date = date;
}

public Double getValue() {
return value;
}

public void setValue(Double value) {
this.value = value;
}
}
6 changes: 3 additions & 3 deletions bff/src/main/java/org/worldbank/indicator/IndicatorBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public List<Indicator> list(String code){
String result = response.readEntity(String.class);
JSONArray objects = new JSONArray(result);

String o = objects.getJSONObject(0).toString();
String o2 = objects.getJSONArray(1).toString();
//@TODO o item 0 pussui o valores para paginacao
String jsonArray = objects.getJSONArray(1).toString();
List<Indicator> indicators = Collections.emptyList();

try {
ObjectMapper mapper = new ObjectMapper();
indicators = mapper.readValue(o2, new TypeReference<>() {});
indicators = mapper.readValue(jsonArray, new TypeReference<>() {});
} catch (JsonProcessingException e) {
e.printStackTrace();
}
Expand Down
51 changes: 0 additions & 51 deletions bff/src/main/java/org/worldbank/indicator/Indicators.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void list() throws InterruptedException {
given()
.when().get("/indicators/CN")
.then()
.statusCode(204)
.statusCode(200)
.body("size()", is(greaterThanOrEqualTo(1)));
}

Expand Down

0 comments on commit 89eb731

Please sign in to comment.