Example usage for org.apache.commons.httpclient HttpMethod releaseConnection

List of usage examples for org.apache.commons.httpclient HttpMethod releaseConnection

Introduction

In this page you can find the example usage for org.apache.commons.httpclient HttpMethod releaseConnection.

Prototype

public abstract void releaseConnection();

Source Link

Usage

From source file:org.iavante.sling.gad.content.ContentServiceTestIT.java

/**
 * Tests path property//from  w w w. j  a  v a  2 s. co  m
 */
public void test_getLogNode() {

    try {
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    String log_node = "log";
    String log_resourceType = "gad/log";

    try {
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Get the log node
    HttpMethod get_content_log = new GetMethod(SLING_URL + COLLECTIONS_URL + slug_collection + "/"
            + CONTENTS_FOLDER + "/" + slug_content + "/" + log_node + "/sling:resourceType");
    try {
        this.client.executeMethod(get_content_log);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }
    // handle response.
    String response_body = "";
    try {
        response_body = get_content_log.getResponseBodyAsString();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertEquals(response_body, log_resourceType);
    get_content_log.releaseConnection();

    // Get the url property
    HttpMethod get_content_log_url = new GetMethod(SLING_URL + COLLECTIONS_URL + slug_collection + "/"
            + CONTENTS_FOLDER + "/" + slug_content + "/" + log_node + "/url");
    try {
        this.client.executeMethod(get_content_log_url);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }

    // handle response.
    response_body = "";
    try {
        response_body = get_content_log_url.getResponseBodyAsString();
    } catch (IOException e) {

        e.printStackTrace();
    }

    String log_url = COLLECTIONS_URL + slug_collection + "/" + CONTENTS_FOLDER + "/" + slug_content;

    assertEquals(response_body, log_url);
    get_content_log_url.releaseConnection();

}

From source file:org.iavante.sling.gad.content.ContentServiceTestIT.java

/**
 * Test for content postprocesing. Associate schema
 *//*from www  .ja  va 2s.c o m*/
public void test_sourceAssociation() {

    // Check sources content type created from schema
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }
    HttpMethod get_source = new GetMethod(SLING_URL + COLLECTIONS_URL + slug_collection + "/" + CONTENTS_FOLDER
            + "/" + slug_content + "/" + SCHEMA_REL_PATH);
    try {
        client.executeMethod(get_source);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }
    assertEquals(get_source.getStatusCode(), 200);

    get_source.releaseConnection();
}

From source file:org.iavante.sling.gad.content.ContentServiceTestIT.java

/**
 * Test the validated property/*www . ja  v a 2 s.co  m*/
 */
public void test_content_validation() {

    String validated = "0";
    String response_body = "";

    String source_video = "fuente_default";
    String source_image = "thumbnail_default";

    String file_video = "test.avi";
    String mime_video = "video/avi";

    String file_image = "test.png";
    String mime_image = "image/png";

    try {
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    HttpMethod get_valid_prop = new GetMethod(SLING_URL + COLLECTIONS_URL + slug_collection + "/"
            + CONTENTS_FOLDER + "/" + slug_content + "/validated");
    try {
        client.executeMethod(get_valid_prop);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }

    try {
        response_body = get_valid_prop.getResponseBodyAsString();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertEquals(response_body, validated);
    get_valid_prop.releaseConnection();

    // Edit source default
    PostMethod post_edit = new PostMethod(SLING_URL + COLLECTIONS_URL + slug_collection + "/" + CONTENTS_FOLDER
            + "/" + slug_content + "/" + SOURCES_FOLDER + "/" + source_video);
    post_edit.setDoAuthentication(true);

    NameValuePair[] data_edit = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("file", file_video), new NameValuePair("mimetype", mime_video),
            new NameValuePair("text_encoding", ""), new NameValuePair("lang", ""),
            new NameValuePair("length", ""), new NameValuePair("size", ""), new NameValuePair("type", ""),
            new NameValuePair("bitrate", ""), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_edit.setRequestBody(data_edit);
    post_edit.setDoAuthentication(true);
    try {
        client.executeMethod(post_edit);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(200, post_edit.getStatusCode());
    post_edit.releaseConnection();

    try {
        Thread.sleep(3000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Edit thumbnail default
    post_edit = null;
    post_edit = new PostMethod(SLING_URL + COLLECTIONS_URL + slug_collection + "/" + CONTENTS_FOLDER + "/"
            + slug_content + "/" + SOURCES_FOLDER + "/" + source_image);
    post_edit.setDoAuthentication(true);

    NameValuePair[] data_edit_image = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("file", file_image), new NameValuePair("mimetype", mime_image),
            new NameValuePair("text_encoding", ""), new NameValuePair("lang", ""),
            new NameValuePair("length", ""), new NameValuePair("size", ""), new NameValuePair("type", ""),
            new NameValuePair("bitrate", ""), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_edit.setRequestBody(data_edit_image);
    post_edit.setDoAuthentication(true);
    try {
        client.executeMethod(post_edit);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(200, post_edit.getStatusCode());
    post_edit.releaseConnection();

    try {
        Thread.sleep(3000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Test if the content is already validated
    validated = "1";
    get_valid_prop = new GetMethod(SLING_URL + COLLECTIONS_URL + slug_collection + "/" + CONTENTS_FOLDER + "/"
            + slug_content + "/validated");
    try {
        client.executeMethod(get_valid_prop);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }

    try {
        response_body = get_valid_prop.getResponseBodyAsString();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertEquals(response_body, validated);
    get_valid_prop.releaseConnection();
}

From source file:org.iavante.sling.gad.red5backend.Red5BackendImplIT.java

/**
 * Tests if config properties are created
 **///from  w w w .  j  a va 2 s. com
public void test_red5backend_properties() {

    try {
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Get red5 config folder
    HttpMethod get_red5_config = new GetMethod(
            SLING_URL + "/" + "content" + "/" + CONFIG_FOLDER + "/" + RED5BACKEND_FOLDER + "/rtmp");
    try {
        client.executeMethod(get_red5_config);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertEquals(get_red5_config.getStatusCode(), 200);
    get_red5_config.releaseConnection();
}

From source file:org.iavante.sling.gad.source.SourceServiceTestIT.java

public void test_notify_status_code() {

    try {//from ww w . j ava  2  s  .  c o  m
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Create the source
    PostMethod post_create = new PostMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/"
            + content_title + "/" + SOURCES_FOLDER + "/" + source_title);
    post_create.setDoAuthentication(true);
    NameValuePair[] data_create = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("title", source_title), new NameValuePair("file", ""),
            new NameValuePair("mimetype", ""), new NameValuePair("text_encoding", ""),
            new NameValuePair("lang", ""), new NameValuePair("length", ""), new NameValuePair("size", ""),
            new NameValuePair("type", ""), new NameValuePair("bitrate", ""),
            new NameValuePair("tags", TAGS_REQUEST), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_create.setRequestBody(data_create);

    try {
        client.executeMethod(post_create);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(201, post_create.getStatusCode());
    post_create.releaseConnection();

    // Edit the source
    PostMethod post_edit = new PostMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/"
            + content_title + "/" + SOURCES_FOLDER + "/" + source_title);
    post_create.setDoAuthentication(true);

    NameValuePair[] data_edit = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("file", file), new NameValuePair("mimetype", mimetype),
            new NameValuePair("text_encoding", ""), new NameValuePair("lang", ""),
            new NameValuePair("length", ""), new NameValuePair("size", ""), new NameValuePair("type", type),
            new NameValuePair("bitrate", ""), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_edit.setRequestBody(data_edit);
    post_edit.setDoAuthentication(true);
    try {
        client.executeMethod(post_edit);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(200, post_edit.getStatusCode());

    try {
        Thread.sleep(12000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Get trans preview notify_status_code
    HttpMethod get_trans_preview_status = new GetMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER
            + "/" + content_title + "/" + SOURCES_FOLDER + "/" + source_title + "/" + TRANSFORMATIONS_FOLDER
            + "/" + TRANSFORMATION_PREVIEW + "/" + "notify_status_code");
    try {
        client.executeMethod(get_trans_preview_status);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }

    int status_code = get_trans_preview_status.getStatusCode();

    boolean failed = true;

    if (status_code != 404)
        failed = false;

    assertFalse(failed);
    get_trans_preview_status.releaseConnection();

}

From source file:org.iavante.sling.gad.source.SourceServiceTestIT.java

public void test_create_source_in_content() {

    try {//from www .j  a v a2s.  c o  m
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Create the source
    PostMethod post_create = new PostMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/"
            + content_title + "/" + SOURCES_FOLDER + "/" + source_title);
    post_create.setDoAuthentication(true);
    NameValuePair[] data_create = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("title", source_title), new NameValuePair("file", ""),
            new NameValuePair("mimetype", ""), new NameValuePair("text_encoding", ""),
            new NameValuePair("lang", ""), new NameValuePair("length", ""), new NameValuePair("size", ""),
            new NameValuePair("type", ""), new NameValuePair("bitrate", ""),
            new NameValuePair("tags", TAGS_REQUEST), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_create.setRequestBody(data_create);
    // post.setDoAuthentication(true);
    try {
        client.executeMethod(post_create);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(201, post_create.getStatusCode());
    post_create.releaseConnection();

    // Edit the source
    PostMethod post_edit = new PostMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/"
            + content_title + "/" + SOURCES_FOLDER + "/" + source_title);
    post_create.setDoAuthentication(true);

    NameValuePair[] data_edit = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("file", file), new NameValuePair("mimetype", mimetype),
            new NameValuePair("text_encoding", ""), new NameValuePair("lang", ""),
            new NameValuePair("length", ""), new NameValuePair("size", ""), new NameValuePair("type", type),
            new NameValuePair("bitrate", ""), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_edit.setRequestBody(data_edit);
    post_edit.setDoAuthentication(true);
    try {
        client.executeMethod(post_edit);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(200, post_edit.getStatusCode());

    try {
        Thread.sleep(10000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Get trans preview
    HttpMethod get_trans_preview = new GetMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/"
            + content_title + "/" + SOURCES_FOLDER + "/" + source_title + "/" + TRANSFORMATIONS_FOLDER + "/"
            + TRANSFORMATION_PREVIEW + "/" + "title");
    try {
        client.executeMethod(get_trans_preview);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }
    // handle response.
    String res_trans_title = "";
    try {
        res_trans_title = get_trans_preview.getResponseBodyAsString();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertEquals(TRANSFORMATION_PREVIEW_TITLE, res_trans_title);
    get_trans_preview.releaseConnection();
}

From source file:org.iavante.sling.gad.source.SourceServiceTestIT.java

public void test_source_finish_prop() {

    try {//from w ww. ja v  a 2s.c om
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Create the source
    PostMethod post_create = new PostMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/"
            + content_title + "/" + SOURCES_FOLDER + "/" + source_title);
    post_create.setDoAuthentication(true);
    NameValuePair[] data_create = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("title", source_title), new NameValuePair("file", ""),
            new NameValuePair("mimetype", ""), new NameValuePair("text_encoding", ""),
            new NameValuePair("lang", ""), new NameValuePair("length", ""), new NameValuePair("size", ""),
            new NameValuePair("type", ""), new NameValuePair("bitrate", ""),
            new NameValuePair("tags", TAGS_REQUEST), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_create.setRequestBody(data_create);
    // post.setDoAuthentication(true);
    try {
        client.executeMethod(post_create);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    post_create.releaseConnection();

    try {
        Thread.sleep(10000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Get the source
    HttpMethod get_source = new GetMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/"
            + content_title + "/" + SOURCES_FOLDER + "/" + source_title);
    try {
        client.executeMethod(get_source);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }
    // handle response.
    String response_body = "";
    try {
        response_body = get_source.getResponseBodyAsString();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertTrue(response_body.contains("<finish>1"));
    get_source.releaseConnection();
}

From source file:org.iavante.sling.gad.source.SourceServiceTestIT.java

public void test_create_source_in_sources() {

    try {/*from   w ww . j  ava 2 s.  c om*/
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Create source
    PostMethod post_create = new PostMethod(
            SLING_URL + COL_URL + col_title + "/" + SOURCES_FOLDER + "/" + source_title);
    post_create.setDoAuthentication(true);

    NameValuePair[] data_create = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("title", source_title), new NameValuePair("file", ""),
            new NameValuePair("mimetype", ""), new NameValuePair("text_encoding", ""),
            new NameValuePair("lang", ""), new NameValuePair("length", ""), new NameValuePair("size", ""),
            new NameValuePair("type", ""), new NameValuePair("bitrate", ""),
            new NameValuePair("tracks_number", ""), new NameValuePair("track_1_type", ""),
            new NameValuePair("track_1_encoding", ""), new NameValuePair("track_1_features", ""),
            new NameValuePair("track_2_type", ""), new NameValuePair("track_2_encoding", ""),
            new NameValuePair("track_2_features", ""), new NameValuePair("jcr:created", ""),
            new NameValuePair("jcr:createdBy", ""), new NameValuePair("jcr:lastModified", ""),
            new NameValuePair("jcr:lastModifiedBy", "") };
    post_create.setRequestBody(data_create);
    // post.setDoAuthentication(true);
    try {
        client.executeMethod(post_create);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(201, post_create.getStatusCode());

    // Edit source
    PostMethod post_edit = new PostMethod(
            SLING_URL + COL_URL + col_title + "/" + SOURCES_FOLDER + "/" + source_title);
    post_edit.setDoAuthentication(true);

    NameValuePair[] data_edit = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("file", file), new NameValuePair("mimetype", mimetype),
            new NameValuePair("text_encoding", ""), new NameValuePair("lang", ""),
            new NameValuePair("length", ""), new NameValuePair("size", ""), new NameValuePair("type", type),
            new NameValuePair("bitrate", ""), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_edit.setRequestBody(data_edit);
    post_edit.setDoAuthentication(true);
    try {
        client.executeMethod(post_edit);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(200, post_edit.getStatusCode());

    try {
        Thread.sleep(10000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Get the source mime type
    HttpMethod get_trans_preview = new GetMethod(SLING_URL + COL_URL + col_title + "/" + SOURCES_FOLDER + "/"
            + source_title + "/" + TRANSFORMATIONS_FOLDER + "/" + TRANSFORMATION_PREVIEW + "/" + "title");
    try {
        client.executeMethod(get_trans_preview);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }
    // handle response.
    String res_trans_title = "";
    try {
        res_trans_title = get_trans_preview.getResponseBodyAsString();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertEquals(TRANSFORMATION_PREVIEW_TITLE, res_trans_title);
    get_trans_preview.releaseConnection();
}

From source file:org.iavante.sling.gad.source.SourceServiceTestIT.java

public void test_transformation_folder_created() {

    try {/*from  w w w  . ja v a2s  .  c  o m*/
        Thread.sleep(2000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Create the source
    PostMethod post_create = new PostMethod(SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/"
            + content_title + "/" + SOURCES_FOLDER + "/" + source_title);
    post_create.setDoAuthentication(true);
    NameValuePair[] data_create = { new NameValuePair("sling:resourceType", "gad/source"),
            new NameValuePair("title", source_title), new NameValuePair("file", ""),
            new NameValuePair("mimetype", ""), new NameValuePair("text_encoding", ""),
            new NameValuePair("lang", ""), new NameValuePair("length", ""), new NameValuePair("size", ""),
            new NameValuePair("type", ""), new NameValuePair("bitrate", ""),
            new NameValuePair("tags", TAGS_REQUEST), new NameValuePair("tracks_number", ""),
            new NameValuePair("track_1_type", ""), new NameValuePair("track_1_encoding", ""),
            new NameValuePair("track_1_features", ""), new NameValuePair("track_2_type", ""),
            new NameValuePair("track_2_encoding", ""), new NameValuePair("track_2_features", ""),
            new NameValuePair("jcr:created", ""), new NameValuePair("jcr:createdBy", ""),
            new NameValuePair("jcr:lastModified", ""), new NameValuePair("jcr:lastModifiedBy", "") };
    post_create.setRequestBody(data_create);
    // post.setDoAuthentication(true);
    try {
        client.executeMethod(post_create);
    } catch (HttpException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    assertEquals(201, post_create.getStatusCode());
    post_create.releaseConnection();

    try {
        Thread.sleep(10000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Get trans folder
    HttpMethod get_trans_folder = new GetMethod(
            SLING_URL + COL_URL + col_title + "/" + CONTENTS_FOLDER + "/" + content_title + "/" + SOURCES_FOLDER
                    + "/" + source_title + "/" + TRANSFORMATIONS_FOLDER + ".html");
    // get_trans_folder.setDoAuthentication(true);
    try {
        client.executeMethod(get_trans_folder);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertEquals(200, get_trans_folder.getStatusCode());
    get_trans_folder.releaseConnection();
}

From source file:org.iavante.sling.gad.transcoder.TranscoderServiceImplIT.java

/**
 * Tests if config properties are created
 **//* w w  w .ja v a2 s  . c  o m*/
public void test_transcoder_properties() {

    try {
        Thread.sleep(4000);
    } catch (InterruptedException e1) {

        e1.printStackTrace();
    }

    // Get transcoder config folder
    HttpMethod get_trans_config = new GetMethod(
            SLING_URL + "/" + "content" + "/" + CONFIG_FOLDER + "/" + TRANSCODER_FOLDER + "/url");
    get_trans_config.setDoAuthentication(true);
    try {
        client.executeMethod(get_trans_config);
    } catch (HttpException e) {

        e.printStackTrace();
    } catch (IOException e) {

        e.printStackTrace();
    }

    assertEquals(200, get_trans_config.getStatusCode());
    get_trans_config.releaseConnection();
}