use of org.pentaho.platform.util.JVMParameterProvider in project pentaho-platform by pentaho.
the class MultipleComponentIT method testJVMParameterProvider.
public void testJVMParameterProvider() {
startTest();
// $NON-NLS-1$//$NON-NLS-2$
System.setProperty("teststring", "test string");
// $NON-NLS-1$//$NON-NLS-2$
System.setProperty("testlong", "32");
// $NON-NLS-1$//$NON-NLS-2$
System.setProperty("testdecimal", "66.6");
Date someDate = new Date();
// $NON-NLS-1$
System.setProperty("testdate", DateFormat.getInstance().format(someDate));
JVMParameterProvider provider = new JVMParameterProvider();
// assertEquals(someDate, provider.getDateParameter("testdate", null) ); //$NON-NLS-1$
// $NON-NLS-1$
assertEquals(someDate, provider.getDateParameter("bogus", someDate));
// $NON-NLS-1$
assertEquals(32, provider.getLongParameter("testlong", 0));
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("test string", provider.getStringParameter("teststring", null));
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals(new BigDecimal("66.6"), provider.getDecimalParameter("testdecimal", null));
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("test string", provider.getParameter("teststring"));
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("string", provider.getParameterType("teststring"));
Iterator it = provider.getParameterNames();
while (it.hasNext()) {
String pName = (String) it.next();
// $NON-NLS-1$
System.out.println(pName + "=" + provider.getStringParameter(pName, null));
}
finishTest();
}
use of org.pentaho.platform.util.JVMParameterProvider in project pentaho-platform by pentaho.
the class MultipleComponentIT method testJVMParameterProviderDifferentPath.
public void testJVMParameterProviderDifferentPath() {
startTest();
JVMParameterProvider provider = new JVMParameterProvider();
// $NON-NLS-1$
assertEquals(99, provider.getLongParameter("bogus", 99));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
assertEquals(new BigDecimal("99"), provider.getDecimalParameter("bogus", new BigDecimal("99")));
finishTest();
}
use of org.pentaho.platform.util.JVMParameterProvider in project pentaho-platform by pentaho.
the class MessageFormatterTest method makeParameterProviders.
private Map<String, IParameterProvider> makeParameterProviders(final IPentahoSession session) {
final Map<String, IParameterProvider> res = new HashMap<>();
res.put("jvm", new JVMParameterProvider());
res.put(SecurityParameterProvider.SCOPE_SECURITY, new SecurityParameterProvider(session));
return res;
}
use of org.pentaho.platform.util.JVMParameterProvider in project pentaho-platform by pentaho.
the class RuntimeContextTest method makeParameterProviders.
private Map<String, IParameterProvider> makeParameterProviders(final IPentahoSession session) {
final Map<String, IParameterProvider> res = new HashMap<>();
res.put("jvm", new JVMParameterProvider());
res.put(SecurityParameterProvider.SCOPE_SECURITY, new SecurityParameterProvider(session));
return res;
}
use of org.pentaho.platform.util.JVMParameterProvider in project pentaho-platform by pentaho.
the class SolutionEngine method init.
public void init(final IPentahoSession pSession) {
parameterProviders = new HashMap<String, IParameterProvider>();
this.session = pSession;
this.setParameterProvider(SolutionEngine.JVM_PARAMETER_PROVIDER, new JVMParameterProvider());
setForcePrompt(false);
// Provide the security parameter provider to the parameter provider map in the super class
SecurityParameterProvider provider = new SecurityParameterProvider(pSession);
this.setParameterProvider(SecurityParameterProvider.SCOPE_SECURITY, provider);
}
Aggregations