use of com.hubspot.singularity.helpers.MesosProtosUtils in project Singularity by HubSpot.
the class SingularityMesosTaskBuilderTest method createMocks.
@Before
public void createMocks() {
pendingTask = new SingularityPendingTaskBuilder().setPendingTaskId(new SingularityPendingTaskId("test", "1", 0, 1, PendingType.IMMEDIATE, 0)).setUser(user).build();
final SingularitySlaveAndRackHelper slaveAndRackHelper = mock(SingularitySlaveAndRackHelper.class);
final ExecutorIdGenerator idGenerator = mock(ExecutorIdGenerator.class);
when(idGenerator.getNextExecutorId()).then(new CreateFakeId());
objectMapper = new ObjectMapper();
objectMapper.registerModule(new ProtobufModule());
objectMapper.registerModule(new GuavaModule());
builder = new SingularityMesosTaskBuilder(objectMapper, idGenerator, configuration, new MesosProtosUtils(objectMapper));
taskResources = new Resources(1, 1, 0, 0);
executorResources = new Resources(0.1, 1, 0, 0);
when(slaveAndRackHelper.getRackId(offer)).thenReturn(Optional.absent());
when(slaveAndRackHelper.getMaybeTruncatedHost(offer)).thenReturn("host");
when(slaveAndRackHelper.getRackIdOrDefault(offer)).thenReturn("DEFAULT");
offer = Offer.newBuilder().setAgentId(AgentID.newBuilder().setValue("1")).setId(OfferID.newBuilder().setValue("1")).setFrameworkId(FrameworkID.newBuilder().setValue("1")).setHostname("test").build();
offerHolder = new SingularityOfferHolder(Collections.singletonList(offer), 1, "DEFAULT", offer.getAgentId().getValue(), offer.getHostname(), Collections.emptyMap(), Collections.emptyMap());
}
Aggregations