io.fabric8.mockwebserver.Context Java Examples

The following examples show how to use io.fabric8.mockwebserver.Context. 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 File: MixedKubernetesServer.java    From flink with Apache License 2.0 5 votes vote down vote up
public void before() {
	HashMap<ServerRequest, Queue<ServerResponse>> response = new HashMap<>();
	mock = crudMode
		? new KubernetesMockServer(new Context(), new MockWebServer(), response, new MixedDispatcher(response), true)
		: new KubernetesMockServer(https);
	mock.init();
	client = mock.createClient();
}
 
Example #2
Source File: WebSocketSession.java    From mockwebserver with Apache License 2.0 5 votes vote down vote up
public WebSocketSession(Context context, ScheduledExecutorService executor, List<WebSocketMessage> open, WebSocketMessage failure, Exception cause) {
    this.context = context;
    this.open = open;
    this.failure = failure;
    this.cause = cause;
    this.executor = executor;
}
 
Example #3
Source File: OpenShiftServer.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
public void before() {
  mock = curdMode
    ? new OpenShiftMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), true)
    : new OpenShiftMockServer(https);
  mock.init();
  client = mock.createOpenShiftClient();
}
 
Example #4
Source File: ServiceCatalogServer.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
public void before() {
  mock = curdMode
    ? new ServiceCatalogMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), true)
    : new ServiceCatalogMockServer(https);
  mock.init();
  client = mock.createServiceCatalog();
}
 
Example #5
Source File: MockServerExpectationImpl.java    From mockwebserver with Apache License 2.0 5 votes vote down vote up
public MockServerExpectationImpl(Context context, HttpMethod method, String path, ResponseProvider<String> bodyProvider, ResponseProvider<List<String>> chunksProvider, long delay, TimeUnit delayUnit, int times, Map<ServerRequest, Queue<ServerResponse>> responses) {
  this.context = context;
  this.method = method;
  this.path = path;
  this.bodyProvider = bodyProvider;
  this.chunksProvider = chunksProvider;
  this.delay = delay;
  this.delayUnit = delayUnit;
  this.times = times;
  this.responses = responses;
}
 
Example #6
Source File: TektonServer.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
public void before() {
  mock = curdMode
    ? new TektonMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), true)
    : new TektonMockServer(https);
  mock.init();
  client = mock.createTekton();
}
 
Example #7
Source File: WatchEventsListener.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
private static WebSocketMessage toWebSocketMessage(Context context, Long delay, Object content, Boolean toBeRemoved) {
  if (content instanceof String) {
    return new WebSocketMessage(delay, (String) content, toBeRemoved);
  } else if (content instanceof WebSocketMessage) {
    return (WebSocketMessage) content;
  } else {
    try {
      return toWebSocketMessage(context, delay, context.getMapper().writeValueAsString(content), toBeRemoved);
    } catch (JsonProcessingException e) {
      throw new IllegalArgumentException(e);
    }
  }
}
 
Example #8
Source File: KnativeServer.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
public void before() {
  mock = curdMode
    ? new KnativeMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), true)
    : new KnativeMockServer(https);
  mock.init();
  client = mock.createKnative();
}
 
Example #9
Source File: KubernetesServer.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
public void before() {
  mock = crudMode
    ? new KubernetesMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), true)
    : new KubernetesMockServer(https);
  mock.init();
  client = mock.createClient();
}
 
Example #10
Source File: KubernetesMockServer.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public KubernetesMockServer(Context context, MockWebServer server, Map<ServerRequest, Queue<ServerResponse>> responses, boolean useHttps) {
    super(context, server, responses, useHttps);
}
 
Example #11
Source File: OpenShiftMockServer.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public OpenShiftMockServer(Context context, MockWebServer server, Map<ServerRequest, Queue<ServerResponse>> responses, Dispatcher dispatcher, boolean useHttps) {
  super(context, server, responses, dispatcher, useHttps);
}
 
Example #12
Source File: ServiceCatalogMockServer.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public ServiceCatalogMockServer(Context context, MockWebServer server, Map<ServerRequest, Queue<ServerResponse>> responses, Dispatcher dispatcher, boolean useHttps) {
  super(context, server, responses, dispatcher, useHttps);
}
 
