// 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/IngestResponse.java
// public class IngestResponse extends FedoraResponseImpl {
// 
//     private String pid;
// 
//     private final URI location;
// 
//     public IngestResponse(ClientResponse cr)
//             throws FedoraClientException {
//         super(cr);
//         location = cr.getLocation();
//     }
// 
//     /**
//      *
//      * @return the pid of the newly created object.
//      */
//     public String getPid() {
//         if (pid == null) {
//             pid = getEntity(String.class);
//         }
//         return pid;
//     }
// 
//     /**
//      *
//      * @return the URI of the newly created resource.
//      */
//     public URI getLocation() {
//         return location;
//     }
// }


import com.yourmediashelf.fedora.client.FedoraClientException;
import com.yourmediashelf.fedora.client.response.IngestResponse;
import static com.yourmediashelf.fedora.client.FedoraClient.ingest;
import static com.yourmediashelf.fedora.client.FedoraClient.purgeObject;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.URI;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
 * 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;





public class IngestIT extends BaseFedoraRequestIT {

    private String pid;

    @Override
    @Before
    public void setUp() throws Exception {
        // do nothing
    }

    @Override
    @After
    public void tearDown() throws Exception {
        if (pid != null) {
            purgeObject(pid).logMessage("purging IngestTest object").execute();
        }
    }

    @Test
    public void testIngestDefault() throws Exception {
        IngestResponse response = null;
        URI location = null;

        // empty object, no pid, no namespace
        response = ingest().logMessage("testIngestDefault").execute();
        assertEquals(201, response.getStatus());
        location = response.getLocation();
        assertTrue(location.toString().contains("/objects/"));
        pid = response.getPid();
    }

    @Test
    public void testIngestWithNamespace() throws Exception {
// 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/IngestResponse.java
// public class IngestResponse extends FedoraResponseImpl {
// 
//     private String pid;
// 
//     private final URI location;
// 
//     public IngestResponse(ClientResponse cr)
//             throws FedoraClientException {
//         super(cr);
//         location = cr.getLocation();
//     }
// 
//     /**
//      *
//      * @return the pid of the newly created object.
//      */
//     public String getPid() {
//         if (pid == null) {
//             pid = getEntity(String.class);
//         }
//         return pid;
//     }
// 
//     /**
//      *
//      * @return the URI of the newly created resource.
//      */
//     public URI getLocation() {
//         return location;
//     }
// }


// Path: fedora-client-core/src/test/java/com/yourmediashelf/fedora/client/request/IngestIT.java
import com.yourmediashelf.fedora.client.FedoraClientException;
import com.yourmediashelf.fedora.client.response.IngestResponse;
import static com.yourmediashelf.fedora.client.FedoraClient.ingest;
import static com.yourmediashelf.fedora.client.FedoraClient.purgeObject;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.URI;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * 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;





public class IngestIT extends BaseFedoraRequestIT {

    private String pid;

    @Override
    @Before
    public void setUp() throws Exception {
        // do nothing
    }

    @Override
    @After
    public void tearDown() throws Exception {
        if (pid != null) {
            purgeObject(pid).logMessage("purging IngestTest object").execute();
        }
    }

    @Test
    public void testIngestDefault() throws Exception {
        IngestResponse response = null;
        URI location = null;

        // empty object, no pid, no namespace
        response = ingest().logMessage("testIngestDefault").execute();
        assertEquals(201, response.getStatus());
        location = response.getLocation();
        assertTrue(location.toString().contains("/objects/"));
        pid = response.getPid();
    }

    @Test
    public void testIngestWithNamespace() throws Exception {
        IngestResponse response = null;