@SuppressWarnings( { "unchecked" } ) InputProperties( final IRuntimeContext context ) { this.context = context; inputs = new HashSet<String>(); inputs.addAll( context.getInputNames() ); inputs.addAll( context.getParameterManager().getCurrentInputNames() ); inputs.add( "$user" ); //$NON-NLS-1$ inputs.add( "$url" ); //$NON-NLS-1$ inputs.add( "$solution" ); //$NON-NLS-1$ }
return value; IParameterManager paramMgr = context.getParameterManager(); Map allParams = paramMgr.getAllParameters(); Object valueObj;
public void testTableTemplate() { IRuntimeContext mockRuntimeContext = mock( IRuntimeContext.class ); IPentahoSession mockSession = mock( IPentahoSession.class ); IParameterManager mockParameterManager = mock( IParameterManager.class ); IPentahoResultSet mockPentahoResultSet = mock( IPentahoResultSet.class ); Object[] mockRow = new Object[] { "field0", "field1" }; when( mockPentahoResultSet.getColumnCount() ).thenReturn( mockRow.length ); when( mockPentahoResultSet.getDataRow( 0 ) ).thenReturn( mockRow ); when( mockParameterManager.getCurrentInputNames() ).thenReturn( new HashSet<Object>( Arrays.asList( new String[] { "param1" } ) ) ); when( mockRuntimeContext.getSession() ).thenReturn( mockSession ); when( mockRuntimeContext.getParameterManager() ).thenReturn( mockParameterManager ); when( mockRuntimeContext.getInputParameterValue( "param1" ) ).thenReturn( mockPentahoResultSet ); String template = "table {param1:col:1} and text"; IParameterResolver resolver = mock( IParameterResolver.class ); assertEquals( "table field1 and text", TemplateUtil.applyTemplate( template, mockRuntimeContext, resolver ) ); }
} else { ReturnParameter rpm = (ReturnParameter) context.getParameterManager().getReturnParameters().get( outputName ); ReturnParameter rpm = (ReturnParameter) context.getParameterManager().getReturnParameters().get( outputName );
public void testKeyedTableTemplate() { IRuntimeContext mockRuntimeContext = mock( IRuntimeContext.class ); IPentahoSession mockSession = mock( IPentahoSession.class ); IParameterManager mockParameterManager = mock( IParameterManager.class ); IPentahoResultSet mockPentahoResultSet = createMockResultSet(); IPentahoMetaData mockPentahoMetaData = mock( IPentahoMetaData.class ); final Set inputNames = new HashSet<Object>( Arrays.asList( new String[] { "param1" } ) ); when( mockParameterManager.getCurrentInputNames() ).thenReturn( inputNames ); when( mockRuntimeContext.getSession() ).thenReturn( mockSession ); when( mockRuntimeContext.getParameterManager() ).thenReturn( mockParameterManager ); when( mockRuntimeContext.getInputParameterValue( "param1" ) ).thenReturn( mockPentahoResultSet ); when( mockRuntimeContext.getInputNames() ).thenReturn( inputNames ); String template = "{param1:keycol:key_Value:valcol:defaultValue}"; // "key_value" is parsed as "key value" assertEquals( "field Value", TemplateUtil.applyTemplate( template, mockRuntimeContext ) ); }
IPentahoSession mockSession = mock( IPentahoSession.class ); IParameterManager mockParameterManager = mock( IParameterManager.class ); when( mockRuntimeContext.getParameterManager() ).thenReturn( mockParameterManager ); when( mockRuntimeContext.getSession() ).thenReturn( mockSession );
solutionEngine.execute( xactionStr, xactionName, "simple output test", false, true, null, false, new HashMap(), //$NON-NLS-1$ null, null, new SimpleUrlFactory( "" ), new ArrayList() ); //$NON-NLS-1$ IParameterManager paramManager = runtimeContext.getParameterManager(); Assert.assertEquals( outParameters.size(), paramManager.getCurrentOutputNames().size() ); for ( Object key : paramManager.getCurrentOutputNames() ) {