Skip to content

Commit 4c95a3e

Browse files
s1monwdadoonet
authored andcommitted
Update to Elasticsearch 0.90.8 / Lucene 4.6.0
Move tests to JUnit Closes #11. Closes #14.
1 parent 939db58 commit 4c95a3e

File tree

4 files changed

+137
-75
lines changed

4 files changed

+137
-75
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
/.project
99
/.settings
1010
/.classpath
11+
/.local-execution-hints.log

README.md

+10-51
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,16 @@ The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis modu
55

66
In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-analysis-kuromoji/1.6.0`.
77

8-
<table>
9-
<thead>
10-
<tr>
11-
<td>Kuromoji Analysis Plugin</td>
12-
<td>Elasticsearch</td>
13-
<td>Release date</td>
14-
</tr>
15-
</thead>
16-
<tbody>
17-
<tr>
18-
<td>1.7.0-SNAPSHOT (master)</td>
19-
<td>0.90.6 -> master</td>
20-
<td></td>
21-
</tr>
22-
<tr>
23-
<td>1.6.0</td>
24-
<td>0.90.6 -> master</td>
25-
<td>2013-11-06</td>
26-
</tr>
27-
<tr>
28-
<td>1.5.0</td>
29-
<td>0.90.3 -> 0.90.5</td>
30-
<td>2013-08-08</td>
31-
</tr>
32-
<tr>
33-
<td>1.4.0</td>
34-
<td>0.90.1 -> 0.90.2</td>
35-
<td>2013-05-30</td>
36-
</tr>
37-
<tr>
38-
<td>1.3.0</td>
39-
<td>0.90.0</td>
40-
<td>2013-04-29</td>
41-
</tr>
42-
<tr>
43-
<td>1.2.0</td>
44-
<td>0.90.0</td>
45-
<td>2013-02-26</td>
46-
</tr>
47-
<tr>
48-
<td>1.1.0</td>
49-
<td>0.19.2 -> 0.20</td>
50-
<td>2012-11-21</td>
51-
</tr>
52-
<tr>
53-
<td>1.0.0</td>
54-
<td>0.19.0 -> 0.19.1</td>
55-
<td>2012-04-30</td>
56-
</tr>
57-
</tbody>
58-
</table>
8+
| Kuromoji Analysis Plugin | elasticsearch | Release date |
9+
|--------------------------|------------------|:------------:|
10+
| 1.7.0-SNAPSHOT (master) | 0.90.8 -> master | 2013-12-19 |
11+
| 1.6.0 | 0.90.6 -> 0.90.7 | 2013-11-06 |
12+
| 1.5.0 | 0.90.3 -> 0.90.5 | 2013-08-08 |
13+
| 1.4.0 | 0.90.1 -> 0.90.2 | 2013-05-30 |
14+
| 1.3.0 | 0.90.0 | 2013-04-29 |
15+
| 1.2.0 | 0.90.0 | 2013-02-26 |
16+
| 1.1.0 | 0.19.2 -> 0.20 | 2012-11-21 |
17+
| 1.0.0 | 0.19.0 -> 0.19.1 | 2012-04-30 |
5918

6019
The plugin includes the `kuromoji` analyzer.
6120

pom.xml

+118-16
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@
3131
</parent>
3232

3333
<properties>
34-
<elasticsearch.version>0.90.6</elasticsearch.version>
35-
<lucene.version>4.5.1</lucene.version>
34+
<elasticsearch.version>0.90.8</elasticsearch.version>
35+
<lucene.version>4.6.0</lucene.version>
36+
<tests.jvms>1</tests.jvms>
37+
<tests.shuffle>true</tests.shuffle>
38+
<tests.output>onerror</tests.output>
39+
<tests.client.ratio></tests.client.ratio>
40+
<es.logger.level>INFO</es.logger.level>
3641
</properties>
3742

3843
<repositories>
@@ -43,6 +48,18 @@
4348
</repositories>
4449

4550
<dependencies>
51+
<dependency>
52+
<groupId>org.hamcrest</groupId>
53+
<artifactId>hamcrest-all</artifactId>
54+
<version>1.3</version>
55+
<scope>test</scope>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.apache.lucene</groupId>
59+
<artifactId>lucene-test-framework</artifactId>
60+
<version>${lucene.version}</version>
61+
<scope>test</scope>
62+
</dependency>
4663
<dependency>
4764
<groupId>org.elasticsearch</groupId>
4865
<artifactId>elasticsearch</artifactId>
@@ -65,9 +82,10 @@
6582
</dependency>
6683

6784
<dependency>
68-
<groupId>org.testng</groupId>
69-
<artifactId>testng</artifactId>
70-
<version>6.8</version>
85+
<groupId>org.elasticsearch</groupId>
86+
<artifactId>elasticsearch</artifactId>
87+
<version>${elasticsearch.version}</version>
88+
<type>test-jar</type>
7189
<scope>test</scope>
7290
</dependency>
7391

@@ -77,13 +95,6 @@
7795
<version>1.3</version>
7896
<scope>test</scope>
7997
</dependency>
80-
81-
<dependency>
82-
<groupId>org.hamcrest</groupId>
83-
<artifactId>hamcrest-library</artifactId>
84-
<version>1.3</version>
85-
<scope>test</scope>
86-
</dependency>
8798
</dependencies>
8899

89100
<build>
@@ -132,13 +143,104 @@
132143
</configuration>
133144
</plugin>
134145
<plugin>
146+
<groupId>org.apache.maven.plugins</groupId>
147+
<artifactId>maven-compiler-plugin</artifactId>
148+
<version>2.3.2</version>
149+
<configuration>
150+
<source>1.6</source>
151+
<target>1.6</target>
152+
</configuration>
153+
</plugin>
154+
<plugin>
155+
<groupId>com.carrotsearch.randomizedtesting</groupId>
156+
<artifactId>junit4-maven-plugin</artifactId>
157+
<version>2.0.12</version>
158+
<executions>
159+
<execution>
160+
<id>tests</id>
161+
<phase>test</phase>
162+
<goals>
163+
<goal>junit4</goal>
164+
</goals>
165+
<configuration>
166+
<heartbeat>20</heartbeat>
167+
<jvmOutputAction>pipe,warn</jvmOutputAction>
168+
<leaveTemporary>true</leaveTemporary>
169+
<listeners>
170+
<report-ant-xml mavenExtensions="true"
171+
dir="${project.build.directory}/surefire-reports"/>
172+
<report-text
173+
showThrowable="true"
174+
showStackTraces="true"
175+
showOutput="${tests.output}"
176+
showStatusOk="false"
177+
showStatusError="true"
178+
showStatusFailure="true"
179+
showStatusIgnored="true"
180+
showSuiteSummary="true"
181+
timestamps="false"/>
182+
<report-execution-times file="${basedir}/.local-execution-hints.log"/>
183+
</listeners>
184+
<assertions>
185+
<enable/>
186+
</assertions>
187+
<parallelism>${tests.jvms}</parallelism>
188+
<balancers>
189+
<execution-times>
190+
<fileset dir="${basedir}" includes=".local-execution-hints.log"/>
191+
</execution-times>
192+
</balancers>
193+
<includes>
194+
<include>**/*Tests.class</include>
195+
<include>**/*Test.class</include>
196+
</includes>
197+
<excludes>
198+
<exclude>**/Abstract*.class</exclude>
199+
<exclude>**/*StressTest.class</exclude>
200+
</excludes>
201+
<jvmArgs>
202+
<param>-Xmx512m</param>
203+
<param>-XX:MaxDirectMemorySize=512m</param>
204+
<param>-Des.logger.prefix=</param>
205+
</jvmArgs>
206+
<shuffleOnSlave>${tests.shuffle}</shuffleOnSlave>
207+
<sysouts>${tests.verbose}</sysouts>
208+
<seed>${tests.seed}</seed>
209+
<haltOnFailure>${tests.failfast}</haltOnFailure>
210+
<systemProperties>
211+
<!-- RandomizedTesting library system properties -->
212+
<tests.iters>${tests.iters}</tests.iters>
213+
<tests.maxfailures>${tests.maxfailures}</tests.maxfailures>
214+
<tests.failfast>${tests.failfast}</tests.failfast>
215+
<tests.class>${tests.class}</tests.class>
216+
<tests.method>${tests.method}</tests.method>
217+
<tests.nightly>${tests.nightly}</tests.nightly>
218+
<tests.badapples>${tests.badapples}</tests.badapples>
219+
<tests.weekly>${tests.weekly}</tests.weekly>
220+
<tests.slow>${tests.slow}</tests.slow>
221+
<tests.awaitsfix>${tests.awaitsfix}</tests.awaitsfix>
222+
<tests.slow>${tests.slow}</tests.slow>
223+
<tests.timeoutSuite>${tests.timeoutSuite}</tests.timeoutSuite>
224+
<tests.showSuccess>${tests.showSuccess}</tests.showSuccess>
225+
<tests.integration>${tests.integration}</tests.integration>
226+
<tests.cluster_seed>${tests.cluster_seed}</tests.cluster_seed>
227+
<tests.client.ratio>${tests.client.ratio}</tests.client.ratio>
228+
<es.node.local>${env.ES_TEST_LOCAL}</es.node.local>
229+
<es.node.mode>${es.node.mode}</es.node.mode>
230+
<es.logger.level>${es.logger.level}</es.logger.level>
231+
<java.awt.headless>true</java.awt.headless>
232+
</systemProperties>
233+
</configuration>
234+
</execution>
235+
</executions>
236+
</plugin>
237+
<plugin>
238+
<!-- we skip surefire to work with randomized testing above -->
135239
<groupId>org.apache.maven.plugins</groupId>
136240
<artifactId>maven-surefire-plugin</artifactId>
137-
<version>2.11</version>
241+
<version>2.15</version>
138242
<configuration>
139-
<includes>
140-
<include>**/*Tests.java</include>
141-
</includes>
243+
<skipTests>true</skipTests>
142244
</configuration>
143245
</plugin>
144246
<plugin>

src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@
3737
import org.elasticsearch.indices.analysis.IndicesAnalysisModule;
3838
import org.elasticsearch.indices.analysis.IndicesAnalysisService;
3939
import org.elasticsearch.plugin.analysis.kuromoji.AnalysisKuromojiPlugin;
40-
import org.testng.Assert;
41-
import org.testng.annotations.Test;
40+
import org.elasticsearch.test.ElasticsearchTestCase;
41+
import org.junit.Test;
4242

4343
import java.io.IOException;
4444
import java.io.StringReader;
4545

4646
import static org.hamcrest.MatcherAssert.assertThat;
47-
import static org.hamcrest.Matchers.instanceOf;
47+
import static org.hamcrest.Matchers.*;
4848

4949
/**
5050
*/
51-
public class KuromojiAnalysisTests {
51+
public class KuromojiAnalysisTests extends ElasticsearchTestCase {
5252

5353
@Test
5454
public void testDefaultsKuromojiAnalysis() throws IOException {
@@ -157,12 +157,12 @@ public static void assertSimpleTSOutput(TokenStream stream,
157157
String[] expected) throws IOException {
158158
stream.reset();
159159
CharTermAttribute termAttr = stream.getAttribute(CharTermAttribute.class);
160-
Assert.assertNotNull(termAttr);
160+
assertThat(termAttr, notNullValue());
161161
int i = 0;
162162
while (stream.incrementToken()) {
163-
Assert.assertTrue(i < expected.length);
164-
Assert.assertEquals(expected[i++], termAttr.toString(), "expected different term at index " + i);
163+
assertThat(expected.length, greaterThan(i));
164+
assertThat( "expected different term at index " + i, expected[i++], equalTo(termAttr.toString()));
165165
}
166-
Assert.assertEquals(i, expected.length, "not all tokens produced");
166+
assertThat("not all tokens produced", i, equalTo(expected.length));
167167
}
168168
}

0 commit comments

Comments
 (0)