use of com.couchbase.client.core.CoreContext in project couchbase-jvm-clients by couchbase.
the class FeatureNegotiatingHandlerTest method beforeEach.
@BeforeEach
@Override
protected void beforeEach() {
super.beforeEach();
CoreEnvironment env = mock(CoreEnvironment.class);
timeoutConfig = mock(TimeoutConfig.class);
when(env.eventBus()).thenReturn(eventBus);
when(env.timeoutConfig()).thenReturn(timeoutConfig);
when(env.userAgent()).thenReturn(new UserAgent("some", Optional.empty(), Optional.empty(), Optional.empty()));
when(timeoutConfig.connectTimeout()).thenReturn(Duration.ofMillis(1000));
CoreContext coreContext = new CoreContext(mock(Core.class), 1, env, mock(Authenticator.class));
endpointContext = 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.CoreContext 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.CoreContext in project couchbase-jvm-clients by couchbase.
the class MemcacheProtocolTest method before.
@BeforeEach
void before() {
eventBus = mock(EventBus.class);
CoreEnvironment env = mock(CoreEnvironment.class);
context = new CoreContext(mock(Core.class), 1, env, mock(Authenticator.class));
when(env.eventBus()).thenReturn(eventBus);
}
use of com.couchbase.client.core.CoreContext in project couchbase-jvm-clients by couchbase.
the class SaslListMechanismsHandlerTest method beforeEach.
@BeforeEach
@Override
protected void beforeEach() {
super.beforeEach();
CoreEnvironment env = mock(CoreEnvironment.class);
TimeoutConfig timeoutConfig = mock(TimeoutConfig.class);
when(env.eventBus()).thenReturn(eventBus);
when(env.timeoutConfig()).thenReturn(timeoutConfig);
when(timeoutConfig.connectTimeout()).thenReturn(Duration.ofMillis(1000));
CoreContext coreContext = new CoreContext(mock(Core.class), 1, env, mock(Authenticator.class));
endpointContext = 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.CoreContext in project couchbase-jvm-clients by couchbase.
the class RequestContextTest method requestCancellation.
@Test
void requestCancellation() {
Request<?> request = mock(Request.class);
Core core = mock(Core.class);
RequestContext ctx = new RequestContext(new CoreContext(core, 1, null, mock(Authenticator.class)), request);
ctx.cancel();
verify(request, times(1)).cancel(CancellationReason.CANCELLED_VIA_CONTEXT);
}
Aggregations