Search in sources :

Example 11 with SinkResponse

use of org.apache.inlong.manager.common.pojo.sink.SinkResponse in project incubator-inlong by apache.

the class HiveStreamSinkServiceTest method testGetAndUpdate.

@Test
public void testGetAndUpdate() {
    Integer id = this.saveSink();
    SinkResponse response = sinkService.get(id, Constant.SINK_HIVE);
    Assert.assertEquals(globalGroupId, response.getInlongGroupId());
    HiveSinkResponse hiveResponse = (HiveSinkResponse) response;
    hiveResponse.setEnableCreateResource(Constant.DISABLE_CREATE_RESOURCE);
    HiveSinkRequest request = CommonBeanUtils.copyProperties(hiveResponse, HiveSinkRequest::new);
    boolean result = sinkService.update(request, globalOperator);
    Assert.assertTrue(result);
}
Also used : SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) HiveSinkResponse(org.apache.inlong.manager.common.pojo.sink.hive.HiveSinkResponse) HiveSinkResponse(org.apache.inlong.manager.common.pojo.sink.hive.HiveSinkResponse) HiveSinkRequest(org.apache.inlong.manager.common.pojo.sink.hive.HiveSinkRequest) ServiceBaseTest(org.apache.inlong.manager.service.ServiceBaseTest) InlongStreamServiceTest(org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest) Test(org.junit.Test)

Example 12 with SinkResponse

use of org.apache.inlong.manager.common.pojo.sink.SinkResponse in project incubator-inlong by apache.

the class IcebergStreamSinkServiceTest method testListByIdentifier.

@Test
public void testListByIdentifier() {
    Integer id = this.saveSink();
    SinkResponse sink = sinkService.get(id, Constant.SINK_ICEBERG);
    Assert.assertEquals(globalGroupId, sink.getInlongGroupId());
    sinkService.delete(id, Constant.SINK_ICEBERG, globalOperator);
}
Also used : IcebergSinkResponse(org.apache.inlong.manager.common.pojo.sink.iceberg.IcebergSinkResponse) SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) ServiceBaseTest(org.apache.inlong.manager.service.ServiceBaseTest) InlongStreamServiceTest(org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest) Test(org.junit.Test)

Example 13 with SinkResponse

use of org.apache.inlong.manager.common.pojo.sink.SinkResponse in project incubator-inlong by apache.

the class IcebergStreamSinkServiceTest method testGetAndUpdate.

@Test
public void testGetAndUpdate() {
    Integer id = this.saveSink();
    SinkResponse response = sinkService.get(id, Constant.SINK_ICEBERG);
    Assert.assertEquals(globalGroupId, response.getInlongGroupId());
    IcebergSinkResponse icebergSinkResponse = (IcebergSinkResponse) response;
    icebergSinkResponse.setEnableCreateResource(Constant.DISABLE_CREATE_RESOURCE);
    IcebergSinkRequest request = CommonBeanUtils.copyProperties(icebergSinkResponse, IcebergSinkRequest::new);
    boolean result = sinkService.update(request, globalOperator);
    Assert.assertTrue(result);
}
Also used : IcebergSinkRequest(org.apache.inlong.manager.common.pojo.sink.iceberg.IcebergSinkRequest) IcebergSinkResponse(org.apache.inlong.manager.common.pojo.sink.iceberg.IcebergSinkResponse) SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) IcebergSinkResponse(org.apache.inlong.manager.common.pojo.sink.iceberg.IcebergSinkResponse) ServiceBaseTest(org.apache.inlong.manager.service.ServiceBaseTest) InlongStreamServiceTest(org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest) Test(org.junit.Test)

Example 14 with SinkResponse

use of org.apache.inlong.manager.common.pojo.sink.SinkResponse in project incubator-inlong by apache.

the class KafkaStreamSinkServiceTest method testGetAndUpdate.

