@Test public void testExecute_WithPodAssignedToTargetedMember_PodAndPortRemoved() throws Exception { Pod pod = createAndRegisterPod(100L); String sameLabel = UUID.randomUUID().toString(); pod.getLabels().add(new Label(UUID.randomUUID().toString(), sameLabel)); Label memberLabel = new Label(UUID.randomUUID().toString(), sameLabel); DeleteK8sLabelPodTask task = this.factory.create(pod, memberLabel); task.execute(); verify(this.em, Mockito.times(1)).remove(pod.getPorts().iterator().next()); verify(this.em, Mockito.times(1)).remove(pod); }
public DeleteK8sLabelPodTask create(Pod pod, Label label) { DeleteK8sLabelPodTask task = new DeleteK8sLabelPodTask(); task.pod = pod; task.label = label; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }
DeleteK8sLabelPodTask extends TransactionalTask { public DeleteK8sLabelPodTask create(Pod pod, Label label) { DeleteK8sLabelPodTask task = new DeleteK8sLabelPodTask(); task.pod = pod; task.label = label; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; } }
DeleteK8sLabelPodTask extends TransactionalTask { public DeleteK8sLabelPodTask create(Pod pod, Label label) { DeleteK8sLabelPodTask task = new DeleteK8sLabelPodTask(); task.pod = pod; task.label = label; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  }
DeleteK8sLabelPodTask extends TransactionalTask { public DeleteK8sLabelPodTask create(Pod pod, Label label) { DeleteK8sLabelPodTask task = new DeleteK8sLabelPodTask(); task.pod = pod; task.label = label; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  @Override void executeTransaction(EntityManager em); DeleteK8sLabelPodTask create(Pod pod, Label label); @Override String getName(); @Override Set<LockObjectReference> getObjects(); }
DeleteK8sLabelPodTask extends TransactionalTask { public DeleteK8sLabelPodTask create(Pod pod, Label label) { DeleteK8sLabelPodTask task = new DeleteK8sLabelPodTask(); task.pod = pod; task.label = label; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  @Override void executeTransaction(EntityManager em); DeleteK8sLabelPodTask create(Pod pod, Label label); @Override String getName(); @Override Set<LockObjectReference> getObjects();  }