コード例 #1
0
  @Test
  public void shouldCreateMeasurementStreams() {
    sessionManager.startMobileSession(false);

    triggerMeasurement();

    MeasurementStream expected = lastEvent.stream();
    Collection<MeasurementStream> streams = sessionManager.getMeasurementStreams();

    assertThat(streams, hasItem(expected));
  }
コード例 #2
0
  @Test
  public void shouldCreateAStreamForEachSensor() {
    sessionManager.startMobileSession(false);

    triggerMeasurement();
    SensorEvent event =
        new SensorEvent("CERN", "LHC2", "Siggh boson", "SB", "number", "#", 1, 2, 3, 4, 5, 10);
    sessionManager.onEvent(event);

    MeasurementStream expected = event.stream();
    assertThat(sessionManager.getMeasurementStreams(), hasItem(expected));
  }
コード例 #3
0
  private MeasurementStream prepareStream(SensorEvent event) {
    String sensorName = event.getSensorName();

    if (!session.hasStream(sensorName)) {
      MeasurementStream stream = event.stream();
      tracker.addStream(stream);
    }

    MeasurementStream stream = session.getStream(sensorName);
    if (stream.isVisible()) {
      stream.markAs(MeasurementStream.Visibility.VISIBLE_RECONNECTED);
    }

    return stream;
  }