Example usage for org.apache.http.entity.mime MultipartEntity addPart

List of usage examples for org.apache.http.entity.mime MultipartEntity addPart

Introduction

In this page you can find the example usage for org.apache.http.entity.mime MultipartEntity addPart.

Prototype

public void addPart(final String name, final ContentBody contentBody) 

Source Link

Usage

From source file:bluej.collect.DataCollectorImpl.java

public static void codePadException(Package pkg, String command, String exception) {
    MultipartEntity mpe = new MultipartEntity();
    mpe.addPart("event[codepad][outcome]", CollectUtility.toBody("exception"));
    mpe.addPart("event[codepad][command]", CollectUtility.toBody(command));
    mpe.addPart("event[codepad][exception]", CollectUtility.toBody(exception));
    submitEvent(pkg.getProject(), pkg, EventName.CODEPAD, new PlainEvent(mpe));
}

From source file:bluej.collect.DataCollectorImpl.java

/**
 * Turns the Repository into an MPE with appropriate information
 *///ww w.ja v  a2  s. co m
private static MultipartEntity getRepoMPE(Repository repo) {
    MultipartEntity mpe = new MultipartEntity();
    mpe.addPart("event[vcs][vcs_type]", CollectUtility.toBody(repo.getVCSType()));
    mpe.addPart("event[vcs][protocol]", CollectUtility.toBody(repo.getVCSProtocol()));
    return mpe;
}

From source file:bluej.collect.DataCollectorImpl.java

public static void cancelTestMethod(Package pkg, int testIdentifier) {
    MultipartEntity mpe = new MultipartEntity();

    mpe.addPart("event[test][test_identifier]", CollectUtility.toBody(testIdentifier));

    submitEvent(pkg.getProject(), pkg, EventName.CANCEL_TEST, new PlainEvent(mpe));
}

From source file:bluej.collect.DataCollectorImpl.java

public static void endTestMethod(Package pkg, int testIdentifier) {
    MultipartEntity mpe = new MultipartEntity();

    mpe.addPart("event[test][test_identifier]", CollectUtility.toBody(testIdentifier));

    submitEvent(pkg.getProject(), pkg, EventName.END_TEST, new PlainEvent(mpe));

}

From source file:bluej.collect.DataCollectorImpl.java

public static void benchGet(Package pkg, String benchName, String typeName, int testIdentifier) {
    MultipartEntity mpe = new MultipartEntity();

    mpe.addPart("event[bench_object][class_name]", CollectUtility.toBody(typeName));
    mpe.addPart("event[bench_object][name]", CollectUtility.toBody(benchName));
    mpe.addPart("event[test_identifier]", CollectUtility.toBody(testIdentifier));
    submitEvent(pkg.getProject(), pkg, EventName.BENCH_GET, new PlainEvent(mpe));

}

From source file:bluej.collect.DataCollectorImpl.java

public static void removeObject(Package pkg, String name) {
    if (!false) {
        MultipartEntity mpe = new MultipartEntity();
        mpe.addPart("event[object_name]", CollectUtility.toBody(name));
        submitEvent(pkg.getProject(), pkg, EventName.REMOVE_OBJECT, new PlainEvent(mpe));
    }/*from w w  w  . j av  a 2  s.com*/
}

From source file:bluej.collect.DataCollectorImpl.java

public static void invokeMethodTerminated(Package pkg, String code) {
    if (!false) {
        MultipartEntity mpe = new MultipartEntity();
        mpe.addPart("event[invoke][code]", CollectUtility.toBody(code));
        mpe.addPart("event[invoke][result]", CollectUtility.toBody("terminated"));
        submitEvent(pkg.getProject(), pkg, EventName.INVOKE_METHOD, new PlainEvent(mpe));
    }/*ww w.ja  v a  2s  .  c o  m*/
}

From source file:bluej.collect.DataCollectorImpl.java

public static void startTestMethod(Package pkg, int testIdentifier, File sourceFile, String testName) {
    MultipartEntity mpe = new MultipartEntity();

    mpe.addPart("event[test][test_identifier]", CollectUtility.toBody(testIdentifier));
    mpe.addPart("event[test][source_file]",
            CollectUtility.toBodyLocal(new ProjectDetails(pkg.getProject()), sourceFile));
    mpe.addPart("event[test][method_name]", CollectUtility.toBody(testName));

    submitEvent(pkg.getProject(), pkg, EventName.START_TEST, new PlainEvent(mpe));

}

From source file:bluej.collect.DataCollectorImpl.java

public static void inspectorClassShow(Package pkg, Inspector inspector, String className) {
    if (!false) {
        MultipartEntity mpe = new MultipartEntity();
        mpe.addPart("event[inspect][unique]", CollectUtility.toBody(inspector.getUniqueId()));
        mpe.addPart("event[inspect][static_class]", CollectUtility.toBody(className));
        inspectorPackages.put(inspector, pkg);
        submitEvent(pkg.getProject(), pkg, EventName.INSPECTOR_SHOW, new PlainEvent(mpe));
    }/*  w ww .j  a  v a 2  s.c  o  m*/
}

From source file:bluej.collect.DataCollectorImpl.java

public static void objectBenchToFixture(Package pkg, File sourceFile, List<String> benchNames) {
    MultipartEntity mpe = new MultipartEntity();

    mpe.addPart("event[source_file_name]",
            CollectUtility.toBodyLocal(new ProjectDetails(pkg.getProject()), sourceFile));
    for (String name : benchNames) {
        mpe.addPart("event[bench_objects][][name]", CollectUtility.toBody(name));
    }/*  w  w  w .  j a  v  a  2 s.  com*/

    submitEvent(pkg.getProject(), pkg, EventName.BENCH_TO_FIXTURE, new PlainEvent(mpe));

}