<commit_before>package org.cagrid.data.styles.cacore41.test;

import gov.nih.nci.cagrid.common.Utils;
import gov.nih.nci.cagrid.testing.system.deployment.ServiceContainer;
import gov.nih.nci.cagrid.testing.system.deployment.ServiceContainerFactory;
import gov.nih.nci.cagrid.testing.system.deployment.ServiceContainerType;
import gov.nih.nci.cagrid.testing.system.deployment.steps.DeployServiceStep;
import gov.nih.nci.cagrid.testing.system.deployment.steps.DestroyContainerStep;
import gov.nih.nci.cagrid.testing.system.deployment.steps.StartContainerStep;
import gov.nih.nci.cagrid.testing.system.deployment.steps.StopContainerStep;
import gov.nih.nci.cagrid.testing.system.deployment.steps.UnpackContainerStep;
import gov.nih.nci.cagrid.testing.system.haste.Step;
import gov.nih.nci.cagrid.testing.system.haste.Story;

import java.io.File;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;

import org.cagrid.data.styles.cacore41.test.steps.InvokeSDK41CQL2DataServiceStep;
import org.cagrid.data.styles.cacore41.test.steps.InvokeSDK41DataServiceStep;
import org.cagrid.data.styles.cacore41.test.steps.SDK41StyleCreationStep;
import org.cagrid.data.test.creation.DataTestCaseInfo;

/** 
 *  SDK41ServiceStyleInvocationTest
 *  Test to stand up an SDK 4.1 style data service and invoke it.
 * 
 * @author <NAME>
 * 
 * @created Feb 1, 2008 7:49:44 AM
 * @version $Id: SDK41ServiceStyleInvocationTest.java,v 1.2 2009-04-10 15:15:24 dervin Exp $ 
 */
public class SDK41ServiceStyleInvocationTest extends Story {
    
    private DataTestCaseInfo serviceTestInfo = null;
    private ServiceContainer container = null;

    public SDK41ServiceStyleInvocationTest() {
        super();
    }


    public String getDescription() {
        return "Test to stand up an SDK 4.1 style data service and invoke it";
    }
    
    
    public String getName() {
        return "SDK 4_1 Data Service style Invocation test";
    }
    
    
    public boolean storySetUp() throws Throwable {
        serviceTestInfo = SDK41ServiceStyleSystemTestConstants.getTestServiceInfo();
        
        container = ServiceContainerFactory.createContainer(ServiceContainerType.GLOBUS_CONTAINER);
        
        File serviceDir = new File(serviceTestInfo.getDir());
        serviceDir.mkdirs();
        
        return container != null && serviceDir.exists() && serviceDir.isDirectory();
    }


    protected Vector<?> steps() {
        Vector<Step> steps = new Vector<Step>();
        steps.add(new SDK41StyleCreationStep(serviceTestInfo, getIntroduceBaseDir()));
        steps.add(new UnpackContainerStep(container));
        List<String> deploymentArgs = 
            Collections.singletonList("-Dno.deployment.validation=true");
        steps.add(new DeployServiceStep(container, serviceTestInfo.getDir(), deploymentArgs));
        steps.add(new StartContainerStep(container));
        steps.add(new InvokeSDK41DataServiceStep(container, serviceTestInfo));
        steps.add(new InvokeSDK41CQL2DataServiceStep(container, serviceTestInfo));
        return steps;
    }
    
    
    public void storyTearDown() throws Throwable {
        List<Throwable> errors = new LinkedList<Throwable>();
        try {        
            new StopContainerStep(container).runStep();
        } catch (Throwable th) {
            errors.add(th);
        }
        try {
            new DestroyContainerStep(container).runStep();
        } catch (Throwable th) {
            errors.add(th);
        }
        try {
            Utils.deleteDir(new File(serviceTestInfo.getDir()));
        } catch (Throwable th) {
            errors.add(th);
        }
        
        if (errors.size() != 0) {
            System.err.println("EXCEPTION(S) OCCURED DURING TEAR DOWN:");
            for (Throwable t : errors) {
                System.err.println("----------------");
                t.printStackTrace();
            }
            throw new Exception("EXCEPTION(S) OCCURED DURING TEAR DOWN.  SEE LOGS");
        }
    }
    
    
    public String getIntroduceBaseDir() {
        String dir = System.getProperty(SDK41ServiceStyleSystemTestConstants.INTRODUCE_DIR_PROPERTY);
        if (dir == null) {
            fail("Introduce base dir system property " + 
                SDK41ServiceStyleSystemTestConstants.INTRODUCE_DIR_PROPERTY + " is required");
        }
        return dir;
    }
}
<commit_msg>CAGRID-110: Migrating SDK 4.1 data service tests to Tomcat 6<commit_after>package org.cagrid.data.styles.cacore41.test;

