Search in sources :

Example 6 with GitVersions

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));
}
Also used : GitVersion(io.fabric8.api.commands.GitVersion) JMXRequest(io.fabric8.api.commands.JMXRequest) GitVersions(io.fabric8.api.commands.GitVersions) JMXResult(io.fabric8.api.commands.JMXResult) Test(org.junit.Test)

Example 7 with GitVersions

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));
}
Also used : GitVersions(io.fabric8.api.commands.GitVersions) JMXResult(io.fabric8.api.commands.JMXResult) Test(org.junit.Test)

Aggregations

GitVersion (io.fabric8.api.commands.GitVersion)4 GitVersions (io.fabric8.api.commands.GitVersions)4 JMXRequest (io.fabric8.api.commands.JMXRequest)4 JMXResult (io.fabric8.api.commands.JMXResult)3 Test (org.junit.Test)2 GitContext (io.fabric8.api.GitContext)1 LockHandle (io.fabric8.api.LockHandle)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Git (org.eclipse.jgit.api.Git)1 Ref (org.eclipse.jgit.lib.Ref)1 RevCommit (org.eclipse.jgit.revwalk.RevCommit)1 RevWalk (org.eclipse.jgit.revwalk.RevWalk)1