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;
}
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;
}
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());
}
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);
}
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);
}
Aggregations