<commit_before>/**
 * Created by Jack on 10/02/2015.
 */
import nz.ac.auckland.morc.*;
import scriptella.configuration.StringResource;
import scriptella.spi.ParametersCallback;
import scriptella.spi.Resource;

public class HTTPConnectionTestMorc extends MorcTestBuilder {

    public void configure(){

        final HTTPConnection httpConnection;
        final ParametersCallback parametersCallback;

        httpConnection = new HTTPConnection();
        httpConnection.setHOST("http://127.0.0.1:8080");
        httpConnection.setTIME_OUT(9999);
        parametersCallback = new ParametersCallback() {
            @Override
            public Object getParameter(String s) {
                return null;
            }
        };


        syncTest("script POST test",new TestBean() {
            @Override
            public void run() throws Exception {

                System.out.println("Test2");
                httpConnection.setTYPE("POST");

                Resource resource = new StringResource("test=test2\n" +
                                                    "test3=test4");

                httpConnection.executeScript(resource,parametersCallback);

            }

        }).addExpectation(syncExpectation("jetty:http://localhost:8080").expectedBody(text("test=test2&test3=test4")).responseBody(text("OK")));

    }
}<commit_msg>Update HTTPConnection.java and tests<commit_after>/**
 * Created by Jack on 10/02/2015.
 */
import nz.ac.auckland.morc.*;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import scriptella.configuration.StringResource;
import scriptella.spi.ParametersCallback;
import scriptella.spi.Resource;

public class HTTPConnectionTestMorc extends MorcTestBuilder {

    public void configure(){

        final HTTPConnection httpConnection;
        final ParametersCallback parametersCallback;


        httpConnection = new HTTPConnection();
        httpConnection.setHOST("http://127.0.0.1:8080");
        httpConnection.setTIME_OUT(9999);
        parametersCallback = new ParametersCallback() {
            @Override
            public Object getParameter(String s) {
                return null;
            }
        };


        syncTest("script POST test",new TestBean() {
            @Override
            public void run() throws Exception {

                System.out.println("Test2");
                httpConnection.setTYPE("POST");

                Resource resource = new StringResource("abc=123\n" +
                                                        "def=456\n" +
                                                        "ghi=789");

                httpConnection.executeScript(resource,parametersCallback);

            }

        }).addExpectation(syncExpectation("jetty:http://localhost:8080").expectedHeaders(headers(header("abc", "123"), header("def", "456"), header("ghi", "789"))).mockFeedPreprocessor(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                if (exchange.getIn().getBody() == null) exchange.getIn().setBody("");
            }
        }));

    }
}
{'fraction_non_alphanumeric': 0.10893944248638257, 'fraction_numerical': 0.024991989746876, 'mean_word_length': 2.1889683350357507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1999439', 'n_tokens_mistral': 818, 'n_tokens_neox': 732, 'n_words': 149}