Search in sources :

Example 1 with MediaListQueueResponse

use of com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse in project cos-java-sdk-v5 by tencentyun.

the class MediaJobTest method describeMediaJobsTest.

@Test
public void describeMediaJobsTest() {
    if (!judgeUserInfoValid()) {
        return;
    }
    MediaQueueRequest queueRequest = new MediaQueueRequest();
    queueRequest.setBucketName(bucket);
    MediaListQueueResponse queueResponse = cosclient.describeMediaQueues(queueRequest);
    if (queueResponse != null && queueResponse.getQueueList().size() != 0) {
        MediaJobsRequest request = new MediaJobsRequest();
        request.setBucketName(bucket);
        String queueId = queueResponse.getQueueList().get(0).getQueueId();
        request.setQueueId(queueId);
        request.setTag(TAG);
        MediaListJobResponse response = cosclient.describeMediaJobs(request);
        List<MediaJobObject> jobsDetail = response.getJobsDetailList();
        for (MediaJobObject mediaJobObject : jobsDetail) {
            assertEquals(TAG, mediaJobObject.getTag());
            assertEquals(queueId, mediaJobObject.getQueueId());
        }
    }
}
Also used : MediaJobsRequest(com.qcloud.cos.model.ciModel.job.MediaJobsRequest) MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaListQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse) MediaJobObject(com.qcloud.cos.model.ciModel.job.MediaJobObject) MediaListJobResponse(com.qcloud.cos.model.ciModel.job.MediaListJobResponse) Test(org.junit.Test)

Example 2 with MediaListQueueResponse

use of com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse in project cos-java-sdk-v5 by tencentyun.

the class MediaQueueTest method describeMediaQueuesTest.

@Test
public void describeMediaQueuesTest() {
    if (!judgeUserInfoValid()) {
        return;
    }
    MediaQueueRequest request = new MediaQueueRequest();
    request.setBucketName(bucket);
    MediaListQueueResponse response = cosclient.describeMediaQueues(request);
    if (response != null && response.getQueueList().size() != 0) {
        assertNotEquals("0", response.getTotalCount());
        assertTrue(Integer.parseInt(response.getTotalCount()) > 0);
        assertTrue(Integer.parseInt(response.getPageSize()) > 0);
        assertTrue(Integer.parseInt(response.getPageNumber()) > 0);
        assertEquals(bucket, response.getQueueList().get(0).getBucketId());
    }
}
Also used : MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaListQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse) Test(org.junit.Test)

Example 3 with MediaListQueueResponse

use of com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse in project cos-java-sdk-v5 by tencentyun.

the class MediaJobTest method describeMediaJobTest.

@Test
public void describeMediaJobTest() {
    if (!judgeUserInfoValid()) {
        return;
    }
    MediaQueueRequest queueRequest = new MediaQueueRequest();
    queueRequest.setBucketName(bucket);
    MediaListQueueResponse queueResponse = cosclient.describeMediaQueues(queueRequest);
    if (queueResponse != null && queueResponse.getQueueList().size() != 0) {
        MediaJobsRequest request = new MediaJobsRequest();
        request.setBucketName(bucket);
        String queueId = queueResponse.getQueueList().get(0).getQueueId();
        request.setQueueId(queueId);
        request.setTag(TAG);
        MediaListJobResponse response = cosclient.describeMediaJobs(request);
        List<MediaJobObject> jobsDetail = response.getJobsDetailList();
        for (MediaJobObject mediaJobObject : jobsDetail) {
            request = new MediaJobsRequest();
            request.setBucketName(bucket);
            request.setJobId(mediaJobObject.getJobId());
            MediaJobResponse jobResponse = cosclient.describeMediaJob(request);
            System.out.println(jobResponse);
            assertEquals(queueId, jobResponse.getJobsDetail().getQueueId());
        }
    }
}
Also used : MediaJobsRequest(com.qcloud.cos.model.ciModel.job.MediaJobsRequest) MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaJobResponse(com.qcloud.cos.model.ciModel.job.MediaJobResponse) MediaListQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse) MediaJobObject(com.qcloud.cos.model.ciModel.job.MediaJobObject) MediaListJobResponse(com.qcloud.cos.model.ciModel.job.MediaListJobResponse) Test(org.junit.Test)

Example 4 with MediaListQueueResponse

use of com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse in project cos-java-sdk-v5 by tencentyun.

the class MediaQueueTest method updateMediaQueueTest.

@Test
public void updateMediaQueueTest() {
    if (!judgeUserInfoValid()) {
        return;
    }
    MediaQueueRequest request = new MediaQueueRequest();
    request.setBucketName(bucket);
    MediaListQueueResponse response = cosclient.describeMediaQueues(request);
    if (response != null) {
        List<MediaQueueObject> queueList = response.getQueueList();
        if (queueList.size() != 0) {
            MediaQueueObject mediaQueueObject = queueList.get(0);
            request = new MediaQueueRequest();
            request.setBucketName(bucket);
            request.setQueueId(mediaQueueObject.getQueueId());
            request.getNotifyConfig().setUrl(QUEUE_URL);
            request.setState(QUEUE_STATE);
            request.setName(QUEUE_NAME);
            MediaQueueResponse updateResponse = cosclient.updateMediaQueue(request);
            MediaQueueObject queue = updateResponse.getQueue();
            assertEquals(bucket, queue.getBucketId());
            assertEquals(QUEUE_NAME, queue.getName());
            assertEquals(QUEUE_STATE, queue.getState());
        }
    }
}
Also used : MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaQueueResponse) MediaListQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse) MediaQueueObject(com.qcloud.cos.model.ciModel.queue.MediaQueueObject) Test(org.junit.Test)

Example 5 with MediaListQueueResponse

use of com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse in project cos-java-sdk-v5 by tencentyun.

the class QueueDemo method describeMediaQueues.

/**
 * DescribeMediaQueues 接口用于搜索队列。
 * @param client
 */
public static void describeMediaQueues(COSClient client) {
    // 1.创建队列请求对象
    MediaQueueRequest request = new MediaQueueRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    // 3.调用接口,获取队列响应对象
    MediaListQueueResponse response = client.describeMediaQueues(request);
    System.out.println(response);
}
Also used : MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaListQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse)

Aggregations

MediaListQueueResponse (com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse)5 MediaQueueRequest (com.qcloud.cos.model.ciModel.queue.MediaQueueRequest)5 Test (org.junit.Test)4 MediaJobObject (com.qcloud.cos.model.ciModel.job.MediaJobObject)2 MediaJobsRequest (com.qcloud.cos.model.ciModel.job.MediaJobsRequest)2 MediaListJobResponse (com.qcloud.cos.model.ciModel.job.MediaListJobResponse)2 MediaJobResponse (com.qcloud.cos.model.ciModel.job.MediaJobResponse)1 MediaQueueObject (com.qcloud.cos.model.ciModel.queue.MediaQueueObject)1 MediaQueueResponse (com.qcloud.cos.model.ciModel.queue.MediaQueueResponse)1