@Test
public void testGetAndUpdate() {
    SinkResponse response = sinkService.get(kafkaSinkId, Constant.SINK_KAFKA);
    Assert.assertEquals(globalGroupId, response.getInlongGroupId());
    KafkaSinkResponse kafkaSinkResponse = (KafkaSinkResponse) response;
    kafkaSinkResponse.setEnableCreateResource(Constant.ENABLE_CREATE_RESOURCE);
    KafkaSinkRequest request = CommonBeanUtils.copyProperties(kafkaSinkResponse, KafkaSinkRequest::new);
    boolean result = sinkService.update(request, globalOperator);
    Assert.assertTrue(result);
}
Also used : SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) KafkaSinkResponse(org.apache.inlong.manager.common.pojo.sink.kafka.KafkaSinkResponse) KafkaSinkResponse(org.apache.inlong.manager.common.pojo.sink.kafka.KafkaSinkResponse) KafkaSinkRequest(org.apache.inlong.manager.common.pojo.sink.kafka.KafkaSinkRequest) Test(org.junit.Test) ServiceBaseTest(org.apache.inlong.manager.service.ServiceBaseTest) InlongStreamServiceTest(org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest)

Example 15 with SinkResponse

use of org.apache.inlong.manager.common.pojo.sink.SinkResponse in project incubator-inlong by apache.

the class InlongStreamServiceImpl method listAllWithGroupId.

@Override
public PageInfo<FullStreamResponse> listAllWithGroupId(InlongStreamPageRequest request) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("begin to list full inlong stream page by {}", request);
    }
    Preconditions.checkNotNull(request, "request is empty");
    Preconditions.checkNotNull(request.getInlongGroupId(), Constant.GROUP_ID_IS_EMPTY);
    // 1. Query all valid data sources under groupId
    String groupId = request.getInlongGroupId();
    // The person in charge of the inlong group has the authority of all inlong streams
    InlongGroupEntity inlongGroupEntity = groupMapper.selectByGroupId(groupId);
    Preconditions.checkNotNull(inlongGroupEntity, "inlong group not found by groupId=" + groupId);
    String inCharges = inlongGroupEntity.getInCharges();
    request.setInCharges(inCharges);
    PageHelper.startPage(request.getPageNum(), request.getPageSize());
    Page<InlongStreamEntity> page = (Page<InlongStreamEntity>) streamMapper.selectByCondition(request);
    List<InlongStreamInfo> streamInfoList = CommonBeanUtils.copyListProperties(page, InlongStreamInfo::new);
    // Convert and encapsulate the paged results
    List<FullStreamResponse> responseList = new ArrayList<>(streamInfoList.size());
    for (InlongStreamInfo streamInfo : streamInfoList) {
        // 2.1 Set the extended information and field information of the inlong stream
        String streamId = streamInfo.getInlongStreamId();
        setStreamExtAndField(groupId, streamId, streamInfo);
        // 2.3 Set the inlong stream to the result sub-object
        FullStreamResponse pageInfo = new FullStreamResponse();
        pageInfo.setStreamInfo(streamInfo);
        // 3. Query the basic and detailed information of the data source
        String dataSourceType = streamInfo.getDataSourceType();
        if (StringUtils.isEmpty(dataSourceType)) {
            continue;
        }
        switch(dataSourceType.toUpperCase(Locale.ROOT)) {
            case Constant.DATA_SOURCE_FILE:
                SourceFileBasicInfo fileBasicInfo = sourceFileService.getBasicByIdentifier(groupId, streamId);
                pageInfo.setFileBasicInfo(fileBasicInfo);
                List<SourceFileDetailInfo> fileDetailInfoList = sourceFileService.listDetailByIdentifier(groupId, streamId);
                pageInfo.setFileDetailInfoList(fileDetailInfoList);
                break;
            case Constant.DATA_SOURCE_DB:
                SourceDbBasicInfo dbBasicInfo = sourceDbService.getBasicByIdentifier(groupId, streamId);
                pageInfo.setDbBasicInfo(dbBasicInfo);
                List<SourceDbDetailInfo> dbDetailInfoList = sourceDbService.listDetailByIdentifier(groupId, streamId);
                pageInfo.setDbDetailInfoList(dbDetailInfoList);
                break;
            case Constant.DATA_SOURCE_AUTO_PUSH:
                break;
            default:
                throw new BusinessException(ErrorCodeEnum.SOURCE_TYPE_NOT_SUPPORTED);
        }
        // 4. Query stream sources information
        List<SourceResponse> sourceList = sourceService.listSource(groupId, streamId);
        pageInfo.setSourceInfo(sourceList);
        // 5. Query various stream sinks and its extended information, field information
        List<SinkResponse> sinkList = sinkService.listSink(groupId, streamId);
        pageInfo.setSinkInfo(sinkList);
        // 6. Add a single result to the paginated list
        responseList.add(pageInfo);
    }
    PageInfo<FullStreamResponse> pageInfo = new PageInfo<>(responseList);
    pageInfo.setTotal(pageInfo.getTotal());
    LOGGER.debug("success to list full inlong stream info");
    return pageInfo;
}
Also used : SourceDbBasicInfo(org.apache.inlong.manager.common.pojo.source.SourceDbBasicInfo) SourceResponse(org.apache.inlong.manager.common.pojo.source.SourceResponse) ArrayList(java.util.ArrayList) Page(com.github.pagehelper.Page) SourceFileDetailInfo(org.apache.inlong.manager.common.pojo.source.SourceFileDetailInfo) InlongGroupEntity(org.apache.inlong.manager.dao.entity.InlongGroupEntity) BusinessException(org.apache.inlong.manager.common.exceptions.BusinessException) PageInfo(com.github.pagehelper.PageInfo) SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) InlongStreamEntity(org.apache.inlong.manager.dao.entity.InlongStreamEntity) FullStreamResponse(org.apache.inlong.manager.common.pojo.stream.FullStreamResponse) SourceDbDetailInfo(org.apache.inlong.manager.common.pojo.source.SourceDbDetailInfo) SourceFileBasicInfo(org.apache.inlong.manager.common.pojo.source.SourceFileBasicInfo) InlongStreamInfo(org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)

