use of io.fabric8.api.commands.GitVersions in project fabric8 by jboss-fuse.
the class FabricManagerTest method toJson.
@Test
public void toJson() throws JsonProcessingException {
JMXRequest r = new JMXRequest();
r.setId("id");
r.withObjectName("io.fabric8:type=manager");
r.withParam(Boolean.class, true);
System.out.println(om().writeValueAsString(r));
JMXResult res = new JMXResult();
res.setCode(0);
res.setMessage("OK");
res.setCorrelationId("id");
GitVersion v = new GitVersion("1.0");
v.setSha1("SHA1");
GitVersions versions = new GitVersions();
versions.getVersions().addAll(Arrays.asList(v, v, v));
res.setResponse(versions);
System.out.println(om().writeValueAsString(res));
System.out.println(om().writeValueAsString(versions));
}
use of io.fabric8.api.commands.GitVersions in project fabric8 by jboss-fuse.
the class FabricManagerTest method fromJson.
@Test
public void fromJson() throws IOException {
JMXResult res = om().readValue("{\"correlationId\":\"id\",\"code\":0,\"message\":\"OK\",\"response\":{\"@class\":\"io.fabric8.api.commands.GitVersions\",\"versions\":[{\"version\":\"1.0\",\"sha1\":\"SHA1\",\"timestamp\":null,\"message\":null},{\"version\":\"1.0\",\"sha1\":\"SHA1\",\"timestamp\":null,\"message\":null},{\"version\":\"1.0\",\"sha1\":\"SHA1\",\"timestamp\":null,\"message\":null}]}}", JMXResult.class);
assertNotNull(res);
assertThat(res.getMessage(), equalTo("OK"));
assertThat(((GitVersions) res.getResponse()).getVersions().get(2).getSha1(), equalTo("SHA1"));
assertThat(((GitVersions) res.getResponse()).getVersions().size(), equalTo(3));
}
Aggregations