Java Code Examples for com.couchbase.client.core.config.ConfigurationException

The following examples show how to use com.couchbase.client.core.config.ConfigurationException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: couchbase-jvm-core   Source File: BucketLifecycleTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailWithEmptySeedNodeList() {
    CouchbaseCore core = new CouchbaseCore(ENV);
    core.send(new SeedNodesRequest(Collections.<String>emptyList()));
    OpenBucketRequest request = new OpenBucketRequest(TestProperties.bucket(), TestProperties.username(), TestProperties.password());
    core.send(request).toBlocking().single();
}
 
Example 2
Source Project: couchbase-jvm-core   Source File: BucketLifecycleTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailOpeningNonExistentBucket() {
    CouchbaseCore core = new CouchbaseCore(ENV);

    core.send(new SeedNodesRequest(Arrays.asList(TestProperties.seedNode())));
    OpenBucketRequest request = new OpenBucketRequest(TestProperties.bucket() + "asd", TestProperties.password());
    core.send(request).toBlocking().single();
}
 
Example 3
Source Project: couchbase-jvm-core   Source File: BucketLifecycleTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailOpeningBucketWithWrongPassword() {
    CouchbaseCore core = new CouchbaseCore(ENV);

    core.send(new SeedNodesRequest(Arrays.asList(TestProperties.seedNode())));
    OpenBucketRequest request = new OpenBucketRequest(TestProperties.bucket(), TestProperties.username(), TestProperties.password() + "asd");
    core.send(request).toBlocking().single();
}
 
Example 4
Source Project: couchbase-jvm-core   Source File: BucketLifecycleTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailOpeningWithWrongHost() {
    CouchbaseCore core = new CouchbaseCore(ENV);

    core.send(new SeedNodesRequest(Arrays.asList("certainlyInvalidHostname")));
    OpenBucketRequest request = new OpenBucketRequest(TestProperties.bucket(), TestProperties.username(), TestProperties.password() + "asd");
    core.send(request).toBlocking().single();
}
 
Example 5
Source Project: couchbase-jvm-core   Source File: SeedNodesRequest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link SeedNodesRequest} with the given list of hostnames.
 *
 * @param nodes the seed node hostnames.
 */
public SeedNodesRequest(final List<String> nodes) {
    super(null, null);

    if (nodes == null || nodes.isEmpty()) {
        throw new ConfigurationException("Empty or null bootstrap list provided.");
    }
    Set<String> parsedNodes = new HashSet<>();
    for (String node : nodes) {
        if (node == null || node.isEmpty()) {
            LOGGER.info("Empty or null host in bootstrap list.");
            continue;
        }

        try {
            parsedNodes.add(node);
        } catch (Exception e) {
            LOGGER.info("Unknown host {} in bootstrap list.", system(node), e);
        }
    }

    if (parsedNodes.isEmpty()) {
        throw new ConfigurationException("No valid node found to bootstrap from. "
            + "Please check your network configuration.");
    }
    this.nodes = parsedNodes;
}
 
Example 6
Source Project: couchbase-jvm-core   Source File: BucketLifecycleTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailWithNoSeedNodeList() {
    OpenBucketRequest request = new OpenBucketRequest(TestProperties.bucket(), TestProperties.username(), TestProperties.password());
    new CouchbaseCore(ENV).send(request).toBlocking().single();
}
 
Example 7
Source Project: couchbase-jvm-core   Source File: SeedNodesRequestTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailOnNullHostname() {
    List<String> nodes = null;
    new SeedNodesRequest(nodes);
}
 
Example 8
Source Project: couchbase-jvm-core   Source File: SeedNodesRequestTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test(expected = ConfigurationException.class)
public void shouldFailOnEmptyHostname() {
    new SeedNodesRequest(new ArrayList<String>());
}