gt: 							&& !file.getName().equals("EmptyGraph.grf") // ok, is to fail
context: package org.jetel.graph;
  
  import java.io.File;
  import java.io.FileFilter;
  import java.io.FileInputStream;
  import java.net.URL;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  import java.util.concurrent.Future;
  
  import org.apache.commons.io.filefilter.AbstractFileFilter;
  import org.apache.commons.io.filefilter.IOFileFilter;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.jetel.graph.runtime.EngineInitializer;
  import org.jetel.graph.runtime.GraphRuntimeContext;
  import org.jetel.main.runGraph;
  import org.jetel.test.CloverTestCase;
  import org.jetel.util.file.FileUtils;
  import org.jetel.util.string.StringUtils;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  /*
   * Copyright (c) 2004-2005 Javlin Consulting s.r.o. All rights reserved.
   * 
   */
  public class ResetTest extends CloverTestCase {
  
  	private final static String SCENARIOS_RELATIVE_PATH = "../cloveretl.test.scenarios/";
  	private final static String[] EXAMPLE_PATH = {
  			"../cloveretl.examples/SimpleExamples/",
  			"../cloveretl.examples/AdvancedExamples/",
  			"../cloveretl.examples/CTL2FunctionsTutorial/",
  			"../cloveretl.examples/DataProfiling/",
  			"../cloveretl.examples/DataSampling/",
  			"../cloveretl.examples/ExtExamples/",
  			"../cloveretl.examples.community/RealWorldExamples/",
  			"../cloveretl.examples.community/WebSiteExamples/",
  			"../cloveretl.examples/BasicExamples/",
  			"../cloveretl.test.scenarios/",
  			"../cloveretl.examples.commercial/CommercialExamples/",
  			"../cloveretl.examples.commercial/DataQualityExamples/"
  			//"../cloveretl.examples/CompanyTransactionsTutorial/"  // runs too long
  		};
  	
  	private final static String[] NEEDS_SCENARIOS_CONNECTION = {
  		"graphRevenues.grf",
  		"graphDBExecuteMsSql.grf",
  		"graphDBExecuteMySql.grf",
  		"graphDBExecuteOracle.grf",
  		"graphDBExecutePostgre.grf",
  		"graphDBExecuteSybase.grf",
  		"graphInfobrightDataWriterRemote.grf",
  		"graphLdapReaderWriter.grf"
  	};
  	
  	private final static String[] NEEDS_SCENARIOS_LIB = {
  		"graphDBExecuteOracle.grf",
  		"graphDBExecuteSybase.grf",
  		"graphLdapReaderWriter.grf"
  	};
  	
  	private final static Map<String, List<String>> CLASSPATHS = new HashMap<String, List<String>>();
  	static {
  		CLASSPATHS.put("rpc-literal-service-test.grf", Collections.singletonList("lib/rpc-literal-test.jar"));
  		CLASSPATHS.put("3rdPartyCode_CLO-8964.grf", Collections.singletonList("lib/Classloading_CLO-9137.jar"));
  	}
  		
  	private final static String GRAPHS_DIR = "graph";
  	private final static String TRANS_DIR = "trans";
  	private final static String[] OUT_DIRS = {"data-out/", "data-tmp/", "seq/"};
  	
  	private final String basePath;
  	private final File graphFile;
  	private final boolean batchMode;
  	
  	private boolean cleanUp = true;
  	
  	private static Log logger = LogFactory.getLog(ResetTest.class);
  	
  	public static Test suite() {
  
          final TestSuite suite = new TestSuite();
  		
  		for (int i = 0; i < EXAMPLE_PATH.length; i++) {
  			logger.info("Testing graphs in " + EXAMPLE_PATH[i]);
  			final File graphsDir =  new File(EXAMPLE_PATH[i], GRAPHS_DIR);
  			if(!graphsDir.exists()){
  				throw new IllegalStateException("Graphs directory " + graphsDir.getAbsolutePath() +" not found");
  			}
  			IOFileFilter fileFilter = new AbstractFileFilter() {
  				@Override
  				public boolean accept(File file) {
  					return file.getName().endsWith(".grf") 
  							&& !file.getName().startsWith("TPCH")// ok, performance tests - last very long
  							&& !file.getName().startsWith("Subgraph") // need server
  							&& !file.getName().startsWith("clusterDictionary") // cluster tests
  							&& !file.getName().contains("Performance")// ok, performance tests - last very long
  							&& !file.getName().equals("graphJoinData.grf") // ok, uses class file that is not created
  							&& !file.getName().equals("graphJoinHash.grf") // ok, uses class file that is not created
  							&& !file.getName().equals("graphOrdersReformat.grf") // ok, uses class file that is not created
  							&& !file.getName().equals("graphDataGeneratorExt.grf") // ok, uses class file that is not created
  							&& !file.getName().equals("graphApproximativeJoin.grf") // ok, uses class file that is not created
  							&& !file.getName().equals("graphDBJoin.grf") // ok, uses class file that is not created
  							&& !file.getName().equals("conversionNum2num.grf") // ok, should fail
  							&& !file.getName().equals("outPortWriting.grf") // ok, should fail
  							&& !file.getName().equals("graphDb2Load.grf") // ok, can only work with db2 client
  							&& !file.getName().equals("graphMsSqlDataWriter.grf") // ok, can only work with MsSql client
  							&& !file.getName().equals("graphMysqlDataWriter.grf") // ok, can only work with MySql client
  							&& !file.getName().equals("graphOracleDataWriter.grf") // ok, can only work with Oracle client
  							&& !file.getName().equals("graphPostgreSqlDataWriter.grf") // ok, can only work with postgre client
  							&& !file.getName().equals("graphInformixDataWriter.grf") // ok, can only work with informix server
  							&& !file.getName().equals("graphInfobrightDataWriter.grf") // ok, can only work with infobright server
  							&& !file.getName().equals("graphSystemExecuteWin.grf") // ok, graph for Windows
  							&& !file.getName().equals("graphLdapReader_Uninett.grf") // ok, invalid server
  							&& !file.getName().equals("graphSequenceChecker.grf") // ok, is to fail
  							&& !file.getName().equals("FixedData.grf") // ok, is to fail
  							&& !file.getName().equals("xpathReaderStates.grf") // ok, is to fail
  							&& !file.getName().equals("graphDataPolicy.grf") // ok, is to fail
  							&& !file.getName().equals("conversionDecimal2integer.grf") // ok, is to fail
  							&& !file.getName().equals("conversionDecimal2long.grf") // ok, is to fail
  							&& !file.getName().equals("conversionDouble2integer.grf") // ok, is to fail							
  							&& !file.getName().equals("conversionDouble2long.grf") // ok, is to fail
  							&& !file.getName().equals("conversionLong2integer.grf") // ok, is to fail
  							&& !file.getName().equals("nativeSortTestGraph.grf") // ok, invalid paths
  							&& !file.getName().equals("mountainsInformix.grf") // see issue 2550							
  							&& !file.getName().equals("SystemExecuteWin_EchoFromFile.grf") // graph for windows
  							&& !file.getName().equals("XLSEncryptedFail.grf") // ok, is to fail
  							&& !file.getName().equals("XLSXEncryptedFail.grf") // ok, is to fail
  							&& !file.getName().equals("XLSInvalidFile.grf") // ok, is to fail
  							&& !file.getName().equals("XLSReaderOrderMappingFail.grf") // ok, is to fail
  							&& !file.getName().equals("XLSXReaderOrderMappingFail.grf") // ok, is to fail
  							&& !file.getName().equals("XLSWildcardStrict.grf") // ok, is to fail
  							&& !file.getName().equals("XLSXWildcardStrict.grf") // ok, is to fail
  							&& !file.getName().equals("XLSWildcardControlled1.grf") // ok, is to fail
  							&& !file.getName().equals("XLSXWildcardControlled1.grf") // ok, is to fail
  							&& !file.getName().equals("XLSWildcardControlled7.grf") // ok, is to fail
  							&& !file.getName().equals("XLSXWildcardControlled7.grf") // ok, is to fail
  							&& !file.getName().equals("SSWRITER_MultilineInsertIntoTemplate.grf") // uses graph parameter definition from after-commit.ts
  							&& !file.getName().equals("SSWRITER_FormatInMetadata.grf") // uses graph parameter definition from after-commit.ts
  							&& !file.getName().equals("SSW_stringOutputField.grf") // ok, is to fail
  							&& !file.getName().equals("WSC_NamespaceBindingsDefined.grf") // ok, is to fail
  							&& !file.getName().equals("FailingGraph.grf") // ok, is to fail
  							&& !file.getName().equals("RunGraph_FailWhenUnderlyingGraphFails.grf") // probably should fail, recheck after added to after-commit.ts
  							&& !file.getName().equals("DataIntersection_order_check_A.grf") // ok, is to fail
  							&& !file.getName().equals("DataIntersection_order_check_B.grf") // ok, is to fail
  							&& !file.getName().equals("UDR_Logging_SFTP_CL1469.grf") // ok, is to fail
  							&& !file.getName().startsWith("AddressDoctor") //wrong path to db file, try to fix when AD installed on jenkins machines 
  							&& !file.getName().equals("EmailReader_Local.grf") // remove after CL-2167 solved
  							&& !file.getName().equals("EmailReader_Server.grf") // remove after CLD-3437 solved (or mail.javlin.eu has valid certificate)
  							&& !file.getName().equals("EmailValidation.grf") // runs too long
  							&& !file.getName().equals("EmailFilterGreylistingExample.grf") // runs too long
  							&& !file.getName().equals("EmailFilterSimpleExample.grf") // runs too long
  							&& !file.getName().equals("graphEmailFilterTestSmtp.grf") // runs too long
  							&& !file.getName().contains("firebird") // remove after CL-2170 solved
  							&& !file.getName().startsWith("ListOfRecords_Functions_02_") // remove after CL-2173 solved
  							&& !file.getName().equals("UDR_FileURL_OneZipMultipleFilesUnspecified.grf") // remove after CL-2174 solved
  							&& !file.getName().equals("UDR_FileURL_OneZipOneFileUnspecified.grf") // remove after CL-2174 solved
  							&& !file.getName().startsWith("MapOfRecords_Functions_01_Compiled_") // remove after CL-2175 solved
  							&& !file.getName().startsWith("MapOfRecords_Functions_01_Interpreted_") // remove after CL-2176 solved
  							&& !file.getName().equals("manyRecords.grf") // remove after CL-1292 implemented
  							&& !file.getName().equals("packedDecimal.grf") // remove after CL-1811 solved
  							&& !file.getName().equals("SimpleZipWrite.grf") // used by ArchiveFlushTest.java, doesn't make sense to run it separately
  							&& !file.getName().equals("XMLExtract_TKLK_003_Back.grf") // needs output from XMLWriter_LKTW_003.grf
  							&& !file.getName().equals("XMLWriter-CL-2404-CNO_OTF_ITSS.grf") // runs too long
  							&& !file.getName().equals("WebAccessLog.grf") // runs too long
  							&& !file.getName().equals("graphXLSReadWrite.grf") // runs too long
  							&& !file.getName().equals("JoiningAggregating.grf") // runs too long
  							&& !file.getName().equals("UDW_sortedInput_manyFiles.grf") // runs too long
  							&& !file.getName().equals("dataWriting.grf") // runs too long
  							&& !file.getName().equals("FSClosingTest-longRunning.grf") // runs too long
  							&& !file.getName().equals("CDW_sortedInput_manyFiles_CLO-5060.grf") // runs too long
  							&& !file.getName().equals("CreditCards.grf") // runs too long
  							&& !file.getName().equals("SQLDataParser_precision_CL2187.grf") // ok, is to fail
  							&& !file.getName().equals("incrementalReadingDB_explicitMapping.grf") // remove after CL-2239 solved
  							&& !file.getName().equals("HTTPConnector_get_bodyparams.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_get_error_unknownhost.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_get_error_unknownprotocol.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_get_inputfield.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_get_inputfileURL.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_get_requestcontent.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_post_error_unknownhost.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_post_error_unknownprotocol.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_inputmapping_null_values.grf") // ok, is to fail
  							&& !file.getName().equals("HttpConnector_errHandlingNoRedir.grf") // ok, is to fail
  							&& !file.getName().equals("HTTPConnector_retry_CLO-1251.grf") // runs too long
  							&& !file.getName().equals("HTTPConnector_timeout_CLO-1251.grf") // runs too long
  							&& !file.getName().equals("XMLExtract_fileURL_not_xml.grf") // ok, is to fail
  							&& !file.getName().equals("XMLExtract_charset_invalid.grf") // ok, is to fail
  							&& !file.getName().equals("XMLExtract_mappingURL_missing.grf") // ok, is to fail
  							&& !file.getName().equals("XMLExtract_fileURL_not_exists.grf") // ok, is to fail
  							&& !file.getName().equals("XMLExtract_charset_not_default_fail.grf") // ok, is to fail
  							&& !file.getName().equals("RunGraph_differentOutputMetadataFail.grf") // ok, is to fail
  							&& !file.getName().equals("LUTPersistent_wrong_metadata.grf") // ok, is to fail
  							&& !file.getName().equals("UDW_nonExistingDir_fail_CL-2478.grf") // ok, is to fail
  							&& !file.getName().equals("CTL_lookup_put_fail.grf") // ok, is to fail
  							&& !file.getName().equals("PersistentLookupTable_keyDuplicates_incompatibility.grf") // ok, is to fail
  							&& !file.getName().equals("SystemExecute_printBatchFile.grf") // ok, is to fail
  							&& !file.getName().equals("JoinMergeIssue_FailWhenMasterUnsorted.grf") // ok, is to fail
  							&& !file.getName().equals("UDW_remoteZipPartitioning_fail_CL-2564.grf") // ok, is to fail
  							&& !file.getName().equals("checkConfigTest.grf") // ok, is to fail
  							&& !file.getName().equals("DebuggingGraph.grf") // ok, is to fail
  							&& !file.getName().equals("graphDebuggingGraph.grf") // ok, is to fail
  							&& !file.getName().equals("CLO-404-recordCountsInErrorMessage.grf") // ok, is to fail
  							&& !file.getName().equals("TreeReader_CLO-4699.grf") // ok, is to fail
  							&& !file.getName().matches("Locale_.*_default.grf") // server only
  							&& !file.getName().equals("CompanyChecks.grf") // an example that needs embedded derby
  							&& !file.getName().equals("DatabaseAccess.grf") // an example that needs embedded derby
  							&& !file.getName().equals("graphDatabaseAccess.grf") // an example that needs embedded derby
  							&& !file.getName().equals("Twitter.grf") // an example that needs credentials
  							&& !file.getName().equals("XMLReader_no_output_port.grf") // ok, is to fail
  							&& !file.getName().startsWith("Proxy_") // allowed to run only on virt-cyan as proxy tests
  							&& !file.getName().equals("SandboxOperationHandlerTest.grf") // runs only on server
  							&& !file.getName().equals("DenormalizerWithoutInputFile.grf") // probably subgraph not supposed to be executed separately
  							&& !file.getName().equals("SimpleSequence_longValue.grf") // needs the sequence to be reset on start
  							&& !file.getName().equals("BeanWriterReader_employees.grf") // remove after CL-2474 solved
  							&& !file.getName().equals("GraphParameters_secure.grf") // server test
  							&& !file.getName().equals("GraphParameters_secureOverriden.grf") // server test
  							&& !file.getName().equals("GraphParameters_secureOverriden_subgraph.grf") // subgraph of server test
  							&& !file.getName().equals("SSR_CloseOnError.grf") // subgraph of server test
  							&& !file.getName().equals("TypedProperties_CLO-1997.grf") // server test
  							&& !file.getName().equals("EmptySubGraph.grf") // server test
  							&& !file.getName().equals("ParallelReader_HDFS.grf") // cluster test
  							&& !file.getName().equals("ParallelReader_CLO-13541.grf") // server test
  							&& !file.getName().equals("SubgraphsReuse.grf") // contains subgraphs
  							&& !file.getName().startsWith("Issues") // contains subgraphs
  							&& !file.getName().equals("SubgraphsSimplifyingGraph.grf") // contains subgraphs
  							&& !file.getName().equals("RandomDataGenerator.grf") // contains subgraphs
  							&& !file.getName().equals("graphHTTPConnector.grf") // external service is unstable
  							&& !file.getName().equals("WSC_Soap12_CLO-3349.grf") // external service is unstable (see CLO-9877)
  							&& !file.getName().equals("WebServiceClient.grf") // external service is unstable
  							&& !file.getName().equals("WebServiceClient1.grf") // external service is unstable
  							&& !file.getName().equals("WebServiceClientWithNS.grf") // external service is unstable
  							&& !file.getName().equals("WebServiceClient_HttpHeaders_invalid_field.grf") // negative test
  							&& !file.getName().equals("CLO-2214_pre_post_execute_race_condition.grf") // ok, is to fail
  