1
1
package controllers
2
2
3
3
import elastic .{ElasticResponse , Success }
4
- import models .ElasticServer
4
+ import models .{ ElasticServer , Host }
5
5
import play .api .libs .json .Json
6
6
import play .api .test .FakeRequest
7
7
import play .api .test .Helpers ._
@@ -30,7 +30,7 @@ object AnalysisControllerSpec extends MockedServices {
30
30
|]
31
31
""" .stripMargin
32
32
)
33
- client.getIndices(ElasticServer (" somehost" )) returns Future .successful(Success (200 , expectedResponse))
33
+ client.getIndices(ElasticServer (Host ( " somehost" ) )) returns Future .successful(Success (200 , expectedResponse))
34
34
val response = route(application, FakeRequest (POST , " /analysis/indices" ).withBody(Json .obj(" host" -> " somehost" ))).get
35
35
ensure(response, 200 , Json .arr(" index1" , " index2" ))
36
36
}
@@ -58,7 +58,7 @@ object AnalysisControllerSpec extends MockedServices {
58
58
|}
59
59
""" .stripMargin
60
60
)
61
- client.getIndexSettings(" foo" , ElasticServer (" somehost" )) returns Future .successful(Success (200 , expectedResponse))
61
+ client.getIndexSettings(" foo" , ElasticServer (Host ( " somehost" ) )) returns Future .successful(Success (200 , expectedResponse))
62
62
val response = route(application, FakeRequest (POST , " /analysis/analyzers" ).withBody(Json .obj(" host" -> " somehost" , " index" -> " foo" ))).get
63
63
ensure(response, 200 , Json .arr(" foo_analyzer" ))
64
64
}
@@ -83,7 +83,7 @@ object AnalysisControllerSpec extends MockedServices {
83
83
|}
84
84
""" .stripMargin
85
85
)
86
- client.getIndexMapping(" foo" , ElasticServer (" somehost" )) returns Future .successful(Success (200 , expectedResponse))
86
+ client.getIndexMapping(" foo" , ElasticServer (Host ( " somehost" ) )) returns Future .successful(Success (200 , expectedResponse))
87
87
val response = route(application, FakeRequest (POST , " /analysis/fields" ).withBody(Json .obj(" host" -> " somehost" , " index" -> " foo" ))).get
88
88
ensure(response, 200 , Json .arr(" name" ))
89
89
}
@@ -104,7 +104,7 @@ object AnalysisControllerSpec extends MockedServices {
104
104
|}
105
105
""" .stripMargin
106
106
)
107
- client.analyzeTextByAnalyzer(" foo" , " bar" , " qux" , ElasticServer (" somehost" )) returns Future .successful(Success (200 , expectedResponse))
107
+ client.analyzeTextByAnalyzer(" foo" , " bar" , " qux" , ElasticServer (Host ( " somehost" ) )) returns Future .successful(Success (200 , expectedResponse))
108
108
val params = Json .obj(" host" -> " somehost" , " index" -> " foo" , " analyzer" -> " bar" , " text" -> " qux" )
109
109
val response = route(application, FakeRequest (POST , " /analysis/analyze/analyzer" ).withBody(params)).get
110
110
val expected = Json .parse(
@@ -138,7 +138,7 @@ object AnalysisControllerSpec extends MockedServices {
138
138
|}
139
139
""" .stripMargin
140
140
)
141
- client.analyzeTextByField(" foo" , " bar" , " qux" , ElasticServer (" somehost" )) returns Future .successful(Success (200 , expectedResponse))
141
+ client.analyzeTextByField(" foo" , " bar" , " qux" , ElasticServer (Host ( " somehost" ) )) returns Future .successful(Success (200 , expectedResponse))
142
142
val params = Json .obj(" host" -> " somehost" , " index" -> " foo" , " field" -> " bar" , " text" -> " qux" )
143
143
val response = route(application, FakeRequest (POST , " /analysis/analyze/field" ).withBody(params)).get
144
144
val expected = Json .parse(
0 commit comments