Search in sources :

Example 1 with DeleteMethod

use of org.apache.commons.httpclient.methods.DeleteMethod in project zeppelin by apache.

the class ZeppelinRestApiTest method testDeleteNote.

private void testDeleteNote(String noteId) throws IOException {
    DeleteMethod delete = httpDelete(("/notebook/" + noteId));
    LOG.info("testDeleteNote delete response\n" + delete.getResponseBodyAsString());
    assertThat("Test delete method:", delete, isAllowed());
    delete.releaseConnection();
    // make sure note is deleted
    if (!noteId.isEmpty()) {
        Note deletedNote = ZeppelinServer.notebook.getNote(noteId);
        assertNull("Deleted note should be null", deletedNote);
    }
}
Also used : DeleteMethod(org.apache.commons.httpclient.methods.DeleteMethod) Note(org.apache.zeppelin.notebook.Note)

Example 2 with DeleteMethod

use of org.apache.commons.httpclient.methods.DeleteMethod in project zeppelin by apache.

the class NotebookSecurityRestApiTest method userTryRemoveNote.

private void userTryRemoveNote(String noteId, String user, String pwd, Matcher<? super HttpMethodBase> m) throws IOException {
    DeleteMethod delete = httpDelete(("/notebook/" + noteId), user, pwd);
    assertThat(delete, m);
    delete.releaseConnection();
}
Also used : DeleteMethod(org.apache.commons.httpclient.methods.DeleteMethod)

Example 3 with DeleteMethod

use of org.apache.commons.httpclient.methods.DeleteMethod in project zeppelin by apache.

the class CredentialsRestApiTest method testRemoveUserCredentials.

public void testRemoveUserCredentials() throws IOException {
    DeleteMethod deleteMethod = httpDelete("/credential/");
    assertThat("Test delete method:", deleteMethod, isAllowed());
    deleteMethod.releaseConnection();
}
Also used : DeleteMethod(org.apache.commons.httpclient.methods.DeleteMethod)

Example 4 with DeleteMethod

use of org.apache.commons.httpclient.methods.DeleteMethod in project zeppelin by apache.

the class CredentialsRestApiTest method testRemoveCredentialEntity.

public void testRemoveCredentialEntity(String entity) throws IOException {
    DeleteMethod deleteMethod = httpDelete("/credential/" + entity);
    assertThat("Test delete method:", deleteMethod, isAllowed());
    deleteMethod.releaseConnection();
}
Also used : DeleteMethod(org.apache.commons.httpclient.methods.DeleteMethod)

Example 5 with DeleteMethod

use of org.apache.commons.httpclient.methods.DeleteMethod in project zeppelin by apache.

the class InterpreterRestApiTest method testAddDeleteRepository.

@Test
public void testAddDeleteRepository() throws IOException {
    // Call create repository API
    String repoId = "securecentral";
    String jsonRequest = "{\"id\":\"" + repoId + "\",\"url\":\"https://repo1.maven.org/maven2\",\"snapshot\":\"false\"}";
    PostMethod post = httpPost("/interpreter/repository/", jsonRequest);
    assertThat("Test create method:", post, isAllowed());
    post.releaseConnection();
    // Call delete repository API
    DeleteMethod delete = httpDelete("/interpreter/repository/" + repoId);
    assertThat("Test delete method:", delete, isAllowed());
    delete.releaseConnection();
}
Also used : DeleteMethod(org.apache.commons.httpclient.methods.DeleteMethod) PostMethod(org.apache.commons.httpclient.methods.PostMethod) Test(org.junit.Test)

Aggregations

DeleteMethod (org.apache.commons.httpclient.methods.DeleteMethod)46 GetMethod (org.apache.commons.httpclient.methods.GetMethod)14 Test (org.junit.Test)14 HttpClient (org.apache.commons.httpclient.HttpClient)12 PutMethod (org.apache.commons.httpclient.methods.PutMethod)10 IOException (java.io.IOException)9 HttpMethod (org.apache.commons.httpclient.HttpMethod)8 PostMethod (org.apache.commons.httpclient.methods.PostMethod)8 AbstractHttpTest (org.xwiki.test.rest.framework.AbstractHttpTest)7 HttpException (org.apache.commons.httpclient.HttpException)5 Note (org.apache.zeppelin.notebook.Note)5 Header (org.apache.commons.httpclient.Header)3 ByteArrayRequestEntity (org.apache.commons.httpclient.methods.ByteArrayRequestEntity)3 StringRequestEntity (org.apache.commons.httpclient.methods.StringRequestEntity)3 Paragraph (org.apache.zeppelin.notebook.Paragraph)3 Account (com.zimbra.cs.account.Account)2 ElasticSearchConnector (com.zimbra.cs.index.elasticsearch.ElasticSearchConnector)2 URL (java.net.URL)2 Map (java.util.Map)2 URIException (org.apache.commons.httpclient.URIException)2