Aggregations

SinkResponse (org.apache.inlong.manager.common.pojo.sink.SinkResponse)17 ServiceBaseTest (org.apache.inlong.manager.service.ServiceBaseTest)8 InlongStreamServiceTest (org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest)8 Test (org.junit.Test)8 SinkFieldResponse (org.apache.inlong.manager.common.pojo.sink.SinkFieldResponse)4 ClickHouseSinkResponse (org.apache.inlong.manager.common.pojo.sink.ck.ClickHouseSinkResponse)4 HiveSinkResponse (org.apache.inlong.manager.common.pojo.sink.hive.HiveSinkResponse)4 IcebergSinkResponse (org.apache.inlong.manager.common.pojo.sink.iceberg.IcebergSinkResponse)4 KafkaSinkResponse (org.apache.inlong.manager.common.pojo.sink.kafka.KafkaSinkResponse)4 StreamSinkEntity (org.apache.inlong.manager.dao.entity.StreamSinkEntity)4 StreamSinkFieldEntity (org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity)4 WorkflowListenerException (org.apache.inlong.manager.common.exceptions.WorkflowListenerException)2 InlongGroupInfo (org.apache.inlong.manager.common.pojo.group.InlongGroupInfo)2 SourceResponse (org.apache.inlong.manager.common.pojo.source.SourceResponse)2 FullStreamResponse (org.apache.inlong.manager.common.pojo.stream.FullStreamResponse)2 GroupResourceProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm)2 DataFlowInfo (org.apache.inlong.sort.protocol.DataFlowInfo)2 Page (com.github.pagehelper.Page)1 PageInfo (com.github.pagehelper.PageInfo)1 Lists (com.google.common.collect.Lists)1