????hadoop????????mock????????
???????????? ???????[ 2012/12/26 10:42:44 ] ????????
????6????????????HTable??????????????????Mock Get???????get??????????????????????????????Result???????????????PowerMockito??when????shop_info.get(gtShopInfo)???HTable???????????????thenReturn????????????shop_info_result????
Get gtShopInfo = PowerMockito.mock(Get.class);
PowerMockito.whenNew(Get.class)
.withArguments("126:38934426".getBytes())
.thenReturn(gtShopInfo);
List<KeyValue> kv_shop_info = new ArrayList<KeyValue>();
kv_shop_info.add(new KeyValue("126:38934426".getBytes()?? "sp_shop_info"
.getBytes()?? "feature".getBytes()));
Result shop_info_result = new Result(kv_shop_info);
PowerMockito.when(shop_info.get(gtShopInfo)).thenReturn(shop_info_result);
????????????е?mock???ShopScanMap???????????Щ???????????????????????????
?????????????????????mock????main_process?????????????????
int r = map.mainProcess(mapOutPut?? fBmwShops?? shop_id?? timeBill_shop??
timeBill_user);
/**
* ?????????????????????????mapOutPut??????
*/
System.out.println(r);
System.out.println(mapOutPut.toString());
????????????
???????????????????????????????????????????????????????????????????????к?????????
?????????????????????????????????????????????????????????????????????????????????????????????????ShopScanMap??do_seller?? do_prepay???????á?
?????????????????????????Σ???????????mock??????????????????????????????????????????????????????hadoop????????mock??????????й?mrunit????????ITest-hadoop??????????????????????map/reduce???棬??????????????????????????????????????????hadoop?????????MiniDFSCluster?? MiniMRCluster?? MiniHBaseCluster??????????????????????????????????????????壬????????????????????????????????????????????ITest-hadoop?????????????????????????????????????????????????????????÷?????
??????????????????ЩUT???·???????????????????????????????????
????????POM??????
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.4.10</version>
</dependency>
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11