Search in sources :

Example 1 with MediaQueueRequest

use of com.qcloud.cos.model.ciModel.queue.MediaQueueRequest 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 MediaQueueRequest

use of com.qcloud.cos.model.ciModel.queue.MediaQueueRequest 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 MediaQueueRequest

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

the class QueueDemo method updateMediaQueue.

/**
 * UpdateMediaQueue 接口用于更新队列
 * Request中 Name,QueueID,State,NotifyConfig 为必填字段
 * @param client
 */
public static void updateMediaQueue(COSClient client) {
    // 1.创建队列请求对象
    MediaQueueRequest request = new MediaQueueRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setQueueId("p9900025e4ec44b5e8225e70a521*****");
    request.getNotifyConfig().setUrl("cloud.tencent.com");
    request.setState("Active");
    request.setName("queue-2");
    // 3.调用接口,获取队列响应对象
    MediaQueueResponse response = client.updateMediaQueue(request);
    System.out.println(response);
}
Also used : MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaQueueResponse)

Example 4 with MediaQueueRequest

use of com.qcloud.cos.model.ciModel.queue.MediaQueueRequest 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 5 with MediaQueueRequest

use of com.qcloud.cos.model.ciModel.queue.MediaQueueRequest 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)

Aggregations

MediaQueueRequest (com.qcloud.cos.model.ciModel.queue.MediaQueueRequest)6 MediaListQueueResponse (com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse)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 MediaQueueResponse (com.qcloud.cos.model.ciModel.queue.MediaQueueResponse)2 MediaJobResponse (com.qcloud.cos.model.ciModel.job.MediaJobResponse)1 MediaQueueObject (com.qcloud.cos.model.ciModel.queue.MediaQueueObject)1