NovaService { public Flowable<MetricsDump> dumpMetricsContinuously (Duration interval) { return nova.metrics.dumpContinuously(interval); } protected  NovaService(Nova nova); protected  NovaService(Nova nova, ServiceDescriptor serviceDescriptor); void registerInitHandler(Runnable initHandler); void registerStartupHandler(Runnable startupHandler); void registerShutdownHandler(Runnable shutdownHandler); void start(); void shutdown(); boolean isStarted(); Flowable<MetricsDump> dumpMetricsContinuously(Duration interval); final Nova nova; }
@Test void metricsDumpContainsAdditionalInformation() throws Exception { InetAddress inetAddress = InetAddress.getLocalHost(); MyService sut = new MyService(new ServiceDescriptor("Name", "ID")); MetricsDump dump = sut .dumpMetricsContinuously(Duration.ofSeconds(1)) .blockingFirst(); assertThat(dump.additionalInfo.size(), is(5)); assertThat(dump.additionalInfo.get(0)._1, is("hostName")); assertThat(dump.additionalInfo.get(0)._2, is(inetAddress.getHostName())); assertThat(dump.additionalInfo.get(1)._1, is("hostAddress")); assertThat(dump.additionalInfo.get(1)._2, is(inetAddress.getHostAddress())); assertThat(dump.additionalInfo.get(2)._1, is("serviceName")); assertThat(dump.additionalInfo.get(2)._2, is("Name")); assertThat(dump.additionalInfo.get(3)._1, is("serviceInstanceId")); assertThat(dump.additionalInfo.get(3)._2, is("ID")); assertThat(dump.additionalInfo.get(4)._1, is("serviceInstanceName")); assertThat(dump.additionalInfo.get(4)._2, is("Name.ID")); }