@Test public void testExecute_WithAValidNewPod_PodAndPortArePersisted() throws Exception { CreateK8sLabelPodTask task = this.factoryTask.create(VALID_K8S_POD, VALID_POD_SGM_LABEL); NetworkElement podPort = createNetworkElement(); registerNetworkElement(VALID_POD_SGM_LABEL.getSecurityGroupMembers().iterator().next(), podPort, VALID_K8S_POD); task.execute(); Pod createdPod = PodEntityMgr.findExternalId(this.em, VALID_K8S_POD.getUid()); Assert.assertNotNull("The created pod should no be null", createdPod); Assert.assertTrue("The persisted pod is different than expected", isExpectedPod(createdPod, VALID_K8S_POD, podPort)); Assert.assertTrue("The label SGM should contain the created pod", VALID_POD_SGM_LABEL.getPods().contains(createdPod)); }
public CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label) { CreateK8sLabelPodTask task = new CreateK8sLabelPodTask(); task.k8sPod = k8sPod; task.label = label; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }
CreateK8sLabelPodTask extends TransactionalTask { public CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label) { CreateK8sLabelPodTask task = new CreateK8sLabelPodTask(); task.k8sPod = k8sPod; task.label = label; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; } }
CreateK8sLabelPodTask extends TransactionalTask { public CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label) { CreateK8sLabelPodTask task = new CreateK8sLabelPodTask(); task.k8sPod = k8sPod; task.label = label; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  }
CreateK8sLabelPodTask extends TransactionalTask { public CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label) { CreateK8sLabelPodTask task = new CreateK8sLabelPodTask(); task.k8sPod = k8sPod; task.label = label; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  @Override void executeTransaction(EntityManager em); CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label); @Override String getName(); @Override Set<LockObjectReference> getObjects(); }
CreateK8sLabelPodTask extends TransactionalTask { public CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label) { CreateK8sLabelPodTask task = new CreateK8sLabelPodTask(); task.k8sPod = k8sPod; task.label = label; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  @Override void executeTransaction(EntityManager em); CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label); @Override String getName(); @Override Set<LockObjectReference> getObjects();  }