Example #13
Source File: TektonMockServer.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public TektonMockServer(Context context, MockWebServer server, Map<ServerRequest, Queue<ServerResponse>> responses, Dispatcher dispatcher, boolean useHttps) {
  super(context, server, responses, dispatcher, useHttps);
}
 
Example #14
Source File: KnativeMockServer.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public KnativeMockServer(Context context, MockWebServer server, Map<ServerRequest, Queue<ServerResponse>> responses, Dispatcher dispatcher, boolean useHttps) {
  super(context, server, responses, dispatcher, useHttps);
}
 
Example #15
Source File: KubernetesMockServer.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public KubernetesMockServer(Context context, MockWebServer server, Map<ServerRequest, Queue<ServerResponse>> responses, boolean useHttps) {
    super(context, server, responses, useHttps);
}
 
Example #16
Source File: KubernetesMockServer.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public KubernetesMockServer(Context context, MockWebServer server, Map<ServerRequest, Queue<ServerResponse>> responses, Dispatcher dispatcher, boolean useHttps) {
  super(context, server, responses, dispatcher, useHttps);
}
 
Example #17
Source File: CrudDispatcher.java    From mockwebserver with Apache License 2.0 4 votes vote down vote up
public CrudDispatcher(Context context, AttributeExtractor attributeExtractor, ResponseComposer responseComposer) {
    this.context = context;
    this.attributeExtractor = attributeExtractor;
    this.responseComposer = responseComposer;
}
 
Example #18
Source File: KubernetesCrudDispatcher.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public KubernetesCrudDispatcher(KubernetesCrudAttributesExtractor attributeExtractor, ResponseComposer responseComposer) {
  super(new Context(Serialization.jsonMapper()), attributeExtractor, responseComposer);
}
 
Example #19
Source File: WatchEventsListener.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
private static WebSocketMessage toWebSocketMessage(Context context, Object content, Boolean toBeRemoved) {
  return toWebSocketMessage(context,0L, content, toBeRemoved);
}
 
Example #20
Source File: WatchEventsListener.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
private static WebSocketMessage toWebSocketMessage(Context context, Object content) {
  return toWebSocketMessage(context, content, true);
}
 
Example #21
Source File: WatchEventsListener.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public WatchEventsListener(Context context, AttributeSet attributeSet, final Set<WatchEventsListener> watchEventListenerList, Logger logger) {
  this.logger = logger;
  this.context = context;
  this.attributeSet = attributeSet;
  this.watchEventListenerList = watchEventListenerList;
}
 
Example #22
Source File: MockServerExpectationImpl.java    From mockwebserver with Apache License 2.0 4 votes vote down vote up
public MockServerExpectationImpl(Context context, HttpMethod method, String path, int statusCode, String body, String[] chunks, long delay, TimeUnit delayUnit, int times, Map<ServerRequest, Queue<ServerResponse>> responses) {
  this(context, method, path, ResponseProviders.of(statusCode, body), ResponseProviders.ofAll(statusCode, chunks), delay, delayUnit, times, responses);
}
 
Example #23
Source File: MockServerExpectationImpl.java    From mockwebserver with Apache License 2.0 4 votes vote down vote up
public MockServerExpectationImpl(Map<ServerRequest, Queue<ServerResponse>> responses, Context context) {
  this(context, HttpMethod.ANY, null, 200, null, null, 0, TimeUnit.SECONDS, 1, responses);
}
 
Example #24
Source File: InlineWebSocketSessionBuilder.java    From mockwebserver with Apache License 2.0 4 votes vote down vote up
public InlineWebSocketSessionBuilder(Context context, Function<WebSocketSession, T> function) {
    this.context = context;
    this.function = function;
    this.executor = Executors.newSingleThreadScheduledExecutor();
}
 
Example #25
Source File: InlineWebSocketSessionBuilder.java    From mockwebserver with Apache License 2.0 4 votes vote down vote up
public InlineWebSocketSessionBuilder(Context context, ScheduledExecutorService executor, Function<WebSocketSession, T> function) {
    this.context = context;
    this.function = function;
    this.executor = executor;
}