Package io.netty.util

Examples of io.netty.util.AttributeMap


    @Test
    public void testOnServerRequest() throws Exception {
        RequestIdProvider provider = new HttpRequestIdProvider(REQUEST_ID_HEADER_NAME, CORRELATOR);
        MapBackedKeySupplier keySupplier = new MapBackedKeySupplier(new HashMap<String, String>());
        AttributeMap attributeMap = new DefaultAttributeMap();
        String requestId = provider.onServerRequest(keySupplier, attributeMap);
        Assert.assertNull("Request Id should be null.", requestId);

        String expectedId = "hellothere";
        keySupplier.put(REQUEST_ID_HEADER_NAME, expectedId);
View Full Code Here


    @Test
    public void testNewRequestId() throws Exception {
        RequestIdProvider provider = new HttpRequestIdProvider("request_id", CORRELATOR);
        ContextKeySupplier keySupplier = new MapBackedKeySupplier(new HashMap<String, String>());
        AttributeMap attributeMap = new DefaultAttributeMap();
        String requestId = provider.newRequestId(keySupplier, attributeMap);
        ConcurrentLinkedQueue<String> ids = attributeMap.attr(HttpRequestIdProvider.REQUEST_IDS_KEY).get();
        Assert.assertNotNull("Request Id not added to context.", ids);
        Assert.assertNotNull("Request Id not added to context.", ids.peek());
        Assert.assertSame("Unexpected request Id in the context.", requestId, ids.poll());
    }
View Full Code Here

    }

    @Test
    public void testBeforeServerResponse() throws Exception {
        RequestIdProvider provider = new HttpRequestIdProvider(REQUEST_ID_HEADER_NAME, CORRELATOR);
        AttributeMap attributeMap = new DefaultAttributeMap();
        MapBackedKeySupplier keySupplier = new MapBackedKeySupplier(new HashMap<String, String>());
        String expectedId1 = "hellothere1";
        String expectedId2 = "hellothere2";
        String expectedId3 = "hellothere3";
View Full Code Here

    }

    @Test
    public void testBeforeClientRequest() throws Exception {
        RequestIdProvider provider = new HttpRequestIdProvider(REQUEST_ID, CORRELATOR);
        AttributeMap attributeMap = new DefaultAttributeMap();
        ContextKeySupplier keySupplier = new MapBackedKeySupplier(new HashMap<String, String>());
        String expectedId = "daah";
        CORRELATOR.onNewServerRequest(expectedId, new ContextsContainerImpl(keySupplier));
        String requestId = provider.beforeClientRequest(attributeMap);
View Full Code Here

    }

    @Test
    public void testOnClientResponse() throws Exception {
        RequestIdProvider provider = new HttpRequestIdProvider("request_id", CORRELATOR);
        AttributeMap attributeMap = new DefaultAttributeMap();
        ContextKeySupplier keySupplier = new MapBackedKeySupplier(new HashMap<String, String>());
        String expectedId = "daah";
        CORRELATOR.onNewServerRequest(expectedId, new ContextsContainerImpl(keySupplier));
        String requestId = provider.beforeClientRequest(attributeMap);
        Assert.assertSame("Unexpected request Id", expectedId, requestId);
View Full Code Here

    }

    @Override
    public <V> Callable<V> makeClosure(final Callable<V> original) {

        final AttributeMap currentState = state.get().peek();

        return new Callable<V>() {
            @Override
            public V call() throws Exception {
                state.get().push(currentState);
View Full Code Here

        };
    }

    @Override
    public Runnable makeClosure(final Runnable original) {
        final AttributeMap currentState = state.get().peek();

        return new Runnable() {

            @Override
            public void run() {
View Full Code Here

TOP

Related Classes of io.netty.util.AttributeMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.