use of alfio.model.system.ConfigurationKeyValuePathLevel in project alf.io by alfio-event.
the class FeeCalculatorTest method setUp.
@BeforeEach
void setUp() {
event = mock(EventAndOrganizationId.class);
configurationManager = mock(ConfigurationManager.class);
when(configurationManager.getFor(eq(PLATFORM_MODE_ENABLED), any())).thenReturn(new MaybeConfiguration(PLATFORM_MODE_ENABLED, new ConfigurationKeyValuePathLevel(PLATFORM_MODE_ENABLED.name(), "true", null)));
}
use of alfio.model.system.ConfigurationKeyValuePathLevel in project alf.io by alfio-event.
the class AdminOpenIdAuthenticationManagerTest method setUp.
@BeforeEach
void setUp() {
environment = mock(Environment.class);
when(environment.getProperty(eq("openid.domain"))).thenReturn(DOMAIN);
when(environment.getProperty(eq("openid.clientId"))).thenReturn(CLIENT_ID);
when(environment.getProperty(eq("openid.clientSecret"))).thenReturn(CLIENT_SECRET);
when(environment.getProperty(eq("openid.callbackURI"), anyString())).thenReturn(CALLBACK_URI);
when(environment.getProperty(eq("openid.authenticationUrl"))).thenReturn(AUTHENTICATION_URL);
when(environment.getProperty(eq("openid.tokenEndpoint"), anyString())).thenReturn(CLAIMS_URI);
when(environment.getProperty(eq("openid.contentType"), anyString())).thenReturn(CONTENT_TYPE);
when(environment.getProperty(eq("openid.rolesParameter"))).thenReturn(GROUPS_NAME);
when(environment.getProperty(eq("openid.alfioGroupsParameter"))).thenReturn(ALFIO_GROUPS_NAME);
when(environment.getProperty(eq("openid.logoutUrl"))).thenReturn(LOGOUT_URL);
when(environment.getProperty(eq("openid.logoutRedirectUrl"), anyString())).thenReturn(LOGOUT_REDIRECT_URL);
var configurationManager = mock(ConfigurationManager.class);
when(configurationManager.getFor(eq(ConfigurationKeys.BASE_URL), any())).thenReturn(new ConfigurationManager.MaybeConfiguration(ConfigurationKeys.BASE_URL, new ConfigurationKeyValuePathLevel("", "blabla", ConfigurationPathLevel.SYSTEM)));
authenticationManager = new AdminOpenIdAuthenticationManager(environment, null, configurationManager, null, null, null, null, null, null, null, new Json());
}
use of alfio.model.system.ConfigurationKeyValuePathLevel in project alf.io by alfio-event.
the class WaitingQueueSubscriptionProcessorTest method filterWaitingQueueFlagIsNotActive.
@Test
void filterWaitingQueueFlagIsNotActive() {
when(configurationManager.getFor(eq(Set.of(ENABLE_WAITING_QUEUE, ENABLE_PRE_REGISTRATION)), any())).thenReturn(Map.of(ENABLE_WAITING_QUEUE, new ConfigurationManager.MaybeConfiguration(ENABLE_WAITING_QUEUE, new ConfigurationKeyValuePathLevel("", "false", null)), ENABLE_PRE_REGISTRATION, new ConfigurationManager.MaybeConfiguration(ENABLE_PRE_REGISTRATION)));
processor.handleWaitingTickets();
verify(waitingQueueManager, never()).distributeSeats(eq(event));
}
use of alfio.model.system.ConfigurationKeyValuePathLevel in project alf.io by alfio-event.
the class TicketReservationManagerTest method initOfflinePaymentTest.
private void initOfflinePaymentTest() {
when(configurationManager.getFor(eq(OFFLINE_PAYMENT_DAYS), any())).thenReturn(new MaybeConfiguration(OFFLINE_PAYMENT_DAYS, new ConfigurationKeyValuePathLevel(OFFLINE_PAYMENT_DAYS.getValue(), "2", null)));
when(event.getZoneId()).thenReturn(ClockProvider.clock().getZone());
}
use of alfio.model.system.ConfigurationKeyValuePathLevel in project alf.io by alfio-event.
the class SendGridMailerTest method shouldSendEmail.
@Test
public void shouldSendEmail() throws IOException, InterruptedException {
// Test data
final var apiConfig = new ConfigurationManager.MaybeConfiguration(ConfigurationKeys.SENDGRID_API_KEY, new ConfigurationKeyValuePathLevel("key", "value", ConfigurationPathLevel.SYSTEM));
final var fromConfig = new ConfigurationManager.MaybeConfiguration(ConfigurationKeys.SENDGRID_FROM, new ConfigurationKeyValuePathLevel("key", "value", ConfigurationPathLevel.SYSTEM));
// Mock
when(configurationManager.getFor(anySet(), any(ConfigurationLevel.class))).thenReturn(Map.of(ConfigurationKeys.SENDGRID_API_KEY, apiConfig, ConfigurationKeys.SENDGRID_FROM, fromConfig));
final HttpResponse<Object> httpResponse = createMockHttpResponse();
when(client.send(any(HttpRequest.class), any())).thenReturn(httpResponse);
// Service call
sendGridMailer.send(new EventAndOrganizationId(1, 2), "Test", "TestEmail", List.of(), "TestSubject", "Test", Optional.empty(), ArrayUtils.toArray());
// Verify
verify(configurationManager).getFor(anySet(), any(ConfigurationLevel.class));
verify(client).send(any(HttpRequest.class), any());
verifyNoMoreInteractions(configurationManager, client);
}
Aggregations