Search in sources :

Example 1 with InlongGroupRequest

use of org.apache.inlong.manager.common.pojo.group.InlongGroupRequest in project incubator-inlong by apache.

the class InlongGroupProcessOperationTest method before.

public void before(int status) {
    MockPlugin mockPlugin = new MockPlugin();
    serviceTaskListenerFactory.acceptPlugin(mockPlugin);
    InlongGroupRequest groupInfo = new InlongGroupRequest();
    groupInfo.setInlongGroupId(GROUP_ID);
    groupInfo.setName(GROUP_NAME);
    groupInfo.setInCharges(OPERATOR);
    groupInfo.setMiddlewareType(Constant.MIDDLEWARE_PULSAR);
    InlongGroupPulsarInfo pulsarInfo = new InlongGroupPulsarInfo();
    pulsarInfo.setInlongGroupId(GROUP_ID);
    groupInfo.setMqExtInfo(pulsarInfo);
    groupService.save(groupInfo, OPERATOR);
    groupService.update(groupInfo, OPERATOR);
}
Also used : InlongGroupPulsarInfo(org.apache.inlong.manager.common.pojo.group.InlongGroupPulsarInfo) MockPlugin(org.apache.inlong.manager.service.mocks.MockPlugin) InlongGroupRequest(org.apache.inlong.manager.common.pojo.group.InlongGroupRequest)

Example 2 with InlongGroupRequest

use of org.apache.inlong.manager.common.pojo.group.InlongGroupRequest in project incubator-inlong by apache.

the class InlongGroupImpl method update.

@Override
public void update(InlongGroupConf conf) throws Exception {
    if (conf != null) {
        AssertUtil.isTrue(conf.getGroupName() != null && conf.getGroupName().equals(this.groupConf.getGroupName()), "Group must have same name");
        this.groupConf = conf;
    } else {
        conf = this.groupConf;
    }
    InlongGroupInfo groupInfo = InlongGroupTransfer.createGroupInfo(conf);
    InlongGroupRequest groupRequest = groupInfo.genRequest();
    Pair<String, String> idAndErr = managerClient.updateGroup(groupRequest);
    String errMsg = idAndErr.getValue();
    AssertUtil.isNull(errMsg, errMsg);
}
Also used : InlongGroupInfo(org.apache.inlong.manager.common.pojo.group.InlongGroupInfo) InlongGroupRequest(org.apache.inlong.manager.common.pojo.group.InlongGroupRequest)

Example 3 with InlongGroupRequest

use of org.apache.inlong.manager.common.pojo.group.InlongGroupRequest in project incubator-inlong by apache.

the class UtilsTest method testCopyProperties.

@Test
public void testCopyProperties() {
    InlongGroupEntity entity = new InlongGroupEntity();
    entity.setInlongGroupId("test");
    entity.setStatus(1);
    entity.setCreator("user1");
    entity.setModifier("");
    entity.setCreateTime(new Date());
    entity.setModifyTime(null);
    InlongGroupRequest request = new InlongGroupRequest();
    request.setInlongGroupId("info");
    BeanUtils.copyProperties(request, entity);
    Assert.assertEquals(1, (int) entity.getStatus());
    Assert.assertNotNull(entity.getCreateTime());
    Assert.assertNull(entity.getModifyTime());
}
Also used : InlongGroupEntity(org.apache.inlong.manager.dao.entity.InlongGroupEntity) Date(java.util.Date) InlongGroupRequest(org.apache.inlong.manager.common.pojo.group.InlongGroupRequest) Test(org.junit.Test)

Example 4 with InlongGroupRequest

use of org.apache.inlong.manager.common.pojo.group.InlongGroupRequest in project incubator-inlong by apache.

the class UtilsTest method testCopyPropertiesIgnoreNull.

@Test
public void testCopyPropertiesIgnoreNull() {
    InlongGroupEntity entity = new InlongGroupEntity();
    entity.setInlongGroupId("test");
    entity.setCreator("user1");
    entity.setModifier("");
    entity.setStatus(1);
    entity.setCreateTime(new Date());
    entity.setModifyTime(null);
    InlongGroupRequest request = new InlongGroupRequest();
    request.setInlongGroupId("info");
    CommonBeanUtils.copyProperties(request, entity, true);
    Assert.assertEquals(1, (int) entity.getStatus());
    Assert.assertNotNull(entity.getCreateTime());
    Assert.assertNull(entity.getModifyTime());
}
Also used : InlongGroupEntity(org.apache.inlong.manager.dao.entity.InlongGroupEntity) Date(java.util.Date) InlongGroupRequest(org.apache.inlong.manager.common.pojo.group.InlongGroupRequest) Test(org.junit.Test)

Example 5 with InlongGroupRequest

use of org.apache.inlong.manager.common.pojo.group.InlongGroupRequest in project incubator-inlong by apache.

the class InlongGroupImpl method initOnUpdate.

@Override
public InlongGroupContext initOnUpdate(InlongGroupConf conf) throws Exception {
    update(conf);
    InlongGroupInfo groupInfo = InlongGroupTransfer.createGroupInfo(conf);
    InlongGroupRequest groupRequest = groupInfo.genRequest();
    Pair<Boolean, InlongGroupResponse> existMsg = managerClient.isGroupExists(groupRequest);
    if (existMsg.getKey()) {
        groupInfo = CommonBeanUtils.copyProperties(existMsg.getValue(), InlongGroupInfo::new);
        this.groupContext.setGroupInfo(groupInfo);
        return init();
    } else {
        throw new RuntimeException(String.format("Group is not found by groupName=%s", groupInfo.getName()));
    }
}
Also used : InlongGroupInfo(org.apache.inlong.manager.common.pojo.group.InlongGroupInfo) InlongGroupRequest(org.apache.inlong.manager.common.pojo.group.InlongGroupRequest) InlongGroupResponse(org.apache.inlong.manager.common.pojo.group.InlongGroupResponse)

Aggregations

InlongGroupRequest (org.apache.inlong.manager.common.pojo.group.InlongGroupRequest)8 InlongGroupResponse (org.apache.inlong.manager.common.pojo.group.InlongGroupResponse)4 Call (okhttp3.Call)3 Request (okhttp3.Request)3 RequestBody (okhttp3.RequestBody)3 Response (okhttp3.Response)3 InlongGroupApproveRequest (org.apache.inlong.manager.common.pojo.group.InlongGroupApproveRequest)3 InlongGroupListResponse (org.apache.inlong.manager.common.pojo.group.InlongGroupListResponse)3 SinkListResponse (org.apache.inlong.manager.common.pojo.sink.SinkListResponse)3 SinkRequest (org.apache.inlong.manager.common.pojo.sink.SinkRequest)3 SourceListResponse (org.apache.inlong.manager.common.pojo.source.SourceListResponse)3 SourceRequest (org.apache.inlong.manager.common.pojo.source.SourceRequest)3 FullStreamResponse (org.apache.inlong.manager.common.pojo.stream.FullStreamResponse)3 InlongStreamApproveRequest (org.apache.inlong.manager.common.pojo.stream.InlongStreamApproveRequest)3 InlongStreamConfigLogListResponse (org.apache.inlong.manager.common.pojo.stream.InlongStreamConfigLogListResponse)3 Date (java.util.Date)2 InlongGroupInfo (org.apache.inlong.manager.common.pojo.group.InlongGroupInfo)2 InlongGroupEntity (org.apache.inlong.manager.dao.entity.InlongGroupEntity)2 Test (org.junit.Test)2 InlongGroupPulsarInfo (org.apache.inlong.manager.common.pojo.group.InlongGroupPulsarInfo)1