use of org.eclipse.hono.telemetry.impl.TelemetryEndpoint in project hono by eclipse.
the class StandaloneTelemetryApiTest method prepareHonoServer.
/**
* Sets up the fixture common to all test cases.
*
* @param ctx The vert.x test context.
*/
@BeforeClass
public static void prepareHonoServer(final TestContext ctx) {
vertx = Vertx.vertx();
downstreamAdapter = new MessageDiscardingDownstreamAdapter(vertx);
final HonoMessagingConfigProperties configProperties = new HonoMessagingConfigProperties();
configProperties.setInsecurePort(0);
final TelemetryEndpoint telemetryEndpoint = new TelemetryEndpoint(vertx);
telemetryEndpoint.setMetrics(mock(MessagingMetrics.class));
telemetryEndpoint.setTelemetryAdapter(downstreamAdapter);
telemetryEndpoint.setRegistrationAssertionValidator(assertionHelper);
telemetryEndpoint.setConfiguration(configProperties);
server = new HonoMessaging();
server.setSaslAuthenticatorFactory(new HonoSaslAuthenticatorFactory(TestSupport.createAuthenticationService(createUser())));
server.setConfig(configProperties);
server.addEndpoint(telemetryEndpoint);
final Future<String> serverTracker = Future.future();
vertx.deployVerticle(server, serverTracker.completer());
serverTracker.compose(s -> {
final ClientConfigProperties clientProps = new ClientConfigProperties();
clientProps.setName("test");
clientProps.setHost(server.getInsecurePortBindAddress());
clientProps.setPort(server.getInsecurePort());
clientProps.setUsername(USER);
clientProps.setPassword(PWD);
client = new HonoClientImpl(vertx, clientProps);
return client.connect(new ProtonClientOptions());
}).setHandler(ctx.asyncAssertSuccess());
}
Aggregations