use of javax.persistence.NoResultException in project webpieces by deanhiller.
the class UserDbo method findWithJoin.
public static UserDbo findWithJoin(EntityManager mgr, int id) {
Query query = mgr.createNamedQuery("findByIdWithRoleJoin");
query.setParameter("id", id);
try {
return (UserDbo) query.getSingleResult();
} catch (NoResultException e) {
return null;
}
}
use of javax.persistence.NoResultException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_DistinctionsTest method testDeleteDistinction.
@Test
public void testDeleteDistinction() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0002", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewDistinction("0000-0000-0000-0002", 1000L);
assertNotNull(response);
Distinction distinction = (Distinction) response.getEntity();
assertNotNull(distinction);
response = serviceDelegator.deleteAffiliation("0000-0000-0000-0002", 1000L);
assertNotNull(response);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
try {
serviceDelegator.viewDistinction("0000-0000-0000-0002", 1000L);
fail();
} catch (NoResultException nre) {
} catch (Exception e) {
fail();
}
}
use of javax.persistence.NoResultException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_EmploymentsTest method testDeleteEmployment.
@Test
public void testDeleteEmployment() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0002", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewEmployment("0000-0000-0000-0002", 1002L);
assertNotNull(response);
Employment employment = (Employment) response.getEntity();
assertNotNull(employment);
response = serviceDelegator.deleteAffiliation("0000-0000-0000-0002", 1002L);
assertNotNull(response);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
try {
serviceDelegator.viewEmployment("0000-0000-0000-0002", 1002L);
fail();
} catch (NoResultException nre) {
} catch (Exception e) {
fail();
}
}
use of javax.persistence.NoResultException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_InvitedPositionsTest method testDeleteInvitedPosition.
@Test
public void testDeleteInvitedPosition() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0002", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewInvitedPosition("0000-0000-0000-0002", 1003L);
assertNotNull(response);
InvitedPosition invitedPosition = (InvitedPosition) response.getEntity();
assertNotNull(invitedPosition);
response = serviceDelegator.deleteAffiliation("0000-0000-0000-0002", 1003L);
assertNotNull(response);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
try {
serviceDelegator.viewInvitedPosition("0000-0000-0000-0002", 1003L);
fail();
} catch (NoResultException nre) {
} catch (Exception e) {
fail();
}
}
use of javax.persistence.NoResultException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_MembershipsTest method testDeleteMembership.
@Test
public void testDeleteMembership() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0002", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewMembership("0000-0000-0000-0002", 1004L);
assertNotNull(response);
Membership membership = (Membership) response.getEntity();
assertNotNull(membership);
response = serviceDelegator.deleteAffiliation("0000-0000-0000-0002", 1004L);
assertNotNull(response);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
try {
serviceDelegator.viewMembership("0000-0000-0000-0002", 1004L);
fail();
} catch (NoResultException nre) {
} catch (Exception e) {
fail();
}
}
Aggregations