Search in sources :

Example 1 with TicketGrantingTicketIdGenerator

use of org.apereo.cas.util.TicketGrantingTicketIdGenerator in project cas by apereo.

the class JpaTicketRegistryTests method verifyLargeDataset.

@RepeatedTest(2)
public void verifyLargeDataset() throws Exception {
    val ticketGrantingTickets = Stream.generate(() -> {
        var ticketGrantingTicketId = new TicketGrantingTicketIdGenerator(10, StringUtils.EMPTY).getNewTicketId(TicketGrantingTicket.PREFIX);
        return new TicketGrantingTicketImpl(ticketGrantingTicketId, CoreAuthenticationTestUtils.getAuthentication(), NeverExpiresExpirationPolicy.INSTANCE);
    }).limit(COUNT);
    var stopwatch = new StopWatch();
    stopwatch.start();
    newTicketRegistry.addTicket(ticketGrantingTickets);
    assertEquals(COUNT, newTicketRegistry.getTickets().size());
    stopwatch.stop();
    var time = stopwatch.getTime(TimeUnit.SECONDS);
    assertTrue(time <= 20);
}
Also used : lombok.val(lombok.val) TicketGrantingTicketIdGenerator(org.apereo.cas.util.TicketGrantingTicketIdGenerator) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) StopWatch(org.apache.commons.lang3.time.StopWatch) RepeatedTest(org.junit.jupiter.api.RepeatedTest)

Aggregations

lombok.val (lombok.val)1 StopWatch (org.apache.commons.lang3.time.StopWatch)1 TicketGrantingTicketImpl (org.apereo.cas.ticket.TicketGrantingTicketImpl)1 TicketGrantingTicketIdGenerator (org.apereo.cas.util.TicketGrantingTicketIdGenerator)1 RepeatedTest (org.junit.jupiter.api.RepeatedTest)1