Tabnine Logo
FutureCallbackProxy
Code IndexAdd Tabnine to your IDE (free)

How to use
FutureCallbackProxy
in
rocks.inspectit.agent.java.tracing.core.adapter.http.proxy

Best Java code snippets using rocks.inspectit.agent.java.tracing.core.adapter.http.proxy.FutureCallbackProxy (Showing top 12 results out of 315)

origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public Object beforeBody(long methodId, Object object, Object[] parameters, SpecialSensorConfig ssc) {
  if ((null != parameters) && (parameters.length == 4)) {
    // the HTTP context
    Object httpContext = parameters[2];
    // the original callback given by the user
    Object originalCallback = parameters[3];
    SpanStoreAdapter spanStoreAdapter = new ApacheHttpContextSpanStoreAdapter(httpContext);
    FutureCallbackProxy proxy = new FutureCallbackProxy(originalCallback, spanStoreAdapter);
    Object newProxy = runtimeLinker.createProxy(FutureCallbackProxy.class, proxy, object.getClass().getClassLoader());
    parameters[3] = newProxy;
  }
  return null;
}
origin: inspectIT/inspectIT

  @Test
  public void returnsAnEmptyCollection() {
    Object[] args = proxy.getProxyConstructorArguments();
    assertThat("Number of args returned by the constructor must be zero.", args, is(new Object[] {}));
  }
}
origin: inspectIT/inspectIT

@Test
public void withoutSpanStore() throws Exception {
  proxy.cancelled();
  verify(spanStoreAdapter).getSpanStore();
  verify(originalCallback).cancelled();
  verifyNoMoreInteractions(spanStoreAdapter, originalCallback);
  verifyZeroInteractions(spanStore);
}
origin: inspectIT/inspectIT

  @Test
  public void withoutSpanStoreAndCallback() throws Exception {
    Exception exception = new Exception();
    removeOriginalCallback();
    proxy.failed(exception);
    verify(spanStoreAdapter).getSpanStore();
    verifyNoMoreInteractions(spanStoreAdapter);
    verifyZeroInteractions(spanStore, originalCallback);
  }
}
origin: inspectIT/inspectIT

  @Test
  public void withoutSpanStoreAndCallback() throws Exception {
    Object response = new Object();
    removeOriginalCallback();
    proxy.completed(response);
    verify(spanStoreAdapter).getSpanStore();
    verifyNoMoreInteractions(spanStoreAdapter);
    verifyZeroInteractions(spanStore, originalCallback);
  }
}
origin: inspectIT/inspectIT

  @Test
  public void withoutSpanStoreAndCallback() throws Exception {
    removeOriginalCallback();
    proxy.cancelled();
    verify(spanStoreAdapter).getSpanStore();
    verifyNoMoreInteractions(spanStoreAdapter);
    verifyZeroInteractions(spanStore, originalCallback);
  }
}
origin: inspectIT/inspectIT

@Test
public void withoutSpanStore() throws Exception {
  Exception exception = new Exception();
  proxy.failed(exception);
  verify(spanStoreAdapter).getSpanStore();
  verify(originalCallback).failed(exception);
  verifyNoMoreInteractions(spanStoreAdapter, originalCallback);
  verifyZeroInteractions(spanStore);
}
origin: inspectIT/inspectIT

@Test
public void withoutSpanStore() {
  Object response = new Object();
  proxy.completed(response);
  verify(spanStoreAdapter).getSpanStore();
  verify(originalCallback).completed(response);
  verifyNoMoreInteractions(spanStoreAdapter, originalCallback);
  verifyZeroInteractions(spanStore);
}
origin: inspectIT/inspectIT

@BeforeMethod
public void init() throws Exception {
  proxy = new FutureCallbackProxy(originalCallback, spanStoreAdapter);
  WFutureCallback.completed = new CachedMethod<Void>(FutureCallback.class.getName(), "completed", Object.class);
  WFutureCallback.failed = new CachedMethod<Void>(FutureCallback.class.getName(), "failed", Exception.class);
  WFutureCallback.cancelled = new CachedMethod<Void>(FutureCallback.class.getName(), "cancelled");
}
origin: inspectIT/inspectIT

@Test
public void successful() throws Exception {
  when(spanStoreAdapter.getSpanStore()).thenReturn(spanStore);
  proxy.cancelled();
  ArgumentCaptor<TagsProvidingAdapter> captor = ArgumentCaptor.forClass(TagsProvidingAdapter.class);
  verify(spanStoreAdapter).getSpanStore();
  verify(spanStore).finishSpan(captor.capture());
  verify(originalCallback).cancelled();
  verifyNoMoreInteractions(spanStore, spanStoreAdapter, originalCallback);
  assertThat(captor.getValue().getTags(), hasKey(SpanStoreAdapter.Constants.CANCEL));
}
origin: inspectIT/inspectIT

@Test
public void successful() throws Exception {
  Exception exception = new Exception();
  when(spanStoreAdapter.getSpanStore()).thenReturn(spanStore);
  proxy.failed(exception);
  verify(spanStoreAdapter).getSpanStore();
  verify(spanStore).finishSpan((TagsProvidingAdapter) any());
  verify(originalCallback).failed(exception);
  verifyNoMoreInteractions(spanStore, spanStoreAdapter, originalCallback);
}
origin: inspectIT/inspectIT

@Test
public void successful() {
  Object response = new Object();
  when(spanStoreAdapter.getSpanStore()).thenReturn(spanStore);
  proxy.completed(response);
  verify(spanStoreAdapter).getSpanStore();
  verify(spanStore).finishSpan((HttpResponseAdapter) any());
  verify(originalCallback).completed(response);
  verifyNoMoreInteractions(spanStore, spanStoreAdapter, originalCallback);
}
rocks.inspectit.agent.java.tracing.core.adapter.http.proxyFutureCallbackProxy

Javadoc

Proxy-class to wrap instances of the org.apache.http.concurrent.FutureCallback class.

Most used methods

  • <init>
    Constructor.
  • cancelled
    Cancelled method for FutureCallback.
  • completed
    Completed method for FutureCallback.
  • failed
    Failed method of FutureCallback.
  • getProxyConstructorArguments

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • runOnUiThread (Activity)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JList (javax.swing)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now