/*
 * Created on Jun 11, 2006
 */
package edu.duke.cabig.catrip.test.system.steps;

import gov.nci.nih.cagrid.tests.core.util.FileUtils;

import java.io.File;
import java.io.IOException;

import com.atomicobject.haste.framework.Step;

public class DQEConfigureStep
	extends Step
{
	private File dqeConfigFile;
	private int port;
	
	public DQEConfigureStep(File dqeConfigFile, int port) 
	{
		super();
		
		this.dqeConfigFile = dqeConfigFile;
		this.port = port;
	}
	
	public void runStep() 
		throws IOException
	{
		File configDir = new File(System.getProperty("user.home"), ".caTRIP");
		configDir.mkdir();
		File dqeConfigFile = new File(configDir, "query_engine_services_config.xml");
		FileUtils.copy(this.dqeConfigFile, dqeConfigFile);
		FileUtils.replace(
			dqeConfigFile, "8080", String.valueOf(port)
		);
	}
}

@@ -508,16 +508,31 @@
 tion%0A%09%7B%0A
+%09%09// copy file%0A
 %09%09File c
@@ -750,16 +750,39 @@
 gFile);%0A
+%09%09%0A%09%09// configure port%0A
 %09%09FileUt
@@ -845,14 +845,323 @@
 rt)%0A%09%09);
+%0A%0A%09%09// configure client config%0A%09%09File dqeClientConfig = new File(System.getProperty(%22dqe.client.config%22,%0A%09%09%09%22..%22 + File.separator + %22gui%22 + File.separator + %22conf%22 + File.separator + %22client-config.wsdd%22%0A%09%09));%0A%09%09FileUtils.replace(%0A%09%09%09dqeConfigFile, %22@clientConfigWsdd@%22, dqeClientConfig.getAbsolutePath()%0A%09%09);
 %0A%09%7D%0A%7D%0A

writing output