use of org.eclipse.hono.service.management.credentials.PskSecret in project hono by eclipse.
the class RegistryServiceTest method testGetDisabledCredentials.
@Test
void testGetDisabledCredentials(final VertxTestContext context) {
Future.succeededFuture().flatMap(x -> {
final var device = new Device();
return this.registrationManagement.createDevice(DEFAULT_TENANT, Optional.of("d1"), device, SPAN).onComplete(context.succeeding(result -> {
context.verify(() -> {
assertThat(result.getStatus()).isEqualTo(HttpURLConnection.HTTP_CREATED);
});
}));
}).flatMap(x -> {
final var credentials = new LinkedList<CommonCredential>();
final var psk = new PskCredential("a1", List.of(new PskSecret().setKey(new byte[] { 1, 2, 3, 4 })));
psk.setEnabled(false);
credentials.add(psk);
return this.credentialsManagement.updateCredentials(DEFAULT_TENANT, "d1", credentials, Optional.empty(), SPAN).onFailure(context::failNow);
}).flatMap(x -> {
return this.credentialsAdapter.get(DEFAULT_TENANT, CredentialsConstants.SECRETS_TYPE_PRESHARED_KEY, "d1").onComplete(context.succeeding(result -> {
context.verify(() -> {
assertThat(result.getStatus()).isEqualTo(HttpURLConnection.HTTP_NOT_FOUND);
});
}));
}).onComplete(context.succeedingThenComplete());
}
Aggregations