use of org.pentaho.platform.api.engine.ISystemSettings in project pentaho-platform by pentaho.
the class HttpSessionPentahoSessionIntegrationFilterTest method testSessionCookieNoAuthenticationProviders.
@Test
public void testSessionCookieNoAuthenticationProviders() {
final ISystemSettings systemSettings = PentahoSystem.getSystemSettings();
try {
final ISystemSettings mockSettings = Mockito.mock(ISystemSettings.class);
Mockito.when(mockSettings.getSystemSetting("session-expired-dialog", "true")).thenReturn("true");
PentahoSystem.setSystemSettingsService(mockSettings);
new HttpSessionPentahoSessionIntegrationFilter().setSessionExpirationCookies(httpSession, pentahoSession, servletResponse);
Mockito.verify(servletResponse, Mockito.never()).addCookie(Mockito.any());
} finally {
PentahoSystem.setSystemSettingsService(systemSettings);
}
}
use of org.pentaho.platform.api.engine.ISystemSettings in project pentaho-platform by pentaho.
the class PluginResourceLoaderTest method testGetPluginSettings.
@Test
public void testGetPluginSettings() {
final ISystemSettings mockSettings = mockery.mock(ISystemSettings.class);
final String fullPathToSettingsFile = resLoader.getSystemRelativePluginPath(pluginClass.getClassLoader()) + "/settings.xml";
mockery.checking(new Expectations() {
{
oneOf(mockSettings).getSystemSetting(fullPathToSettingsFile, "testsetting", null);
will(returnValue("false"));
oneOf(mockSettings).getSystemSetting(fullPathToSettingsFile, "bogussetting", null);
will(returnValue(null));
oneOf(mockSettings).getSystemSetting(fullPathToSettingsFile, "bogussetting", "true");
will(returnValue("true"));
}
});
PentahoSystem.setSystemSettingsService(mockSettings);
assertEquals("Cache value incorrect", "false", resLoader.getPluginSetting(pluginClass, "testsetting"));
assertNull("Bogus value should not have been found", resLoader.getPluginSetting(pluginClass, "bogussetting"));
assertEquals("Bogus value should have a default of true", "true", resLoader.getPluginSetting(pluginClass, "bogussetting", "true"));
}
use of org.pentaho.platform.api.engine.ISystemSettings in project pentaho-platform by pentaho.
the class WebApplicationContextTest method testGetPentahoServerName.
@Test
public void testGetPentahoServerName() throws Exception {
webAppContext = new WebApplicationContext("rootPath", null, null);
ISystemSettings settingsService = mock(ISystemSettings.class);
when(settingsService.getSystemSetting(eq("name"), anyString())).thenReturn("PENTAHO");
PentahoSystem.setSystemSettingsService(settingsService);
assertEquals("PENTAHO", webAppContext.getPentahoServerName());
}
use of org.pentaho.platform.api.engine.ISystemSettings in project data-access by pentaho.
the class AgileHelperTest method testGetFolderPath.
@Test
public void testGetFolderPath() {
PentahoSystem.setSystemSettingsService(null);
assertNull(AgileHelper.getFolderPath(null));
String sampleProject = AgileHelper.PLUGIN_NAME;
String sampleFolderPath = "/etc/";
ISystemSettings systemSettings = mock(ISystemSettings.class);
when(systemSettings.getSystemSetting(anyString(), anyString(), anyString())).thenReturn(null).thenReturn(sampleFolderPath);
PentahoSystem.setSystemSettingsService(systemSettings);
assertNull(AgileHelper.getFolderPath(sampleProject));
assertTrue((sampleFolderPath + sampleProject).equals(AgileHelper.getFolderPath(sampleProject)));
}
use of org.pentaho.platform.api.engine.ISystemSettings in project data-access by pentaho.
the class AgileHelperTest method testGetSchemaName.
@Test
public void testGetSchemaName() {
PentahoSystem.setSystemSettingsService(null);
assertNull(AgileHelper.getSchemaName());
ISystemSettings systemSettings = mock(ISystemSettings.class);
when(systemSettings.getSystemSetting(anyString(), anyString(), anyString())).thenReturn(null);
PentahoSystem.setSystemSettingsService(systemSettings);
assertNull(AgileHelper.getSchemaName());
}
Aggregations