use of org.junit.jupiter.api.TestTemplate in project java-cloudant by cloudant.
the class SslAuthenticationTest method localSslAuthenticationDisabled.
/**
* Connect to the local simple https server with SSL authentication disabled.
*/
@TestTemplate
public void localSslAuthenticationDisabled() throws Exception {
// Build a client that connects to the mock server with SSL authentication disabled
CloudantClient dbClient = CloudantClientHelper.newMockWebServerClientBuilder(server).disableSSLAuthentication().build();
// Queue a 200 OK response
server.enqueue(new MockResponse());
// Make an arbitrary connection to the DB.
dbClient.getAllDbs();
// Test is successful if no exception is thrown, so no explicit check is needed.
}
use of org.junit.jupiter.api.TestTemplate in project java-cloudant by cloudant.
the class SslAuthenticationTest method remoteSslAuthenticationEnabledTest.
/**
* Connect to the remote Cloudant server with SSL Authentication enabled.
* This shouldn't throw an exception as the Cloudant server has a valid
* SSL certificate, so should be authenticated.
*/
@TestTemplate
@RequiresCloudantService
public void remoteSslAuthenticationEnabledTest() {
CloudantClient dbClient = CloudantClientHelper.getClientBuilder().build();
// Make an arbitrary connection to the DB.
dbClient.getAllDbs();
// Test is successful if no exception is thrown, so no explicit check is needed.
}
use of org.junit.jupiter.api.TestTemplate in project java-cloudant by cloudant.
the class SslAuthenticationTest method remoteSslAuthenticationDisabledTest.
/**
* Connect to the remote Cloudant server with SSL Authentication disabled.
*/
@TestTemplate
@RequiresCloudantService
public void remoteSslAuthenticationDisabledTest() {
CloudantClient dbClient = CloudantClientHelper.getClientBuilder().disableSSLAuthentication().build();
// Make an arbitrary connection to the DB.
dbClient.getAllDbs();
// Test is successful if no exception is thrown, so no explicit check is needed.
}
use of org.junit.jupiter.api.TestTemplate in project java-cloudant by cloudant.
the class DatabaseURIHelperTest method buildDocumentUri_options_optionsEncoded.
@TestTemplate
public void buildDocumentUri_options_optionsEncoded(String path) throws Exception {
URI expected = new URI(uriBase + "/test/path1%2Fpath2?detail=true&revs=%5B1-2%5D");
Map<String, Object> options = new TreeMap<String, Object>();
options.put("revs", "[1-2]");
options.put("detail", true);
URI actual = helper(path + "/test").documentId("path1/path2").query(options).build();
Assertions.assertEquals(expected, actual);
}
use of org.junit.jupiter.api.TestTemplate in project java-cloudant by cloudant.
the class DatabaseURIHelperTest method buildQuery_joinTwoQueries.
@TestTemplate
public void buildQuery_joinTwoQueries(String path) throws Exception {
Map<String, Object> mapOptions = new TreeMap<String, Object>();
mapOptions.put("revs", "[1-2]");
mapOptions.put("detail", "/SDF@#%$#)");
String query = "boolean=true";
URI expectedQuery = new URI(uriBase + "?detail=/SDF@%23%25$%23)" + "&revs=%5B1-2%5D&boolean=true");
URI actualQuery = helper(path).query(mapOptions).query(query).build();
Assertions.assertEquals(expectedQuery.toASCIIString(), actualQuery.toASCIIString());
}
Aggregations