use of org.eclipse.hono.util.CredentialsConstants in project hono by eclipse.
the class CredentialsHttpIT method testGetCredentialsForDeviceRegardlessOfType.
/**
* Verifies that the service returns all credentials registered for a given device regardless of type.
* <p>
* The returned JsonObject must consist of the total number of entries and contain all previously added credentials
* in the provided JsonArray that is found under the key of the endpoint {@link CredentialsConstants#CREDENTIALS_ENDPOINT}.
*
* @param context The vert.x test context.
* @throws InterruptedException if registration of credentials is interrupted.
*/
@Test
public void testGetCredentialsForDeviceRegardlessOfType(final TestContext context) throws InterruptedException {
final String pskAuthId = getRandomAuthId(TEST_AUTH_ID);
final List<JsonObject> credentialsToAdd = new ArrayList<>();
for (int i = 0; i < 5; i++) {
final JsonObject requestBody = newPskCredentials(deviceId, pskAuthId);
requestBody.put(CredentialsConstants.FIELD_TYPE, "type" + i);
credentialsToAdd.add(requestBody);
}
addMultipleCredentials(credentialsToAdd).compose(ar -> registry.getCredentials(TENANT, deviceId)).setHandler(context.asyncAssertSuccess(b -> {
assertResponseBodyContainsAllCredentials(context, b.toJsonObject(), credentialsToAdd);
}));
}
Aggregations