Update to Elasticsearch 0.90.8 / Lucene 4.6.0

Move tests to JUnit

Closes #11.
Closes #14.
This commit is contained in:
Simon Willnauer 2013-11-12 13:14:34 +01:00 committed by David Pilato
parent 939db58526
commit 4c95a3ef70
4 changed files with 138 additions and 76 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
/.project
/.settings
/.classpath
/.local-execution-hints.log

View File

@ -5,57 +5,16 @@ The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis modu
In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-analysis-kuromoji/1.6.0`.
<table>
<thead>
<tr>
<td>Kuromoji Analysis Plugin</td>
<td>Elasticsearch</td>
<td>Release date</td>
</tr>
</thead>
<tbody>
<tr>
<td>1.7.0-SNAPSHOT (master)</td>
<td>0.90.6 -> master</td>
<td></td>
</tr>
<tr>
<td>1.6.0</td>
<td>0.90.6 -> master</td>
<td>2013-11-06</td>
</tr>
<tr>
<td>1.5.0</td>
<td>0.90.3 -> 0.90.5</td>
<td>2013-08-08</td>
</tr>
<tr>
<td>1.4.0</td>
<td>0.90.1 -> 0.90.2</td>
<td>2013-05-30</td>
</tr>
<tr>
<td>1.3.0</td>
<td>0.90.0</td>
<td>2013-04-29</td>
</tr>
<tr>
<td>1.2.0</td>
<td>0.90.0</td>
<td>2013-02-26</td>
</tr>
<tr>
<td>1.1.0</td>
<td>0.19.2 -> 0.20</td>
<td>2012-11-21</td>
</tr>
<tr>
<td>1.0.0</td>
<td>0.19.0 -> 0.19.1</td>
<td>2012-04-30</td>
</tr>
</tbody>
</table>
| Kuromoji Analysis Plugin | elasticsearch | Release date |
|--------------------------|------------------|:------------:|
| 1.7.0-SNAPSHOT (master) | 0.90.8 -> master | 2013-12-19 |
| 1.6.0 | 0.90.6 -> 0.90.7 | 2013-11-06 |
| 1.5.0 | 0.90.3 -> 0.90.5 | 2013-08-08 |
| 1.4.0 | 0.90.1 -> 0.90.2 | 2013-05-30 |
| 1.3.0 | 0.90.0 | 2013-04-29 |
| 1.2.0 | 0.90.0 | 2013-02-26 |
| 1.1.0 | 0.19.2 -> 0.20 | 2012-11-21 |
| 1.0.0 | 0.19.0 -> 0.19.1 | 2012-04-30 |
The plugin includes the `kuromoji` analyzer.

132
pom.xml
View File

@ -31,8 +31,13 @@
</parent>
<properties>
<elasticsearch.version>0.90.6</elasticsearch.version>
<lucene.version>4.5.1</lucene.version>
<elasticsearch.version>0.90.8</elasticsearch.version>
<lucene.version>4.6.0</lucene.version>
<tests.jvms>1</tests.jvms>
<tests.shuffle>true</tests.shuffle>
<tests.output>onerror</tests.output>
<tests.client.ratio></tests.client.ratio>
<es.logger.level>INFO</es.logger.level>
</properties>
<repositories>
@ -43,6 +48,18 @@
</repositories>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-test-framework</artifactId>
<version>${lucene.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
@ -65,9 +82,10 @@
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
@ -77,13 +95,6 @@
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -133,12 +144,103 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.carrotsearch.randomizedtesting</groupId>
<artifactId>junit4-maven-plugin</artifactId>
<version>2.0.12</version>
<executions>
<execution>
<id>tests</id>
<phase>test</phase>
<goals>
<goal>junit4</goal>
</goals>
<configuration>
<heartbeat>20</heartbeat>
<jvmOutputAction>pipe,warn</jvmOutputAction>
<leaveTemporary>true</leaveTemporary>
<listeners>
<report-ant-xml mavenExtensions="true"
dir="${project.build.directory}/surefire-reports"/>
<report-text
showThrowable="true"
showStackTraces="true"
showOutput="${tests.output}"
showStatusOk="false"
showStatusError="true"
showStatusFailure="true"
showStatusIgnored="true"
showSuiteSummary="true"
timestamps="false"/>
<report-execution-times file="${basedir}/.local-execution-hints.log"/>
</listeners>
<assertions>
<enable/>
</assertions>
<parallelism>${tests.jvms}</parallelism>
<balancers>
<execution-times>
<fileset dir="${basedir}" includes=".local-execution-hints.log"/>
</execution-times>
</balancers>
<includes>
<include>**/*Tests.java</include>
<include>**/*Tests.class</include>
<include>**/*Test.class</include>
</includes>
<excludes>
<exclude>**/Abstract*.class</exclude>
<exclude>**/*StressTest.class</exclude>
</excludes>
<jvmArgs>
<param>-Xmx512m</param>
<param>-XX:MaxDirectMemorySize=512m</param>
<param>-Des.logger.prefix=</param>
</jvmArgs>
<shuffleOnSlave>${tests.shuffle}</shuffleOnSlave>
<sysouts>${tests.verbose}</sysouts>
<seed>${tests.seed}</seed>
<haltOnFailure>${tests.failfast}</haltOnFailure>
<systemProperties>
<!-- RandomizedTesting library system properties -->
<tests.iters>${tests.iters}</tests.iters>
<tests.maxfailures>${tests.maxfailures}</tests.maxfailures>
<tests.failfast>${tests.failfast}</tests.failfast>
<tests.class>${tests.class}</tests.class>
<tests.method>${tests.method}</tests.method>
<tests.nightly>${tests.nightly}</tests.nightly>
<tests.badapples>${tests.badapples}</tests.badapples>
<tests.weekly>${tests.weekly}</tests.weekly>
<tests.slow>${tests.slow}</tests.slow>
<tests.awaitsfix>${tests.awaitsfix}</tests.awaitsfix>
<tests.slow>${tests.slow}</tests.slow>
<tests.timeoutSuite>${tests.timeoutSuite}</tests.timeoutSuite>
<tests.showSuccess>${tests.showSuccess}</tests.showSuccess>
<tests.integration>${tests.integration}</tests.integration>
<tests.cluster_seed>${tests.cluster_seed}</tests.cluster_seed>
<tests.client.ratio>${tests.client.ratio}</tests.client.ratio>
<es.node.local>${env.ES_TEST_LOCAL}</es.node.local>
<es.node.mode>${es.node.mode}</es.node.mode>
<es.logger.level>${es.logger.level}</es.logger.level>
<java.awt.headless>true</java.awt.headless>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- we skip surefire to work with randomized testing above -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>

View File

@ -37,18 +37,18 @@ import org.elasticsearch.index.settings.IndexSettingsModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
import org.elasticsearch.indices.analysis.IndicesAnalysisService;
import org.elasticsearch.plugin.analysis.kuromoji.AnalysisKuromojiPlugin;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.elasticsearch.test.ElasticsearchTestCase;
import org.junit.Test;
import java.io.IOException;
import java.io.StringReader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.*;
/**
*/
public class KuromojiAnalysisTests {
public class KuromojiAnalysisTests extends ElasticsearchTestCase {
@Test
public void testDefaultsKuromojiAnalysis() throws IOException {
@ -157,12 +157,12 @@ public class KuromojiAnalysisTests {
String[] expected) throws IOException {
stream.reset();
CharTermAttribute termAttr = stream.getAttribute(CharTermAttribute.class);
Assert.assertNotNull(termAttr);
assertThat(termAttr, notNullValue());
int i = 0;
while (stream.incrementToken()) {
Assert.assertTrue(i < expected.length);
Assert.assertEquals(expected[i++], termAttr.toString(), "expected different term at index " + i);
assertThat(expected.length, greaterThan(i));
assertThat( "expected different term at index " + i, expected[i++], equalTo(termAttr.toString()));
}
Assert.assertEquals(i, expected.length, "not all tokens produced");
assertThat("not all tokens produced", i, equalTo(expected.length));
}
}