Search in sources :

Example 21 with PublisherIdentifier

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

the class RegisteredServiceHazelcastDistributedCacheManagerTests method verifyAction.

@Test
public void verifyAction() {
    val registeredService = RegisteredServiceTestUtils.getRegisteredService();
    var obj = mgr.get(registeredService);
    assertNull(obj);
    assertFalse(mgr.contains(registeredService));
    val id = new PublisherIdentifier();
    val cache = DistributedCacheObject.<RegisteredService>builder().value(registeredService).publisherIdentifier(id).build();
    mgr.set(registeredService, cache, true);
    assertFalse(mgr.getAll().isEmpty());
    obj = mgr.get(registeredService);
    assertNotNull(obj);
    val c = mgr.findAll(obj1 -> obj1.getValue().equals(registeredService));
    assertFalse(c.isEmpty());
    mgr.remove(registeredService, cache, true);
    assertTrue(mgr.getAll().isEmpty());
}
Also used : lombok.val(lombok.val) PublisherIdentifier(org.apereo.cas.util.PublisherIdentifier) Test(org.junit.jupiter.api.Test)

Example 22 with PublisherIdentifier

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

the class JmsTicketRegistryConfiguration method messageQueueTicketRegistryIdentifier.

@ConditionalOnMissingBean(name = "messageQueueTicketRegistryIdentifier")
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public PublisherIdentifier messageQueueTicketRegistryIdentifier(final CasConfigurationProperties casProperties) {
    val bean = new PublisherIdentifier();
    val jms = casProperties.getTicket().getRegistry().getJms();
    if (StringUtils.isNotBlank(jms.getQueueIdentifier())) {
        bean.setId(jms.getQueueIdentifier());
    }
    return bean;
}
Also used : lombok.val(lombok.val) PublisherIdentifier(org.apereo.cas.util.PublisherIdentifier) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 23 with PublisherIdentifier

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

the class UpdateTicketMessageQueueCommandTests method verifyUpdateTicket.

@Test
public void verifyUpdateTicket() throws Exception {
    var ticket = new TicketGrantingTicketImpl("TGT", CoreAuthenticationTestUtils.getAuthentication(), NeverExpiresExpirationPolicy.INSTANCE);
    val cmd = new UpdateTicketMessageQueueCommand(new PublisherIdentifier(), ticket);
    cmd.execute(ticketRegistry.getObject());
    ticket = ticketRegistry.getObject().getTicket(ticket.getId(), ticket.getClass());
    assertNotNull(ticket);
    assertEquals("TGT", ticket.getId());
}
Also used : lombok.val(lombok.val) UpdateTicketMessageQueueCommand(org.apereo.cas.ticket.queue.UpdateTicketMessageQueueCommand) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) PublisherIdentifier(org.apereo.cas.util.PublisherIdentifier) Test(org.junit.jupiter.api.Test)

Example 24 with PublisherIdentifier

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

the class AddTicketMessageQueueCommandTests method verifyAddTicket.

@Test
public void verifyAddTicket() throws Exception {
    var ticket = new TicketGrantingTicketImpl("TGT", CoreAuthenticationTestUtils.getAuthentication(), NeverExpiresExpirationPolicy.INSTANCE);
    ticketRegistry.getObject().addTicket(ticket);
    val cmd = new AddTicketMessageQueueCommand(new PublisherIdentifier(), ticket);
    cmd.execute(ticketRegistry.getObject());
    ticket = ticketRegistry.getObject().getTicket(ticket.getId(), ticket.getClass());
    assertNotNull(ticket);
    assertEquals("TGT", ticket.getId());
}
Also used : lombok.val(lombok.val) AddTicketMessageQueueCommand(org.apereo.cas.ticket.queue.AddTicketMessageQueueCommand) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) PublisherIdentifier(org.apereo.cas.util.PublisherIdentifier) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)24 PublisherIdentifier (org.apereo.cas.util.PublisherIdentifier)24 Test (org.junit.jupiter.api.Test)23 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)13 InMemoryServiceRegistry (org.apereo.cas.services.InMemoryServiceRegistry)7 StaticApplicationContext (org.springframework.context.support.StaticApplicationContext)7 CasRegisteredServiceDeletedEvent (org.apereo.cas.support.events.service.CasRegisteredServiceDeletedEvent)5 TicketGrantingTicketImpl (org.apereo.cas.ticket.TicketGrantingTicketImpl)4 DistributedCacheObject (org.apereo.cas.util.cache.DistributedCacheObject)4 File (java.io.File)3 RegisteredService (org.apereo.cas.services.RegisteredService)3 CasRegisteredServiceSavedEvent (org.apereo.cas.support.events.service.CasRegisteredServiceSavedEvent)3 RegexRegisteredService (org.apereo.cas.services.RegexRegisteredService)2 RegisteredServiceJsonSerializer (org.apereo.cas.services.util.RegisteredServiceJsonSerializer)2 CasRegisteredServiceLoadedEvent (org.apereo.cas.support.events.service.CasRegisteredServiceLoadedEvent)2 Assertions (org.junit.jupiter.api.Assertions)2 Tag (org.junit.jupiter.api.Tag)2 Executable (org.junit.jupiter.api.function.Executable)2 Objects (java.util.Objects)1 UUID (java.util.UUID)1