// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static AddDatastream addDatastream(String pid, String dsId) {
//     return new AddDatastream(pid, dsId);
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static GetDatastreamDissemination getDatastreamDissemination(
//         String pid, String dsId) {
//     return new GetDatastreamDissemination(pid, dsId);
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static Ingest ingest() {
//     return new Ingest();
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static PurgeObject purgeObject(String pid) {
//     return new PurgeObject(pid);
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClientException.java
// public class FedoraClientException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private int status;
// 
//     public FedoraClientException(String message) {
//         super(message, null);
//     }
// 
//     public FedoraClientException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     /**
//      *
//      * @param status the HTTP status code of the error.
//      * @param message
//      */
//     public FedoraClientException(int status, String message) {
//         super(message);
//         this.status = status;
//     }
// 
//     /**
//      *
//      * @return the HTTP status code of the error
//      */
//     public int getStatus() {
//         return status;
//     }
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/response/BatchResponse.java
// public class BatchResponse extends FedoraResponseImpl {
// 
//     public BatchResponse(ClientResponse cr)
//             throws FedoraClientException {
//         super(cr);
//     }
// 
//     public MultiPart getMultiPart() {
//         return getEntity(MultiPart.class);
//     }
// 
//     public List<BodyPart> getBodyParts() {
//         return getMultiPart().getBodyParts();
//     }
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/response/FedoraResponse.java
// public interface FedoraResponse {
// 
//     /**
//      *
//      * @return the HTTP Status Code of the response.
//      */
//     public int getStatus();
// 
//     /**
//      * <p>Gets the raw response entity.</p>
//      *
//      * @return the entity response
//      */
//     public InputStream getEntityInputStream();
// 
//     /**
//      * <p>Gets the raw response entity.</p>
//      *
//      * @return the entity response
//      */
//     public <T> T getEntity(Class<T> c);
// 
//     /**
//      * <p>Get the media type of the response;
//      * @return the media type.
//      */
//     public String getType();
// 
//     /**
//      * <p>Close the response.
//      * <p>The entity input stream is closed;
//      */
//     public void close();
// 
// }


import static com.yourmediashelf.fedora.client.FedoraClient.addDatastream;
import static com.yourmediashelf.fedora.client.FedoraClient.getDatastreamDissemination;
import static com.yourmediashelf.fedora.client.FedoraClient.ingest;
import static com.yourmediashelf.fedora.client.FedoraClient.purgeObject;
import static org.junit.Assert.assertEquals;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import com.carrotsearch.junitbenchmarks.BenchmarkOptions;
import com.carrotsearch.junitbenchmarks.BenchmarkRule;
import com.carrotsearch.junitbenchmarks.annotation.AxisRange;
import com.carrotsearch.junitbenchmarks.annotation.BenchmarkMethodChart;
import com.sun.jersey.multipart.BodyPart;
import com.yourmediashelf.fedora.client.FedoraClientException;
import com.yourmediashelf.fedora.client.response.BatchResponse;
import com.yourmediashelf.fedora.client.response.FedoraResponse;
        System.out.print("Creating fixture objects, this may take some time ");
        FedoraRequest.setDefaultClient(fedora);
        for (String dsType : dsTypes) {
            for (int i = 1; i <= pidCountPerDsType; i++) {
                pid = String.format("%s:%s%d", pidNamespace, dsType, i); // e.g. test-batch:X1

                pids.add(pid);
                ingest(pid).execute();
                System.out.print(".");

                for (int size : dsSizes) {
                    dsid = String.format("%s%sK", dsType, size); // e.g. X100K or M10K
                    addDatastream(pid, dsid).controlGroup(dsType).content(
                            contents.get(String.valueOf(size))).execute();

                    dsids.add(dsid);
                }
            }
        }
        System.out.println();

        System.out.println("* Ingested pids:\n\t" + listAsCSV(pids));
        System.out.println("* Added dsids:\n\t" + listAsCSV(dsids));
    }

    @AfterClass
    public static void purgeFixtures() throws FedoraClientException {
        System.out.print("Purging fixtures, this may take some time ");
        for (String pid : pids) {
            purgeObject(pid).execute(fedora);
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static AddDatastream addDatastream(String pid, String dsId) {
//     return new AddDatastream(pid, dsId);
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static GetDatastreamDissemination getDatastreamDissemination(
//         String pid, String dsId) {
//     return new GetDatastreamDissemination(pid, dsId);
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static Ingest ingest() {
//     return new Ingest();
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClient.java
// public static PurgeObject purgeObject(String pid) {
//     return new PurgeObject(pid);
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/FedoraClientException.java
// public class FedoraClientException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     private int status;
// 
//     public FedoraClientException(String message) {
//         super(message, null);
//     }
// 
//     public FedoraClientException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     /**
//      *
//      * @param status the HTTP status code of the error.
//      * @param message
//      */
//     public FedoraClientException(int status, String message) {
//         super(message);
//         this.status = status;
//     }
// 
//     /**
//      *
//      * @return the HTTP status code of the error
//      */
//     public int getStatus() {
//         return status;
//     }
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/response/BatchResponse.java
// public class BatchResponse extends FedoraResponseImpl {
// 
//     public BatchResponse(ClientResponse cr)
//             throws FedoraClientException {
//         super(cr);
//     }
// 
//     public MultiPart getMultiPart() {
//         return getEntity(MultiPart.class);
//     }
// 
//     public List<BodyPart> getBodyParts() {
//         return getMultiPart().getBodyParts();
//     }
// }
// 
// Path: fedora-client-core/src/main/java/com/yourmediashelf/fedora/client/response/FedoraResponse.java
// public interface FedoraResponse {
// 
//     /**
//      *
//      * @return the HTTP Status Code of the response.
//      */
//     public int getStatus();
// 
//     /**
//      * <p>Gets the raw response entity.</p>
//      *
//      * @return the entity response
//      */
//     public InputStream getEntityInputStream();
// 
//     /**
//      * <p>Gets the raw response entity.</p>
//      *
//      * @return the entity response
//      */
//     public <T> T getEntity(Class<T> c);
// 
//     /**
//      * <p>Get the media type of the response;
//      * @return the media type.
//      */
//     public String getType();
// 
//     /**
//      * <p>Close the response.
//      * <p>The entity input stream is closed;
//      */
//     public void close();
// 
// }


// Path: fedora-client-core/src/test/java/com/yourmediashelf/fedora/client/request/BatchIT.java
import static com.yourmediashelf.fedora.client.FedoraClient.addDatastream;
import static com.yourmediashelf.fedora.client.FedoraClient.getDatastreamDissemination;
import static com.yourmediashelf.fedora.client.FedoraClient.ingest;
import static com.yourmediashelf.fedora.client.FedoraClient.purgeObject;
import static org.junit.Assert.assertEquals;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import com.carrotsearch.junitbenchmarks.BenchmarkOptions;
import com.carrotsearch.junitbenchmarks.BenchmarkRule;
import com.carrotsearch.junitbenchmarks.annotation.AxisRange;
import com.carrotsearch.junitbenchmarks.annotation.BenchmarkMethodChart;
import com.sun.jersey.multipart.BodyPart;
import com.yourmediashelf.fedora.client.FedoraClientException;
import com.yourmediashelf.fedora.client.response.BatchResponse;
import com.yourmediashelf.fedora.client.response.FedoraResponse;

        System.out.print("Creating fixture objects, this may take some time ");
        FedoraRequest.setDefaultClient(fedora);
        for (String dsType : dsTypes) {
            for (int i = 1; i <= pidCountPerDsType; i++) {
                pid = String.format("%s:%s%d", pidNamespace, dsType, i); // e.g. test-batch:X1

                pids.add(pid);
                ingest(pid).execute();
                System.out.print(".");

                for (int size : dsSizes) {
                    dsid = String.format("%s%sK", dsType, size); // e.g. X100K or M10K
                    addDatastream(pid, dsid).controlGroup(dsType).content(
                            contents.get(String.valueOf(size))).execute();

                    dsids.add(dsid);
                }
            }
        }
        System.out.println();

        System.out.println("* Ingested pids:\n\t" + listAsCSV(pids));
        System.out.println("* Added dsids:\n\t" + listAsCSV(dsids));
    }

    @AfterClass
    public static void purgeFixtures() throws FedoraClientException {
        System.out.print("Purging fixtures, this may take some time ");
        for (String pid : pids) {
            purgeObject(pid).execute(fedora);
            System.out.print(".");