@Test void testGetWhenSecretCouldNotBeFetchedFromVault() { String name = "aProxyConfig"; String host = "https: Integer port = 8443; SecretResponse secretResponse = new SecretResponse(); ProxyResponse proxyResponse = new ProxyResponse(); proxyResponse.setName(name); proxyResponse.setHost(host); proxyResponse.setPort(port); proxyResponse.setUserName(secretResponse); proxyResponse.setPassword(secretResponse); when(environmentServiceCrnClient.withCrn(anyString()).proxyV1Endpoint()).thenReturn(proxyEndpoint); when(proxyEndpoint.getByResourceCrn(anyString())).thenReturn(proxyResponse); when(secretService.getByResponse(any(SecretResponse.class))).thenThrow(new VaultException("Vault token is invalid!")); CloudbreakServiceException exception = assertThrows(CloudbreakServiceException.class, () -> underTest.getByCrn( "crn:cdp:environments:us-west-1:cloudera:proxyconfig:a2f0bee2-059e-433f-a9d0-2893c53419ad")); assertEquals("Failed to get Proxy config related secret due to: 'Vault token is invalid!' ", exception.getMessage()); }
public ProxyConfig getByCrn(String resourceCrn) { return convert(getProxyConfig(resourceCrn, proxyEndpoint::getByResourceCrn)); }
ProxyConfigDtoService { public ProxyConfig getByCrn(String resourceCrn) { return convert(getProxyConfig(resourceCrn, proxyEndpoint::getByResourceCrn)); } }
ProxyConfigDtoService { public ProxyConfig getByCrn(String resourceCrn) { return convert(getProxyConfig(resourceCrn, proxyEndpoint::getByResourceCrn)); }  }
ProxyConfigDtoService { public ProxyConfig getByCrn(String resourceCrn) { return convert(getProxyConfig(resourceCrn, proxyEndpoint::getByResourceCrn)); }  ProxyConfig getByCrn(String resourceCrn); Optional<ProxyConfig> getByCrnWithEnvironmentFallback(String resourceCrn, @Nonnull String environmentCrn); Optional<ProxyConfig> getByEnvironmentCrn(String environmentCrn); }
ProxyConfigDtoService { public ProxyConfig getByCrn(String resourceCrn) { return convert(getProxyConfig(resourceCrn, proxyEndpoint::getByResourceCrn)); }  ProxyConfig getByCrn(String resourceCrn); Optional<ProxyConfig> getByCrnWithEnvironmentFallback(String resourceCrn, @Nonnull String environmentCrn); Optional<ProxyConfig> getByEnvironmentCrn(String environmentCrn);  }