33
33
import org .apache .accumulo .core .clientImpl .bulk .Bulk .FileInfo ;
34
34
import org .apache .accumulo .core .clientImpl .bulk .Bulk .Files ;
35
35
import org .apache .accumulo .core .clientImpl .bulk .LoadMappingIterator ;
36
+ import org .apache .accumulo .core .conf .Property ;
36
37
import org .apache .accumulo .core .data .TableId ;
37
38
import org .apache .accumulo .core .dataImpl .KeyExtent ;
38
39
import org .apache .accumulo .core .fate .FateId ;
42
43
import org .apache .accumulo .manager .Manager ;
43
44
import org .apache .accumulo .manager .tableOps .bulkVer2 .LoadFiles .ImportTimingStats ;
44
45
import org .apache .accumulo .manager .tableOps .bulkVer2 .LoadFiles .TabletsMetadataFactory ;
46
+ import org .apache .accumulo .server .ServerContext ;
47
+ import org .apache .accumulo .server .conf .TableConfiguration ;
45
48
import org .apache .hadoop .fs .Path ;
46
49
import org .apache .hadoop .io .Text ;
47
50
import org .easymock .EasyMock ;
@@ -60,6 +63,10 @@ public TestTabletsMetadata(AutoCloseable closeable, Iterable<TabletMetadata> tmi
60
63
61
64
private static class CaptureLoader extends LoadFiles .Loader {
62
65
66
+ public CaptureLoader (Manager manager , TableId tableId ) {
67
+ super (manager , tableId );
68
+ }
69
+
63
70
private static class LoadResult {
64
71
private final List <TabletMetadata > tablets ;
65
72
private final Files files ;
@@ -159,19 +166,27 @@ public void testFindOverlappingFiles() {
159
166
private Map <String ,HashSet <KeyExtent >> runLoadFilesLoad (Map <KeyExtent ,String > loadRanges )
160
167
throws Exception {
161
168
169
+ Manager manager = EasyMock .createMock (Manager .class );
170
+ ServerContext ctx = EasyMock .createMock (ServerContext .class );
171
+ TableConfiguration tconf = EasyMock .createMock (TableConfiguration .class );
172
+
173
+ EasyMock .expect (manager .getContext ()).andReturn (ctx ).anyTimes ();
174
+ EasyMock .expect (ctx .getTableConfiguration (tid )).andReturn (tconf ).anyTimes ();
175
+ EasyMock .expect (tconf .getCount (Property .TABLE_FILE_PAUSE ))
176
+ .andReturn (Integer .parseInt (Property .TABLE_FILE_PAUSE .getDefaultValue ())).anyTimes ();
177
+
178
+ Path bulkDir = EasyMock .createMock (Path .class );
179
+ EasyMock .replay (manager , ctx , tconf , bulkDir );
180
+
162
181
TabletsMetadata tabletMeta = new TestTabletsMetadata (null , tm );
163
182
LoadMappingIterator lmi = PrepBulkImportTest .createLoadMappingIter (loadRanges );
164
- CaptureLoader cl = new CaptureLoader ();
183
+ CaptureLoader cl = new CaptureLoader (manager , tid );
165
184
BulkInfo info = new BulkInfo ();
166
185
TabletsMetadataFactory tmf = (startRow ) -> tabletMeta ;
167
186
FateId txid = FateId .from (FateInstanceType .USER , UUID .randomUUID ());
168
187
169
- Manager manager = EasyMock .createMock (Manager .class );
170
- Path bulkDir = EasyMock .createMock (Path .class );
171
- EasyMock .replay (manager , bulkDir );
172
-
173
188
LoadFiles .loadFiles (cl , info , bulkDir , lmi , tmf , manager , txid );
174
- EasyMock .verify (manager , bulkDir );
189
+ EasyMock .verify (manager , ctx , tconf , bulkDir );
175
190
List <CaptureLoader .LoadResult > results = cl .getLoadResults ();
176
191
assertEquals (loadRanges .size (), results .size ());
177
192
0 commit comments