use of org.pentaho.platform.api.engine.ISystemSettings in project pentaho-platform by pentaho.
the class SolutionEngineInteractivityService method setupRequestHandler.
protected void setupRequestHandler(final HttpServletRequest request, final HttpServletRequestHandler requestHandler, final IParameterProvider requestParameters, final IPentahoSession userSession) {
this.setupRequestHandler(request, requestHandler);
// first take a secondary action
// $NON-NLS-1$
String actionName = requestParameters.getStringParameter("action2", null);
if (actionName == null) {
// now look for a primary action
// $NON-NLS-1$
actionName = requestParameters.getStringParameter("action", null);
}
ISystemSettings systemSettings = PentahoSystem.getSystemSettings();
String defaultParameterXsl = systemSettings.getSystemSetting("default-parameter-xsl", "DefaultParameterForm.xsl");
// $NON-NLS-1$ //$NON-NLS-2$
requestHandler.setParameterXsl(defaultParameterXsl);
}
use of org.pentaho.platform.api.engine.ISystemSettings in project pentaho-platform by pentaho.
the class XactionUtil method executeInternal.
@SuppressWarnings("rawtypes")
protected static IRuntimeContext executeInternal(RepositoryFile file, IParameterProvider requestParams, HttpServletRequest httpServletRequest, IOutputHandler outputHandler, Map<String, IParameterProvider> parameterProviders, IPentahoSession userSession, boolean forcePrompt, List messages) throws Exception {
String processId = XactionUtil.class.getName();
// $NON-NLS-1$
String instanceId = httpServletRequest.getParameter("instance-id");
// $NON-NLS-1$
SimpleUrlFactory urlFactory = new SimpleUrlFactory("");
ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, userSession);
ISystemSettings systemSettings = PentahoSystem.getSystemSettings();
if (solutionEngine == null) {
throw new ObjectFactoryException("No Solution Engine");
}
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
boolean instanceEnds = "true".equalsIgnoreCase(requestParams.getStringParameter("instanceends", "true"));
// $NON-NLS-1$ //$NON-NLS-2$
String parameterXsl = systemSettings.getSystemSetting("default-parameter-xsl", "DefaultParameterForm.xsl");
solutionEngine.setLoggingLevel(2);
solutionEngine.init(userSession);
solutionEngine.setForcePrompt(forcePrompt);
if (parameterXsl != null) {
solutionEngine.setParameterXsl(parameterXsl);
}
return solutionEngine.execute(file.getPath(), processId, false, instanceEnds, instanceId, false, parameterProviders, outputHandler, null, urlFactory, messages);
}
use of org.pentaho.platform.api.engine.ISystemSettings in project pentaho-platform by pentaho.
the class HttpSessionPentahoSessionIntegrationFilterTest method testSessionCookieSettingsEnabled.
@Test
public void testSessionCookieSettingsEnabled() throws ObjectFactoryException {
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);
final AuthenticationProvider mockObj = Mockito.mock(AuthenticationProvider.class);
PentahoSystem.registerObject(mockObj, AuthenticationProvider.class);
new HttpSessionPentahoSessionIntegrationFilter().setSessionExpirationCookies(httpSession, pentahoSession, servletResponse);
Mockito.verify(servletResponse, Mockito.times(2)).addCookie(Mockito.any());
} finally {
PentahoSystem.setSystemSettingsService(systemSettings);
}
}
use of org.pentaho.platform.api.engine.ISystemSettings in project pentaho-platform by pentaho.
the class HttpSessionPentahoSessionIntegrationFilterTest method testSessionCookieSsoEnabled.
@Test
public void testSessionCookieSsoEnabled() throws ObjectFactoryException {
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);
final CasAuthenticationProvider mockObj = Mockito.mock(CasAuthenticationProvider.class);
PentahoSystem.registerObject(mockObj, AuthenticationProvider.class);
HttpSessionPentahoSessionIntegrationFilter hspsif = new HttpSessionPentahoSessionIntegrationFilter();
hspsif.setSsoEnabled(true);
hspsif.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 PentahoSystemTest method initXMLFactories.
private void initXMLFactories(boolean factoriesInPentahoXML) throws Exception {
// mock pentaho.xml
final ISystemSettings settingsService = mock(ISystemSettings.class);
if (factoriesInPentahoXML) {
final Node testNode = mock(Node.class);
final Node testNodeName = mock(Node.class);
when(testNodeName.getText()).thenReturn(testSystemPropertyName);
when(testNode.selectSingleNode(eq("@name"))).thenReturn(testNodeName);
final Node testNodeImplementation = mock(Node.class);
when(testNodeImplementation.getText()).thenReturn(testXMLValue);
when(testNode.selectSingleNode(eq("@implementation"))).thenReturn(testNodeImplementation);
when(settingsService.getSystemSettings(eq("xml-factories/factory-impl"))).thenReturn(new LinkedList() {
{
add(testNode);
}
});
} else {
when(settingsService.getSystemSettings(eq("xml-factories/factory-impl"))).thenReturn(new LinkedList());
}
when(settingsService.getSystemSetting(anyString(), anyString())).thenReturn("");
PentahoSystem.setSystemSettingsService(settingsService);
// mock java-system-properties.properties
final IPentahoObjectFactory objectFactory = mock(IPentahoObjectFactory.class);
final ISystemConfig systemConfig = mock(ISystemConfig.class);
final IConfiguration configuration = mock(IConfiguration.class);
when(configuration.getProperties()).thenReturn(new Properties() {
{
setProperty(testSystemPropertyName, testPropertyValue);
}
});
when(systemConfig.getConfiguration(eq(PentahoSystem.JAVA_SYSTEM_PROPERTIES))).thenReturn(configuration);
when(objectFactory.objectDefined(eq(ISystemConfig.class))).thenReturn(true);
final IPentahoObjectReference pentahoObjectReference = mock(IPentahoObjectReference.class);
when(pentahoObjectReference.getObject()).thenReturn(systemConfig);
when(objectFactory.getObjectReferences(eq(ISystemConfig.class), any(IPentahoSession.class), any(Map.class))).thenReturn(new LinkedList() {
{
add(pentahoObjectReference);
}
});
PentahoSystem.registerObjectFactory(objectFactory);
PentahoSystem.init();
}
Aggregations