@Test public void testinItializeVariablesFrom() { final Variables variablesMock = mock( Variables.class ); doCallRealMethod().when( variablesMock ).initializeVariablesFrom( any( VariableSpace.class ) ); @SuppressWarnings( "unchecked" ) final Map<String, String> propertiesMock = mock( Map.class ); when( variablesMock.getProperties() ).thenReturn( propertiesMock ); doAnswer( new Answer<Map<String, String>>() { final String keyStub = "key"; @Override public Map<String, String> answer( InvocationOnMock invocation ) throws Throwable { if ( System.getProperty( keyStub ) == null ) { modifySystemproperties(); } if ( invocation.getArguments()[ 1 ] != null ) { propertiesMock.put( (String) invocation.getArguments()[ 0 ], System.getProperties().getProperty( (String) invocation.getArguments()[ 1 ] ) ); } return propertiesMock; } } ).when( propertiesMock ).put( anyString(), anyString() ); variablesMock.initializeVariablesFrom( null ); }
@Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; }
Variables implements VariableSpace { @Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; } }
Variables implements VariableSpace { @Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; } Variables(); }
Variables implements VariableSpace { @Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; } Variables(); @Override void copyVariablesFrom( VariableSpace space ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace parent ); @Override String getVariable( String variableName, String defaultValue ); @Override String getVariable( String variableName ); @Override boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); @Override void initializeVariablesFrom( VariableSpace parent ); @Override String[] listVariables(); @Override void setVariable( String variableName, String variableValue ); @Override String environmentSubstitute( String aString ); @Override String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); @Override String[] environmentSubstitute( String[] string ); @Override void shareVariablesWith( VariableSpace space ); @Override void injectVariables( Map<String, String> prop ); static synchronized VariableSpace getADefaultVariableSpace(); }
Variables implements VariableSpace { @Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; } Variables(); @Override void copyVariablesFrom( VariableSpace space ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace parent ); @Override String getVariable( String variableName, String defaultValue ); @Override String getVariable( String variableName ); @Override boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); @Override void initializeVariablesFrom( VariableSpace parent ); @Override String[] listVariables(); @Override void setVariable( String variableName, String variableValue ); @Override String environmentSubstitute( String aString ); @Override String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); @Override String[] environmentSubstitute( String[] string ); @Override void shareVariablesWith( VariableSpace space ); @Override void injectVariables( Map<String, String> prop ); static synchronized VariableSpace getADefaultVariableSpace();  }