Java Code Examples for org.apache.mesos.v1.scheduler.Protos.Event#Type

The following examples show how to use org.apache.mesos.v1.scheduler.Protos.Event#Type . 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: RecordIOOperatorChunkSizesTest.java    From mesos-rxjava with Apache License 2.0 5 votes vote down vote up
@Test
public void test() {
    final byte[] chunk = RecordIOUtils.createChunk(TestingProtos.SUBSCRIBED.toByteArray());
    final List<byte[]> bytes = RecordIOOperatorTest.partitionIntoArraysOfSize(chunk, chunkSize);
    final List<ByteBuf> chunks = CollectionUtils.listMap(bytes, Unpooled::copiedBuffer);

    final List<Event> events = RecordIOOperatorTest.runTestOnChunks(chunks);
    final List<Event.Type> eventTypes = CollectionUtils.listMap(events, Event::getType);

    assertThat(eventTypes).isEqualTo(newArrayList(Event.Type.SUBSCRIBED));
}
 
Example 2
Source File: VersionedMesosSchedulerImpl.java    From attic-aurora with Apache License 2.0 5 votes vote down vote up
private void initializeEventMetrics() {
  // For variable named metrics that are keyed on mesos enums, this ensures that we set
  // all possible metrics to 0.
  for (Event.Type type : Event.Type.values()) {
    this.counters.get(eventMetricNameCache.getUnchecked(type));
  }
}
 
Example 3
Source File: RecordIOOperatorTest.java    From mesos-rxjava with Apache License 2.0 4 votes vote down vote up
@Test
public void correctlyAbleToReadEventsFromEventsBinFile() throws Exception {
    final InputStream inputStream = this.getClass().getResourceAsStream("/events.bin");

    final List<ByteBuf> chunks = new ArrayList<>();
    final byte[] bytes = new byte[100];

    int read;
    while ((read = inputStream.read(bytes)) != -1) {
        chunks.add(Unpooled.copiedBuffer(bytes, 0, read));
    }

    final List<Event> events = runTestOnChunks(chunks);
    final List<Event.Type> eventTypes = CollectionUtils.listMap(events, Event::getType);

    assertThat(eventTypes).isEqualTo(newArrayList(
        Event.Type.SUBSCRIBED,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.OFFERS,
        Event.Type.HEARTBEAT,
        Event.Type.HEARTBEAT,
        Event.Type.HEARTBEAT
    ));
}
 
Example 4
Source File: VersionedMesosSchedulerImpl.java    From attic-aurora with Apache License 2.0 4 votes vote down vote up
@Override
public String load(Event.Type key) throws Exception {
  return EVENT_COUNTER_STAT_PREFIX + key.name();
}