Java 类org.springframework.orm.jpa.JpaObjectRetrievalFailureException 实例源码

项目:plugin-prov    文件:ProvQuoteStorageResourceTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void updateStorageUnknownInstance() {
    final QuoteStorageEditionVo vo = new QuoteStorageEditionVo();
    vo.setSubscription(subscription);
    vo.setId(qsRepository.findByNameExpected("server1-root").getId());
    vo.setName("server1-root-bis");
    vo.setType("storage1");
    vo.setQuoteInstance(-1);
    vo.setSize(1);
    sResource.update(vo);
}
项目:bootstrap    文件:AuthorizationResourceTest.java   
/**
 * test create service without a valid role.
 */
@Test(expected = JpaObjectRetrievalFailureException.class)
public void testCreateNoRole() {
    final AuthorizationEditionVo authorization = new AuthorizationEditionVo();
    authorization.setRole(-1);
    authorization.setPattern("any");
    resource.create(authorization);
}
项目:bootstrap    文件:AuthorizationResourceTest.java   
/**
 * test update service without a valid role.
 */
@Test(expected = JpaObjectRetrievalFailureException.class)
public void testUpdateNoRole() {
    final AuthorizationEditionVo authorization = new AuthorizationEditionVo();
    authorization.setRole(-1);
    authorization.setPattern("pattern");
    resource.update(authorizationId, authorization);
}
项目:bootstrap    文件:RestRepositoryImplTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void deleteAllExpectedFailed() {
    final SystemDialect systemDialect = repository.findAll().get(1);
    Assert.assertFalse(repository.findAll().isEmpty());
    final List<Integer> list = new ArrayList<>();
    list.add(systemDialect.getId());
    list.add(-1);
    repository.deleteAllExpected(list);
}
项目:strategy-spring-security-acl    文件:MultithreadCustomerRepositoryTest.java   
@Test
public void should_getOne_retrieve_customers() throws InterruptedException {
    prepareTaskAs(() -> assertThat(catchExec(() -> repository.getOne(johnDoe.getId())))
            .isInstanceOf(JpaObjectRetrievalFailureException.class), "Smith");
    prepareTaskAs(() -> assertThat(repository.getOne(johnDoe.getId())).isEqualTo(johnDoe), "Doe");
    prepareTaskAs(() -> assertThat(repository.getOne(aliceSmith.getId())).isEqualTo(aliceSmith), "Smith");
    prepareTaskAs(() -> assertThat(catchExec(() -> repository.getOne(aliceSmith.getId())))
            .isInstanceOf(JpaObjectRetrievalFailureException.class), "Doe");
    waitForAssertions();
}
项目:plugin-bt    文件:BugTrackerResourceTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void deleteUnknown() {
    resource.delete(-1, false);
}
项目:plugin-prov    文件:ProvQuoteStorageResourceTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void findStorageTypeNotExistsSubscription() {
    sResource.findType(-1, newUriInfo());
}
项目:plugin-prov    文件:ProvQuoteInstanceResourceTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void findInstancePriceTermNotExistsSubscription() {
    iResource.findPriceTerm(-1, newUriInfo());
}
项目:plugin-prov    文件:ProvQuoteInstanceResourceTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void findInstanceNotExistsSubscription() {
    iResource.findAll(-1, newUriInfo());
}
项目:plugin-prov    文件:ProvQuoteInstanceResourceTest.java   
/**
 * Expected usage does not exist at all.
 */
@Test(expected = JpaObjectRetrievalFailureException.class)
public void uploadInvalidUsage() throws IOException {
    iResource.upload(subscription, new ByteArrayInputStream("ANY;0.5;500;LINUX;any".getBytes("UTF-8")),
            new String[] { "name", "cpu", "ram", "os", "usage" }, "on-demand2", 1, "UTF-8");
}
项目:plugin-id    文件:ContainerScopeResourceTest.java   
/**
 * test {@link ContainerScopeResource#findById(int)}
 */
@Test(expected = JpaObjectRetrievalFailureException.class)
public void findByIdInvalid() {
    Assert.assertNull(resource.findById(0));
}
项目:bootstrap    文件:JpaObjectRetrievalFailureExceptionMapper.java   
@Override
public Response toResponse(final JpaObjectRetrievalFailureException exception) {
    return toResponseNotFound(exception.getCause());
}
项目:bootstrap    文件:ExceptionMapperResource.java   
@DELETE
@Path("jpaObjectRetrievalFailureException")
public void throwJpaObjectRetrievalFailureException() {
    throw new JpaObjectRetrievalFailureException(new EntityNotFoundException("key"));
}
项目:bootstrap    文件:RoleRessourceTest.java   
/**
 * test find by id service. Id is not in database
 */
@Test(expected = JpaObjectRetrievalFailureException.class)
public void testFindByIdNotFound() {
    resource.findById(-1);
}
项目:bootstrap    文件:AuthorizationResourceTest.java   
/**
 * test update service without a valid identifier.
 */
@Test(expected = JpaObjectRetrievalFailureException.class)
public void testUpdateInvalidId() {
    resource.update(-1, null);
}
项目:bootstrap    文件:JpaObjectRetrievalFailureExceptionMapperTest.java   
@Test
public void toResponse() {
    final JpaObjectRetrievalFailureException exception = new JpaObjectRetrievalFailureException(new EntityNotFoundException("key"));
    check(mock(new JpaObjectRetrievalFailureExceptionMapper()).toResponse(exception), 404,
            "{\"code\":\"entity\",\"message\":\"key\",\"parameters\":null,\"cause\":null}");
}
项目:bootstrap    文件:RestRepositoryImplTest.java   
/**
 * Find one without expected result.
 */
@Test(expected = JpaObjectRetrievalFailureException.class)
public void findOneExpectedError() {
    repository.findOneExpected(-1);
}
项目:bootstrap    文件:RestRepositoryImplTest.java   
/**
 * Find by name without expected result.
 */
@Test(expected = JpaObjectRetrievalFailureException.class)
public void findByNameExpectedError() {
    roleRepository.findByNameExpected("any");
}
项目:bootstrap    文件:RestRepositoryImplTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void deleteNoFetchError() {
    SystemDialect systemDialect = repository.findAll().get(1);
    repository.deleteNoFetch(systemDialect.getId());
    repository.deleteNoFetch(systemDialect.getId());
}
项目:bootstrap    文件:RestRepositoryImplTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void existExpectedFail() {
    repository.existExpected(-1);
}
项目:plugin-bt-jira    文件:JiraImportPluginResourceTest.java   
@Test
public void testUploadInvalidSubscription() throws Exception {
    thrown.expect(JpaObjectRetrievalFailureException.class);
    resource.upload(new StringInputStream("id;"), ENCODING, -1, UploadMode.VALIDATION);
}
项目:plugin-bt-jira    文件:BugTrackerResourceTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void deleteUnknown() {
    resource.delete(-1, false);
}
项目:strategy-spring-security-acl    文件:CustomerRepositoryTest.java   
@Test(expected = JpaObjectRetrievalFailureException.class)
public void should_not_getOne_member_of_Doe_family_with_method_query() {
  assertThat(repository.getOne(johnDoe.getId())).isNull();
}