none
[Java][Azure Storage] Executing the JUnit's for azure-storage-java project RRS feed

  • Question

  • I cloned the https://github.com/Azure/azure-storage-java.git project and want to do some changes. In-order to verify the changes I would like to execute the Junits.

    Looking at https://github.com/Azure/azure-storage-java/blob/master/microsoft-azure-storage-test/res/TestConfigurations.xml. It looks like there are two options.

    1.        Running against the storage emulator
    2.        Running  against real storage

    I tried to edit https://github.com/Azure/azure-storage-java/blob/master/microsoft-azure-storage-test/res/TestConfigurations.xml with my own storage account and got

    com.microsoft.azure.storage.StorageException: A Client side exception occurred, please check the inner exception for details: Caused by: java.lang.IllegalArgumentException: Primary and secondary location URIs in a StorageUri

    Please advise, both options are fine by me?



    Sunday, August 9, 2015 11:57 AM

Answers

  • Hi Girish,

    I guess I was not clear enough as you provided a general guidelines on connecting to azure storage. Did some debugging and figured it out (worked for me on the 2.2.0 version). I posted the answer on stackoverflow since I have more privileges there.

    http://stackoverflow.com/questions/31904128/executing-the-junits-for-azure-storage-java-project/31912141#31912141



    • Edited by haimra Monday, August 10, 2015 5:37 AM
    • Marked as answer by Girish Prajwal Monday, August 10, 2015 10:47 AM
    Monday, August 10, 2015 5:29 AM

All replies

  • Hi Haimra,

    From the exception error provided in the query, I see that issue is with Primary & Secondary Azure storage URLs.

    An Azure Storage client uses a storage connection string to store endpoints and credentials for accessing data management services. When running in a client application, you must provide the storage connection string in the following format, using the name of your storage account and the Primary access key for the storage account listed in the Azure portal for the AccountName and AccountKey values. The following example shows how you can declare a static field to hold the connection string.

    // Define the connection-string with your values

    public static final String storageConnectionString =

        "DefaultEndpointsProtocol=http;" +

        "AccountName=your_storage_account;" +

        "AccountKey=your_storage_account_key";

    In an application running within a role in Microsoft Azure, this string can be stored in the service configuration file, ServiceConfiguration.cscfg, and can be accessed with a call to the RoleEnvironment.getConfigurationSettings method. The following example gets the connection string from a Setting element named StorageConnectionString in the service configuration file.

    // Retrieve storage account from connection-string.

    String storageConnectionString =

        RoleEnvironment.getConfigurationSettings().get("StorageConnectionString");

    The following samples assume that you have used one of these two methods to get the storage connection string.

    Please confirm whether you have followed the above procedure in coding.

    Girish Prajwal

    Sunday, August 9, 2015 4:31 PM
  • Hi Girish,

    I guess I was not clear enough as you provided a general guidelines on connecting to azure storage. Did some debugging and figured it out (worked for me on the 2.2.0 version). I posted the answer on stackoverflow since I have more privileges there.

    http://stackoverflow.com/questions/31904128/executing-the-junits-for-azure-storage-java-project/31912141#31912141



    • Edited by haimra Monday, August 10, 2015 5:37 AM
    • Marked as answer by Girish Prajwal Monday, August 10, 2015 10:47 AM
    Monday, August 10, 2015 5:29 AM
  • Hi Haimra,

    I am glad to hear that your query is resolved and the link directed to stack-overflow will be helpful for others. I am marking your reply as answered and if you need further assistance on this query, please post the same.

    Girish Prajwal

    Monday, August 10, 2015 10:47 AM