@Test public void testExecute_WhenCreateDeploymentSucceeds_DSIsUpdatedWithK8sDeploymentID() throws Exception { VirtualizationConnector vc = new VirtualizationConnector(); vc.setProviderIpAddress("1.1.1.1"); VirtualSystem vs = new VirtualSystem(null); vs.setVirtualizationConnector(vc); vs.setId(102L); ApplianceSoftwareVersion avs = new ApplianceSoftwareVersion(); avs.setImageUrl("ds-image-url"); avs.setImagePullSecretName("ds-pull-secret-name"); vs.setApplianceSoftwareVersion(avs); DeploymentSpec ds = new DeploymentSpec(vs, null, null, null, null, null); ds.setId(101L); ds.setName("ds-name"); ds.setNamespace("ds-namespace"); ds.setInstanceCount(5); when(this.em.find(DeploymentSpec.class, ds.getId())).thenReturn(ds); String k8sDeploymentId = UUID.randomUUID().toString(); mockCreateK8sDeployment(ds, k8sDeploymentId); CreateK8sDeploymentTask task = this.factory.create(ds, this.k8sDeploymentApi); task.execute(); Assert.assertEquals("The deployment spec external id was different than expected", k8sDeploymentId, ds.getExternalId()); verify(this.em, Mockito.times(1)).merge(ds); }
CreateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { CreateK8sDeploymentTask task = new CreateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; }
CreateK8sDeploymentTask extends TransactionalTask { CreateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { CreateK8sDeploymentTask task = new CreateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; } }
CreateK8sDeploymentTask extends TransactionalTask { CreateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { CreateK8sDeploymentTask task = new CreateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; }  }
CreateK8sDeploymentTask extends TransactionalTask { CreateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { CreateK8sDeploymentTask task = new CreateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; }  CreateK8sDeploymentTask create(DeploymentSpec ds); @Override void executeTransaction(EntityManager em); @Override String getName(); @Override Set<LockObjectReference> getObjects(); }
CreateK8sDeploymentTask extends TransactionalTask { CreateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { CreateK8sDeploymentTask task = new CreateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; }  CreateK8sDeploymentTask create(DeploymentSpec ds); @Override void executeTransaction(EntityManager em); @Override String getName(); @Override Set<LockObjectReference> getObjects();  }