Search in sources :

Example 1 with DeleteIsoCmd

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);
}
Also used : DeleteIsoCmd(org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd)

Example 2 with 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);
}
Also used : UserVO(com.cloud.user.UserVO) KubernetesClusterVO(com.cloud.kubernetes.cluster.KubernetesClusterVO) ArrayList(java.util.ArrayList) VMTemplateVO(com.cloud.storage.VMTemplateVO) DeleteKubernetesSupportedVersionCmd(org.apache.cloudstack.api.command.admin.kubernetes.version.DeleteKubernetesSupportedVersionCmd) AccountVO(com.cloud.user.AccountVO) DeleteIsoCmd(org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

DeleteIsoCmd (org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd)2 KubernetesClusterVO (com.cloud.kubernetes.cluster.KubernetesClusterVO)1 VMTemplateVO (com.cloud.storage.VMTemplateVO)1 AccountVO (com.cloud.user.AccountVO)1 UserVO (com.cloud.user.UserVO)1 ArrayList (java.util.ArrayList)1 DeleteKubernetesSupportedVersionCmd (org.apache.cloudstack.api.command.admin.kubernetes.version.DeleteKubernetesSupportedVersionCmd)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1