Search in sources :

Example 1 with TicketRegistry

use of org.apereo.cas.ticket.registry.TicketRegistry in project cas by apereo.

the class SessionHealthIndicatorTests method addTicketsToRegistry.

private static void addTicketsToRegistry(final TicketRegistry registry, final int tgtCount, final int stCount) {
    val ticket = new TicketGrantingTicketImpl[] { null };
    IntStream.range(0, tgtCount).forEach(Unchecked.intConsumer(i -> {
        ticket[0] = new TicketGrantingTicketImpl(GENERATOR.getNewTicketId("TGT"), CoreAuthenticationTestUtils.getAuthentication(), TEST_EXP_POLICY);
        registry.addTicket(ticket[0]);
    }));
    if (ticket[0] != null) {
        val testService = getService("junit");
        IntStream.range(0, stCount).forEach(Unchecked.intConsumer(i -> registry.addTicket(ticket[0].grantServiceTicket(GENERATOR.getNewTicketId("ST"), testService, TEST_EXP_POLICY, false, true))));
    }
}
Also used : lombok.val(lombok.val) HardTimeoutExpirationPolicy(org.apereo.cas.ticket.expiration.HardTimeoutExpirationPolicy) Status(org.springframework.boot.actuate.health.Status) IntStream(java.util.stream.IntStream) BeforeEach(org.junit.jupiter.api.BeforeEach) DefaultTicketRegistry(org.apereo.cas.ticket.registry.DefaultTicketRegistry) Unchecked(org.jooq.lambda.Unchecked) lombok.val(lombok.val) WebApplicationServiceFactory(org.apereo.cas.authentication.principal.WebApplicationServiceFactory) UniqueTicketIdGenerator(org.apereo.cas.ticket.UniqueTicketIdGenerator) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) AbstractWebApplicationService(org.apereo.cas.authentication.principal.AbstractWebApplicationService) Test(org.junit.jupiter.api.Test) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) DefaultUniqueTicketIdGenerator(org.apereo.cas.util.DefaultUniqueTicketIdGenerator) TicketRegistry(org.apereo.cas.ticket.registry.TicketRegistry) ExpirationPolicy(org.apereo.cas.ticket.ExpirationPolicy) Assertions(org.junit.jupiter.api.Assertions) Tag(org.junit.jupiter.api.Tag) CoreAuthenticationTestUtils(org.apereo.cas.authentication.CoreAuthenticationTestUtils) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl)

Aggregations

IntStream (java.util.stream.IntStream)1 lombok.val (lombok.val)1 CoreAuthenticationTestUtils (org.apereo.cas.authentication.CoreAuthenticationTestUtils)1 AbstractWebApplicationService (org.apereo.cas.authentication.principal.AbstractWebApplicationService)1 WebApplicationServiceFactory (org.apereo.cas.authentication.principal.WebApplicationServiceFactory)1 ExpirationPolicy (org.apereo.cas.ticket.ExpirationPolicy)1 TicketGrantingTicketImpl (org.apereo.cas.ticket.TicketGrantingTicketImpl)1 UniqueTicketIdGenerator (org.apereo.cas.ticket.UniqueTicketIdGenerator)1 HardTimeoutExpirationPolicy (org.apereo.cas.ticket.expiration.HardTimeoutExpirationPolicy)1 DefaultTicketRegistry (org.apereo.cas.ticket.registry.DefaultTicketRegistry)1 TicketRegistry (org.apereo.cas.ticket.registry.TicketRegistry)1 DefaultUniqueTicketIdGenerator (org.apereo.cas.util.DefaultUniqueTicketIdGenerator)1 Unchecked (org.jooq.lambda.Unchecked)1 Assertions (org.junit.jupiter.api.Assertions)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Tag (org.junit.jupiter.api.Tag)1 Test (org.junit.jupiter.api.Test)1 Status (org.springframework.boot.actuate.health.Status)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1