import gov.nih.nci.cagrid.common.Utils;
import gov.nih.nci.cagrid.testing.system.deployment.ServiceContainer;
import gov.nih.nci.cagrid.testing.system.deployment.ServiceContainerFactory;
import gov.nih.nci.cagrid.testing.system.deployment.ServiceContainerType;
import gov.nih.nci.cagrid.testing.system.deployment.steps.DeployServiceStep;
import gov.nih.nci.cagrid.testing.system.deployment.steps.DestroyContainerStep;
import gov.nih.nci.cagrid.testing.system.deployment.steps.StartContainerStep;
import gov.nih.nci.cagrid.testing.system.deployment.steps.StopContainerStep;
import gov.nih.nci.cagrid.testing.system.deployment.steps.UnpackContainerStep;
import gov.nih.nci.cagrid.testing.system.haste.Step;
import gov.nih.nci.cagrid.testing.system.haste.Story;

import java.io.File;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;

import org.cagrid.data.styles.cacore41.test.steps.InvokeSDK41CQL2DataServiceStep;
import org.cagrid.data.styles.cacore41.test.steps.InvokeSDK41DataServiceStep;
import org.cagrid.data.styles.cacore41.test.steps.SDK41StyleCreationStep;
import org.cagrid.data.test.creation.DataTestCaseInfo;

/** 
 *  SDK41ServiceStyleInvocationTest
 *  Test to stand up an SDK 4.1 style data service and invoke it.
 * 
 * @author <NAME>
 * 
 * @created Feb 1, 2008 7:49:44 AM
 * @version $Id: SDK41ServiceStyleInvocationTest.java,v 1.2 2009-04-10 15:15:24 dervin Exp $ 
 */
public class SDK41ServiceStyleInvocationTest extends Story {
    
    private DataTestCaseInfo serviceTestInfo = null;
    private ServiceContainer container = null;

    public SDK41ServiceStyleInvocationTest() {
        super();
    }


    public String getDescription() {
        return "Test to stand up an SDK 4.1 style data service and invoke it";
    }
    
    
    public String getName() {
        return "SDK 4_1 Data Service style Invocation test";
    }
    
    
    public boolean storySetUp() throws Throwable {
        serviceTestInfo = SDK41ServiceStyleSystemTestConstants.getTestServiceInfo();
        
        container = ServiceContainerFactory.createContainer(ServiceContainerType.TOMCAT_6_CONTAINER);
        
        File serviceDir = new File(serviceTestInfo.getDir());
        serviceDir.mkdirs();
        
        return container != null && serviceDir.exists() && serviceDir.isDirectory();
    }


    protected Vector<?> steps() {
        Vector<Step> steps = new Vector<Step>();
        steps.add(new SDK41StyleCreationStep(serviceTestInfo, getIntroduceBaseDir()));
        steps.add(new UnpackContainerStep(container));
        List<String> deploymentArgs = 
            Collections.singletonList("-Dno.deployment.validation=true");
        steps.add(new DeployServiceStep(container, serviceTestInfo.getDir(), deploymentArgs));
        steps.add(new StartContainerStep(container));
        steps.add(new InvokeSDK41DataServiceStep(container, serviceTestInfo));
        steps.add(new InvokeSDK41CQL2DataServiceStep(container, serviceTestInfo));
        return steps;
    }
    
    
    public void storyTearDown() throws Throwable {
        List<Throwable> errors = new LinkedList<Throwable>();
        try {        
            new StopContainerStep(container).runStep();
        } catch (Throwable th) {
            errors.add(th);
        }
        try {
            new DestroyContainerStep(container).runStep();
        } catch (Throwable th) {
            errors.add(th);
        }
        try {
            Utils.deleteDir(new File(serviceTestInfo.getDir()));
        } catch (Throwable th) {
            errors.add(th);
        }
        
        if (errors.size() != 0) {
            System.err.println("EXCEPTION(S) OCCURED DURING TEAR DOWN:");
            for (Throwable t : errors) {
                System.err.println("----------------");
                t.printStackTrace();
            }
            throw new Exception("EXCEPTION(S) OCCURED DURING TEAR DOWN.  SEE LOGS");
        }
    }
    
    
    public String getIntroduceBaseDir() {
        String dir = System.getProperty(SDK41ServiceStyleSystemTestConstants.INTRODUCE_DIR_PROPERTY);
        if (dir == null) {
            fail("Introduce base dir system property " + 
                SDK41ServiceStyleSystemTestConstants.INTRODUCE_DIR_PROPERTY + " is required");
        }
        return dir;
    }
}

{'fraction_non_alphanumeric': 0.10551747387346892, 'fraction_numerical': 0.016293965614113944, 'mean_word_length': 2.9696699375557536, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1799892', 'n_tokens_mistral': 2786, 'n_tokens_neox': 2626, 'n_words': 481}