Skip to content

Commit 53c9fe8

Browse files
authored
Merge pull request #14 from rosette-api/suppo-1041-update-per-es6.3-spec-change
SUPPO-1041: fix the pluging to work with ES 6.3.0+
2 parents 7eda70d + 499de82 commit 53c9fe8

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

docker/test.sh

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/usr/bin/env bash
22

3-
# uses '|| true' to make sure that even if there is an error,
3+
code=0
4+
set -x
5+
6+
# uses '|| code=$?' to make sure that even if there is an error,
47
# the maven build continues and stops the docker image
5-
curl -XPUT "localhost:$1/_ingest/pipeline/rosapi?pretty" -d'
8+
# the exit codes will be appended to the output file for later verification
9+
10+
curl -fsSL -H "Content-Type: application/json" -XPUT "localhost:$1/_ingest/pipeline/rosapi?pretty" -d'
611
{
712
"processors": [
813
{
@@ -52,10 +57,10 @@ curl -XPUT "localhost:$1/_ingest/pipeline/rosapi?pretty" -d'
5257
}
5358
]
5459
}
55-
' || true
60+
' || ((code++))
5661

5762
#Pipeline without categories since it only supports English
58-
curl -XPUT "localhost:$1/_ingest/pipeline/rosapi_jpn?pretty" -d'
63+
curl -fsSL -H "Content-Type: application/json" -XPUT "localhost:$1/_ingest/pipeline/rosapi_jpn?pretty" -d'
5964
{
6065
"processors": [
6166
{
@@ -99,9 +104,9 @@ curl -XPUT "localhost:$1/_ingest/pipeline/rosapi_jpn?pretty" -d'
99104
}
100105
]
101106
}
102-
' || true
107+
' || ((code++))
103108

104-
curl -XPUT "localhost:$1/test_idx?pretty" -d'
109+
curl -fsSL -H "Content-Type: application/json" -XPUT "localhost:$1/test_idx?pretty" -d'
105110
{
106111
"mappings": {
107112
"rosette": {
@@ -117,30 +122,30 @@ curl -XPUT "localhost:$1/test_idx?pretty" -d'
117122
}
118123
}
119124
}
120-
' || true
125+
' || ((code++))
121126

122-
curl -XPUT "localhost:$1/test_idx/rosette/1?pretty&refresh=true&pipeline=rosapi" -d'
127+
curl -fsSL -H "Content-Type: application/json" -XPUT "localhost:$1/test_idx/rosette/1?pretty&refresh=true&pipeline=rosapi" -d'
123128
{
124129
"text": "Original Ghostbuster Dan Aykroyd, who also co-wrote the 1984 Ghostbusters film, couldn’t be more pleased with the new all-female Ghostbusters cast, telling The Hollywood Reporter, “The Aykroyd family is delighted by this inheritance of the Ghostbusters torch by these most magnificent women in comedy.”"
125130
}
126-
' || true
131+
' || ((code++))
127132

128-
curl -XPUT "localhost:$1/test_idx/rosette/2?pretty&refresh=true&pipeline=rosapi_jpn" -d'
133+
curl -fsSL -H "Content-Type: application/json" -XPUT "localhost:$1/test_idx/rosette/2?pretty&refresh=true&pipeline=rosapi_jpn" -d'
129134
{
130135
"text": "バングラデシュ政府、ロヒンギャ難民の島への移動を計画
\nバングラデシュ政府、ロヒンギャ難民の島への移動を計画\n\nテンガール・チャール島は約10年前に、メグナ川の堆積土で形成され、高潮の際には数十センチの水に囲まれてしまう。道路や堤防などは築かれておらず、島を記載する地図はあまりない。\n\n約30キロ西には60万人が住むハティア島があり、現在の難民キャンプからの移動には9時間かかる。\n\nある地元政府関係者はAFP通信に対し、テンガール・チャール島について、「島に行けるのは冬のみで、海賊たちの隠れ家になっている」と語った。島を洪水から守るため植樹が行われているが、完了するまでには少なくとも10年がかかるという。同関係者は、「モンスーンの季節には完全に水浸しになってしまう」と話し、「あそこに住まわせるというのは、ひどいアイデアだ」と指摘した。\n\nImage caption 移住が計画されているテンガール・チャール島はハティア(Hatiya)島の近くにある\n\nミャンマーでは、ロヒンギャの人々は国境を接するバングラデシュからの不法移民として扱われており、国籍の取得ができずにいる。\n\n"
131136
}
132-
' || true
137+
' || ((code++))
133138

134-
curl -XPUT "localhost:$1/test_idx/rosette/3?pretty&refresh=true&pipeline=rosapi" -d'
139+
curl -fsSL -H "Content-Type: application/json" -XPUT "localhost:$1/test_idx/rosette/3?pretty&refresh=true&pipeline=rosapi" -d'
135140
{
136141
"text" : "Vladimir Vladimirovich Nabokov was a Russian-American novelist and entomologist. His first nine novels were in Russian, and he achieved international prominence after he began writing English prose.",
137142
"name" : "Vladimir Nabokov"
138143
}
139-
' || true
144+
' || ((code++))
140145

141146
sleep 3
142147

143-
curl -XPOST "localhost:$1/test_idx/_search?pretty" -d'
148+
curl -fsSL -H "Content-Type: application/json" -XPOST "localhost:$1/test_idx/_search?pretty" -d'
144149
{
145150
"query": {
146151
"constant_score" : {
@@ -150,4 +155,7 @@ curl -XPOST "localhost:$1/test_idx/_search?pretty" -d'
150155
}
151156
}
152157
}
153-
' || true
158+
' || ((code++))
159+
160+
set +x
161+
echo "exit: $code"

docker/verify.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env bash
22

3-
if grep -E -i 'exception|"failed":[1-9]' $1; then
4-
echo "Test query failed! See $1 for details. Exiting...";
5-
exit 1;
3+
if [[ "$(tail -1 "$1" 2>/dev/null)" != "exit: 0" ]] ; then
4+
echo "There are test failures. Exiting..."
5+
exit 1
6+
fi
7+
8+
if grep -E -i 'exception|"failed":[1-9]' "$1" ; then
9+
echo "Test query failed! See $1 for details. Exiting..."
10+
exit 1
611
fi

plugin/src/main/assemblies/plugin.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@
88
<files>
99
<file>
1010
<source>${project.basedir}/src/main/resources/plugin-descriptor.properties</source>
11-
<outputDirectory>elasticsearch</outputDirectory>
1211
<filtered>true</filtered>
1312
</file>
1413
<file>
1514
<source>${project.basedir}/src/main/resources/plugin-security.policy</source>
16-
<outputDirectory>elasticsearch</outputDirectory>
1715
<filtered>false</filtered>
1816
</file>
1917
</files>
2018
<dependencySets>
2119
<dependencySet>
22-
<outputDirectory>elasticsearch</outputDirectory>
2320
<useProjectArtifact>true</useProjectArtifact>
2421
<useTransitiveFiltering>false</useTransitiveFiltering>
2522
<excludes>

0 commit comments

Comments
 (0)