@Test public void testTransportRuntimeTaskFailure() { String mockBackendName = "backend"; String testTransport = "testTransport"; TransportRuntime runtime = new TransportRuntime( fixedClock(EVENT_MILLIS), fixedClock(UPTIME_MILLIS), new ImmediateScheduler(Runnable::run, mockRegistry), new Uploader(null, null, null, null, null, null, () -> 2), mockInitializer); verify(mockInitializer, times(1)).ensureContextsScheduled(); when(mockRegistry.get(mockBackendName)).thenReturn(mockBackend); when(mockBackend.decorate(any())).thenThrow(new IllegalArgumentException()); TransportFactory factory = runtime.newFactory(mockBackendName); Transport<String> transport = factory.getTransport(testTransport, String.class, String::getBytes); Event<String> stringEvent = Event.ofTelemetry(12, "TelemetryData"); StatefulTransportScheduleCallback callback = new StatefulTransportScheduleCallback(); transport.schedule(stringEvent, callback); assertThat(callback.called).isTrue(); assertThat(callback.exception).isInstanceOf(IllegalArgumentException.class); }
@Deprecated public TransportFactory newFactory(String backendName) { return new TransportFactoryImpl( getSupportedEncodings(null), TransportContext.builder().setBackendName(backendName).build(), this); }
TransportRuntime implements TransportInternal { @Deprecated public TransportFactory newFactory(String backendName) { return new TransportFactoryImpl( getSupportedEncodings(null), TransportContext.builder().setBackendName(backendName).build(), this); } }
TransportRuntime implements TransportInternal { @Deprecated public TransportFactory newFactory(String backendName) { return new TransportFactoryImpl( getSupportedEncodings(null), TransportContext.builder().setBackendName(backendName).build(), this); } @Inject  TransportRuntime(
      @WallTime Clock eventClock,
      @Monotonic Clock uptimeClock,
      Scheduler scheduler,
      Uploader uploader,
      WorkInitializer initializer); }
TransportRuntime implements TransportInternal { @Deprecated public TransportFactory newFactory(String backendName) { return new TransportFactoryImpl( getSupportedEncodings(null), TransportContext.builder().setBackendName(backendName).build(), this); } @Inject  TransportRuntime(
      @WallTime Clock eventClock,
      @Monotonic Clock uptimeClock,
      Scheduler scheduler,
      Uploader uploader,
      WorkInitializer initializer); static void initialize(Context applicationContext); static TransportRuntime getInstance(); @Deprecated TransportFactory newFactory(String backendName); TransportFactory newFactory(Destination destination); @RestrictTo(RestrictTo.Scope.LIBRARY) Uploader getUploader(); @Override void send(SendRequest request, TransportScheduleCallback callback); }
TransportRuntime implements TransportInternal { @Deprecated public TransportFactory newFactory(String backendName) { return new TransportFactoryImpl( getSupportedEncodings(null), TransportContext.builder().setBackendName(backendName).build(), this); } @Inject  TransportRuntime(
      @WallTime Clock eventClock,
      @Monotonic Clock uptimeClock,
      Scheduler scheduler,
      Uploader uploader,
      WorkInitializer initializer); static void initialize(Context applicationContext); static TransportRuntime getInstance(); @Deprecated TransportFactory newFactory(String backendName); TransportFactory newFactory(Destination destination); @RestrictTo(RestrictTo.Scope.LIBRARY) Uploader getUploader(); @Override void send(SendRequest request, TransportScheduleCallback callback);  }