GraphResourceRepository extends GraphGenericRepository<ResourceEntity> implements ResourceRepository, ResourceHierarchicalRepository { @Override public <S extends ResourceEntity> S findOne(final Example<S> example) { throw new UnsupportedOperationException(MESSAGE); }  @Override ResourceEntity getByZoneAndResourceIdentifier(final ZoneEntity zone, final String resourceIdentifier); @Override ResourceEntity getResourceWithInheritedAttributes(final ZoneEntity zone, final String resourceIdentifier); @Override Set<String> getResourceEntityAndDescendantsIds(final ResourceEntity entity); @Override List<S> findAll(final Example<S> example); @Override List<S> findAll(final Example<S> example, final Sort sort); @Override S findOne(final Example<S> example); @Override Page<S> findAll(final Example<S> example, final Pageable pageable); @Override long count(final Example<S> example); @Override boolean exists(final Example<S> example); static final String RESOURCE_LABEL; static final String RESOURCE_ID_KEY; }
@Test(threadPoolSize = CONCURRENT_TEST_THREAD_COUNT, invocationCount = CONCURRENT_TEST_INVOCATIONS) public void testDelete() { ResourceEntity resourceEntity = persistRandomResourcetoZone1AndAssert(); long id = resourceEntity.getId(); this.resourceRepository.delete(id); assertThat(this.resourceRepository.findOne(id), nullValue()); }
@Test(threadPoolSize = CONCURRENT_TEST_THREAD_COUNT, invocationCount = CONCURRENT_TEST_INVOCATIONS) public void testDeleteMultiple() { List<ResourceEntity> resourceEntities = new ArrayList<>(); ResourceEntity resourceEntity1 = persistRandomResourcetoZone1AndAssert(); Long resourceId1 = resourceEntity1.getId(); resourceEntities.add(resourceEntity1); ResourceEntity resourceEntity2 = persistRandomResourcetoZone1AndAssert(); Long resourceId2 = resourceEntity2.getId(); resourceEntities.add(resourceEntity2); this.resourceRepository.delete(resourceEntities); assertThat(this.resourceRepository.findOne(resourceId1), nullValue()); assertThat(this.resourceRepository.findOne(resourceId2), nullValue()); }