Package crate.elasticsearch.client.transport

Source Code of crate.elasticsearch.client.transport.TransportClientTest

package crate.elasticsearch.client.transport;

import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;

/**
* Test to make sure TransportClient works correctly with InOut plugin
*/
public class TransportClientTest {


    /**
     * Instantiate a TransportClient to make sure dependency injection works correctly
     */
    @Test
    public void testTransportClient() {

        /**
         * InOut plugin modules must not be loaded for TransportClient instances
         */
        TransportClient client = new TransportClient();
        assertNotNull(client);

        /**
         * Internally, this get determined by the settings flag node.client which is set to true in case of
         * a TransportClient object. Thought the setting was given to the TransportClient with node.client = false
         * the constructor of TransportClient overwrites it to node.client = true
         */
        Settings settings = ImmutableSettings.settingsBuilder()
                .put("node.client", false)
                .build();

        client = null;
        client = new TransportClient(settings);
        assertNotNull(client);

    }
}
TOP

Related Classes of crate.elasticsearch.client.transport.TransportClientTest

TOP
Copyright © 2018 www.massapi.com. 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.