[ANN] Java annotations for JUnit testing with elasticsearch

Hi all,

I've put on GitHub a small project that can be helpful for those who need
to do JUNIT tests with elasticsearch. It helps to instantiate nodes and
clients and take care of index and mappings creation in a less programmatic
manner than usual.

This is how it looks like:

@RunWith(ElasticsearchRunner.class)
public class MyTest {
@ElasticsearchClient
Client client;
@Test
@ElasticsearchIndex(indexName = "library",
mappings = {
@ElasticsearchMapping(typeName = "book",
properties = {
@ElasticsearchMappingField(name = "title", store = Store.Yes, type =
Types.String),
@ElasticsearchMappingField(name = "author", store = Store.Yes, type =
Types.String)
})
})
public void myFirstTestMethod(){
... test stuff...
}
}

More documentation and source code can be found on GitHub project page:

In the hope that it may be useful,

Regards,

-- Tanguy
@tlrx

Great stuff, can you add it to the clients and integrations page?

On Sat, Jun 2, 2012 at 11:25 PM, Tanguy tlrx.dev@gmail.com wrote:

Hi all,

I've put on GitHub a small project that can be helpful for those who need
to do JUNIT tests with elasticsearch. It helps to instantiate nodes and
clients and take care of index and mappings creation in a less programmatic
manner than usual.

This is how it looks like:

@RunWith(ElasticsearchRunner.class)
public class MyTest {
@ElasticsearchClient
Client client;
@Test
@ElasticsearchIndex(indexName = "library",
mappings = {
@ElasticsearchMapping(typeName = "book",
properties = {
@ElasticsearchMappingField(name = "title", store = Store.Yes, type =
Types.String),
@ElasticsearchMappingField(name = "author", store = Store.Yes, type =
Types.String)
})
})
public void myFirstTestMethod(){
... test stuff...
}
}

More documentation and source code can be found on GitHub project page:
https://github.com/tlrx/elasticsearch-test

In the hope that it may be useful,

Regards,

-- Tanguy
@tlrx

Thanks Shay,

It's done:
https://github.com/elasticsearch/elasticsearch.github.com/pull/194

-- Tanguy
@tlrx

Le dimanche 3 juin 2012 11:46:01 UTC+2, kimchy a écrit :

Great stuff, can you add it to the clients and integrations page?

On Sat, Jun 2, 2012 at 11:25 PM, Tanguy tlrx.dev@gmail.com wrote:

Hi all,

I've put on GitHub a small project that can be helpful for those who need
to do JUNIT tests with elasticsearch. It helps to instantiate nodes and
clients and take care of index and mappings creation in a less programmatic
manner than usual.

This is how it looks like:

@RunWith(ElasticsearchRunner.class)
public class MyTest {
@ElasticsearchClient
Client client;
@Test
@ElasticsearchIndex(indexName = "library",
mappings = {
@ElasticsearchMapping(typeName = "book",
properties = {
@ElasticsearchMappingField(name = "title", store = Store.Yes, type =
Types.String),
@ElasticsearchMappingField(name = "author", store = Store.Yes, type =
Types.String)
})
})
public void myFirstTestMethod(){
... test stuff...
}
}

More documentation and source code can be found on GitHub project page:
https://github.com/tlrx/elasticsearch-test

In the hope that it may be useful,

Regards,

-- Tanguy
@tlrx

Hi,

Just updated to 0.0.3, now with settings, analyzers and bulk requests:
https://github.com/tlrx/elasticsearch-test/blob/master/src/test/java/fr/tlrx/elasticsearch/test/annotations/ElasticsearchBulkRequestAnnotationTest.java

Issues, PR and feedback are welcome :o)

-- Tanguy
@tlrx

Le samedi 2 juin 2012 23:25:28 UTC+2, Tanguy a écrit :

Hi all,

I've put on GitHub a small project that can be helpful for those who need
to do JUNIT tests with elasticsearch. It helps to instantiate nodes and
clients and take care of index and mappings creation in a less programmatic
manner than usual.

This is how it looks like:

@RunWith(ElasticsearchRunner.class)
public class MyTest {
@ElasticsearchClient
Client client;
@Test
@ElasticsearchIndex(indexName = "library",
mappings = {
@ElasticsearchMapping(typeName = "book",
properties = {
@ElasticsearchMappingField(name = "title", store = Store.Yes, type =
Types.String),
@ElasticsearchMappingField(name = "author", store = Store.Yes, type =
Types.String)
})
})
public void myFirstTestMethod(){
... test stuff...
}
}

More documentation and source code can be found on GitHub project page:
https://github.com/tlrx/elasticsearch-test

In the hope that it may be useful,

Regards,

-- Tanguy
@tlrx

Hi,

Just to let you know - version 0.0.5 of this test library for JUnit &
Elasticsearch has been released on OSS maven repositories.


https://oss.sonatype.org/content/repositories/releases/com/github/tlrx/

I (and other folks) use it on production and it works well. I hope it will
be helpful for other people as well :o)

-- Tanguy
Twitter: @tlrx

--

HI Tanguy,

Is this library still maintained for the newer versions of ES, for example
1.4.0?

Thanks,
Ramin

On Wednesday, November 7, 2012 4:39:16 AM UTC-5, Tanguy wrote:

Hi,

Just to let you know - version 0.0.5 of this test library for JUnit &
Elasticsearch has been released on OSS maven repositories.
https://github.com/tlrx/elasticsearch-test
https://oss.sonatype.org/content/repositories/releases/com/github/tlrx/

I (and other folks) use it on production and it works well. I hope it will
be helpful for other people as well :o)

-- Tanguy
Twitter: @tlrx
https://github.com/tlrx/

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5098ba86-5c72-4bc2-98b1-3d77b1168d6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.