use of org.apereo.cas.util.PublisherIdentifier in project cas by apereo.
the class DistributedCacheObjectTests method verifySerialization.
@Test
public void verifySerialization() throws Exception {
val o = DistributedCacheObject.<String>builder().value("objectValue").publisherIdentifier(new PublisherIdentifier()).build();
val file = new File(FileUtils.getTempDirectoryPath(), UUID.randomUUID().toString() + ".json");
MAPPER.writeValue(file, o);
val readPolicy = MAPPER.readValue(file, DistributedCacheObject.class);
assertEquals(o, readPolicy);
}
use of org.apereo.cas.util.PublisherIdentifier in project cas by apereo.
the class DistributedCacheObjectTests method verifyNullValue.
@Test
public void verifyNullValue() {
val o = DistributedCacheObject.<String>builder().value("objectValue").publisherIdentifier(new PublisherIdentifier()).build();
assertTrue(o.getProperties().isEmpty());
o.getProperties().put("key", null);
o.getProperties().put("key2", "12.54");
assertNull(o.getProperty("nothing", String.class));
assertNull(o.getProperty("key", String.class));
assertThrows(ClassCastException.class, () -> o.getProperty("key2", Long.class));
}
use of org.apereo.cas.util.PublisherIdentifier in project cas by apereo.
the class DistributedCacheObjectTests method verifyAction.
@Test
public void verifyAction() {
val o = DistributedCacheObject.<String>builder().value("objectValue").publisherIdentifier(new PublisherIdentifier()).build();
assertNotNull(o.toString());
assertNotNull(o.getValue());
assertTrue(o.getTimestamp() > 0);
assertTrue(o.getProperties().isEmpty());
o.getProperties().put("key", "value");
assertFalse(o.getProperties().isEmpty());
assertNotNull(o.getProperty("key", String.class));
assertTrue(o.containsProperty("key"));
}
use of org.apereo.cas.util.PublisherIdentifier in project cas by apereo.
the class DeleteTicketsMessageQueueCommandTests method verifyDeleteTickets.
@Test
public void verifyDeleteTickets() throws Exception {
val ticket = new TicketGrantingTicketImpl("TGT", CoreAuthenticationTestUtils.getAuthentication(), NeverExpiresExpirationPolicy.INSTANCE);
ticketRegistry.getObject().addTicket(ticket);
val cmd = new DeleteTicketsMessageQueueCommand(new PublisherIdentifier());
cmd.execute(ticketRegistry.getObject());
assertTrue(ticketRegistry.getObject().getTickets().isEmpty());
}
use of org.apereo.cas.util.PublisherIdentifier in project cas by apereo.
the class DeleteTicketMessageQueueCommandTests method verifyDeleteTicket.
@Test
public void verifyDeleteTicket() throws Exception {
val ticket = new TicketGrantingTicketImpl("TGT", CoreAuthenticationTestUtils.getAuthentication(), NeverExpiresExpirationPolicy.INSTANCE);
ticketRegistry.getObject().addTicket(ticket);
val cmd = new DeleteTicketMessageQueueCommand(new PublisherIdentifier(), ticket.getId());
cmd.execute(ticketRegistry.getObject());
assertTrue(ticketRegistry.getObject().getTickets().isEmpty());
}
Aggregations