use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminRealmTest method testGetSettings.
@Test
public void testGetSettings() {
PowerMock.mockStatic(CDIUtils.class);
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
expect(CDIUtils.getBean(SettingsService.class)).andReturn(settingsService);
expect(settingsService.getSettings()).andReturn(settings);
PowerMock.replayAll(CDIUtils.class, settingsService);
Settings actual = adminRealm.getSettings();
PowerMock.verifyAll();
assertSame(settings, actual);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminSetupControlFilterTest method testGetSettings.
@Test
public void testGetSettings() {
PowerMock.mockStatic(CDIUtils.class);
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
expect(CDIUtils.getBean(SettingsService.class)).andReturn(settingsService);
expect(settingsService.getSettings()).andReturn(settings);
PowerMock.replayAll(CDIUtils.class, settingsService);
Settings actual = filter.getSettings();
PowerMock.verifyAll();
assertSame(settings, actual);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminSetupControlFilterTest method testOnAccessDenied_ifAdminSettingsNotRequired_andNotRequestSetupPage.
@Test
public void testOnAccessDenied_ifAdminSettingsNotRequired_andNotRequestSetupPage() throws Exception {
filter = createMockBuilder(AdminSetupControlFilter.class).addMockedMethod("isSetupPageRequest", ServletRequest.class).createMock();
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setAdminUsername("admin");
settings.setAdminPassword("pass");
PowerMock.mockStatic(CDIUtils.class);
expect(CDIUtils.getBean(SettingsService.class)).andReturn(settingsService);
expect(settingsService.getSettings()).andReturn(settings);
expect(filter.isSetupPageRequest(request)).andReturn(false);
PowerMock.replayAll(CDIUtils.class, settingsService, filter);
boolean actual = filter.onAccessDenied(request, response);
PowerMock.verifyAll();
assertFalse(actual);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminSetupControlFilterTest method testIsAccessAllowed_ifRequestNotSetupPage.
@Test
public void testIsAccessAllowed_ifRequestNotSetupPage() {
filter = createMockBuilder(AdminSetupControlFilter.class).addMockedMethod("isSetupPageRequest", ServletRequest.class).createMock();
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setAdminUsername(null);
PowerMock.mockStatic(CDIUtils.class);
expect(CDIUtils.getBean(SettingsService.class)).andReturn(settingsService);
expect(settingsService.getSettings()).andReturn(settings);
expect(filter.isSetupPageRequest(request)).andReturn(false);
PowerMock.replayAll(CDIUtils.class, settingsService, filter);
boolean actual = filter.isAccessAllowed(request, response, null);
PowerMock.verifyAll();
assertFalse(actual);
}
use of com.artezio.arttime.config.Settings in project ART-TIME by Artezio.
the class AdminSetupControlFilterTest method testIsAccessAllowed_ifRequestSetupPage.
@Test
public void testIsAccessAllowed_ifRequestSetupPage() {
filter = createMockBuilder(AdminSetupControlFilter.class).addMockedMethod("isSetupPageRequest", ServletRequest.class).createMock();
Settings settings = new Settings(new EnumMap<>(Setting.Name.class));
settings.setAdminUsername(null);
PowerMock.mockStatic(CDIUtils.class);
expect(CDIUtils.getBean(SettingsService.class)).andReturn(settingsService);
expect(settingsService.getSettings()).andReturn(settings);
expect(filter.isSetupPageRequest(request)).andReturn(true);
PowerMock.replayAll(CDIUtils.class, settingsService, filter);
boolean actual = filter.isAccessAllowed(request, response, null);
PowerMock.verifyAll();
assertTrue(actual);
}
Aggregations