Skip to content

Commit e6a46d7

Browse files
committed
Add integration test
We want to make sure that the plugin starts correctly when a node starts. Closes #17.
1 parent 28f7deb commit e6a46d7

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Licensed to Elasticsearch (the "Author") under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. Author licenses this
6+
* file to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.index.analysis;
21+
22+
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
23+
import org.elasticsearch.test.ElasticsearchIntegrationTest;
24+
import org.junit.Test;
25+
26+
import java.util.concurrent.ExecutionException;
27+
28+
import static org.hamcrest.CoreMatchers.is;
29+
import static org.hamcrest.CoreMatchers.notNullValue;
30+
31+
@ElasticsearchIntegrationTest.ClusterScope(numNodes = 1, scope = ElasticsearchIntegrationTest.Scope.SUITE)
32+
public class SimplePolishIntegrationTests extends ElasticsearchIntegrationTest {
33+
34+
@Test
35+
public void testPolishAnalyzer() throws ExecutionException, InterruptedException {
36+
AnalyzeResponse response = client().admin().indices()
37+
.prepareAnalyze("wirtualna polska").setAnalyzer("polish")
38+
.execute().get();
39+
40+
assertThat(response, notNullValue());
41+
assertThat(response.getTokens().size(), is(2));
42+
}
43+
44+
@Test
45+
public void testPolishStemmerTokenFilter() throws ExecutionException, InterruptedException {
46+
AnalyzeResponse response = client().admin().indices()
47+
.prepareAnalyze("canona").setTokenFilters("polish_stem")
48+
.execute().get();
49+
50+
assertThat(response, notNullValue());
51+
assertThat(response.getTokens().size(), is(1));
52+
}
53+
}

0 commit comments

Comments
 (0)