use of com.couchbase.client.core.cnc.SimpleEventBus in project couchbase-jvm-clients by couchbase.
the class TransportEncryptionIntegrationTest method failsIfWrongCertPresent.
@Test
@SuppressWarnings("unchecked")
void failsIfWrongCertPresent() {
SimpleEventBus eventBus = new SimpleEventBus(true);
CoreEnvironment env = secureEnvironment(SecurityConfig.enableTls(true).trustCertificates(mock(List.class)), eventBus);
Core core = Core.create(env, authenticator(), secureSeeds());
try {
core.openBucket(config().bucketname());
waitUntilCondition(() -> {
boolean hasEndpointConnectFailedEvent = false;
boolean hasSecureConnectionFailedEvent = false;
for (Event event : eventBus.publishedEvents()) {
if (event instanceof EndpointConnectionFailedEvent) {
hasEndpointConnectFailedEvent = true;
}
if (event instanceof SecureConnectionFailedEvent) {
hasSecureConnectionFailedEvent = true;
}
}
return hasEndpointConnectFailedEvent && hasSecureConnectionFailedEvent;
});
} finally {
core.shutdown().block();
env.shutdown();
}
}
use of com.couchbase.client.core.cnc.SimpleEventBus in project couchbase-jvm-clients by couchbase.
the class DefaultConfigurationProviderIntegrationTest method openBucketFromSecondValidSeed.
/**
* Bucket config should also be loaded when the first seed in the list is not available.
*/
@Test
void openBucketFromSecondValidSeed() {
TestNodeConfig cfg = config().firstNodeWith(Services.KV).get();
Set<SeedNode> seeds = new HashSet<>(Arrays.asList(SeedNode.create("1.2.3.4"), SeedNode.create(cfg.hostname(), Optional.of(cfg.ports().get(Services.KV)), Optional.of(cfg.ports().get(Services.MANAGER)))));
SimpleEventBus eventBus = new SimpleEventBus(true);
environment = CoreEnvironment.builder().eventBus(eventBus).build();
core = Core.create(environment, authenticator(), seeds);
String bucketName = config().bucketname();
ConfigurationProvider provider = new DefaultConfigurationProvider(core, seeds);
openAndClose(bucketName, provider);
provider.shutdown().block();
waitUntilCondition(() -> eventBus.publishedEvents().stream().anyMatch(e -> e instanceof EndpointConnectionFailedEvent));
}
use of com.couchbase.client.core.cnc.SimpleEventBus in project couchbase-jvm-clients by couchbase.
the class BaseEndpointIntegrationTest method beforeEach.
@BeforeEach
void beforeEach() {
eventBus = new SimpleEventBus(true);
env = environment().eventBus(eventBus).build();
eventLoopGroup = new DefaultEventLoopGroup();
}
use of com.couchbase.client.core.cnc.SimpleEventBus in project couchbase-jvm-clients by couchbase.
the class KeyValueMessageHandlerTest method setup.
@BeforeAll
static void setup() {
ENV = CoreEnvironment.builder().eventBus(new SimpleEventBus(true)).build();
Core core = mock(Core.class);
CoreContext coreContext = new CoreContext(core, 1, ENV, PasswordAuthenticator.create("foo", "bar"));
ConfigurationProvider configurationProvider = mock(ConfigurationProvider.class);
when(configurationProvider.collectionMap()).thenReturn(new CollectionMap());
when(core.configurationProvider()).thenReturn(configurationProvider);
CTX = new EndpointContext(coreContext, new HostAndPort("127.0.0.1", 1234), null, ServiceType.KV, Optional.empty(), Optional.empty(), Optional.empty());
}
use of com.couchbase.client.core.cnc.SimpleEventBus in project couchbase-jvm-clients by couchbase.
the class AbstractKeyValueEmbeddedChannelTest method beforeEach.
@BeforeEach
protected void beforeEach() {
channel = new EmbeddedChannel();
eventBus = new SimpleEventBus(true);
}
Aggregations