@Test public void testExecute_WhenUpdatingSucceeds_K8sDeploymentIsUpdatedWithNewInstanceCount() throws Exception { VirtualizationConnector vc = new VirtualizationConnector(); vc.setProviderIpAddress("1.1.1.1"); VirtualSystem vs = new VirtualSystem(null); vs.setVirtualizationConnector(vc); vs.setId(102L); ApplianceSoftwareVersion asv = new ApplianceSoftwareVersion(); asv.setImageUrl("ds-image-url"); asv.setImagePullSecretName("ds-pull-secret-name"); vs.setApplianceSoftwareVersion(asv); DeploymentSpec ds = new DeploymentSpec(vs, null, null, null, null, null); ds.setId(101L); ds.setName("ds-name"); ds.setNamespace("ds-namespace"); ds.setInstanceCount(8); ds.setExternalId(UUID.randomUUID().toString()); when(this.em.find(DeploymentSpec.class, ds.getId())).thenReturn(ds); UpdateK8sDeploymentTask task = this.factory.create(ds, this.k8sDeploymentApi); task.execute(); verify(this.k8sDeploymentApi, Mockito.times(1)).updateDeploymentReplicaCount( ds.getExternalId(), ds.getNamespace(), K8sUtil.getK8sName(ds), ds.getInstanceCount()); }
UpdateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { UpdateK8sDeploymentTask task = new UpdateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; }
UpdateK8sDeploymentTask extends TransactionalTask { UpdateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { UpdateK8sDeploymentTask task = new UpdateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; } }
UpdateK8sDeploymentTask extends TransactionalTask { UpdateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { UpdateK8sDeploymentTask task = new UpdateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; }  }
UpdateK8sDeploymentTask extends TransactionalTask { UpdateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { UpdateK8sDeploymentTask task = new UpdateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; }  UpdateK8sDeploymentTask create(DeploymentSpec ds); @Override void executeTransaction(EntityManager em); @Override String getName(); @Override Set<LockObjectReference> getObjects(); }
UpdateK8sDeploymentTask extends TransactionalTask { UpdateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) { UpdateK8sDeploymentTask task = new UpdateK8sDeploymentTask(); task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; task.ds = ds; task.k8sDeploymentApi = k8sDeploymentApi; return task; }  UpdateK8sDeploymentTask create(DeploymentSpec ds); @Override void executeTransaction(EntityManager em); @Override String getName(); @Override Set<LockObjectReference> getObjects();  }