Search in sources :

Example 1 with MesosFrameworkObject

use of com.hubspot.mesos.json.MesosFrameworkObject in project Singularity by HubSpot.

the class SingularityMachineStatesTest method getMasterState.

private MesosMasterStateObject getMasterState(int numSlaves) {
    long now = System.currentTimeMillis();
    Map<String, Object> resources = new HashMap<>();
    resources.put("cpus", 10);
    resources.put("mem", 2000);
    Map<String, String> attributes = new HashMap<>();
    attributes.put("testKey", "testValue");
    List<MesosMasterSlaveObject> slaves = new ArrayList<>();
    for (Integer i = 0; i < numSlaves; i++) {
        slaves.add(new MesosMasterSlaveObject(i.toString(), i.toString(), String.format("localhost:505%s", i), now, new MesosResourcesObject(resources), attributes, new MesosResourcesObject(resources), new MesosResourcesObject(resources), new MesosResourcesObject(resources), new MesosResourcesObject(resources), "", true));
    }
    MesosFrameworkObject framework = new MesosFrameworkObject("", "", "", "", "", "", "", now, now, now, true, true, new MesosResourcesObject(resources), new MesosResourcesObject(resources), new MesosResourcesObject(resources), Collections.emptyList());
    return new MesosMasterStateObject("", "", "", "", now, "", now, now, "", "", "", 0, 0, "", "", "", Collections.emptyMap(), slaves, Collections.singletonList(framework));
}
Also used : MesosResourcesObject(com.hubspot.mesos.json.MesosResourcesObject) HashMap(java.util.HashMap) MesosFrameworkObject(com.hubspot.mesos.json.MesosFrameworkObject) MesosMasterSlaveObject(com.hubspot.mesos.json.MesosMasterSlaveObject) ArrayList(java.util.ArrayList) MesosMasterStateObject(com.hubspot.mesos.json.MesosMasterStateObject) MesosResourcesObject(com.hubspot.mesos.json.MesosResourcesObject) MesosMasterSlaveObject(com.hubspot.mesos.json.MesosMasterSlaveObject) MesosFrameworkObject(com.hubspot.mesos.json.MesosFrameworkObject) MesosMasterStateObject(com.hubspot.mesos.json.MesosMasterStateObject)

Aggregations

MesosFrameworkObject (com.hubspot.mesos.json.MesosFrameworkObject)1 MesosMasterSlaveObject (com.hubspot.mesos.json.MesosMasterSlaveObject)1 MesosMasterStateObject (com.hubspot.mesos.json.MesosMasterStateObject)1 MesosResourcesObject (com.hubspot.mesos.json.MesosResourcesObject)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1