Search in sources :

Example 1 with Operator

use of io.github.asw.i3a.operatorsWebClient.entitites.Operator in project InciDashboard_i3a by Arquisoft.

the class OperatorService method getAllOperators.

public static List<Operator> getAllOperators() {
    try {
        HttpResponse<JsonNode> response = Unirest.post(API_GATEWAY + "/operators").asJson();
        ObjectMapper mapper = new ObjectMapper();
        List<Operator> items = mapper.readValue(response.getBody().toString(), mapper.getTypeFactory().constructParametricType(List.class, Operator.class));
        return items;
    } catch (IOException | UnirestException e) {
        e.printStackTrace();
        return null;
    }
}
Also used : Operator(io.github.asw.i3a.operatorsWebClient.entitites.Operator) UnirestException(com.mashape.unirest.http.exceptions.UnirestException) JsonNode(com.mashape.unirest.http.JsonNode) List(java.util.List) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with Operator

use of io.github.asw.i3a.operatorsWebClient.entitites.Operator in project InciDashboard_i3a by Arquisoft.

the class OperatorTest method extraTest.

@Test
public void extraTest() {
    Operator op = new Operator("Pepe@gmail.com", "123456");
    assertTrue(op.getEmail().equals("Pepe@gmail.com"));
    assertTrue(op.getPassword().equals("123456"));
    Operator op2 = new Operator();
    assertTrue(op.canEquals(op2));
}
Also used : Operator(io.github.asw.i3a.operatorsWebClient.entitites.Operator) UnitTest(TestKit.UnitTest) Test(org.junit.Test)

Aggregations

Operator (io.github.asw.i3a.operatorsWebClient.entitites.Operator)2 UnitTest (TestKit.UnitTest)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonNode (com.mashape.unirest.http.JsonNode)1 UnirestException (com.mashape.unirest.http.exceptions.UnirestException)1 IOException (java.io.IOException)1 List (java.util.List)1 Test (org.junit.Test)1