@Test public void testConnection_WithKubernetes_WithIgnoreControllerException_WhenProviderNotReady_ThrowsErrorTypeException() throws Exception { this.exception.expect(ErrorTypeException.class); this.exception.expectMessage("Kubernetes reported service NOT ready."); DryRunRequest<VirtualizationConnectorRequest> request = VirtualizationConnectorUtilTestData.generateK8sVCWithSDN(); List<ErrorType> errorList = new ArrayList<>(); errorList.add(ErrorType.CONTROLLER_EXCEPTION); request.addErrorsToIgnore(errorList); when(this.k8sStatusApi.isServiceReady()).thenReturn(false); DryRunRequest<VirtualizationConnectorRequest> spyRequest = spy(request); VirtualizationConnector vc = VirtualizationConnectorEntityMgr.createEntity(request.getDto(), this.encrypter); this.util.checkConnection(spyRequest, vc); }
public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception { if (!request.isSkipAllDryRun()) { ErrorTypeException errorTypeException = null; final ArrayList<CertificateResolverModel> certificateResolverModels = new ArrayList<>(); if (this.managerFactory == null) { this.managerFactory = X509TrustManagerFactory.getInstance(); } if (vc.getVirtualizationType().equals(VirtualizationType.OPENSTACK)) { errorTypeException = checkOpenstackConnection(request, certificateResolverModels, vc); } else if (vc.getVirtualizationType().equals(VirtualizationType.KUBERNETES)) { errorTypeException = checkKubernetesConnection(request, certificateResolverModels, vc); } this.managerFactory.clearListener(); if (!certificateResolverModels.isEmpty() && errorTypeException != null) { throw new SslCertificatesExtendedException(errorTypeException, certificateResolverModels); } else if (errorTypeException != null) { throw errorTypeException; } } }
VirtualizationConnectorUtil { public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception { if (!request.isSkipAllDryRun()) { ErrorTypeException errorTypeException = null; final ArrayList<CertificateResolverModel> certificateResolverModels = new ArrayList<>(); if (this.managerFactory == null) { this.managerFactory = X509TrustManagerFactory.getInstance(); } if (vc.getVirtualizationType().equals(VirtualizationType.OPENSTACK)) { errorTypeException = checkOpenstackConnection(request, certificateResolverModels, vc); } else if (vc.getVirtualizationType().equals(VirtualizationType.KUBERNETES)) { errorTypeException = checkKubernetesConnection(request, certificateResolverModels, vc); } this.managerFactory.clearListener(); if (!certificateResolverModels.isEmpty() && errorTypeException != null) { throw new SslCertificatesExtendedException(errorTypeException, certificateResolverModels); } else if (errorTypeException != null) { throw errorTypeException; } } } }
VirtualizationConnectorUtil { public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception { if (!request.isSkipAllDryRun()) { ErrorTypeException errorTypeException = null; final ArrayList<CertificateResolverModel> certificateResolverModels = new ArrayList<>(); if (this.managerFactory == null) { this.managerFactory = X509TrustManagerFactory.getInstance(); } if (vc.getVirtualizationType().equals(VirtualizationType.OPENSTACK)) { errorTypeException = checkOpenstackConnection(request, certificateResolverModels, vc); } else if (vc.getVirtualizationType().equals(VirtualizationType.KUBERNETES)) { errorTypeException = checkKubernetesConnection(request, certificateResolverModels, vc); } this.managerFactory.clearListener(); if (!certificateResolverModels.isEmpty() && errorTypeException != null) { throw new SslCertificatesExtendedException(errorTypeException, certificateResolverModels); } else if (errorTypeException != null) { throw errorTypeException; } } }  }
VirtualizationConnectorUtil { public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception { if (!request.isSkipAllDryRun()) { ErrorTypeException errorTypeException = null; final ArrayList<CertificateResolverModel> certificateResolverModels = new ArrayList<>(); if (this.managerFactory == null) { this.managerFactory = X509TrustManagerFactory.getInstance(); } if (vc.getVirtualizationType().equals(VirtualizationType.OPENSTACK)) { errorTypeException = checkOpenstackConnection(request, certificateResolverModels, vc); } else if (vc.getVirtualizationType().equals(VirtualizationType.KUBERNETES)) { errorTypeException = checkKubernetesConnection(request, certificateResolverModels, vc); } this.managerFactory.clearListener(); if (!certificateResolverModels.isEmpty() && errorTypeException != null) { throw new SslCertificatesExtendedException(errorTypeException, certificateResolverModels); } else if (errorTypeException != null) { throw errorTypeException; } } }  void checkConnection(DryRunRequest<T> request,  VirtualizationConnector vc); }
VirtualizationConnectorUtil { public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception { if (!request.isSkipAllDryRun()) { ErrorTypeException errorTypeException = null; final ArrayList<CertificateResolverModel> certificateResolverModels = new ArrayList<>(); if (this.managerFactory == null) { this.managerFactory = X509TrustManagerFactory.getInstance(); } if (vc.getVirtualizationType().equals(VirtualizationType.OPENSTACK)) { errorTypeException = checkOpenstackConnection(request, certificateResolverModels, vc); } else if (vc.getVirtualizationType().equals(VirtualizationType.KUBERNETES)) { errorTypeException = checkKubernetesConnection(request, certificateResolverModels, vc); } this.managerFactory.clearListener(); if (!certificateResolverModels.isEmpty() && errorTypeException != null) { throw new SslCertificatesExtendedException(errorTypeException, certificateResolverModels); } else if (errorTypeException != null) { throw errorTypeException; } } }  void checkConnection(DryRunRequest<T> request,  VirtualizationConnector vc);  }