2015-08-09 57 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