// 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/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 com.yourmediashelf.fedora.client.response.FedoraResponse;
import static com.yourmediashelf.fedora.client.FedoraClient.addDatastream;
import static org.junit.Assert.assertEquals;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import com.sun.jersey.multipart.BodyPart;
import com.yourmediashelf.fedora.client.FedoraClientException;
import com.yourmediashelf.fedora.client.response.BatchResponse;
/**
 * Copyright (C) 2010 MediaShelf <http://www.yourmediashelf.com/>
 *
 * This file is part of fedora-client.
 *
 * fedora-client is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * fedora-client is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with fedora-client.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.yourmediashelf.fedora.client.request;





@Ignore("Batch API is not included by default in Fedora")
public class BatchDeleteDatastreamsIT extends BaseFedoraRequestIT {

    @Test
    public void testBatchDeleteDatastreams() throws Exception {
        String[] dsids = {"batchDS1", "batchDS2"};
        String content = "<foo>bar</foo>";
        FedoraResponse adr;
        for (String dsid : dsids) {
            adr = addDatastream(testPid, dsid).content(content).execute();
            assertEquals(201, adr.getStatus());
        }

        // now delete it
        BatchResponse response =
                new BatchDeleteDatastreams().pids(testPid).dsids(dsids)
                        .logMessage("testBatchDeleteDatasteams").execute();
        assertEquals(200, response.getStatus());

        List<BodyPart> bps = response.getBodyParts();
// 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/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/BatchDeleteDatastreamsIT.java
import com.yourmediashelf.fedora.client.response.FedoraResponse;
import static com.yourmediashelf.fedora.client.FedoraClient.addDatastream;
import static org.junit.Assert.assertEquals;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import com.sun.jersey.multipart.BodyPart;
import com.yourmediashelf.fedora.client.FedoraClientException;
import com.yourmediashelf.fedora.client.response.BatchResponse;

/**
 * Copyright (C) 2010 MediaShelf <http://www.yourmediashelf.com/>
 *
 * This file is part of fedora-client.
 *
 * fedora-client is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * fedora-client is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with fedora-client.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.yourmediashelf.fedora.client.request;





@Ignore("Batch API is not included by default in Fedora")
public class BatchDeleteDatastreamsIT extends BaseFedoraRequestIT {

    @Test
    public void testBatchDeleteDatastreams() throws Exception {
        String[] dsids = {"batchDS1", "batchDS2"};
        String content = "<foo>bar</foo>";
        FedoraResponse adr;
        for (String dsid : dsids) {
            adr = addDatastream(testPid, dsid).content(content).execute();
            assertEquals(201, adr.getStatus());
        }

        // now delete it
        BatchResponse response =
                new BatchDeleteDatastreams().pids(testPid).dsids(dsids)
                        .logMessage("testBatchDeleteDatasteams").execute();
        assertEquals(200, response.getStatus());

        List<BodyPart> bps = response.getBodyParts();
        for (BodyPart bp : bps) {