2015-08-09 54 views
0

我克隆了https://github.com/Azure/azure-storage-java.git項目並希望做一些更改。爲了驗證我想執行Junits的更改。爲azure-storage-java項目執行JUnit的

看着https://github.com/Azure/azure-storage-java/blob/master/microsoft-azure-storage-test/res/TestConfigurations.xml。看起來有兩種選擇。

  1. 運行鍼對存儲模擬器
  2. 運行鍼對實際存儲

我試圖用我自己的存儲帳戶編輯https://github.com/Azure/azure-storage-java/blob/master/microsoft-azure-storage-test/res/TestConfigurations.xml,並得到

com.microsoft.azure.storage.StorageException:發生客戶端異常,請檢查內部異常以獲取詳細信息:引起:java.lang.IllegalArgumentException:StorageUri中的主要和次要位置URI

請指教,這兩個選項都很好嗎?

回答

0

做了一些調試,並找出它(在2.2.0版本上爲我工作)。

測試設置的關鍵是在文件中 微軟Azure的存儲測試/ RES/TestConfigurations.xml
它可以讓你使用一個真正的存儲賬戶或Azure存儲模擬器。

實際存儲使用由<TargetTestTenant>元素下的<TenantConfiguration>

<TestConfigurations> 
<TargetTestTenant>ProductionTenant</TargetTestTenant> 
Or 
<TargetTestTenant>DevStore</TargetTestTenant> 

例外com.microsoft.azure.storage.StorageException是由於缺少的元素爲new file service

我確定使用ProductionTenant,因爲我現有的模擬器(VS 2013)沒有包含任何文件服務仿真

<TenantConfiguration> 
    <TenantName>ProductionTenant</TenantName> 
    <TenantType>Cloud</TenantType> 
    <AccountName>[ACCOUNT]</AccountName> ... 
    <FileServiceEndpoint>http://[ACCOUNT].file.core.windows.net</FileServiceEndpoint> 
    <FileServiceSecondaryEndpoint>http://[ACCOUNT]-secondary.file.core.windows.net</FileServiceSecondaryEndpoint> 
</TenantConfiguration> 

最後執行

mvn clean test