@@ -85,16 +85,16 @@ class FetcherBaseTest extends AnyFlatSpec with MockitoSugar with Matchers with M
85
85
val response = Response (request, Success (Map (request.name -> " 100" )))
86
86
Future .successful(Seq (response))
87
87
}
88
- }).when(fetcherBase).groupByFetcher. fetchGroupBys(any())
88
+ }).when(fetcherBase).fetchGroupBys(any())
89
89
90
90
// Map should contain query with valid response
91
- val queryResults = Await .result(fetcherBase.groupByFetcher. fetchColumns(Seq (query)), 1 .second)
91
+ val queryResults = Await .result(fetcherBase.fetchColumns(Seq (query)), 1 .second)
92
92
queryResults.contains(query) shouldBe true
93
93
queryResults.get(query).map(_.values) shouldBe Some (Success (Map (s " $GroupBy. $Column" -> " 100" )))
94
94
95
95
// GroupBy request sent to KV store for the query
96
96
val requestsCaptor = ArgumentCaptor .forClass(classOf [Seq [_]])
97
- verify(fetcherBase, times(1 )).groupByFetcher. fetchGroupBys(requestsCaptor.capture().asInstanceOf [Seq [Request ]])
97
+ verify(fetcherBase, times(1 )).fetchGroupBys(requestsCaptor.capture().asInstanceOf [Seq [Request ]])
98
98
val actualRequest = requestsCaptor.getValue.asInstanceOf [Seq [Request ]].headOption
99
99
actualRequest shouldNot be(None )
100
100
actualRequest.get.name shouldBe s " ${query.groupByName}. ${query.columnName}"
@@ -114,18 +114,18 @@ class FetcherBaseTest extends AnyFlatSpec with MockitoSugar with Matchers with M
114
114
val responses = requests.map(r => Response (r, Success (Map (r.name -> " 100" ))))
115
115
Future .successful(responses)
116
116
}
117
- }).when(fetcherBase).groupByFetcher. fetchGroupBys(any())
117
+ }).when(fetcherBase).fetchGroupBys(any())
118
118
119
119
// Map should contain query with valid response
120
- val queryResults = Await .result(fetcherBase.groupByFetcher. fetchColumns(Seq (guestQuery, hostQuery)), 1 .second)
120
+ val queryResults = Await .result(fetcherBase.fetchColumns(Seq (guestQuery, hostQuery)), 1 .second)
121
121
queryResults.contains(guestQuery) shouldBe true
122
122
queryResults.get(guestQuery).map(_.values) shouldBe Some (Success (Map (s " ${GuestKey }_ $GroupBy. $Column" -> " 100" )))
123
123
queryResults.contains(hostQuery) shouldBe true
124
124
queryResults.get(hostQuery).map(_.values) shouldBe Some (Success (Map (s " ${HostKey }_ $GroupBy. $Column" -> " 100" )))
125
125
126
126
// GroupBy request sent to KV store for the query
127
127
val requestsCaptor = ArgumentCaptor .forClass(classOf [Seq [_]])
128
- verify(fetcherBase, times(1 )).groupByFetcher. fetchGroupBys(requestsCaptor.capture().asInstanceOf [Seq [Request ]])
128
+ verify(fetcherBase, times(1 )).fetchGroupBys(requestsCaptor.capture().asInstanceOf [Seq [Request ]])
129
129
val actualRequests = requestsCaptor.getValue.asInstanceOf [Seq [Request ]]
130
130
actualRequests.length shouldBe 2
131
131
actualRequests.head.name shouldBe s " ${guestQuery.groupByName}. ${guestQuery.columnName}"
@@ -143,10 +143,10 @@ class FetcherBaseTest extends AnyFlatSpec with MockitoSugar with Matchers with M
143
143
def answer (invocation : InvocationOnMock ): Future [Seq [Response ]] = {
144
144
Future .successful(Seq ())
145
145
}
146
- }).when(fetcherBase).groupByFetcher. fetchGroupBys(any())
146
+ }).when(fetcherBase).fetchGroupBys(any())
147
147
148
148
// Map should contain query with Failure response
149
- val queryResults = Await .result(fetcherBase.groupByFetcher. fetchColumns(Seq (query)), 1 .second)
149
+ val queryResults = Await .result(fetcherBase.fetchColumns(Seq (query)), 1 .second)
150
150
queryResults.contains(query) shouldBe true
151
151
queryResults.get(query).map(_.values) match {
152
152
case Some (Failure (_ : IllegalStateException )) => succeed
@@ -155,7 +155,7 @@ class FetcherBaseTest extends AnyFlatSpec with MockitoSugar with Matchers with M
155
155
156
156
// GroupBy request sent to KV store for the query
157
157
val requestsCaptor = ArgumentCaptor .forClass(classOf [Seq [_]])
158
- verify(fetcherBase, times(1 )).groupByFetcher. fetchGroupBys(requestsCaptor.capture().asInstanceOf [Seq [Request ]])
158
+ verify(fetcherBase, times(1 )).fetchGroupBys(requestsCaptor.capture().asInstanceOf [Seq [Request ]])
159
159
val actualRequest = requestsCaptor.getValue.asInstanceOf [Seq [Request ]].headOption
160
160
actualRequest shouldNot be(None )
161
161
actualRequest.get.name shouldBe query.groupByName + " ." + query.columnName
@@ -166,16 +166,16 @@ class FetcherBaseTest extends AnyFlatSpec with MockitoSugar with Matchers with M
166
166
it should " get serving info should call update serving info if batch response is from kv store" in {
167
167
val oldServingInfo = mock[GroupByServingInfoParsed ]
168
168
val updatedServingInfo = mock[GroupByServingInfoParsed ]
169
- doReturn(updatedServingInfo).when(fetcherBase).groupByFetcher. getServingInfo(any(), any())
169
+ doReturn(updatedServingInfo).when(fetcherBase).getServingInfo(any(), any())
170
170
171
171
val batchTimedValuesSuccess = Success (Seq (TimedValue (Array (1 .toByte), 2000L )))
172
172
val kvStoreBatchResponses = BatchResponses (batchTimedValuesSuccess)
173
173
174
- val result = fetcherBase.groupByFetcher. getServingInfo(oldServingInfo, kvStoreBatchResponses)
174
+ val result = fetcherBase.getServingInfo(oldServingInfo, kvStoreBatchResponses)
175
175
176
176
// updateServingInfo is called
177
177
result shouldEqual updatedServingInfo
178
- verify(fetcherBase).groupByFetcher. getServingInfo(any(), any())
178
+ verify(fetcherBase).getServingInfo(any(), any())
179
179
}
180
180
181
181
// If a batch response is cached, the serving info should be refreshed. This is needed to prevent
@@ -194,12 +194,12 @@ class FetcherBaseTest extends AnyFlatSpec with MockitoSugar with Matchers with M
194
194
doReturn(groupByOpsMock).when(oldServingInfo).groupByOps
195
195
196
196
val cachedBatchResponses = BatchResponses (mock[FinalBatchIr ])
197
- val result = fetcherBase.groupByFetcher. getServingInfo(oldServingInfo, cachedBatchResponses)
197
+ val result = fetcherBase.getServingInfo(oldServingInfo, cachedBatchResponses)
198
198
199
199
// FetcherBase.updateServingInfo is not called, but getGroupByServingInfo.refresh() is.
200
200
result shouldEqual oldServingInfo
201
201
verify(ttlCache).refresh(any())
202
- verify(fetcherBase, never()).groupByFetcher. getServingInfo(any(), any())
202
+ verify(fetcherBase, never()).getServingInfo(any(), any())
203
203
}
204
204
205
205
it should " is caching enabled correctly determine if cache is enabled" in {
@@ -224,7 +224,7 @@ class FetcherBaseTest extends AnyFlatSpec with MockitoSugar with Matchers with M
224
224
225
225
val fetcherBaseWithFlagStore =
226
226
spy[fetcher.JoinPartFetcher ](new fetcher.JoinPartFetcher (fetchContext, new MetadataStore (fetchContext)))
227
- when(fetcherBaseWithFlagStore.groupByFetcher. isCacheSizeConfigured).thenReturn(true )
227
+ when(fetcherBaseWithFlagStore.isCacheSizeConfigured).thenReturn(true )
228
228
229
229
def buildGroupByWithCustomJson (name : String ): GroupBy = Builders .GroupBy (metaData = Builders .MetaData (name = name))
230
230
0 commit comments