mercoledì 29 novembre 2017

CXF: How to get a json response and test it (as a Set)

    @Test
    public void sample() throws ParseException {

//read response
        Response response = client().path("cardex").path("changes").get();
        Assert.assertNotNull(response);
        Assert.assertTrue(response.getStatus() == 200);

//read response as a set
        Set<CardexDBTO> jsonResponse = new HashSet<>();
        jsonResponse = response.readEntity(new GenericType<Set<CardexDBTO>>() {
        });

//create a set same as the (test)object received
        Set<CardexDBTO> collect = new HashSet<>();
        CardexDBTO cardexResponse = null;
        cardexResponse = new CardexDBTO();
        cardexResponse.setNombre("Mario");
        cardexResponse.setEmail("mario@rossi.it");
        collect.add(cardexResponse);

//iterate and test
        for (CardexDBTO it : collect) {
            for (CardexDBTO it1 : jsonResponse) {
                Assert.assertEquals(it.getNombre(), it1.getNombre());
                Assert.assertEquals(it.getEmail(), it1.getEmail());
            }
        }
    }

How to deploy Podman images to OpenShift Container Platform (CRC on localhost)

I have a microservice on localhost and I want to deploy its Podman image on OCP, which I am running using CRC on localhost.       1. Get the...