Search in sources :

Example 6 with BinlogSourceRequest

use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest in project incubator-inlong by apache.

the class StreamSourceServiceTest method testGetAndUpdate.

@Test
public void testGetAndUpdate() {
    Integer id = this.saveSource();
    SourceResponse response = sourceService.get(id, Constant.SOURCE_BINLOG);
    Assert.assertEquals(globalGroupId, response.getInlongGroupId());
    BinlogSourceResponse binlogResponse = (BinlogSourceResponse) response;
    BinlogSourceRequest request = CommonBeanUtils.copyProperties(binlogResponse, BinlogSourceRequest::new);
    boolean result = sourceService.update(request, globalOperator);
    Assert.assertTrue(result);
    sourceService.delete(id, Constant.SOURCE_BINLOG, globalOperator);
}
Also used : BinlogSourceResponse(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceResponse) SourceResponse(org.apache.inlong.manager.common.pojo.source.SourceResponse) BinlogSourceResponse(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceResponse) BinlogSourceRequest(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest) ServiceBaseTest(org.apache.inlong.manager.service.ServiceBaseTest) InlongStreamServiceTest(org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest) Test(org.junit.Test)

Example 7 with BinlogSourceRequest

use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest in project incubator-inlong by apache.

the class InlongStreamSourceTransfer method createBinlogSourceRequest.

private static BinlogSourceRequest createBinlogSourceRequest(MySQLBinlogSource binlogSource, InlongStreamInfo streamInfo) {
    BinlogSourceRequest sourceRequest = new BinlogSourceRequest();
    sourceRequest.setSourceName(binlogSource.getSourceName());
    sourceRequest.setInlongGroupId(streamInfo.getInlongGroupId());
    sourceRequest.setInlongStreamId(streamInfo.getInlongStreamId());
    sourceRequest.setSourceType(binlogSource.getSourceType().name());
    sourceRequest.setAgentIp(binlogSource.getAgentIp());
    DefaultAuthentication authentication = binlogSource.getAuthentication();
    sourceRequest.setUser(authentication.getUserName());
    sourceRequest.setPassword(authentication.getPassword());
    sourceRequest.setHostname(binlogSource.getHostname());
    sourceRequest.setPort(binlogSource.getPort());
    sourceRequest.setIncludeSchema(binlogSource.getIncludeSchema());
    sourceRequest.setServerTimezone(binlogSource.getServerTimezone());
    sourceRequest.setMonitoredDdl(binlogSource.getMonitoredDdl());
    sourceRequest.setAllMigration(binlogSource.isAllMigration());
    if (CollectionUtils.isNotEmpty(binlogSource.getDbNames())) {
        String dbNames = Joiner.on(",").join(binlogSource.getDbNames());
        sourceRequest.setDatabaseWhiteList(dbNames);
    }
    if (CollectionUtils.isNotEmpty(binlogSource.getTableNames())) {
        String tableNames = Joiner.on(",").join(binlogSource.getTableNames());
        sourceRequest.setTableWhiteList(tableNames);
    }
    sourceRequest.setSnapshotMode("initial");
    sourceRequest.setIntervalMs("500");
    sourceRequest.setTimestampFormatStandard(binlogSource.getTimestampFormatStandard());
    return sourceRequest;
}
Also used : DefaultAuthentication(org.apache.inlong.manager.client.api.auth.DefaultAuthentication) BinlogSourceRequest(org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)

Aggregations

BinlogSourceRequest (org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceRequest)7 DefaultAuthentication (org.apache.inlong.manager.client.api.auth.DefaultAuthentication)1 SourceType (org.apache.inlong.manager.common.enums.SourceType)1 BusinessException (org.apache.inlong.manager.common.exceptions.BusinessException)1 SourceResponse (org.apache.inlong.manager.common.pojo.source.SourceResponse)1 BinlogSourceDTO (org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceDTO)1 BinlogSourceResponse (org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceResponse)1 KafkaSourceRequest (org.apache.inlong.manager.common.pojo.source.kafka.KafkaSourceRequest)1 InlongStreamInfo (org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)1 ServiceBaseTest (org.apache.inlong.manager.service.ServiceBaseTest)1 InlongStreamServiceTest (org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest)1 Test (org.junit.Test)1