use of org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd in project cloudstack by apache.
the class KubernetesVersionManagerImpl method deleteKubernetesVersionIso.
private void deleteKubernetesVersionIso(long templateId) throws IllegalAccessException, NoSuchFieldException, IllegalArgumentException {
DeleteIsoCmd deleteIsoCmd = new DeleteIsoCmd();
deleteIsoCmd = ComponentContext.inject(deleteIsoCmd);
deleteIsoCmd.setId(templateId);
templateService.deleteIso(deleteIsoCmd);
}
use of org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd in project cloudstack by apache.
the class KubernetesVersionServiceTest method deleteKubernetesSupportedVersionTest.
@Test
public void deleteKubernetesSupportedVersionTest() {
DeleteKubernetesSupportedVersionCmd cmd = Mockito.mock(DeleteKubernetesSupportedVersionCmd.class);
AccountVO account = new AccountVO("admin", 1L, "", Account.ACCOUNT_TYPE_ADMIN, "uuid");
UserVO user = new UserVO(1, "adminuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
CallContext.register(user, account);
when(kubernetesSupportedVersionDao.findById(Mockito.anyLong())).thenReturn(Mockito.mock(KubernetesSupportedVersionVO.class));
List<KubernetesClusterVO> clusters = new ArrayList<>();
when(kubernetesClusterDao.listAllByKubernetesVersion(Mockito.anyLong())).thenReturn(clusters);
when(templateDao.findById(Mockito.anyLong())).thenReturn(Mockito.mock(VMTemplateVO.class));
PowerMockito.mockStatic(ComponentContext.class);
when(ComponentContext.inject(Mockito.any(DeleteIsoCmd.class))).thenReturn(new DeleteIsoCmd());
when(templateService.deleteIso(Mockito.any(DeleteIsoCmd.class))).thenReturn(true);
when(kubernetesClusterDao.remove(Mockito.anyLong())).thenReturn(true);
kubernetesVersionService.deleteKubernetesSupportedVersion(cmd);
}
Aggregations