<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project name="TESTING" resourceRoot="${workspaceDir}" soapui-version="3.6.1" runType="PARALLELL" xmlns:con="http://eviware.com/soapui/config">
  <con:description/>
  <con:settings>
    <con:setting id="com.eviware.soapui.impl.wsdl.panels.testcase.JTestRunLog$OptionsForm@max_rows">1000</con:setting>
    <con:setting id="com.eviware.soapui.impl.wsdl.panels.testcase.JTestRunLog$OptionsForm@errors_only">false</con:setting>
    <con:setting id="com.eviware.soapui.impl.wsdl.actions.iface.tools.soapui.TestRunnerAction@values-local"><![CDATA[<xml-fragment xmlns:con="http://eviware.com/soapui/config">
  <con:entry key="Global Properties" value="cli_environment=stg"/>
  <con:entry key="TestSuite" value="&lt;all>"/>
  <con:entry key="Report to Generate" value="TESTING"/>
  <con:entry key="Password" value=""/>
  <con:entry key="soapui-setings.xml Password" value=""/>
  <con:entry key="TestRunner Path" value="C:\Program Files\eviware\soapUI-Pro-4.0.0\bin"/>
  <con:entry key="Tool Args" value=""/>
  <con:entry key="Ignore Errors" value="false"/>
  <con:entry key="Host:Port" value=""/>
  <con:entry key="WSS Password Type" value=""/>
  <con:entry key="Save Project" value="false"/>
  <con:entry key="Enable UI" value="false"/>
  <con:entry key="System Properties" value=""/>
  <con:entry key="Domain" value=""/>
  <con:entry key="Coverage Report" value="false"/>
  <con:entry key="Export JUnit Results" value="true"/>
  <con:entry key="Open Report" value="false"/>
  <con:entry key="Project Properties" value=""/>
  <con:entry key="Project Password" value=""/>
  <con:entry key="Export All" value="false"/>
  <con:entry key="Report Format(s)" value="TXT"/>
  <con:entry key="TestCase" value="&lt;all>"/>
  <con:entry key="Print Report" value="true"/>
  <con:entry key="Username" value=""/>
  <con:entry key="Root Folder" value="C:\X"/>
  <con:entry key="Save After" value="false"/>
  <con:entry key="Add Settings" value="true"/>
  <con:entry key="Endpoint" value=""/>
</xml-fragment>]]></con:setting>
    <con:setting id="com.eviware.soapui.impl.wsdl.actions.iface.tools.soapui.LoadTestRunnerAction@values-local"><![CDATA[<xml-fragment xmlns:con="http://eviware.com/soapui/config">
  <con:entry key="TestSuite" value="&lt;all>"/>
  <con:entry key="Global Properties" value="cli_environment=stg"/>
  <con:entry key="Report to Generate" value="TESTING"/>
  <con:entry key="Password" value=""/>
  <con:entry key="soapui-setings.xml Password" value=""/>
  <con:entry key="TestRunner Path" value="C:\Program Files\eviware\soapUI-Pro-4.0.0/bin"/>
  <con:entry key="Tool Args" value=" -r -j -fC:\SOAP -RTESTING -FTXT"/>
  <con:entry key="LoadTest" value="&lt;all>"/>
  <con:entry key="Host:Port" value=""/>
  <con:entry key="WSS Password Type" value=""/>
  <con:entry key="Save Project" value="true"/>
  <con:entry key="System Properties" value=""/>
  <con:entry key="Domain" value=""/>
  <con:entry key="Open Report" value="true"/>
  <con:entry key="Print Report Statistics" value="true"/>
  <con:entry key="Project Properties" value=""/>
  <con:entry key="Project Password" value=""/>
  <con:entry key="Report Format(s)" value="TXT"/>
  <con:entry key="TestCase" value="&lt;all>"/>
  <con:entry key="Username" value=""/>
  <con:entry key="Root Folder" value="C:\SOAP"/>
  <con:entry key="Add Settings" value="false"/>
  <con:entry key="Save After" value="true"/>
  <con:entry key="Endpoint" value=""/>
  <con:entry key="ThreadCount" value="1"/>
  <con:entry key="Limit" value=""/>
</xml-fragment>]]></con:setting>
  </con:settings>
  <con:requirements/>
  <con:properties>
    <con:property>
      <con:name>environment</con:name>
      <con:value>stg</con:value>
    </con:property>
  </con:properties>
  <con:afterLoadScript>import com.eviware.soapui.support.UISupport;
import com.eviware.soapui.model.ModelItem;
import com.eviware.soapui.SoapUI;


// Configuration
ModelItem modelItem = project;
Boolean allowDefaultValue = false;
String defaultValue = "stg";
String propertyName = "environment";
String cliPropertyName = "cli_environment";
String userPromptTitle = "Select Environment";
String userPromptDescription = "Selection of an environment is required before\ncontinuing.\n\nThe allowed values are: [stg, chi, dal]";


// Setup
String modelName = modelItem.getName();
String modelType = modelItem.getClass().getName();
if (modelType.lastIndexOf('.') > 0) {
	modelType = modelType.substring(modelType.lastIndexOf('.')+1);
}
Boolean isDone;
String previousValue, newValue;
String promptTitle = modelType + " > " + modelName + " > " + userPromptTitle ;
String promptDescription = promptTitle + "\n\n" + userPromptDescription;

// Get Previous Value
if(allowDefaultValue){
	previousValue = defaultValue;
}else{
	previousValue = "";
}

// Get New Value
isDone = false;
while(!isDone){
	if(SoapUI.isCommandLine()){
		newValue = SoapUI.globalProperties.getPropertyValue(cliPropertyName);
		System.out.println("["+newValue+"]")
		if(newValue == null){
			System.out.println("Required property is missing. [" + cliPropertyName + "]");
			System.exit(1);
		}else{
			newValue = newValue.toLowerCase();
			if(newValue.equals("stg") || newValue.equals("chi") || newValue.equals("dal")){
				isDone = true;
			}else{
				System.out.println("Required property is missing or invalid. ["+ cliPropertyName+" = '"+ com.eviware.soapui.SoapUI.globalProperties.getPropertyValue(cliPropertyName)+"']");
				System.exit(1);
			}
		}
	}else{
		UISupport.beep();
		newValue = UISupport.getDialogs().prompt(promptDescription, promptTitle, previousValue);
		newValue = "stg";
		if(newValue == null || newValue == ""){
			if(allowDefaultValue){
				newValue = defaultValue;
			}else{
				newValue = "";
			}
		}
		// some validation...
		newValue = newValue.toLowerCase();
		if(newValue.equals("stg") || newValue.equals("chi") || newValue.equals("dal")){
			isDone = true;
		}else{newValue = newValue.toLowerCase();
			isDone = false;
		}
	}
}

// Save Value
modelItem.setPropertyValue(propertyName,newValue);
def crap = context.expand( '${#Project#esb, loadbalancer}' )
System.out.println("["+crap+"]");
def crap2 = modelItem.getPropertyValue("esb, loadbalancer");
System.out.println("["+crap2+"]");


// output
// [https://lro-uat.navteq.com/LRO/Services/Management]
// [${#Project#${#Project#environment}, esb, loadbalancer}]</con:afterLoadScript>
  <con:wssContainer/>
  <con:databaseConnectionContainer/>
  <con:reporting>
    <con:xmlTemplates/>
    <con:parameters/>
  </con:reporting>
  <con:sensitiveInformation/>
</con:soapui-project>