use of java.util.Collection in project spring-boot-admin by codecentric.
the class HazelcastJournaledEventStoreTest method test_store.
@Test
public void test_store() {
Application application = Application.create("foo").withId("bar").withHealthUrl("http://health").build();
List<ClientApplicationEvent> events = Arrays.asList(new ClientApplicationRegisteredEvent(application), new ClientApplicationDeregisteredEvent(application));
for (ClientApplicationEvent event : events) {
store.store(event);
}
// Items are stored in reverse order
List<ClientApplicationEvent> reversed = new ArrayList<>(events);
Collections.reverse(reversed);
assertThat(store.findAll(), is((Collection<ClientApplicationEvent>) reversed));
}
use of java.util.Collection in project spring-boot-admin by codecentric.
the class SimpleJournaledEventStoreTest method test_store.
@Test
public void test_store() {
SimpleJournaledEventStore store = new SimpleJournaledEventStore();
Application application = Application.create("foo").withId("bar").withHealthUrl("http://health").build();
List<ClientApplicationEvent> events = Arrays.asList(new ClientApplicationRegisteredEvent(application), new ClientApplicationDeregisteredEvent(application));
for (ClientApplicationEvent event : events) {
store.store(event);
}
assertThat(store.findAll(), is((Collection<ClientApplicationEvent>) Arrays.asList(events.get(1), events.get(0))));
}
use of java.util.Collection in project spring-boot-admin by codecentric.
the class SimpleJournaledEventStoreTest method test_store_capacity.
@Test
public void test_store_capacity() {
SimpleJournaledEventStore store = new SimpleJournaledEventStore();
store.setCapacity(2);
Application application = Application.create("foo").withId("bar").withHealthUrl("http://health").build();
List<ClientApplicationEvent> events = Arrays.asList(new ClientApplicationRegisteredEvent(application), new ClientApplicationDeregisteredEvent(application), new ClientApplicationDeregisteredEvent(application));
for (ClientApplicationEvent event : events) {
store.store(event);
}
assertThat(store.findAll(), is((Collection<ClientApplicationEvent>) Arrays.asList(events.get(2), events.get(1))));
}
use of java.util.Collection in project crate by crate.
the class ArrayType method value.
@Override
public Object[] value(Object value) {
if (value == null) {
return null;
}
Object[] result;
if (value instanceof Collection) {
Collection values = (Collection) value;
result = new Object[values.size()];
int idx = 0;
for (Object o : values) {
result[idx] = innerType.value(o);
idx++;
}
} else {
Object[] inputArray = (Object[]) value;
result = new Object[inputArray.length];
for (int i = 0; i < inputArray.length; i++) {
result[i] = innerType.value(inputArray[i]);
}
}
return result;
}
use of java.util.Collection in project cas by apereo.
the class LogoutManagerImpl method performLogoutForTicket.
private void performLogoutForTicket(final TicketGrantingTicket ticket, final List<LogoutRequest> logoutRequests) {
ticket.getServices().entrySet().stream().filter(entry -> entry.getValue() instanceof WebApplicationService).forEach(entry -> {
final Service service = entry.getValue();
LOGGER.debug("Handling single logout callback for [{}]", service);
final LogoutRequest logoutRequest = this.singleLogoutServiceMessageHandler.handle((WebApplicationService) service, entry.getKey());
if (logoutRequest != null) {
LOGGER.debug("Captured logout request [{}]", logoutRequest);
logoutRequests.add(logoutRequest);
}
});
final Collection<ProxyGrantingTicket> proxyGrantingTickets = ticket.getProxyGrantingTickets();
if (proxyGrantingTickets.isEmpty()) {
LOGGER.debug("There are no proxy-granting tickets associated with [{}] to process for single logout", ticket.getId());
} else {
proxyGrantingTickets.forEach(proxyGrantingTicket -> performLogoutForTicket(proxyGrantingTicket, logoutRequests));
}
}
Aggregations