* and testsrc/config.xml. If the implementation is changed, please update/remove
* these files.
* @throws Exception
*/
@Test public void testEnv() throws Exception {
Function func = new Function("env", new Expression[] {}); //$NON-NLS-1$
FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("env", new Class[] {String.class} ); //$NON-NLS-1$
func.setFunctionDescriptor(desc);
FakeDataManager dataMgr = new FakeDataManager();
Properties props = new Properties();
props.setProperty("http_host", "testHostName"); //$NON-NLS-1$ //$NON-NLS-2$
props.setProperty("http_port", "8000"); //$NON-NLS-1$ //$NON-NLS-2$
CommandContext context = new CommandContext(new Long(1), null, null, null, null, 0, props, false);
func.setArgs(new Expression[] {new Constant("http_host")}); //$NON-NLS-1$
assertEquals("testHostName", new Evaluator(Collections.emptyMap(), dataMgr, context).evaluate(func, Collections.emptyList())); //$NON-NLS-1$
func.setArgs(new Expression[] {new Constant("http_port")}); //$NON-NLS-1$
assertEquals("8000", new Evaluator(Collections.emptyMap(), dataMgr, context).evaluate(func, Collections.emptyList())); //$NON-NLS-1$
}