use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class ServiceTicketImplTests method verifyNoService.
@Test
public void verifyNoService() {
this.thrown.expect(Exception.class);
new ServiceTicketImpl(ST_ID, tgt, null, false, new NeverExpiresExpirationPolicy());
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class TicketGrantingTicketImplTests method verifyWebApplicationServices.
@Test
public void verifyWebApplicationServices() {
final Service testService = RegisteredServiceTestUtils.getService(TGT_ID);
final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), testService, new NeverExpiresExpirationPolicy(), false, true);
Map<String, Service> services = t.getServices();
assertEquals(1, services.size());
final String ticketId = services.keySet().iterator().next();
assertEquals(testService, services.get(ticketId));
t.removeAllServices();
services = t.getServices();
assertEquals(0, services.size());
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class AbstractTicketRegistryTests method verifyGetExistingTicketWithProperClass.
@Test
public void verifyGetExistingTicketWithProperClass() {
try {
this.ticketRegistry.addTicket(new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
this.ticketRegistry.getTicket(TicketGrantingTicket.PREFIX, TicketGrantingTicket.class);
} catch (final Exception e) {
throw new AssertionError(EXCEPTION_CAUGHT_NONE_EXPECTED, e);
}
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class AbstractTicketRegistryTests method verifyGetExistingTicketWithImproperClass.
@Test
public void verifyGetExistingTicketWithImproperClass() {
try {
this.ticketRegistry.addTicket(new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
assertNull(this.ticketRegistry.getTicket(TicketGrantingTicket.PREFIX, ServiceTicket.class));
} catch (final ClassCastException e) {
return;
}
throw new AssertionError("ClassCastException expected");
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class AbstractTicketRegistryTests method verifyDeleteNullTicket.
@Test
public void verifyDeleteNullTicket() {
try {
this.ticketRegistry.addTicket(new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
assertFalse("Ticket was deleted.", this.ticketRegistry.deleteTicket(null) == 1);
} catch (final Exception e) {
throw new AssertionError(EXCEPTION_CAUGHT_NONE_EXPECTED + e.getMessage(), e);
}
}
Aggregations