@Test public void testUpdateContext_forSmartIndex_2() { String line = "define vm id = " + SMART_INDEX + " under /tomcat-vm"; DefineVariableCommandInstruction instr = new DefineVariableCommandInstruction( this.context, line, 1 ); Assert.assertEquals( 0, instr.validate().size()); instr.updateContext(); Assert.assertEquals( "1", this.context.variables.get( "vm id" )); }
@Override public void updateContext() { String newValue = replaceVariables( this.value, this.context, this.instancePath ); if( newValue != null ) { this.context.variables.put( this.key, newValue ); } else { setDisabled( true ); this.context.disabledVariables.add( this.key ); this.context.variables.put( this.key, "fake" ); String path = "/fake"; if( this.instancePath != null ) path = this.instancePath + path; this.context.instancePathToComponentName.put( path, FAKE_COMPONENT_NAME ); } }
DefineVariableCommandInstruction extends AbstractCommandInstruction { @Override public void updateContext() { String newValue = replaceVariables( this.value, this.context, this.instancePath ); if( newValue != null ) { this.context.variables.put( this.key, newValue ); } else { setDisabled( true ); this.context.disabledVariables.add( this.key ); this.context.variables.put( this.key, "fake" ); String path = "/fake"; if( this.instancePath != null ) path = this.instancePath + path; this.context.instancePathToComponentName.put( path, FAKE_COMPONENT_NAME ); } } }
DefineVariableCommandInstruction extends AbstractCommandInstruction { @Override public void updateContext() { String newValue = replaceVariables( this.value, this.context, this.instancePath ); if( newValue != null ) { this.context.variables.put( this.key, newValue ); } else { setDisabled( true ); this.context.disabledVariables.add( this.key ); this.context.variables.put( this.key, "fake" ); String path = "/fake"; if( this.instancePath != null ) path = this.instancePath + path; this.context.instancePathToComponentName.put( path, FAKE_COMPONENT_NAME ); } } DefineVariableCommandInstruction( Context context, String instruction, int line ); }
DefineVariableCommandInstruction extends AbstractCommandInstruction { @Override public void updateContext() { String newValue = replaceVariables( this.value, this.context, this.instancePath ); if( newValue != null ) { this.context.variables.put( this.key, newValue ); } else { setDisabled( true ); this.context.disabledVariables.add( this.key ); this.context.variables.put( this.key, "fake" ); String path = "/fake"; if( this.instancePath != null ) path = this.instancePath + path; this.context.instancePathToComponentName.put( path, FAKE_COMPONENT_NAME ); } } DefineVariableCommandInstruction( Context context, String instruction, int line ); @Override List<ParsingError> doValidate(); @Override void updateContext(); }
DefineVariableCommandInstruction extends AbstractCommandInstruction { @Override public void updateContext() { String newValue = replaceVariables( this.value, this.context, this.instancePath ); if( newValue != null ) { this.context.variables.put( this.key, newValue ); } else { setDisabled( true ); this.context.disabledVariables.add( this.key ); this.context.variables.put( this.key, "fake" ); String path = "/fake"; if( this.instancePath != null ) path = this.instancePath + path; this.context.instancePathToComponentName.put( path, FAKE_COMPONENT_NAME ); } } DefineVariableCommandInstruction( Context context, String instruction, int line ); @Override List<ParsingError> doValidate(); @Override void updateContext(); static final String MILLI_TIME; static final String NANO_TIME; static final String FORMATTED_TIME_PREFIX; static final String EXISTING_INDEX_PREFIX; static final String RANDOM_UUID; static final String SMART_INDEX; }