@Test public void testExecute_WithVariousSGM_ExpectCorrectTaskGraph() throws Exception { CheckK8sSecurityGroupLabelMetaTask task = this.factoryTask.create(this.sgm, this.isDelete); UpdateK8sSecurityGroupMemberLabelMetaTask updateK8sSecurityGroupMemberLabelMetaTask = new UpdateK8sSecurityGroupMemberLabelMetaTask(); MarkSecurityGroupMemberDeleteTask markSecurityGroupMemberDeleteTask = new MarkSecurityGroupMemberDeleteTask(); SecurityGroupMemberDeleteTask securityGroupMemberDeleteTask = new SecurityGroupMemberDeleteTask(); task.markSecurityGroupMemberDeleteTask = markSecurityGroupMemberDeleteTask; task.securityGroupMemberDeleteTask = securityGroupMemberDeleteTask; task.updateK8sSecurityGroupMemberLabelMetaTask = updateK8sSecurityGroupMemberLabelMetaTask; this.expectedGraph = new TaskGraph(); if (!this.isDelete) { this.expectedGraph.addTask(updateK8sSecurityGroupMemberLabelMetaTask.create(this.sgm, null)); } else { this.expectedGraph.addTask(markSecurityGroupMemberDeleteTask.create(this.sgm)); this.expectedGraph.appendTask(securityGroupMemberDeleteTask.create(this.sgm)); } task.execute(); TaskGraphHelper.validateTaskGraph(task, this.expectedGraph); }
public CheckK8sSecurityGroupLabelMetaTask create(SecurityGroupMember sgm, boolean isDelete) { CheckK8sSecurityGroupLabelMetaTask task = new CheckK8sSecurityGroupLabelMetaTask(); task.sgm = sgm; task.isDelete = isDelete; task.updateK8sSecurityGroupMemberLabelMetaTask = this.updateK8sSecurityGroupMemberLabelMetaTask; task.markSecurityGroupMemberDeleteTask = this.markSecurityGroupMemberDeleteTask; task.securityGroupMemberDeleteTask = this.securityGroupMemberDeleteTask; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }
CheckK8sSecurityGroupLabelMetaTask extends TransactionalMetaTask { public CheckK8sSecurityGroupLabelMetaTask create(SecurityGroupMember sgm, boolean isDelete) { CheckK8sSecurityGroupLabelMetaTask task = new CheckK8sSecurityGroupLabelMetaTask(); task.sgm = sgm; task.isDelete = isDelete; task.updateK8sSecurityGroupMemberLabelMetaTask = this.updateK8sSecurityGroupMemberLabelMetaTask; task.markSecurityGroupMemberDeleteTask = this.markSecurityGroupMemberDeleteTask; task.securityGroupMemberDeleteTask = this.securityGroupMemberDeleteTask; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; } }
CheckK8sSecurityGroupLabelMetaTask extends TransactionalMetaTask { public CheckK8sSecurityGroupLabelMetaTask create(SecurityGroupMember sgm, boolean isDelete) { CheckK8sSecurityGroupLabelMetaTask task = new CheckK8sSecurityGroupLabelMetaTask(); task.sgm = sgm; task.isDelete = isDelete; task.updateK8sSecurityGroupMemberLabelMetaTask = this.updateK8sSecurityGroupMemberLabelMetaTask; task.markSecurityGroupMemberDeleteTask = this.markSecurityGroupMemberDeleteTask; task.securityGroupMemberDeleteTask = this.securityGroupMemberDeleteTask; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  }
CheckK8sSecurityGroupLabelMetaTask extends TransactionalMetaTask { public CheckK8sSecurityGroupLabelMetaTask create(SecurityGroupMember sgm, boolean isDelete) { CheckK8sSecurityGroupLabelMetaTask task = new CheckK8sSecurityGroupLabelMetaTask(); task.sgm = sgm; task.isDelete = isDelete; task.updateK8sSecurityGroupMemberLabelMetaTask = this.updateK8sSecurityGroupMemberLabelMetaTask; task.markSecurityGroupMemberDeleteTask = this.markSecurityGroupMemberDeleteTask; task.securityGroupMemberDeleteTask = this.securityGroupMemberDeleteTask; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  @Override TaskGraph getTaskGraph(); @Override String getName(); @Override void executeTransaction(EntityManager em); CheckK8sSecurityGroupLabelMetaTask create(SecurityGroupMember sgm, boolean isDelete); @Override String toString(); @Override Set<LockObjectReference> getObjects(); }
CheckK8sSecurityGroupLabelMetaTask extends TransactionalMetaTask { public CheckK8sSecurityGroupLabelMetaTask create(SecurityGroupMember sgm, boolean isDelete) { CheckK8sSecurityGroupLabelMetaTask task = new CheckK8sSecurityGroupLabelMetaTask(); task.sgm = sgm; task.isDelete = isDelete; task.updateK8sSecurityGroupMemberLabelMetaTask = this.updateK8sSecurityGroupMemberLabelMetaTask; task.markSecurityGroupMemberDeleteTask = this.markSecurityGroupMemberDeleteTask; task.securityGroupMemberDeleteTask = this.securityGroupMemberDeleteTask; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  @Override TaskGraph getTaskGraph(); @Override String getName(); @Override void executeTransaction(EntityManager em); CheckK8sSecurityGroupLabelMetaTask create(SecurityGroupMember sgm, boolean isDelete); @Override String toString(); @Override Set<LockObjectReference> getObjects();  }