@Test @DisplayName("validate createWithAadApplicationCertificate throws IllegalArgumentException exception when missing or invalid parameters") void createWithAadApplicationCertificate() throws CertificateException, OperatorCreationException, PKCSException, IOException { String certFilePath = Paths.get("src","test","resources", "cert.cer").toString(); String privateKeyPath = Paths.get("src","test","resources","key.pem").toString(); X509Certificate x509Certificate = readPem(certFilePath, "basic").getCertificate(); PrivateKey privateKey = readPem(privateKeyPath, "basic").getKey(); Assertions.assertThrows(IllegalArgumentException.class, () -> ConnectionStringBuilder .createWithAadApplicationCertificate(null, "appId", x509Certificate, privateKey)); Assertions.assertThrows(IllegalArgumentException.class, () -> ConnectionStringBuilder .createWithAadApplicationCertificate("", "appId", x509Certificate, privateKey)); Assertions.assertThrows(IllegalArgumentException.class, () -> ConnectionStringBuilder .createWithAadApplicationCertificate("resource.uri", null, x509Certificate, privateKey)); Assertions.assertThrows(IllegalArgumentException.class, () -> ConnectionStringBuilder .createWithAadApplicationCertificate("resource.uri", "", x509Certificate, privateKey)); Assertions.assertThrows(IllegalArgumentException.class, () -> ConnectionStringBuilder .createWithAadApplicationCertificate("resource.uri", "appID", null, privateKey)); Assertions.assertThrows(IllegalArgumentException.class, () -> ConnectionStringBuilder .createWithAadApplicationCertificate("resource.uri", "appID", x509Certificate, null)); }
public static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri, String applicationClientId, X509Certificate x509Certificate, PrivateKey privateKey) { return createWithAadApplicationCertificate(resourceUri, applicationClientId, x509Certificate, privateKey, null); }
ConnectionStringBuilder { public static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri, String applicationClientId, X509Certificate x509Certificate, PrivateKey privateKey) { return createWithAadApplicationCertificate(resourceUri, applicationClientId, x509Certificate, privateKey, null); } }
ConnectionStringBuilder { public static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri, String applicationClientId, X509Certificate x509Certificate, PrivateKey privateKey) { return createWithAadApplicationCertificate(resourceUri, applicationClientId, x509Certificate, privateKey, null); } private  ConnectionStringBuilder(String resourceUri); }
ConnectionStringBuilder { public static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri, String applicationClientId, X509Certificate x509Certificate, PrivateKey privateKey) { return createWithAadApplicationCertificate(resourceUri, applicationClientId, x509Certificate, privateKey, null); } private  ConnectionStringBuilder(String resourceUri); String getClusterUrl(); void setApplicationNameForTracing(String applicationNameForTracing); void setClientVersionForTracing(String clientVersionForTracing); Callable<String> getTokenProvider(); static ConnectionStringBuilder createWithAadUserCredentials(String resourceUri,
                                                                       String username,
                                                                       String password,
                                                                       String authorityId); static ConnectionStringBuilder createWithAadUserCredentials(String resourceUri,
                                                                       String username,
                                                                       String password); static ConnectionStringBuilder createWithAadApplicationCredentials(String resourceUri,
                                                                              String applicationClientId,
                                                                              String applicationKey,
                                                                              String authorityId); static ConnectionStringBuilder createWithAadApplicationCredentials(String resourceUri,
                                                                              String applicationClientId,
                                                                              String applicationKey); static ConnectionStringBuilder createWithDeviceCodeCredentials(String resourceUri, String authorityId); static ConnectionStringBuilder createWithDeviceCodeCredentials(String resourceUri); static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri,
                                                                              String applicationClientId,
                                                                              X509Certificate x509Certificate,
                                                                              PrivateKey privateKey); static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri,
                                                                              String applicationClientId,
                                                                              X509Certificate x509Certificate,
                                                                              PrivateKey privateKey,
                                                                              String authorityId); static ConnectionStringBuilder createWithAadAccessTokenAuthentication(String resourceUri, String token); static ConnectionStringBuilder createWithAadTokenProviderAuthentication(String resourceUri, Callable<String> tokenProviderCallable); }
ConnectionStringBuilder { public static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri, String applicationClientId, X509Certificate x509Certificate, PrivateKey privateKey) { return createWithAadApplicationCertificate(resourceUri, applicationClientId, x509Certificate, privateKey, null); } private  ConnectionStringBuilder(String resourceUri); String getClusterUrl(); void setApplicationNameForTracing(String applicationNameForTracing); void setClientVersionForTracing(String clientVersionForTracing); Callable<String> getTokenProvider(); static ConnectionStringBuilder createWithAadUserCredentials(String resourceUri,
                                                                       String username,
                                                                       String password,
                                                                       String authorityId); static ConnectionStringBuilder createWithAadUserCredentials(String resourceUri,
                                                                       String username,
                                                                       String password); static ConnectionStringBuilder createWithAadApplicationCredentials(String resourceUri,
                                                                              String applicationClientId,
                                                                              String applicationKey,
                                                                              String authorityId); static ConnectionStringBuilder createWithAadApplicationCredentials(String resourceUri,
                                                                              String applicationClientId,
                                                                              String applicationKey); static ConnectionStringBuilder createWithDeviceCodeCredentials(String resourceUri, String authorityId); static ConnectionStringBuilder createWithDeviceCodeCredentials(String resourceUri); static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri,
                                                                              String applicationClientId,
                                                                              X509Certificate x509Certificate,
                                                                              PrivateKey privateKey); static ConnectionStringBuilder createWithAadApplicationCertificate(String resourceUri,
                                                                              String applicationClientId,
                                                                              X509Certificate x509Certificate,
                                                                              PrivateKey privateKey,
                                                                              String authorityId); static ConnectionStringBuilder createWithAadAccessTokenAuthentication(String resourceUri, String token); static ConnectionStringBuilder createWithAadTokenProviderAuthentication(String resourceUri, Callable<String> tokenProviderCallable);  }