Search in sources :

Example 1 with BraveRepositoryFilter

use of io.crnk.monitor.brave.internal.BraveRepositoryFilter in project crnk-framework by crnk-project.

the class BraveModule method setupModule.

@Override
public void setupModule(ModuleContext context) {
    // nothing to do
    if (server) {
        BraveRepositoryFilter filter = new BraveRepositoryFilter(brave, context);
        context.addRepositoryFilter(filter);
    }
}
Also used : BraveRepositoryFilter(io.crnk.monitor.brave.internal.BraveRepositoryFilter)

Example 2 with BraveRepositoryFilter

use of io.crnk.monitor.brave.internal.BraveRepositoryFilter in project crnk-framework by crnk-project.

the class BraveResponseFilterTest method setup.

@Before
public void setup() {
    boot = new CrnkBoot();
    boot.setServiceDiscovery(new ReflectionsServiceDiscovery("io.crnk.test.mock.repository", new SampleJsonServiceLocator()));
    boot.boot();
    span = Mockito.mock(Span.class);
    tracing = Mockito.mock(Tracing.class);
    tracer = Mockito.mock(Tracer.class);
    Mockito.when(tracing.tracer()).thenReturn(tracer);
    Mockito.when(tracer.nextSpan()).thenReturn(span);
    moduleContext = Mockito.mock(Module.ModuleContext.class);
    Mockito.when(moduleContext.getResourceRegistry()).thenReturn(boot.getResourceRegistry());
    QuerySpec querySpec = new QuerySpec(Task.class);
    queryAdapter = new QuerySpecAdapter(querySpec, boot.getResourceRegistry());
    ResourceInformation taskResourceInformation = boot.getResourceRegistry().getEntry(Task.class).getResourceInformation();
    requestSpec = Mockito.mock(RepositoryRequestSpec.class);
    Mockito.when(requestSpec.getMethod()).thenReturn(HttpMethod.GET);
    Mockito.when(requestSpec.getQueryAdapter()).thenReturn(queryAdapter);
    Mockito.when(requestSpec.getQuerySpec(taskResourceInformation)).thenReturn(querySpec);
    filter = new BraveRepositoryFilter(tracing, moduleContext);
    filterContext = Mockito.mock(RepositoryFilterContext.class);
    Mockito.when(filterContext.getRequest()).thenReturn(requestSpec);
    filterChain = Mockito.mock(RepositoryRequestFilterChain.class);
}
Also used : ResourceInformation(io.crnk.core.engine.information.resource.ResourceInformation) Task(io.crnk.test.mock.models.Task) RepositoryRequestSpec(io.crnk.core.engine.dispatcher.RepositoryRequestSpec) Tracer(brave.Tracer) SampleJsonServiceLocator(io.crnk.legacy.locator.SampleJsonServiceLocator) BraveRepositoryFilter(io.crnk.monitor.brave.internal.BraveRepositoryFilter) RepositoryFilterContext(io.crnk.core.engine.filter.RepositoryFilterContext) QuerySpecAdapter(io.crnk.core.queryspec.internal.QuerySpecAdapter) Span(brave.Span) CrnkBoot(io.crnk.core.boot.CrnkBoot) ReflectionsServiceDiscovery(io.crnk.core.module.discovery.ReflectionsServiceDiscovery) Tracing(brave.Tracing) QuerySpec(io.crnk.core.queryspec.QuerySpec) RepositoryRequestFilterChain(io.crnk.core.engine.filter.RepositoryRequestFilterChain) Before(org.junit.Before)

Example 3 with BraveRepositoryFilter

use of io.crnk.monitor.brave.internal.BraveRepositoryFilter in project crnk-framework by crnk-project.

the class BraveServerModule method setupModule.

@Override
public void setupModule(ModuleContext context) {
    BraveRepositoryFilter filter = new BraveRepositoryFilter(tracing, context);
    context.addRepositoryFilter(filter);
}
Also used : BraveRepositoryFilter(io.crnk.monitor.brave.internal.BraveRepositoryFilter)

Aggregations

BraveRepositoryFilter (io.crnk.monitor.brave.internal.BraveRepositoryFilter)3 Span (brave.Span)1 Tracer (brave.Tracer)1 Tracing (brave.Tracing)1 CrnkBoot (io.crnk.core.boot.CrnkBoot)1 RepositoryRequestSpec (io.crnk.core.engine.dispatcher.RepositoryRequestSpec)1 RepositoryFilterContext (io.crnk.core.engine.filter.RepositoryFilterContext)1 RepositoryRequestFilterChain (io.crnk.core.engine.filter.RepositoryRequestFilterChain)1 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)1 ReflectionsServiceDiscovery (io.crnk.core.module.discovery.ReflectionsServiceDiscovery)1 QuerySpec (io.crnk.core.queryspec.QuerySpec)1 QuerySpecAdapter (io.crnk.core.queryspec.internal.QuerySpecAdapter)1 SampleJsonServiceLocator (io.crnk.legacy.locator.SampleJsonServiceLocator)1 Task (io.crnk.test.mock.models.Task)1 Before (org.junit.Before)1