Java Code Examples for com.containersol.minimesos.state.State#fromJSON()

The following examples show how to use com.containersol.minimesos.state.State#fromJSON() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParseStateJSONTest.java    From minimesos with Apache License 2.0 6 votes vote down vote up
@Test
public void exampleStateJSONIsParsedCorrectly() throws JsonParseException, JsonMappingException {
    State parsedState = State.fromJSON(EXAMPLE_STATE_JSON);
    assertEquals("20150907-122934-3858764204-5050-23", parsedState.getId());
    assertEquals(1, parsedState.getFrameworks().size());
    Framework framework = parsedState.getFramework("elasticsearch");
    assertNotNull(framework);
    assertEquals("elasticsearch", framework.getName());
    assertEquals(true, framework.isActive());
    assertEquals(true, framework.isCheckpoint());
    assertEquals(2592000, framework.getFailoverTimeout());
    assertEquals("0f43d2f7606a", framework.getHostname());
    assertEquals("20150907-122934-3858764204-5050-23-0000", framework.getId());
    assertEquals("elasticsearch", framework.getName());
    assertEquals("*", framework.getRole());
    assertEquals("0.22.1", parsedState.getVersion());
    assertEquals(0, framework.getExecutors().size());
    assertEquals("29deeca9-0f28-4df7-af1d-14ae790044f6", framework.getTasks().get(0).getExecutorId());
    assertEquals("20150907-122934-3858764204-5050-23-0000", framework.getTasks().get(0).getFrameworkId());
}
 
Example 2
Source File: MesosContainerImpl.java    From minimesos with Apache License 2.0 5 votes vote down vote up
@Override
public State getState() {
    try {
        return State.fromJSON(getStateInfoJSON().toString());
    } catch (JsonParseException | JsonMappingException | UnirestException e) {
        throw new MinimesosException("Could not retrieve state from Mesos container: " + getName(), e);
    }
}
 
Example 3
Source File: FrameworkRoleSystemTest.java    From elasticsearch with Apache License 2.0 4 votes vote down vote up
public State getStateInfo(MesosCluster cluster) throws UnirestException, JsonParseException, JsonMappingException {
    return State.fromJSON(cluster.getClusterStateInfo().toString(2));
}