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:
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...
}
}
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...
}
}
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...
}
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.