use of io.gravitee.am.model.uma.Resource in project gravitee-access-management by gravitee-io.
the class ResourceServiceTest method getMetadata_resources.
@Test
public void getMetadata_resources() {
Resource resource = new Resource();
resource.setDomain(DOMAIN_ID);
resource.setClientId(CLIENT_ID);
resource.setUserId(USER_ID);
List<Resource> resources = Collections.singletonList(resource);
when(userService.findByIdIn(anyList())).thenReturn(Flowable.just(new User()));
when(applicationService.findByIdIn(anyList())).thenReturn(Flowable.just(new Application()));
TestObserver<Map<String, Map<String, Object>>> testObserver = service.getMetadata(resources).test();
testObserver.assertComplete().assertNoErrors();
}
use of io.gravitee.am.model.uma.Resource in project gravitee-access-management by gravitee-io.
the class ResourceServiceTest method delete.
@Test
public void delete() {
Resource toDelete = new Resource().setId(RESOURCE_ID).setDomain(DOMAIN_ID);
when(accessPolicyRepository.findByDomainAndResource(toDelete.getDomain(), toDelete.getId())).thenReturn(Flowable.empty());
when(repository.delete(RESOURCE_ID)).thenReturn(Completable.complete());
TestObserver testObserver = service.delete(toDelete).test();
testObserver.assertComplete().assertNoErrors();
verify(repository, times(1)).delete(RESOURCE_ID);
}
Aggregations