use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class InlongGroupProcessOperation method genNewGroupProcessForm.
/**
* Generate the form of [New Group Workflow]
*/
public NewGroupProcessForm genNewGroupProcessForm(String groupId) {
NewGroupProcessForm form = new NewGroupProcessForm();
InlongGroupInfo groupInfo = groupService.get(groupId);
form.setGroupInfo(groupInfo);
List<StreamBriefResponse> infoList = streamService.getBriefList(groupInfo.getInlongGroupId());
form.setStreamInfoList(infoList);
return form;
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class InlongGroupProcessOperation method genUpdateGroupProcessForm.
private UpdateGroupProcessForm genUpdateGroupProcessForm(String groupId, OperateType operateType) {
InlongGroupInfo groupInfo = groupService.get(groupId);
UpdateGroupProcessForm form = new UpdateGroupProcessForm();
if (OperateType.RESTART == operateType) {
List<InlongStreamEntity> inlongStreamEntityList = streamMapper.selectByGroupId(groupInfo.getInlongGroupId());
List<InlongStreamInfo> inlongStreamInfoList = CommonBeanUtils.copyListProperties(inlongStreamEntityList, InlongStreamInfo::new);
form.setInlongStreamInfoList(inlongStreamInfoList);
}
form.setGroupInfo(groupInfo);
form.setOperateType(operateType);
return form;
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class InlongGroupServiceImpl method get.
@Override
public InlongGroupInfo get(String groupId) {
LOGGER.debug("begin to get inlong group info by groupId={}", groupId);
Preconditions.checkNotNull(groupId, Constant.GROUP_ID_IS_EMPTY);
InlongGroupEntity entity = groupMapper.selectByGroupId(groupId);
if (entity == null) {
LOGGER.error("inlong group not found by groupId={}", groupId);
throw new BusinessException(ErrorCodeEnum.GROUP_NOT_FOUND);
}
InlongGroupInfo groupInfo = CommonBeanUtils.copyProperties(entity, InlongGroupInfo::new);
List<InlongGroupExtEntity> extEntityList = groupExtMapper.selectByGroupId(groupId);
List<InlongGroupExtInfo> extInfoList = CommonBeanUtils.copyListProperties(extEntityList, InlongGroupExtInfo::new);
groupInfo.setExtList(extInfoList);
// If the middleware is Pulsar, we need to encapsulate Pulsar related data
String mqType = entity.getMiddlewareType();
if (Constant.MIDDLEWARE_PULSAR.equals(mqType) || Constant.MIDDLEWARE_TDMQ_PULSAR.equals(mqType)) {
InlongGroupPulsarEntity pulsarEntity = groupPulsarMapper.selectByGroupId(groupId);
Preconditions.checkNotNull(pulsarEntity, "Pulsar info not found by the groupId=" + groupId);
InlongGroupPulsarInfo pulsarInfo = CommonBeanUtils.copyProperties(pulsarEntity, InlongGroupPulsarInfo::new);
pulsarInfo.setMiddlewareType(mqType);
groupInfo.setMqExtInfo(pulsarInfo);
}
// For approved inlong group, encapsulate the cluster address of the middleware
if (GroupState.CONFIG_SUCCESSFUL == GroupState.forCode(groupInfo.getStatus())) {
if (Constant.MIDDLEWARE_TUBE.equalsIgnoreCase(mqType)) {
groupInfo.setTubeMaster(commonOperateService.getSpecifiedParam(Constant.TUBE_MASTER_URL));
} else if (Constant.MIDDLEWARE_PULSAR.equals(mqType) || Constant.MIDDLEWARE_TDMQ_PULSAR.equals(mqType)) {
PulsarClusterInfo pulsarCluster = commonOperateService.getPulsarClusterInfo(mqType);
groupInfo.setPulsarAdminUrl(pulsarCluster.getAdminUrl());
groupInfo.setPulsarServiceUrl(pulsarCluster.getBrokerServiceUrl());
}
}
LOGGER.debug("success to get inlong group for groupId={}", groupId);
return groupInfo;
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class DisableZkForSortTest method testCreateSortConfigInCreateWorkflow.
@Test
public void testCreateSortConfigInCreateWorkflow() {
InlongGroupInfo groupInfo = initGroupForm("PULSAR");
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupInfo.setZookeeperEnabled(0);
groupService.update(groupInfo.genRequest(), OPERATOR);
InlongStreamInfo streamInfo = createStreamInfo(groupInfo);
createHiveSink(streamInfo);
createKafkaSource(streamInfo);
mockTaskListenerFactory();
WorkflowContext context = workflowEngine.processService().start(processName.name(), applicant, form);
WorkflowResult result = WorkflowBeanUtils.result(context);
ProcessResponse response = result.getProcessInfo();
Assert.assertSame(response.getStatus(), ProcessStatus.COMPLETED);
WorkflowProcess process = context.getProcess();
WorkflowTask task = process.getTaskByName("initSort");
Assert.assertTrue(task instanceof ServiceTask);
Assert.assertEquals(1, task.getNameToListenerMap().size());
List<TaskEventListener> listeners = Lists.newArrayList(task.getNameToListenerMap().values());
Assert.assertTrue(listeners.get(0) instanceof CreateSortConfigListener);
ProcessForm form = context.getProcessForm();
InlongGroupInfo curGroupRequest = ((GroupResourceProcessForm) form).getGroupInfo();
Assert.assertTrue(curGroupRequest.getExtList().size() == 1);
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupInfo in project incubator-inlong by apache.
the class DisableZkForSortTest method testCreateSortConfigInUpdateWorkflow.
@Test
public void testCreateSortConfigInUpdateWorkflow() {
InlongGroupInfo groupInfo = initGroupForm("PULSAR");
groupInfo.setZookeeperEnabled(0);
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
InlongStreamInfo streamInfo = createStreamInfo(groupInfo);
createHiveSink(streamInfo);
createKafkaSource(streamInfo);
UpdateGroupProcessForm form = new UpdateGroupProcessForm();
form.setGroupInfo(groupInfo);
form.setOperateType(OperateType.SUSPEND);
taskListenerFactory.acceptPlugin(new MockPlugin());
WorkflowContext context = workflowEngine.processService().start(ProcessName.SUSPEND_GROUP_PROCESS.name(), applicant, form);
WorkflowResult result = WorkflowBeanUtils.result(context);
ProcessResponse response = result.getProcessInfo();
Assert.assertSame(response.getStatus(), ProcessStatus.COMPLETED);
WorkflowProcess process = context.getProcess();
WorkflowTask task = process.getTaskByName("stopSort");
Assert.assertTrue(task instanceof ServiceTask);
Assert.assertEquals(2, task.getNameToListenerMap().size());
List<TaskEventListener> listeners = Lists.newArrayList(task.getNameToListenerMap().values());
Assert.assertTrue(listeners.get(1) instanceof CreateSortConfigListener);
ProcessForm currentProcessForm = context.getProcessForm();
InlongGroupInfo curGroupRequest = ((UpdateGroupProcessForm) currentProcessForm).getGroupInfo();
Assert.assertTrue(curGroupRequest.getExtList().size() == 1);
}
Aggregations