How to use plugins when doing unit tests?


(John Chang) #1

I start nodes locally in unit tests, such as:

    hostNode = NodeBuilder.nodeBuilder().loadConfigSettings(false).clusterName("test.cluster").local(true).settings(
            ImmutableSettings.settingsBuilder()
            .put("index.number_of_shards", 1)
            .put("index.number_of_replicas", 1).build()
    ).node().start();
    elasticSearchClient = hostNode.client();

I want to use the attachment plugin. I can get it all to work when I start the stand-alone cluster and run the code in the java client.

Can I get the attachment plugin to work with the unit tests that start the node in memory as detailed above? If so, how?

Thanks


(Shay Banon) #2

You just need to have the plugin jar file and its deps in the classpath. The
plugins are also in maven repo, for the attachment plugin, you will also
need Tika.

-shay.banon

On Thu, Aug 19, 2010 at 1:14 AM, John Chang jchangkihtest2@gmail.comwrote:

I start nodes locally in unit tests, such as:

   hostNode =

NodeBuilder.nodeBuilder().loadConfigSettings(false).clusterName("test.cluster").local(true).settings(
ImmutableSettings.settingsBuilder()
.put("index.number_of_shards", 1)
.put("index.number_of_replicas", 1).build()
).node().start();
elasticSearchClient = hostNode.client();

I want to use the attachment plugin. I can get it all to work when I start
the stand-alone cluster and run the code in the java client.

Can I get the attachment plugin to work with the unit tests that start the
node in memory as detailed above? If so, how?

Thanks

View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/How-to-use-plugins-when-doing-unit-tests-tp1215857p1215857.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #3