Search in sources :

Example 6 with SinkResponse

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

the class ClickHouseStreamSinkOperation method getById.

@Override
public SinkResponse getById(@NotNull String sinkType, @NotNull Integer id) {
    StreamSinkEntity entity = sinkMapper.selectByPrimaryKey(id);
    Preconditions.checkNotNull(entity, ErrorCodeEnum.SINK_INFO_NOT_FOUND.getMessage());
    String existType = entity.getSinkType();
    Preconditions.checkTrue(Constant.SINK_CLICKHOUSE.equals(existType), String.format(Constant.SINK_TYPE_NOT_SAME, Constant.SINK_CLICKHOUSE, existType));
    SinkResponse response = this.getFromEntity(entity, ClickHouseSinkResponse::new);
    List<StreamSinkFieldEntity> entities = sinkFieldMapper.selectBySinkId(id);
    List<SinkFieldResponse> infos = CommonBeanUtils.copyListProperties(entities, SinkFieldResponse::new);
    response.setFieldList(infos);
    return response;
}
Also used : ClickHouseSinkResponse(org.apache.inlong.manager.common.pojo.sink.ck.ClickHouseSinkResponse) SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) StreamSinkEntity(org.apache.inlong.manager.dao.entity.StreamSinkEntity) ClickHouseSinkResponse(org.apache.inlong.manager.common.pojo.sink.ck.ClickHouseSinkResponse) SinkFieldResponse(org.apache.inlong.manager.common.pojo.sink.SinkFieldResponse) StreamSinkFieldEntity(org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity)

Example 7 with SinkResponse

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

the class StreamSinkServiceImpl method get.

@Override
public SinkResponse get(Integer id, String sinkType) {
    LOGGER.debug("begin to get sink by id={}, sinkType={}", id, sinkType);
    StreamSinkOperation operation = operationFactory.getInstance(SinkType.forType(sinkType));
    SinkResponse sinkResponse = operation.getById(sinkType, id);
    LOGGER.debug("success to get sink info");
    return sinkResponse;
}
Also used : SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse)

Example 8 with SinkResponse

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

the class ClickHouseStreamSinkServiceTest method testListByIdentifier.

@Test
public void testListByIdentifier() {
    SinkResponse sink = sinkService.get(sinkId, Constant.SINK_CLICKHOUSE);
    Assert.assertEquals(globalGroupId, sink.getInlongGroupId());
}
Also used : SinkResponse(org.apache.inlong.manager.common.pojo.sink.SinkResponse) ClickHouseSinkResponse(org.apache.inlong.manager.common.pojo.sink.ck.ClickHouseSinkResponse) Test(org.junit.Test) ServiceBaseTest(org.apache.inlong.manager.service.ServiceBaseTest) InlongStreamServiceTest(org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest)

Example 9 with SinkResponse

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

the class ClickHouseStreamSinkServiceTest method testGetAndUpdate.

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

Example 10 with SinkResponse

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

the class HiveStreamSinkServiceTest method testListByIdentifier.

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

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