use of com.cloudant.test.main.RequiresCloudantService in project java-cloudant by cloudant.
the class CloudantClientTests method apiKey.
@Test
@RequiresCloudantService
public void apiKey() {
ApiKey key = account.generateApiKey();
assertNotNull(key);
assertNotNull(key.getKey());
assertNotNull(key.getPassword());
}
use of com.cloudant.test.main.RequiresCloudantService 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 com.cloudant.test.main.RequiresCloudantService 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 com.cloudant.test.main.RequiresCloudantService in project java-cloudant by cloudant.
the class DatabaseTest method permissions.
@Test
@RequiresCloudantService
public void permissions() {
Map<String, EnumSet<Permissions>> userPerms = db.getPermissions();
assertNotNull(userPerms);
ApiKey key = account.generateApiKey();
EnumSet<Permissions> p = EnumSet.<Permissions>of(Permissions._reader, Permissions._writer);
db.setPermissions(key.getKey(), p);
userPerms = db.getPermissions();
assertNotNull(userPerms);
assertEquals(1, userPerms.size());
assertEquals(p, userPerms.get(key.getKey()));
p = EnumSet.noneOf(Permissions.class);
db.setPermissions(key.getKey(), p);
userPerms = db.getPermissions();
assertNotNull(userPerms);
assertEquals(1, userPerms.size());
assertEquals(p, userPerms.get(key.getKey()));
}
Aggregations