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