use of org.cloudfoundry.uaa.clients.Client in project cf-java-client by cloudfoundry.
the class ClientsTest method delete.
@Test
public void delete() {
String clientId = this.nameFactory.getClientId();
String clientSecret = this.nameFactory.getClientSecret();
requestCreateClient(this.uaaClient, clientId, clientSecret).then(this.uaaClient.clients().delete(DeleteClientRequest.builder().clientId(clientId).build())).thenMany(requestListClients(this.uaaClient)).filter(client -> clientId.equals(client.getClientId())).as(StepVerifier::create).expectComplete().verify(Duration.ofMinutes(5));
}
use of org.cloudfoundry.uaa.clients.Client in project cf-java-client by cloudfoundry.
the class ClientsTest method batchDelete.
@Test
public void batchDelete() {
String clientId1 = this.nameFactory.getClientId();
String clientId2 = this.nameFactory.getClientId();
String clientSecret = this.nameFactory.getClientSecret();
batchCreateClients(this.uaaClient, clientId1, clientId2, clientSecret).flatMapIterable(BatchCreateClientsResponse::getClients).map(Client::getClientId).collectList().flatMap(clientIds -> this.uaaClient.clients().batchDelete(BatchDeleteClientsRequest.builder().clientIds(clientIds).build())).thenMany(requestListClients(this.uaaClient)).filter(client -> clientId1.equals(client.getClientId()) || clientId2.equals(client.getClientId())).as(StepVerifier::create).expectComplete().verify(Duration.ofMinutes(5));
}
use of org.cloudfoundry.uaa.clients.Client in project cf-java-client by cloudfoundry.
the class ClientsTest method changeSecret.
@Test
public void changeSecret() {
String clientId = this.nameFactory.getClientId();
String newClientSecret = this.nameFactory.getClientSecret();
String oldClientSecret = this.nameFactory.getClientSecret();
requestCreateClient(this.uaaClient, clientId, oldClientSecret).then(this.uaaClient.clients().changeSecret(ChangeSecretRequest.builder().clientId(clientId).oldSecret(oldClientSecret).secret(newClientSecret).build())).as(StepVerifier::create).consumeErrorWith(t -> assertThat(t).isInstanceOf(UaaException.class).hasMessage("invalid_client: Only a client can change client secret")).verify(Duration.ofMinutes(5));
}
Aggregations