Sfoglia il codice sorgente

[ZF-10100] WindowsAzure is out-of-date from PHPAzure

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22773 44c647ce-9c0f-0410-b52a-842ac1e357ba
maartenba 15 anni fa
parent
commit
dc37780ef7
62 ha cambiato i file con 4427 aggiunte e 2530 eliminazioni
  1. 18 24
      documentation/manual/en/module_specs/Zend_Service_WindowsAzure.xml
  2. 84 92
      documentation/manual/en/module_specs/Zend_Service_WindowsAzure_Blob.xml
  3. 187 0
      documentation/manual/en/module_specs/Zend_Service_WindowsAzure_Manager.xml
  4. 27 28
      documentation/manual/en/module_specs/Zend_Service_WindowsAzure_Queue.xml
  5. 79 92
      documentation/manual/en/module_specs/Zend_Service_WindowsAzure_Table.xml
  6. 65 18
      library/Zend/Service/WindowsAzure/Credentials/CredentialsAbstract.php
  7. 35 0
      library/Zend/Service/WindowsAzure/Credentials/Exception.php
  8. 3 1
      library/Zend/Service/WindowsAzure/Credentials/SharedAccessSignature.php
  9. 42 9
      library/Zend/Service/WindowsAzure/Credentials/SharedKey.php
  10. 44 1
      library/Zend/Service/WindowsAzure/Credentials/SharedKeyLite.php
  11. 91 0
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDataSources.php
  12. 67 0
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDiagnosticInfrastructureLogs.php
  13. 90 0
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDirectories.php
  14. 220 0
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationInstance.php
  15. 67 0
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationLogs.php
  16. 71 0
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php
  17. 89 0
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationPerformanceCounters.php
  18. 91 0
      library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationWindowsEventLog.php
  19. 62 0
      library/Zend/Service/WindowsAzure/Diagnostics/DirectoryConfigurationSubscription.php
  20. 38 0
      library/Zend/Service/WindowsAzure/Diagnostics/Exception.php
  21. 39 0
      library/Zend/Service/WindowsAzure/Diagnostics/LogLevel.php
  22. 191 0
      library/Zend/Service/WindowsAzure/Diagnostics/Manager.php
  23. 59 0
      library/Zend/Service/WindowsAzure/Diagnostics/PerformanceCounterSubscription.php
  24. 69 13
      library/Zend/Service/WindowsAzure/Storage.php
  25. 2 2
      library/Zend/Service/WindowsAzure/Storage/Batch.php
  26. 6 2
      library/Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php
  27. 366 256
      library/Zend/Service/WindowsAzure/Storage/Blob.php
  28. 3 3
      library/Zend/Service/WindowsAzure/Storage/Blob/Stream.php
  29. 4 0
      library/Zend/Service/WindowsAzure/Storage/BlobContainer.php
  30. 17 1
      library/Zend/Service/WindowsAzure/Storage/BlobInstance.php
  31. 1 1
      library/Zend/Service/WindowsAzure/Storage/DynamicTableEntity.php
  32. 65 0
      library/Zend/Service/WindowsAzure/Storage/LeaseInstance.php
  33. 59 0
      library/Zend/Service/WindowsAzure/Storage/PageRegionInstance.php
  34. 36 28
      library/Zend/Service/WindowsAzure/Storage/Queue.php
  35. 5 35
      library/Zend/Service/WindowsAzure/Storage/QueueInstance.php
  36. 9 36
      library/Zend/Service/WindowsAzure/Storage/QueueMessage.php
  37. 6 35
      library/Zend/Service/WindowsAzure/Storage/SignedIdentifier.php
  38. 73 0
      library/Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php
  39. 53 12
      library/Zend/Service/WindowsAzure/Storage/Table.php
  40. 2 2
      library/Zend/Service/WindowsAzure/Storage/TableEntity.php
  41. 31 7
      library/Zend/Service/WindowsAzure/Storage/TableEntityQuery.php
  42. 5 35
      library/Zend/Service/WindowsAzure/Storage/TableInstance.php
  43. 11 671
      tests/TestConfiguration.php.dist
  44. 25 32
      tests/TestHelper.php
  45. 6 4
      tests/Zend/Service/WindowsAzure/AllTests.php
  46. 10 12
      tests/Zend/Service/WindowsAzure/BlobStorageSharedAccessTest.php
  47. 579 266
      tests/Zend/Service/WindowsAzure/BlobStorageTest.php
  48. 9 9
      tests/Zend/Service/WindowsAzure/BlobStreamTest.php
  49. 4 3
      tests/Zend/Service/WindowsAzure/Credentials/AllTests.php
  50. 9 10
      tests/Zend/Service/WindowsAzure/Credentials/SharedAccessSignatureTest.php
  51. 15 15
      tests/Zend/Service/WindowsAzure/Credentials/SharedKeyLiteTest.php
  52. 14 12
      tests/Zend/Service/WindowsAzure/Credentials/SharedKeyTest.php
  53. 61 0
      tests/Zend/Service/WindowsAzure/Diagnostics/AllTests.php
  54. 188 0
      tests/Zend/Service/WindowsAzure/Diagnostics/ManagerTest.php
  55. 9 10
      tests/Zend/Service/WindowsAzure/DynamicTableEntityTest.php
  56. 226 161
      tests/Zend/Service/WindowsAzure/QueueStorageTest.php
  57. 9 9
      tests/Zend/Service/WindowsAzure/RetryPolicyTest.php
  58. 120 107
      tests/Zend/Service/WindowsAzure/SessionHandlerTest.php
  59. 9 9
      tests/Zend/Service/WindowsAzure/StorageTest.php
  60. 9 9
      tests/Zend/Service/WindowsAzure/TableEntityQueryTest.php
  61. 9 9
      tests/Zend/Service/WindowsAzure/TableEntityTest.php
  62. 534 449
      tests/Zend/Service/WindowsAzure/TableStorageTest.php

+ 18 - 24
documentation/manual/en/module_specs/Zend_Service_WindowsAzure.xml

@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Reviewed: no -->
-<sect1 id="zend.service.windowsazure" xmlns:xi="http://www.w3.org/2001/XInclude">
+<sect1 id="zend.service.windowsazure">
     <title>Zend_Service_WindowsAzure</title>
 
     <sect2 id="zend.service.windowsazure.introduction">
         <title>Introduction</title>
 
         <para>
-          Windows Azure is the name for Microsoft's Software + Services platform, an operating
+          Windows Azure is the name for Microsofts Software + Services platform, an operating
           system in the cloud providing services for hosting, management, scalable storage with
           support for simple blobs, tables, and queues, as well as a management infrastructure for
           provisioning and geo-distribution of cloud-based services, and a development platform for
@@ -26,9 +26,9 @@
             <listitem>
                 <para>
                     You can develop your application using
-                    <classname>Zend_Service_WindowsAzure</classname> and the Windows Azure
-                    <acronym>SDK</acronym>, which provides a local developent environment of the
-                    services provided by Windows Azure's cloud infrastructure.
+                    <classname>Zend_Service_WindowsAzure</classname> and the Windows Azure SDK,
+                    which provides a local developent environment of the services provided by
+                    Windows Azure's cloud infrastructure.
                 </para>
             </listitem>
 
@@ -43,10 +43,10 @@
 
         <para>
             The first case requires you to install the <ulink
-                url="http://www.microsoft.com/downloads/details.aspx?FamilyID=6967ff37-813e-47c7-b987-889124b43abd&amp;displaylang=en">Windows
-                Azure SDK</ulink> on your development machine. It is currently only available for
-            Windows environments; progress is being made on a Java-based version of the
-            <acronym>SDK</acronym> which can run on any platform.
+                url="http://www.microsoft.com/downloads/details.aspx?FamilyID=6967ff37-813e-47c7-b987-889124b43abd&displaylang=en">Windows
+                Azure SDK</ulink> on your development machine.  It is currently only available for
+            Windows environments; progress is being made on a Java-based version of the SDK which
+            can run on any platform.
         </para>
 
         <para>
@@ -59,13 +59,13 @@
         <title>API Documentation</title>
 
         <para>
-            The <classname>Zend_Service_WindowsAzure</classname> class provides the
-            <acronym>PHP</acronym> wrapper to the Windows Azure <acronym>REST</acronym> interface.
-            Please consult the <ulink
+            The <classname>Zend_Service_WindowsAzure</classname> class provides the PHP wrapper to
+            the Windows Azure <acronym>REST</acronym> interface. Please consult the <ulink
                 url="http://msdn.microsoft.com/en-us/library/dd179355.aspx">REST
                 documentation</ulink> for detailed description of the service. You will need to be
             familiar with basic concepts in order to use this service.
         </para>
+    
     </sect2>
 
     <sect2 id="zend.service.windowsazure.features">
@@ -78,15 +78,14 @@
         <itemizedlist>
             <listitem>
                 <para>
-                    <acronym>PHP</acronym> classes for Windows Azure Blobs, Tables and Queues (for
+                    PHP classes for Windows Azure Blobs, Tables and Queues (for
                     <acronym>CRUD</acronym> operations)
                 </para>
             </listitem>
 
             <listitem>
                 <para>
-                    Helper Classes for <acronym>HTTP</acronym> transport, AuthN, AuthZ,
-                    <acronym>REST</acronym> and Error Management
+                    Helper Classes for HTTP transport, AuthN/AuthZ, REST and Error Management
                 </para>
             </listitem>
 
@@ -103,9 +102,8 @@
 
         <para>
             <classname>Zend_Service_WindowsAzure</classname> provides access to Windows Azure's
-            storage, computation and management interfaces by abstracting the
-            <acronym>REST</acronym> - <acronym>XML</acronym> interface Windows Azure provides into
-            a simple <acronym>PHP</acronym> <acronym>API</acronym>.
+            storage, computation and management interfaces by abstracting the REST/XML interface
+            Windows Azure provides into a simple PHP API.
         </para>
 
         <para>
@@ -113,9 +111,5 @@
             Windows Azure's features, no matter if it is hosted on the Windows Azure platform or on
             an in-premise web server.
         </para>
-    </sect2>
-
-    <xi:include href="Zend_Service_WindowsAzure_Blob.xml" />
-    <xi:include href="Zend_Service_WindowsAzure_Table.xml" />
-    <xi:include href="Zend_Service_WindowsAzure_Queue.xml" />
-</sect1>
+  </sect2>
+</sect1>

+ 84 - 92
documentation/manual/en/module_specs/Zend_Service_WindowsAzure_Blob.xml

@@ -1,31 +1,31 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Reviewed: no -->
-<sect2 id="zend.service.windowsazure.storage.blob">
+<sect1 id="zend.service.windowsazure.storage.blob">
     <title>Zend_Service_WindowsAzure_Storage_Blob</title>
 
     <para>
         Blob Storage stores sets of binary data. Blob storage offers the following three
-        resources: the storage account, containers, and blobs. Within your storage account,
+        resources: the storage account, containers, and blobs.  Within your storage account,
         containers provide a way to organize sets of blobs within your storage account.
     </para>
 
     <para>
-        Blob Storage is offered by Windows Azure as a <acronym>REST</acronym> <acronym>API</acronym>
-        which is wrapped by the <classname>Zend_Service_WindowsAzure_Storage_Blob</classname> class
-        in order to provide a native <acronym>PHP</acronym> interface to the storage account.
+        Blob Storage is offered by Windows Azure as a <acronym>REST</acronym> API which is
+        wrapped by the <classname>Zend_Service_WindowsAzure_Storage_Blob</classname> class in
+        order to provide a native PHP interface to the storage account.
     </para>
 
-    <sect3 id="zend.service.windowsazure.storage.blob.api">
+    <sect2 id="zend.service.windowsazure.storage.blob.api">
         <title>API Examples</title>
 
         <para>
             This topic lists some examples of using the
-            <classname>Zend_Service_WindowsAzure_Storage_Blob</classname> class. Other features are
-            available in the download package, as well as a detailed <acronym>API</acronym>
-            documentation of those features.
+            <classname>Zend_Service_WindowsAzure_Storage_Blob</classname> class.  Other features are
+            available in the download package, as well as a detailed API documentation of those
+            features.
         </para>
 
-        <sect4 id="zend.service.windowsazure.storage.blob.api.create-container">
+        <sect3 id="zend.service.windowsazure.storage.blob.api.create-container">
             <title>Creating a storage container</title>
 
             <para>
@@ -33,7 +33,7 @@
                 storage.
             </para>
 
-            <example id="zend.service.windowsazure.storage.blob.api.create-container.example">
+            <example id="zend.service.windowsazure.storage.blob.api.create-container">
                 <title>Creating a storage container</title>
 
                 <programlisting language="php"><![CDATA[
@@ -43,9 +43,9 @@ $result = $storageClient->createContainer('testcontainer');
 echo 'Container name is: ' . $result->Name;
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.blob.api.delete-container">
+        <sect3 id="zend.service.windowsazure.storage.blob.api.delete-container">
             <title>Deleting a storage container</title>
 
             <para>
@@ -53,7 +53,7 @@ echo 'Container name is: ' . $result->Name;
                 storage.
             </para>
 
-            <example id="zend.service.windowsazure.storage.blob.api.delete-container.example">
+            <example id="zend.service.windowsazure.storage.blob.api.delete-container">
                 <title>Deleting a storage container</title>
 
                 <programlisting language="php"><![CDATA[
@@ -61,9 +61,9 @@ $storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
 $storageClient->deleteContainer('testcontainer');
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.blob.api.storing-blob">
+        <sect3 id="zend.service.windowsazure.storage.blob.api.storing-blob">
             <title>Storing a blob</title>
 
             <para>
@@ -71,7 +71,7 @@ $storageClient->deleteContainer('testcontainer');
                 development storage. Note that the container has already been created before.
             </para>
 
-            <example id="zend.service.windowsazure.storage.blob.api.storing-blob.example">
+            <example id="zend.service.windowsazure.storage.blob.api.storing-blob">
                 <title>Storing a blob</title>
 
                 <programlisting language="php"><![CDATA[
@@ -85,19 +85,19 @@ $result = $storageClient->putBlob(
 echo 'Blob name is: ' . $result->Name;
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.blob.api.copy-blob">
+        <sect3 id="zend.service.windowsazure.storage.blob.api.copy-blob">
             <title>Copying a blob</title>
 
             <para>
-                Using the following code, a blob can be copied from inside the storage account. The
+                Using the following code, a blob can be copied from inside the storage account.  The
                 advantage of using this method is that the copy operation occurs in the Azure cloud
                 and does not involve downloading the blob. Note that the container has already been
                 created before.
             </para>
 
-            <example id="zend.service.windowsazure.storage.blob.api.copy-blob.example">
+            <example id="zend.service.windowsazure.storage.blob.api.copy-blob">
                 <title>Copying a blob</title>
 
                 <programlisting language="php"><![CDATA[
@@ -111,9 +111,9 @@ $result = $storageClient->copyBlob(
 echo 'Copied blob name is: ' . $result->Name;
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.blob.api.download-blob">
+        <sect3 id="zend.service.windowsazure.storage.blob.api.download-blob">
             <title>Downloading a blob</title>
 
             <para>
@@ -122,7 +122,7 @@ echo 'Copied blob name is: ' . $result->Name;
                 blob has been uploaded.
             </para>
 
-            <example id="zend.service.windowsazure.storage.blob.api.download-blob.example">
+            <example id="zend.service.windowsazure.storage.blob.api.download-blob">
                 <title>Downloading a blob</title>
 
                 <programlisting language="php"><![CDATA[
@@ -134,9 +134,9 @@ $storageClient->getBlob(
 );
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.blob.api.public-blob">
+        <sect3 id="zend.service.windowsazure.storage.blob.api.public-blob">
             <title>Making a blob publicly available</title>
 
             <para>
@@ -151,48 +151,45 @@ $storageClient->getBlob(
                 storage. Note that the container has already been created before.
             </para>
 
-            <example id="zend.service.windowsazure.storage.blob.api.public-blob.example">
+            <example id="zend.service.windowsazure.storage.blob.api.public-blob">
                 <title>Making a blob publicly available</title>
 
                 <programlisting language="php"><![CDATA[
 $storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
 
-// make container publicly available
-$storageClient->setContainerAcl(
-    'testcontainer',
-    Zend_Service_WindowsAzure_Storage_Blob::ACL_PUBLIC
-);
+// make container publicly available (enumerate all blobs and read blob data)
+$storageClient->setContainerAcl('testcontainer', Zend_Service_WindowsAzure_Storage_Blob::ACL_PUBLIC_CONTAINER);
 ]]></programlisting>
             </example>
-        </sect4>
-    </sect3>
-
-    <sect3 id="zend.service.windowsazure.storage.blob.root">
+        </sect3>
+    </sect2>
+  
+    <sect2 id="zend.service.windowsazure.storage.blob.root">
         <title>Root container</title>
 
         <para>
-            Windows Azure Blob Storage provides support to work with a "root container".
-            This means that a blob can be stored in the root of your storage account,
-            i.e. <filename>http://myaccount.blob.core.windows.net/somefile.txt</filename>.
+            Windows Azure Blob Storage provides support to work with a "root container". 
+            This means that a blob can be stored in the root of your storage account, 
+            i.e. <code>http://myaccount.blob.core.windows.net/somefile.txt</code>.
         </para>
-
+        
         <para>
             In order to work with the root container, it should first be created using the
             <methodname>createContainer()</methodname> method, naming the container
-            <varname>$root</varname>. All other operations on the root container should be issued
+            <varname>$root</varname>.  All other operations on the root container should be issued
             with the container name set to <varname>$root</varname>.
         </para>
-    </sect3>
-
-    <sect3 id="zend.service.windowsazure.storage.blob.wrapper">
+    </sect2>
+  
+    <sect2 id="zend.service.windowsazure.storage.blob.wrapper">
         <title>Blob storage stream wrapper</title>
 
         <para>
-            The Windows Azure <acronym>SDK</acronym> for <acronym>PHP</acronym> provides support for
-            registering a blob storage client as a <acronym>PHP</acronym> file stream wrapper. The
-            blob storage stream wrapper provides support for using regular file operations on
-            Windows Azure Blob Storage. For example, one can open a file from Windows Azure Blob
-            Storage with the <methodname>fopen()</methodname> function:
+            The Windows Azure SDK for PHP provides support for registering a blob storage
+            client as a PHP file stream wrapper. The blob storage stream wrapper provides
+            support for using regular file operations on Windows Azure Blob Storage.
+            For example, one can open a file from Windows Azure Blob Storage with
+            the <functionname>fopen()</functionname> function:
         </para>
 
         <example id="zend.service.windowsazure.storage.blob.wrapper.sample">
@@ -206,11 +203,11 @@ $fileHandle = fopen('azure://mycontainer/myfile.txt', 'r');
 fclose($fileHandle);
 ]]></programlisting>
         </example>
-
+    
         <para>
-            In order to do this, the Windows Azure <acronym>SDK</acronym> for <acronym>PHP</acronym>
-            blob storage client must be registered as a stream wrapper. This can be done by calling
-            the <methodname>registerStreamWrapper()</methodname> method:
+            In order to do this, the Windows Azure SDK for PHP blob storage client
+            must be registered as a stream wrapper. This can be done by calling the
+            <methodname>registerStreamWrapper()</methodname> method:
         </para>
 
         <example id="zend.service.windowsazure.storage.blob.wrapper.register">
@@ -218,24 +215,21 @@ fclose($fileHandle);
 
             <programlisting language="php"><![CDATA[
 $storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
-// registers azure:// on this storage client
-$storageClient->registerStreamWrapper();
-
+$storageClient->registerStreamWrapper(); // registers azure:// on this storage client
 
 // or:
 
-// regiters blob:// on this storage client
-$storageClient->registerStreamWrapper('blob://');
+$storageClient->registerStreamWrapper('blob://'); // regiters blob:// on this storage client
 ]]></programlisting>
         </example>
-
+    
         <para>
             To unregister the stream wrapper, the <methodname>unregisterStreamWrapper()</methodname>
             method can be used.
         </para>
-    </sect3>
+    </sect2>
 
-    <sect3 id="zend.service.windowsazure.storage.blob.sharedaccesssig">
+    <sect2 id="zend.service.windowsazure.storage.blob.sharedaccesssig">
         <title>Shared Access Signature</title>
 
         <para>
@@ -246,21 +240,21 @@ $storageClient->registerStreamWrapper('blob://');
             assigned on a container or a blob and given to a specific client using an URL-based
             model.
         </para>
-
+        
         <para>
             An example would be the following signature:
         </para>
-
+        
         <literallayout>
 http://phpstorage.blob.core.windows.net/phpazuretestshared1?st=2009-08-17T09%3A06%3A17Z&amp;se=2009-08-17T09%3A56%3A17Z&amp;sr=c&amp;sp=w&amp;sig=hscQ7Su1nqd91OfMTwTkxabhJSaspx%2BD%2Fz8UqZAgn9s%3D
         </literallayout>
-
+        
         <para>
             The above signature gives write access to the "phpazuretestshared1"
             container of the "phpstorage" account.
         </para>
-
-        <sect4 id="zend.service.windowsazure.storage.blob.sharedaccesssig.generate">
+    
+        <sect3 id="zend.service.windowsazure.storage.blob.sharedaccesssig.generate">
             <title>Generating a Shared Access Signature</title>
 
             <para>
@@ -270,7 +264,7 @@ http://phpstorage.blob.core.windows.net/phpazuretestshared1?st=2009-08-17T09%3A0
                 <classname>Zend_Service_WindowsAzure_Storage_Blob</classname> storage client can be
                 used.
             </para>
-
+            
             <para>
                 The following example code will generate a Shared Access Signature for write access
                 in a container named "container1", within a timeframe of 3000 seconds.
@@ -284,14 +278,14 @@ $storageClient   = new Zend_Service_WindowsAzure_Storage_Blob();
 $sharedAccessUrl = $storageClient->generateSharedAccessUrl(
     'container1',
     '',
-    'c',
+    'c', 
     'w',
     $storageClient ->isoDate(time() - 500),
     $storageClient ->isoDate(time() + 3000)
 );
 ]]></programlisting>
             </example>
-
+            
             <para>
                 The following example code will generate a Shared Access Signature for read access
                 in a blob named <filename>test.txt</filename> in a container named "container1"
@@ -306,29 +300,28 @@ $storageClient   = new Zend_Service_WindowsAzure_Storage_Blob();
 $sharedAccessUrl = $storageClient->generateSharedAccessUrl(
     'container1',
     'test.txt',
-    'b',
+    'b', 
     'r',
     $storageClient ->isoDate(time() - 500),
     $storageClient ->isoDate(time() + 3000)
 );
 ]]></programlisting>
             </example>
-        </sect4>
-
-        <sect4 id="zend.service.windowsazure.storage.blob.sharedaccesssig.consume">
+        </sect3>
+        
+        <sect3 id="zend.service.windowsazure.storage.blob.sharedaccesssig.consume">
             <title>Working with Shared Access Signatures from others</title>
 
             <para>
                 When you receive a Shared Access Signature from someone else, you can use the
-                Windows Azure <acronym>SDK</acronym> for <acronym>PHP</acronym> to work with the
-                addressed resource. For example, the following signature can be retrieved from the
-                owner of a storage account:
+                Windows Azure SDK for PHP to work with the addressed resource.  For example, the
+                following signature can be retrieved from the owner of a storage account:
             </para>
-
+            
             <literallayout>
 http://phpstorage.blob.core.windows.net/phpazuretestshared1?st=2009-08-17T09%3A06%3A17Z&amp;se=2009-08-17T09%3A56%3A17Z&amp;sr=c&amp;sp=w&amp;sig=hscQ7Su1nqd91OfMTwTkxabhJSaspx%2BD%2Fz8UqZAgn9s%3D
             </literallayout>
-
+            
             <para>
                 The above signature gives write access to the "phpazuretestshared1" "container" of
                 the phpstorage account. Since the shared key for the account is not known, the
@@ -341,27 +334,26 @@ http://phpstorage.blob.core.windows.net/phpazuretestshared1?st=2009-08-17T09%3A0
                 <programlisting language="php"><![CDATA[
 $storageClient = new Zend_Service_WindowsAzure_Storage_Blob(
     'blob.core.windows.net', 'phpstorage', ''
+); 
+$storageClient->setCredentials( 
+    new Zend_Service_WindowsAzure_Credentials_SharedAccessSignature() 
 );
-$storageClient->setCredentials(
-    new Zend_Service_WindowsAzure_Credentials_SharedAccessSignature()
-);
-$storageClient->getCredentials()->setPermissionSet(array(
-    'http://phpstorage.blob.core.windows.net/phpazuretestshared1?st=2009-08-17T09%3A06%3A17Z&se=2009-08-17T09%3A56%3A17Z&sr=c&sp=w&sig=hscQ7Su1nqd91OfMTwTkxabhJSaspx%2BD%2Fz8UqZAgn9s%3D'
+$storageClient->getCredentials()->setPermissionSet(array( 
+    'http://phpstorage.blob.core.windows.net/phpazuretestshared1?st=2009-08-17T09%3A06%3A17Z&se=2009-08-17T09%3A56%3A17Z&sr=c&sp=w&sig=hscQ7Su1nqd91OfMTwTkxabhJSaspx%2BD%2Fz8UqZAgn9s%3D' 
 ));
 $storageClient->putBlob(
     'phpazuretestshared1', 'NewBlob.txt', 'C:\Files\dataforazure.txt'
 );
 ]]></programlisting>
             </example>
-
+            
             <para>
                 Note that there was no explicit permission to write to a specific blob. Instead, the
-                Windows Azure <acronym>SDK</acronym> for <acronym>PHP</acronym> determined that a
-                permission was required to either write to that specific blob, or to write to its
-                container. Since only a signature was available for the latter, the Windows Azure
-                <acronym>SDK</acronym> for <acronym>PHP</acronym> chose those credentials to perform
-                the request on Windows Azure blob storage.
+                Windows Azure SDK for PHP determined that a permission was required to either write
+                to that specific blob, or to write to its container. Since only a signature was
+                available for the latter, the Windows Azure SDK for PHP chose those credentials to
+                perform the request on Windows Azure blob storage.
             </para>
-        </sect4>
-    </sect3>
-</sect2>
+        </sect3>
+    </sect2>
+</sect1>

+ 187 - 0
documentation/manual/en/module_specs/Zend_Service_WindowsAzure_Manager.xml

@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.service.windowsazure.diagnostics.manager">
+    <title>Zend_Service_WindowsAzure_Diagnostics_Manager</title>
+
+    <para>
+        Blob Storage stores sets of binary data. Blob storage offers the following three
+        Windows Azure Diagnostics enables you to collect diagnostic data from a service
+        running in Windows Azure. It can be used for tasks like debugging and
+        troubleshooting, measuring performance, monitoring resource usage, traffic
+        analysis, capacity planning, and auditing. Once collected, diagnostic data can be
+        transferred to a Windows Azure storage account for persistence. Transfers can
+        either be scheduled or on-demand.
+    </para>
+    
+    <para>
+        You can configure Windows Azure Diagnostics from code running within a role. You
+        can also configure it remotely from an application running outside of the Windows
+        Azure; for example, you can manage Windows Azure Diagnostics from a custom
+        dashboard application running locally. By managing Windows Azure Diagnostics
+        remotely, you can start your service with an initial diagnostic configuration,
+        and then tweak that configuration from code running outside of your service,
+        without having to upgrade your service.
+    </para>
+
+    <para>
+        More information on which logs, performance counters, crash dumps, ...
+        can be monitored can be found on the <ulink
+        url="http://msdn.microsoft.com/en-us/library/ee758705(v=MSDN.10).aspx">
+        corresponding MSDN web page</ulink>.
+    </para>
+
+    <para>
+        Note: Diagnostics are configured on a per-role basis. This means that each
+        role should be configured separately. Specifying diagnostics instructions
+        for one role instance does not imply this configuration is loaded on other
+        role instances.
+    </para>
+
+    <para>
+        Note: Diagnostics are configured on a per-role basis. This means that each
+        The Diagnostics API in the Windows Azure SDK for PHP can only be used when
+        the DiagnosticsMonitor has been started during role startup. Currently,
+        this is only supported when an application is packaged with the Windows
+        Azure Command-line Tools for PHP Developers.
+    </para>
+
+    <sect2 id="zend.service.windowsazure.diagnostics.manager.api">
+        <title>API Examples</title>
+
+        <para>
+            This topic lists some examples of using the
+            <classname>Zend_Service_WindowsAzure_Diagnostics_Manager</classname> class.  Other features are
+            available in the download package, as well as a detailed API documentation of those
+            features.
+        </para>
+
+        <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-exists">
+            <title>Checking if a diagnostics configuration for the current role instance exists</title>
+
+            <para>
+                Using the following code, you can check if a diagnostics configuration for the
+                current role instance exists.
+            </para>
+
+            <example id="zend.service.windowsazure.diagnostics.manager.api.config-exists">
+                <title>Checking if a diagnostics configuration for the current role instance exists</title>
+
+                <programlisting language="php"><![CDATA[
+/** Zend_Service_WindowsAzure_Storage_Blob */
+require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
+
+/** Zend_Service_WindowsAzure_Diagnostics_Manager */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
+
+$storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
+$manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient);
+
+$configurationExists = $manager->configurationForCurrentRoleInstanceExists();
+
+echo 'The configuration ' . ($configurationExists ? 'exists' : 'does not exist';
+]]></programlisting>
+            </example>
+        </sect3>
+        
+        <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-load">
+            <title>Loading the current role instance diagnostics configuration</title>
+
+            <para>
+                Using the following code, you can load the current role instance diagnostics 
+                configuration.
+            </para>
+
+            <example id="zend.service.windowsazure.diagnostics.manager.api.config-load">
+                <title>Loading the current role instance diagnostics configuration</title>
+
+                <programlisting language="php"><![CDATA[
+/** Zend_Service_WindowsAzure_Storage_Blob */
+require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
+
+/** Zend_Service_WindowsAzure_Diagnostics_Manager */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
+
+$storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
+$manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient);
+
+$configuration = $manager->getConfigurationForCurrentRoleInstance();
+]]></programlisting>
+            </example>
+        </sect3>
+        
+        <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-store">
+            <title>Storing the current role instance diagnostics configuration</title>
+
+            <para>
+                Using the following code, you can store the current role instance diagnostics
+                configuration.
+            </para>
+
+            <example id="zend.service.windowsazure.diagnostics.manager.api.config-store">
+                <title>Storing the current role instance diagnostics configuration</title>
+
+                <programlisting language="php"><![CDATA[
+/** Zend_Service_WindowsAzure_Storage_Blob */
+require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
+
+/** Zend_Service_WindowsAzure_Diagnostics_Manager */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
+
+$storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
+$manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient);
+
+$configuration = // ...;
+$manager->setConfigurationForCurrentRoleInstance($configuration);
+]]></programlisting>
+            </example>
+        </sect3>
+        
+        <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-perf">
+            <title>Subscribing to a performance counter</title>
+
+            <para>
+                Using the following code, you can subscribe to a performance counter.
+            </para>
+
+            <example id="zend.service.windowsazure.diagnostics.manager.api.config-perf">
+                <title>Subscribing to a performance counter</title>
+
+                <programlisting language="php"><![CDATA[
+/** Zend_Service_WindowsAzure_Storage_Blob */
+require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
+
+/** Zend_Service_WindowsAzure_Diagnostics_Manager */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
+
+$storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
+$manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient);
+
+$configuration = $manager->getConfigurationForCurrentRoleInstance();
+
+// Subscribe to \Processor(*)\% Processor Time
+$configuration->DataSources->PerformanceCounters->addSubscription('\Processor(*)\% Processor Time', 1);
+
+$manager->setConfigurationForCurrentRoleInstance($configuration);
+]]></programlisting>
+            </example>
+        </sect3>
+        
+        <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-roleid">
+            <title>Getting the current role instance id</title>
+
+            <para>
+                The current role instance id is defined in the server variable
+                RdRoleId. It will only be available when the application is run in
+                Development Fabric or Windows Azure Fabric.
+            </para>
+
+            <example id="zend.service.windowsazure.diagnostics.manager.api.config-roleid">
+                <title>Getting the current role instance id</title>
+
+                <programlisting language="php"><![CDATA[
+echo 'The role instance id is ' . $_SERVER['RdRoleId'];
+]]></programlisting>
+            </example>
+        </sect3>
+    </sect2>
+</sect1>

+ 27 - 28
documentation/manual/en/module_specs/Zend_Service_WindowsAzure_Queue.xml

@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Reviewed: no -->
-<sect2 id="zend.service.windowsazure.storage.queue">
+<sect1 id="zend.service.windowsazure.storage.queue">
     <title>Zend_Service_WindowsAzure_Storage_Queue</title>
 
     <para>
         The Queue service stores messages that may be read by any client who has access to the
         storage account.
     </para>
-
+    
     <para>
         A queue can contain an unlimited number of messages, each of which can be up to 8 KB in
         size. Messages are generally added to the end of the queue and retrieved from the front of
@@ -17,23 +17,22 @@
     </para>
 
     <para>
-        Queue Storage is offered by Windows Azure as a <acronym>REST</acronym>
-        <acronym>API</acronym> which is wrapped by the
-        <classname>Zend_Service_WindowsAzure_Storage_Queue</classname> class in order to
-        provide a native <acronym>PHP</acronym> interface to the storage account.
+        Queue Storage is offered by Windows Azure as a <acronym>REST</acronym> API which is wrapped
+        by the <classname>Zend_Service_WindowsAzure_Storage_Queue</classname> class in order to
+        provide a native PHP interface to the storage account.
     </para>
 
-    <sect3 id="zend.service.windowsazure.storage.queue.api">
+    <sect2 id="zend.service.windowsazure.storage.queue.api">
         <title>API Examples</title>
 
         <para>
             This topic lists some examples of using the
-            <classname>Zend_Service_WindowsAzure_Storage_Queue</classname> class. Other features
-            are available in the download package, as well as a detailed <acronym>API</acronym>
-            documentation of those features.
+            <classname>Zend_Service_WindowsAzure_Storage_Queue</classname> class.  Other features
+            are available in the download package, as well as a detailed API documentation of those
+            features.
         </para>
 
-        <sect4 id="zend.service.windowsazure.storage.queue.api.create-queue">
+        <sect3 id="zend.service.windowsazure.storage.queue.api.create-queue">
             <title>Creating a queue</title>
 
             <para>
@@ -50,9 +49,9 @@ $result = $storageClient->createQueue('testqueue');
 echo 'Queue name is: ' . $result->Name;
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.queue.api.delete-queue">
+        <sect3 id="zend.service.windowsazure.storage.queue.api.delete-queue">
             <title>Deleting a queue</title>
 
             <para>
@@ -67,9 +66,9 @@ $storageClient = new Zend_Service_WindowsAzure_Storage_Queue();
 $storageClient->deleteQueue('testqueue');
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.queue.api.storing-queue">
+        <sect3 id="zend.service.windowsazure.storage.queue.api.storing-queue">
             <title>Adding a message to a queue</title>
 
             <para>
@@ -84,12 +83,12 @@ $storageClient->deleteQueue('testqueue');
 $storageClient = new Zend_Service_WindowsAzure_Storage_Queue();
 
 // 3600 = time-to-live of the message, if omitted defaults to 7 days
-$storageClient->putMessage('testqueue', 'This is a test message', 3600);
+$storageClient->putMessage('testqueue', 'This is a test message', 3600); 
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.queue.api.read-queue">
+        <sect3 id="zend.service.windowsazure.storage.queue.api.read-queue">
             <title>Reading a message from a queue</title>
 
             <para>
@@ -111,11 +110,11 @@ foreach ($messages as $message) {
 }
 ]]></programlisting>
             </example>
-
+            
             <para>
                 The messages that are read using <methodname>getMessages()</methodname> will be
                 invisible in the queue for 30 seconds, after which the messages will re-appear in
-                the queue. To mark a message as processed and remove it from the queue, use the
+                the queue.  To mark a message as processed and remove it from the queue, use the
                 <methodname>deleteMessage()</methodname> method.
             </para>
 
@@ -136,13 +135,13 @@ foreach ($messages as $message) {
 }
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.queue.api.peek-queue">
+        <sect3 id="zend.service.windowsazure.storage.queue.api.peek-queue">
             <title>Check if there are messages in a queue</title>
 
             <para>
-                Using the following code, a queue can be checked for new messages. Note that the
+                Using the following code, a queue can be checked for new messages.  Note that the
                 queue and message have already been created before.
             </para>
 
@@ -160,13 +159,13 @@ foreach ($messages as $message) {
 }
 ]]></programlisting>
             </example>
-
+            
             <para>
                 Note that messages that are read using <methodname>peekMessages()</methodname> will
                 not become invisible in the queue, nor can they be marked as processed using the
-                <methodname>deleteMessage()</methodname> method. To do this, use
+                <methodname>deleteMessage()</methodname> method.  To do this, use
                 <methodname>getMessages()</methodname> instead.
             </para>
-        </sect4>
-    </sect3>
-</sect2>
+        </sect3>
+    </sect2>
+</sect1>

+ 79 - 92
documentation/manual/en/module_specs/Zend_Service_WindowsAzure_Table.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Reviewed: no -->
-<sect2 id="zend.service.windowsazure.storage.table">
+<sect1 id="zend.service.windowsazure.storage.table">
     <title>Zend_Service_WindowsAzure_Storage_Table</title>
 
     <para>
@@ -8,32 +8,32 @@
     </para>
 
     <para>
-        Table Storage is offered by Windows Azure as a REST <acronym>API</acronym> which is wrapped
-        by the <classname>Zend_Service_WindowsAzure_Storage_Table</classname> class in order to
-        provide a native <acronym>PHP</acronym> interface to the storage account.
+        Table Storage is offered by Windows Azure as a REST API which is wrapped by the
+        <classname>Zend_Service_WindowsAzure_Storage_Table</classname> class in order to provide a
+        native PHP interface to the storage account.
     </para>
 
     <para>
         This topic lists some examples of using the
-        <classname>Zend_Service_WindowsAzure_Storage_Table</classname> class. Other features are
-        available in the download package, as well as a detailed <acronym>API</acronym>
-        documentation of those features.
+        <classname>Zend_Service_WindowsAzure_Storage_Table</classname> class.  Other features are
+        available in the download package, as well as a detailed API documentation of those
+        features.
     </para>
 
     <para>
-        Note that development table storage (in the Windows Azure <acronym>SDK</acronym>) does not
-        support all features provided by the <acronym>API</acronym>. Therefore, the examples listed
-        on this page are to be used on Windows Azure production table storage.
+        Note that development table storage (in the Windows Azure SDK) does not support all features
+        provided by the API. Therefore, the examples listed on this page are to be used on Windows
+        Azure production table storage.
     </para>
 
-    <sect3 id="zend.service.windowsazure.storage.table.api">
+    <sect2 id="zend.service.windowsazure.storage.table.api">
         <title>Operations on tables</title>
 
         <para>
             This topic lists some samples of operations that can be executed on tables.
         </para>
 
-        <sect4 id="zend.service.windowsazure.storage.table.api.create">
+        <sect3 id="zend.service.windowsazure.storage.table.api.create">
             <title>Creating a table</title>
 
             <para>
@@ -53,9 +53,9 @@ $result = $storageClient->createTable('testtable');
 echo 'New table name is: ' . $result->Name;
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.table.api.list">
+        <sect3 id="zend.service.windowsazure.storage.table.api.list">
             <title>Listing all tables</title>
 
             <para>
@@ -76,24 +76,24 @@ foreach ($result as $table) {
 }
 ]]></programlisting>
             </example>
-        </sect4>
-    </sect3>
+        </sect3>
+    </sect2>
 
-    <sect3 id="zend.service.windowsazure.storage.table.entities">
+    <sect2 id="zend.service.windowsazure.storage.table.entities">
         <title>Operations on entities</title>
 
         <para>
-            Tables store data as collections of entities. Entities are similar to rows. An entity
+            Tables store data as collections of entities. Entities are similar to rows.  An entity
             has a primary key and a set of properties. A property is a named, typed-value pair,
             similar to a column.
         </para>
-
+        
         <para>
             The Table service does not enforce any schema for tables, so two entities in the same
             table may have different sets of properties. Developers may choose to enforce a schema
             on the client side. A table may contain any number of entities.
         </para>
-
+        
         <para>
             <classname>Zend_Service_WindowsAzure_Storage_Table</classname> provides 2 ways of
             working with entities:
@@ -127,12 +127,12 @@ class SampleEntity extends Zend_Service_WindowsAzure_Storage_TableEntity
     * @azure Name
     */
     public $Name;
-
+    
     /**
     * @azure Age Edm.Int64
     */
     public $Age;
-
+    
     /**
     * @azure Visible Edm.Boolean
     */
@@ -147,14 +147,14 @@ class SampleEntity extends Zend_Service_WindowsAzure_Storage_TableEntity
             <classname>Zend_Service_WindowsAzure_Storage_DynamicTableEntity</classname>.
         </para>
 
-        <sect4 id="zend.service.windowsazure.storage.table.entities.enforced">
+        <sect3 id="zend.service.windowsazure.storage.table.entities.enforced">
             <title>Enforced schema entities</title>
 
             <para>
                 To enforce a schema on the client side using the
                 <classname>Zend_Service_WindowsAzure_Storage_Table</classname> class, you can create
                 a class which inherits
-                <classname>Zend_Service_WindowsAzure_Storage_TableEntity</classname>. This class
+                <classname>Zend_Service_WindowsAzure_Storage_TableEntity</classname>.  This class
                 provides some basic functionality for the
                 <classname>Zend_Service_WindowsAzure_Storage_Table</classname> class to work with a
                 client-side schema.
@@ -210,12 +210,12 @@ class SampleEntity extends Zend_Service_WindowsAzure_Storage_TableEntity
      * @azure Name
      */
     public $Name;
-
+    
     /**
      * @azure Age Edm.Int64
      */
     public $Age;
-
+    
     /**
      * @azure Visible Edm.Boolean
      */
@@ -249,8 +249,7 @@ public $<property name in PHP>;
                 storage:
             </para>
 
-            <example
-                id="zend.service.windowsazure.storage.table.entities.enforced.schema-property-sample">
+            <example id="zend.service.windowsazure.storage.table.entities.enforced.schema-property-sample">
                 <title>Sample enforced property</title>
 
                 <programlisting language="php"><![CDATA[
@@ -324,19 +323,18 @@ public $Age;
                     </para>
                 </listitem>
             </itemizedlist>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.table.entities.dynamic">
+        <sect3 id="zend.service.windowsazure.storage.table.entities.dynamic">
             <title>No enforced schema entities (a.k.a. DynamicEntity)</title>
 
             <para>
                 To use the <classname>Zend_Service_WindowsAzure_Storage_Table</classname> class
                 without defining a schema, you can make use of the
                 <classname>Zend_Service_WindowsAzure_Storage_DynamicTableEntity</classname> class.
-                This class inherits
-                <classname>Zend_Service_WindowsAzure_Storage_TableEntity</classname> like an
-                enforced schema class does, but contains additional logic to make it dynamic and not
-                bound to a schema.
+                This class inherits <classname>Zend_Service_WindowsAzure_Storage_TableEntity</classname>
+                like an enforced schema class does, but contains additional logic to make it dynamic
+                and not bound to a schema.
             </para>
 
             <para>
@@ -380,10 +378,7 @@ public $Age;
             </para>
 
             <example id="zend.service.windowsazure.storage.table.entities.dynamic.schema">
-                <title>
-                    Dynamicaly adding properties
-                    Zend_Service_WindowsAzure_Storage_DynamicTableEntity
-                </title>
+                <title>Dynamicaly adding properties to Zend_Service_WindowsAzure_Storage_DynamicTableEntity</title>
 
                 <programlisting language="php"><![CDATA[
 $target = new Zend_Service_WindowsAzure_Storage_DynamicTableEntity(
@@ -398,11 +393,8 @@ $target->Age  = 25;     // Will add property "Age" of type "Edm.Int32"
                 Optionally, a property type can be enforced:
             </para>
 
-            <example
-                id="zend.service.windowsazure.storage.table.entities.dynamic.schema-forcedproperties">
-                <title>
-                    Forcing property types on Zend_Service_WindowsAzure_Storage_DynamicTableEntity
-                </title>
+            <example id="zend.service.windowsazure.storage.table.entities.dynamic.schema-forcedproperties">
+                <title>Forcing property types on Zend_Service_WindowsAzure_Storage_DynamicTableEntity</title>
 
                 <programlisting language="php"><![CDATA[
 $target = new Zend_Service_WindowsAzure_Storage_DynamicTableEntity(
@@ -412,7 +404,7 @@ $target->Name = 'Name'; // Will add property "Name" of type "Edm.String"
 $target->Age  = 25;     // Will add property "Age" of type "Edm.Int32"
 
 // Change type of property "Age" to "Edm.Int32":
-$target->setAzurePropertyType('Age', 'Edm.Int64');
+$target->setAzurePropertyType('Age', 'Edm.Int64'); 
 ]]></programlisting>
             </example>
 
@@ -422,17 +414,17 @@ $target->setAzurePropertyType('Age', 'Edm.Int64');
                 <classname>Zend_Service_WindowsAzure_Storage_TableEntity</classname> if no specific
                 class is passed into Table Storage methods.
             </para>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.table.entities.api">
+        <sect3 id="zend.service.windowsazure.storage.table.entities.api">
             <title>Entities API examples</title>
 
-            <sect5 id="zend.service.windowsazure.storage.table.entities.api.insert">
+            <sect4 id="zend.service.windowsazure.storage.table.entities.api.insert">
                 <title>Inserting an entity</title>
 
                 <para>
                     Using the following code, an entity can be inserted into a table named
-                    "testtable". Note that the table has already been created before.
+                    "testtable".  Note that the table has already been created before.
                 </para>
 
                 <example id="zend.service.windowsazure.storage.table.api.entities.insert.example">
@@ -454,18 +446,17 @@ echo 'Timestamp: ' . $result->getTimestamp() . "\n";
 echo 'Etag: ' . $result->getEtag() . "\n";
 ]]></programlisting>
                 </example>
-            </sect5>
+            </sect4>
 
-            <sect5 id="zend.service.windowsazure.storage.table.entities.api.retrieve-by-id">
+            <sect4 id="zend.service.windowsazure.storage.table.entities.api.retrieve-by-id">
                 <title>Retrieving an entity by partition key and row key</title>
 
                 <para>
                     Using the following code, an entity can be retrieved by partition key and row
-                    key. Note that the table and entity have already been created before.
+                    key.  Note that the table and entity have already been created before.
                 </para>
 
-                <example
-                    id="zend.service.windowsazure.storage.table.entities.api.retrieve-by-id.example">
+                <example id="zend.service.windowsazure.storage.table.entities.api.retrieve-by-id.example">
                     <title>Retrieving an entity by partition key and row key</title>
 
                     <programlisting language="php"><![CDATA[
@@ -477,9 +468,9 @@ $entity= $storageClient->retrieveEntityById(
 );
 ]]></programlisting>
                 </example>
-            </sect5>
+            </sect4>
 
-            <sect5 id="zend.service.windowsazure.storage.table.entities.api.updating">
+            <sect4 id="zend.service.windowsazure.storage.table.entities.api.updating">
                 <title>Updating an entity</title>
 
                 <para>
@@ -510,8 +501,7 @@ $result = $storageClient->updateEntity('testtable', $entity);
                     newer data.
                 </para>
 
-                <example
-                    id="zend.service.windowsazure.storage.table.entities.api.updating.example-etag">
+                <example id="zend.service.windowsazure.storage.table.entities.api.updating.example-etag">
                     <title>Updating an entity (with Etag check)</title>
 
                     <programlisting language="php"><![CDATA[
@@ -525,16 +515,16 @@ $entity = $storageClient->retrieveEntityById(
 $entity->Name = 'New name';
 
 // last parameter instructs the Etag check:
-$result = $storageClient->updateEntity('testtable', $entity, true);
+$result = $storageClient->updateEntity('testtable', $entity, true); 
 ]]></programlisting>
                 </example>
-            </sect5>
+            </sect4>
 
-            <sect5 id="zend.service.windowsazure.storage.table.entities.api.delete">
+            <sect4 id="zend.service.windowsazure.storage.table.entities.api.delete">
                 <title>Deleting an entity</title>
 
                 <para>
-                    Using the following code, an entity can be deleted. Note that the table and
+                    Using the following code, an entity can be deleted.  Note that the table and
                     entity have already been created before.
                 </para>
 
@@ -551,10 +541,10 @@ $entity = $storageClient->retrieveEntityById(
 $result = $storageClient->deleteEntity('testtable', $entity);
 ]]></programlisting>
                 </example>
-            </sect5>
-        </sect4>
+            </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.table.entities.querying">
+        <sect3 id="zend.service.windowsazure.storage.table.entities.querying">
             <title>Performing queries</title>
 
             <para>
@@ -579,7 +569,7 @@ $result = $storageClient->deleteEntity('testtable', $entity);
             </itemizedlist>
 
             <para>
-                Using the following code, a table can be queried using a filter condition. Note
+                Using the following code, a table can be queried using a filter condition.  Note
                 that the table and entities have already been created before.
             </para>
 
@@ -603,7 +593,7 @@ foreach ($entities as $entity) {
             </example>
 
             <para>
-                Using the following code, a table can be queried using a fluent interface. Note
+                Using the following code, a table can be queried using a fluent interface.  Note
                 that the table and entities have already been created before.
             </para>
 
@@ -628,9 +618,9 @@ foreach ($entities as $entity) {
 }
 ]]></programlisting>
             </example>
-        </sect4>
+        </sect3>
 
-        <sect4 id="zend.service.windowsazure.storage.table.entities.batch">
+        <sect3 id="zend.service.windowsazure.storage.table.entities.batch">
             <title>Batch operations</title>
 
             <para>
@@ -656,37 +646,35 @@ $storageClient = new Zend_Service_WindowsAzure_Storage_Table(
 
 // Start batch
 $batch = $storageClient->startBatch();
-
+            
 // Insert entities in batch
 $entities = generateEntities();
 foreach ($entities as $entity) {
     $storageClient->insertEntity($tableName, $entity);
 }
-
+            
 // Commit
 $batch->commit();
 ]]></programlisting>
             </example>
-        </sect4>
-    </sect3>
-
-    <sect3 id="zend.service.windowsazure.storage.table.sessionhandler">
+        </sect3>
+    </sect2>
+  
+    <sect2 id="zend.service.windowsazure.storage.table.sessionhandler">
         <title>Table storage session handler</title>
 
         <para>
-            When running a <acronym>PHP</acronym> application on the Windows Azure platform in a
-            load-balanced mode (running 2 Web Role instances or more), it is important that
-            <acronym>PHP</acronym> session data can be shared between multiple Web Role instances.
-            The Windows Azure <acronym>SDK</acronym> for <acronym>PHP</acronym> provides the
+            When running a PHP application on the Windows Azure platform in a load-balanced mode
+            (running 2 Web Role instances or more), it is important that PHP session data can be
+            shared between multiple Web Role instances. The Windows Azure SDK for PHP provides the
             <classname>Zend_Service_WindowsAzure_SessionHandler</classname> class, which uses
-            Windows Azure Table Storage as a session handler for <acronym>PHP</acronym>
-            applications.
+            Windows Azure Table Storage as a session handler for PHP applications.
         </para>
-
+        
         <para>
             To use the <classname>Zend_Service_WindowsAzure_SessionHandler</classname> session
-            handler, it should be registered as the default session handler for your
-            <acronym>PHP</acronym> application:
+            handler, it should be registered as the default session handler for your PHP
+            application:
         </para>
 
         <example id="zend.service.windowsazure.storage.table.api.sessionhandler-register">
@@ -703,20 +691,19 @@ $sessionHandler = new Zend_Service_WindowsAzure_SessionHandler(
 $sessionHandler->register();
 ]]></programlisting>
         </example>
-
+    
         <para>
             The above classname registers the
             <classname>Zend_Service_WindowsAzure_SessionHandler</classname> session handler and will
             store sessions in a table called "sessionstable".
         </para>
-
+        
         <para>
             After registration of the
             <classname>Zend_Service_WindowsAzure_SessionHandler</classname> session handler,
-            sessions can be started and used in the same way as a normal <acronym>PHP</acronym>
-            session:
+            sessions can be started and used in the same way as a normal PHP session:
         </para>
-
+        
         <example id="zend.service.windowsazure.storage.table.api.sessionhandler-usage">
             <title>Using table storage session handler</title>
 
@@ -739,13 +726,13 @@ if (!isset($_SESSION['firstVisit'])) {
 // ...
 ]]></programlisting>
         </example>
-
+    
         <warning>
             <para>
                 The <classname>Zend_Service_WindowsAzure_SessionHandler</classname> session handler
-                should be registered before a call to <methodname>session_start()</methodname>
+                should be registered before a call to <functionname>session_start()</functionname>
                 is made!
             </para>
         </warning>
-    </sect3>
-</sect2>
+    </sect2>
+</sect1>

+ 65 - 18
library/Zend/Service/WindowsAzure/Credentials/CredentialsAbstract.php

@@ -25,6 +25,11 @@
 require_once 'Zend/Http/Client.php';
 
 /**
+ * @see Zend_Service_WindowsAzure_Credentials_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Credentials/Exception.php';
+
+/**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
@@ -151,6 +156,7 @@ abstract class Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
 	 * @param boolean $forTableStorage Is the request for table storage?
 	 * @param string $resourceType Resource type
 	 * @param string $requiredPermission Required permission
+	 * @param mixed  $rawData Raw post data
 	 * @return array Array of headers
 	 */
 	abstract public function signRequestHeaders(
@@ -160,7 +166,8 @@ abstract class Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
 		$headers = null,
 		$forTableStorage = false,
 		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
+		$rawData = null
 	);
 	
 	
@@ -172,26 +179,66 @@ abstract class Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
 	 */
 	protected function _prepareQueryStringForSigning($value)
 	{
-	    // Check for 'comp='
-	    if (strpos($value, 'comp=') === false) {
-	        // If not found, no query string needed
-	        return '';
+	    // Return value
+	    $returnValue = array();
+	    
+	    // Prepare query string
+	    $queryParts = $this->_makeArrayOfQueryString($value);
+	    foreach ($queryParts as $key => $value) {
+	    	$returnValue[] = $key . '=' . $value;
+	    }
+	    
+	    // Return
+	    if (count($returnValue) > 0) {
+	    	return '?' . implode('&', $returnValue);
 	    } else {
-	        // If found, make sure it is the only parameter being used      
-    		if (strlen($value) > 0 && strpos($value, '?') === 0) {
-    			$value = substr($value, 1);
-    		}
+	    	return '';
+	    }
+	}
+	
+	/**
+	 * Make array of query string
+	 * 
+	 * @param  string $value Query string
+	 * @return array         Array of key/value pairs
+	 */
+	protected function _makeArrayOfQueryString($value)
+	{
+		// Returnvalue
+		$returnValue = array();
+		
+	    // Remove front ?     
+   		if (strlen($value) > 0 && strpos($value, '?') === 0) {
+    		$value = substr($value, 1);
+    	}
+    		
+    	// Split parts
+    	$queryParts = explode('&', $value);
+    	foreach ($queryParts as $queryPart) {
+    		$queryPart = explode('=', $queryPart, 2);
     		
-    		// Split parts
-    		$queryParts = explode('&', $value);
-    		foreach ($queryParts as $queryPart) {
-    		    if (strpos($queryPart, 'comp=') !== false) {
-    		        return '?' . $queryPart;
-    		    }
+    		if ($queryPart[0] != '') {
+    			$returnValue[ $queryPart[0] ] = isset($queryPart[1]) ? $queryPart[1] : '';
     		}
+    	}
+    	
+    	// Sort
+    	ksort($returnValue);
 
-    		// Should never happen...
-			return '';
-	    }
+    	// Return
+		return $returnValue;
+	}
+	
+	/**
+	 * Returns an array value if the key is set, otherwide returns $valueIfNotSet
+	 * 
+	 * @param array $array
+	 * @param mixed $key
+	 * @param mixed $valueIfNotSet
+	 * @return mixed
+	 */
+	protected function _issetOr($array, $key, $valueIfNotSet)
+	{
+		return isset($array[$key]) ? $array[$key] : $valueIfNotSet;
 	}
 }

+ 35 - 0
library/Zend/Service/WindowsAzure/Credentials/Exception.php

@@ -0,0 +1,35 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Exception
+ * @version    $Id$
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Exception.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_WindowsAzure_Credentials_Exception extends Zend_Service_WindowsAzure_Exception
+{}

+ 3 - 1
library/Zend/Service/WindowsAzure/Credentials/SharedAccessSignature.php

@@ -289,6 +289,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
 	 * @param boolean $forTableStorage Is the request for table storage?
 	 * @param string $resourceType Resource type
 	 * @param string $requiredPermission Required permission
+	 * @param mixed  $rawData Raw post data
 	 * @return array Array of headers
 	 */
 	public function signRequestHeaders(
@@ -298,7 +299,8 @@ class Zend_Service_WindowsAzure_Credentials_SharedAccessSignature
 		$headers = null,
 		$forTableStorage = false,
 		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
+		$rawData = null
 	) {
 	    return $headers;
 	}

+ 42 - 9
library/Zend/Service/WindowsAzure/Credentials/SharedKey.php

@@ -35,6 +35,11 @@ require_once 'Zend/Service/WindowsAzure/Storage.php';
 require_once 'Zend/Http/Client.php';
 
 /**
+ * @see Zend_Service_WindowsAzure_Credentials_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Credentials/Exception.php';
+
+/**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
@@ -69,6 +74,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKey
 	 * @param boolean $forTableStorage Is the request for table storage?
 	 * @param string $resourceType Resource type
 	 * @param string $requiredPermission Required permission
+	 * @param mixed  $rawData Raw post data
 	 * @return array Array of headers
 	 */
 	public function signRequestHeaders(
@@ -78,10 +84,16 @@ class Zend_Service_WindowsAzure_Credentials_SharedKey
 		$headers = null,
 		$forTableStorage = false,
 		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
+		$rawData = null
 	) {
 		// http://github.com/sriramk/winazurestorage/blob/214010a2f8931bac9c96dfeb337d56fe084ca63b/winazurestorage.py
 
+		// Table storage?
+		if ($forTableStorage) {
+			throw new Zend_Service_WindowsAzure_Credentials_Exception('The Windows Azure SDK for PHP does not support SharedKey authentication on table storage. Use SharedKeyLite authentication instead.');
+		}
+		
 		// Determine path
 		if ($this->_usePathStyleUri) {
 			$path = substr($path, strpos($path, '/'));
@@ -103,7 +115,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKey
 		}
 		
 		// Build canonicalized headers
-		if ($headers !== null) {
+		if (!is_null($headers)) {
 			foreach ($headers as $header => $value) {
 				if (is_bool($value)) {
 					$value = $value === true ? 'True' : 'False';
@@ -124,17 +136,38 @@ class Zend_Service_WindowsAzure_Credentials_SharedKey
 		}
 		$canonicalizedResource .= $path;
 		if ($queryString !== '') {
-		    $canonicalizedResource .= $queryString;
+		    $queryStringItems = $this->_makeArrayOfQueryString($queryString);
+		    foreach ($queryStringItems as $key => $value) {
+		    	$canonicalizedResource .= "\n" . strtolower($key) . ':' . $value;
+		    }
+		}
+		
+		// Content-Length header
+		$contentLength = '';
+		if (strtoupper($httpVerb) != Zend_Http_Client::GET
+			 && strtoupper($httpVerb) != Zend_Http_Client::DELETE
+			 && strtoupper($httpVerb) != Zend_Http_Client::HEAD) {
+			$contentLength = 0;
+			
+			if (!is_null($rawData)) {
+				$contentLength = strlen($rawData);
+			}
 		}
 
 		// Create string to sign   
 		$stringToSign   = array();
-		$stringToSign[] = strtoupper($httpVerb); 	// VERB
-    	$stringToSign[] = "";						// Content-MD5
-    	$stringToSign[] = "";						// Content-Type
-    	$stringToSign[] = "";
-        // Date already in $canonicalizedHeaders
-    	// $stringToSign[] = self::PREFIX_STORAGE_HEADER . 'date:' . $requestDate; // Date
+		$stringToSign[] = strtoupper($httpVerb); 									// VERB
+    	$stringToSign[] = $this->_issetOr($headers, 'Content-Encoding', '');		// Content-Encoding
+    	$stringToSign[] = $this->_issetOr($headers, 'Content-Language', '');		// Content-Language
+    	$stringToSign[] = $contentLength; 											// Content-Length
+    	$stringToSign[] = $this->_issetOr($headers, 'Content-MD5', '');				// Content-MD5
+    	$stringToSign[] = $this->_issetOr($headers, 'Content-Type', '');			// Content-Type
+    	$stringToSign[] = "";														// Date
+    	$stringToSign[] = $this->_issetOr($headers, 'If-Modified-Since', '');		// If-Modified-Since
+    	$stringToSign[] = $this->_issetOr($headers, 'If-Match', '');				// If-Match
+    	$stringToSign[] = $this->_issetOr($headers, 'If-None-Match', '');			// If-None-Match
+    	$stringToSign[] = $this->_issetOr($headers, 'If-Unmodified-Since', '');		// If-Unmodified-Since
+    	$stringToSign[] = $this->_issetOr($headers, 'Range', '');					// Range
     	
     	if (!$forTableStorage && count($canonicalizedHeaders) > 0) {
     		$stringToSign[] = implode("\n", $canonicalizedHeaders); // Canonicalized headers

+ 44 - 1
library/Zend/Service/WindowsAzure/Credentials/SharedKeyLite.php

@@ -35,6 +35,11 @@ require_once 'Zend/Service/WindowsAzure/Storage.php';
 require_once 'Zend/Service/WindowsAzure/Credentials/SharedKey.php';
 
 /**
+ * @see Zend_Service_WindowsAzure_Credentials_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Credentials/Exception.php';
+
+/**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
@@ -69,6 +74,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLite
 	 * @param boolean $forTableStorage Is the request for table storage?
 	 * @param string $resourceType Resource type
 	 * @param string $requiredPermission Required permission
+	 * @param mixed  $rawData Raw post data
 	 * @return array Array of headers
 	 */
 	public function signRequestHeaders(
@@ -78,8 +84,14 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLite
 		$headers = null,
 		$forTableStorage = false,
 		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
-		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ,
+		$rawData = null
 	) {
+		// Table storage?
+		if (!$forTableStorage) {
+			throw new Zend_Service_WindowsAzure_Credentials_Exception('The Windows Azure SDK for PHP does not support SharedKeyLite authentication on blob or queue storage. Use SharedKey authentication instead.');
+		}
+		
 		// Determine path
 		if ($this->_usePathStyleUri) {
 			$path = substr($path, strpos($path, '/'));
@@ -120,4 +132,35 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLite
     	// Return headers
     	return $headers;
 	}
+	
+	/**
+	 * Prepare query string for signing
+	 * 
+	 * @param  string $value Original query string
+	 * @return string        Query string for signing
+	 */
+	protected function _prepareQueryStringForSigning($value)
+	{
+	    // Check for 'comp='
+	    if (strpos($value, 'comp=') === false) {
+	        // If not found, no query string needed
+	        return '';
+	    } else {
+	        // If found, make sure it is the only parameter being used      
+    		if (strlen($value) > 0 && strpos($value, '?') === 0) {
+    			$value = substr($value, 1);
+    		}
+    		
+    		// Split parts
+    		$queryParts = explode('&', $value);
+    		foreach ($queryParts as $queryPart) {
+    		    if (strpos($queryPart, 'comp=') !== false) {
+    		        return '?' . $queryPart;
+    		    }
+    		}
+
+    		// Should never happen...
+			return '';
+	    }
+	}
 }

+ 91 - 0
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDataSources.php

@@ -0,0 +1,91 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationLogs.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationDiagnosticInfrastructureLogs.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationPerformanceCounters.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationWindowsEventLog.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationDirectories.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property	int																				OverallQuotaInMB				Overall quota in MB
+ * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs							Logs							Logs
+ * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs	DiagnosticInfrastructureLogs	Diagnostic infrastructure logs
+ * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters				PerformanceCounters				Performance counters
+ * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog					WindowsEventLog					Windows Event Log
+ * @property	Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories						Directories						Directories
+ */
+class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Constructor
+     * 
+	 * @param	int	$overallQuotaInMB				Overall quota in MB
+	 */
+    public function __construct($overallQuotaInMB = 0) 
+    {	        
+        $this->_data = array(
+            'overallquotainmb'        		=> $overallQuotaInMB,
+            'logs'             				=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs(),
+            'diagnosticinfrastructurelogs'  => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs(),
+            'performancecounters'     		=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters(),
+            'windowseventlog'              	=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog(),
+            'directories'             		=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories()
+        );
+    }
+}

+ 67 - 0
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDiagnosticInfrastructureLogs.php

@@ -0,0 +1,67 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_LogLevel
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property	int		BufferQuotaInMB						Buffer quota in MB
+ * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+ * @property	string	ScheduledTransferLogLevelFilter		Scheduled transfer log level filter
+ */
+class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Constructor
+     * 
+	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
+	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+	 * @param	string	$scheduledTransferLogLevelFilter	Scheduled transfer log level filter
+	 */
+    public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED) 
+    {	        
+        $this->_data = array(
+            'bufferquotainmb'        			=> $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
+            'scheduledtransferloglevelfilter'	=> $scheduledTransferLogLevelFilter
+        );
+    }
+}

+ 90 - 0
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationDirectories.php

@@ -0,0 +1,90 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/DirectoryConfigurationSubscription.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property	int		BufferQuotaInMB						Buffer quota in MB
+ * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+ * @property	array	Subscriptions						Subscriptions
+ */
+class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Constructor
+     * 
+	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
+	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+	 */
+    public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0) 
+    {	        
+        $this->_data = array(
+            'bufferquotainmb'        			=> $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
+        	'subscriptions'						=> array()
+        );
+    }
+    
+	/**
+	 * Add subscription
+	 * 
+	 * @param	string	$path					Path
+	 * @param	string	$container				Container
+	 * @param	int		$directoryQuotaInMB		Directory quota in MB
+	 */
+    public function addSubscription($path, $container, $directoryQuotaInMB = 1024)
+    {
+    	$this->_data['subscriptions'][$path] = new Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription($path, $container, $directoryQuotaInMB);
+    }
+    
+	/**
+	 * Remove subscription
+	 * 
+	 * @param	string	$path					Path
+	 */
+    public function removeSubscription($path)
+    {
+    	if (isset($this->_data['subscriptions'][$path])) {
+    		unset($this->_data['subscriptions'][$path]);
+    	}
+    }
+}

+ 220 - 0
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationInstance.php

@@ -0,0 +1,220 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationDataSources.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources	DataSources	Data sources
+ */
+class Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+	/**
+	 * Constructor
+	 */
+	public function __construct()
+	{
+        $this->_data = array(
+            'datasources'	=> new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources()
+        );
+	}
+
+	/**
+	 * Load configuration XML
+	 * 
+	 * @param string $configurationXml Configuration XML
+	 */
+	public function loadXml($configurationXml)
+	{
+		// Convert to SimpleXMLElement
+		$configurationXml = simplexml_load_string($configurationXml);
+	
+		// Assign general settings
+		$this->DataSources->OverallQuotaInMB = (int)$configurationXml->DataSources->OverallQuotaInMB;
+
+		// Assign Logs settings	
+		$this->DataSources->Logs->BufferQuotaInMB = (int)$configurationXml->DataSources->Logs->BufferQuotaInMB;
+		$this->DataSources->Logs->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->Logs->ScheduledTransferPeriodInMinutes;
+		$this->DataSources->Logs->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->Logs->ScheduledTransferLogLevelFilter;
+
+		// Assign DiagnosticInfrastructureLogs settings
+		$this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB = (int)$configurationXml->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB;
+		$this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes;
+		$this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter;
+
+		// Assign PerformanceCounters settings
+		$this->DataSources->PerformanceCounters->BufferQuotaInMB = (int)$configurationXml->DataSources->PerformanceCounters->BufferQuotaInMB;
+		$this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes;
+		if ($configurationXml->DataSources->PerformanceCounters->Subscriptions
+			&& $configurationXml->DataSources->PerformanceCounters->Subscriptions->PerformanceCounterConfiguration) {
+			$subscriptions = $configurationXml->DataSources->PerformanceCounters->Subscriptions;
+			if (count($subscriptions->PerformanceCounterConfiguration) > 1) {
+				$subscriptions = $subscriptions->PerformanceCounterConfiguration;
+			} else {
+				$subscriptions = array($subscriptions->PerformanceCounterConfiguration);
+			}
+			foreach ($subscriptions as $subscription) {
+				$this->DataSources->PerformanceCounters->addSubscription((string)$subscription->CounterSpecifier, (int)$subscription->SampleRateInSeconds);
+			}
+		}
+				
+		// Assign WindowsEventLog settings
+		$this->DataSources->WindowsEventLog->BufferQuotaInMB = (int)$configurationXml->DataSources->WindowsEventLog->BufferQuotaInMB;
+		$this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes;
+		$this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter;
+		if ($configurationXml->DataSources->WindowsEventLog->Subscriptions
+			&& $configurationXml->DataSources->WindowsEventLog->Subscriptions->string) {
+			$subscriptions = $configurationXml->DataSources->WindowsEventLog->Subscriptions;
+			if (count($subscriptions->string) > 1) {
+				$subscriptions = $subscriptions->string;
+			} else {
+				$subscriptions = array($subscriptions->string);
+			}
+			foreach ($subscriptions as $subscription) {
+				$this->DataSources->WindowsEventLog->addSubscription((string)$subscription);
+			}
+		}
+		
+		// Assign Directories settings
+		$this->DataSources->Directories->BufferQuotaInMB = (int)$configurationXml->DataSources->Directories->BufferQuotaInMB;
+		$this->DataSources->Directories->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->Directories->ScheduledTransferPeriodInMinutes;
+		if ($configurationXml->DataSources->Directories->Subscriptions
+			&& $configurationXml->DataSources->Directories->Subscriptions->DirectoryConfiguration) {
+			$subscriptions = $configurationXml->DataSources->WindowsEventLog->Subscriptions;
+			if (count($subscriptions->DirectoryConfiguration) > 1) {
+				$subscriptions = $subscriptions->DirectoryConfiguration;
+			} else {
+				$subscriptions = array($subscriptions->DirectoryConfiguration);
+			}
+			foreach ($subscriptions as $subscription) {
+				$this->DataSources->Directories->addSubscription((string)$subscription->Path, (string)$subscription->Container, (int)$subscription->DirectoryQuotaInMB);
+			}
+		}
+	}
+	
+	/**
+	 * Create configuration XML
+	 * 
+	 * @return string
+	 */
+	public function toXml()
+	{
+		// Return value
+		$returnValue = array();
+		
+		// Build XML
+		$returnValue[] = '<?xml version="1.0"?>';
+		$returnValue[] = '<ConfigRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">';
+		
+		// Add data sources
+		$returnValue[] = '  <DataSources>';
+		
+		$returnValue[] = '    <OverallQuotaInMB>' . $this->DataSources->OverallQuotaInMB . '</OverallQuotaInMB>';
+		
+		$returnValue[] = '    <Logs>';
+		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->Logs->BufferQuotaInMB . '</BufferQuotaInMB>';
+		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->Logs->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+		$returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->Logs->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
+		$returnValue[] = '    </Logs>';
+		
+		$returnValue[] = '    <DiagnosticInfrastructureLogs>';
+		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB . '</BufferQuotaInMB>';
+		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+		$returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
+		$returnValue[] = '    </DiagnosticInfrastructureLogs>';
+		
+		$returnValue[] = '    <PerformanceCounters>';
+		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->PerformanceCounters->BufferQuotaInMB . '</BufferQuotaInMB>';
+		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+		if (count($this->DataSources->PerformanceCounters->Subscriptions) == 0) {
+			$returnValue[] = '      <Subscriptions />';
+		} else {
+			$returnValue[] = '      <Subscriptions>';
+			foreach ($this->DataSources->PerformanceCounters->Subscriptions as $subscription) {
+				$returnValue[] = '        <PerformanceCounterConfiguration>';
+				$returnValue[] = '          <CounterSpecifier>' . $subscription->CounterSpecifier . '</CounterSpecifier>';
+				$returnValue[] = '          <SampleRateInSeconds>' . $subscription->SampleRateInSeconds . '</SampleRateInSeconds>';
+				$returnValue[] = '        </PerformanceCounterConfiguration>';
+			}
+			$returnValue[] = '      </Subscriptions>';
+		}
+		$returnValue[] = '    </PerformanceCounters>';
+		
+		$returnValue[] = '    <WindowsEventLog>';
+		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->WindowsEventLog->BufferQuotaInMB . '</BufferQuotaInMB>';
+		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+			if (count($this->DataSources->WindowsEventLog->Subscriptions) == 0) {
+			$returnValue[] = '      <Subscriptions />';
+		} else {
+			$returnValue[] = '      <Subscriptions>';
+			foreach ($this->DataSources->WindowsEventLog->Subscriptions as $subscription) {
+				$returnValue[] = '      <string>' . $subscription . '</string>';
+			}
+			$returnValue[] = '      </Subscriptions>';
+		}
+		$returnValue[] = '      <ScheduledTransferLogLevelFilter>' . $this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
+		$returnValue[] = '    </WindowsEventLog>';
+		
+		$returnValue[] = '    <Directories>';
+		$returnValue[] = '      <BufferQuotaInMB>' . $this->DataSources->Directories->BufferQuotaInMB . '</BufferQuotaInMB>';
+		$returnValue[] = '      <ScheduledTransferPeriodInMinutes>' . $this->DataSources->Directories->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
+		if (count($this->DataSources->Directories->Subscriptions) == 0) {
+			$returnValue[] = '      <Subscriptions />';
+		} else {
+			$returnValue[] = '      <Subscriptions>';
+			foreach ($this->DataSources->Directories->Subscriptions as $subscription) {
+				$returnValue[] = '        <DirectoryConfiguration>';
+				$returnValue[] = '          <Path>' . $subscription->Path . '</Path>';
+				$returnValue[] = '          <Container>' . $subscription->Container . '</Container>';
+				$returnValue[] = '          <DirectoryQuotaInMB>' . $subscription->DirectoryQuotaInMB . '</DirectoryQuotaInMB>';
+				$returnValue[] = '        </DirectoryConfiguration>';
+			}
+			$returnValue[] = '      </Subscriptions>';
+		}
+		$returnValue[] = '    </Directories>';
+		
+		$returnValue[] = '  </DataSources>';
+		$returnValue[] = '</ConfigRequest>';
+		
+		// Return
+		return implode("\r\n", $returnValue);
+	}
+}

+ 67 - 0
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationLogs.php

@@ -0,0 +1,67 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_LogLevel
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property	int		BufferQuotaInMB						Buffer quota in MB
+ * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+ * @property	string	ScheduledTransferLogLevelFilter		Scheduled transfer log level filter
+ */
+class Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Constructor
+     * 
+	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
+	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+	 * @param	string	$scheduledTransferLogLevelFilter	Scheduled transfer log level filter
+	 */
+    public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED) 
+    {	        
+        $this->_data = array(
+            'bufferquotainmb'        			=> $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
+            'scheduledtransferloglevelfilter'	=> $scheduledTransferLogLevelFilter
+        );
+    }
+}

+ 71 - 0
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php

@@ -0,0 +1,71 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+abstract class Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Data
+     * 
+     * @var array
+     */
+    protected $_data = null;
+    
+    /**
+     * Magic overload for setting properties
+     * 
+     * @param string $name     Name of the property
+     * @param string $value    Value to set
+     */
+    public function __set($name, $value) {
+        if (array_key_exists(strtolower($name), $this->_data)) {
+            $this->_data[strtolower($name)] = $value;
+            return;
+        }
+
+        throw new Zend_Service_WindowsAzure_Diagnostics_Exception("Unknown property: " . $name);
+    }
+
+    /**
+     * Magic overload for getting properties
+     * 
+     * @param string $name     Name of the property
+     */
+    public function __get($name) {
+        if (array_key_exists(strtolower($name), $this->_data)) {
+            return $this->_data[strtolower($name)];
+        }
+
+        throw new Zend_Service_WindowsAzure_Diagnostics_Exception("Unknown property: " . $name);
+    }
+}

+ 89 - 0
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationPerformanceCounters.php

@@ -0,0 +1,89 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/PerformanceCounterSubscription.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property	int		BufferQuotaInMB						Buffer quota in MB
+ * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+ * @property	array	Subscriptions						Subscriptions
+ */
+class Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Constructor
+     * 
+	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
+	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+	 */
+    public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0) 
+    {	        
+        $this->_data = array(
+            'bufferquotainmb'        			=> $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
+        	'subscriptions'						=> array()
+        );
+    }
+    
+	/**
+	 * Add subscription
+	 * 
+ 	 * @param	string	$counterSpecifier					Counter specifier
+ 	 * @param	int		$sampleRateInSeconds				Sample rate in seconds
+	 */
+    public function addSubscription($counterSpecifier, $sampleRateInSeconds = 1)
+    {
+    	$this->_data['subscriptions'][$counterSpecifier] = new Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription($counterSpecifier, $sampleRateInSeconds);
+    }
+    
+	/**
+	 * Remove subscription
+	 * 
+ 	 * @param	string	$counterSpecifier					Counter specifier
+	 */
+    public function removeSubscription($counterSpecifier)
+    {
+    	if (isset($this->_data['subscriptions'][$counterSpecifier])) {
+    		unset($this->_data['subscriptions'][$counterSpecifier]);
+    	}
+    }
+}

+ 91 - 0
library/Zend/Service/WindowsAzure/Diagnostics/ConfigurationWindowsEventLog.php

@@ -0,0 +1,91 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_LogLevel
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property	int		BufferQuotaInMB						Buffer quota in MB
+ * @property	int		ScheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+ * @property	string	ScheduledTransferLogLevelFilter		Scheduled transfer log level filter
+ * @property	array	Subscriptions						Subscriptions
+ */
+class Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Constructor
+     * 
+	 * @param	int		$bufferQuotaInMB					Buffer quota in MB
+	 * @param	int		$scheduledTransferPeriodInMinutes	Scheduled transfer period in minutes
+	 * @param	string	$scheduledTransferLogLevelFilter	Scheduled transfer log level filter
+	 */
+    public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED) 
+    {	        
+        $this->_data = array(
+            'bufferquotainmb'        			=> $bufferQuotaInMB,
+            'scheduledtransferperiodinminutes' 	=> $scheduledTransferPeriodInMinutes,
+            'scheduledtransferloglevelfilter'	=> $scheduledTransferLogLevelFilter,
+        	'subscriptions'						=> array()
+        );
+    }
+    
+	/**
+	 * Add subscription
+	 * 
+ 	 * @param	string	$filter	Event log filter
+	 */
+    public function addSubscription($filter)
+    {
+    	$this->_data['subscriptions'][$filter] = $filter;
+    }
+    
+	/**
+	 * Remove subscription
+	 * 
+ 	 * @param	string	$filter	Event log filter
+	 */
+    public function removeSubscription($filter)
+    {
+    	if (isset($this->_data['subscriptions'][$filter])) {
+    		unset($this->_data['subscriptions'][$filter]);
+    	}
+    }
+}

+ 62 - 0
library/Zend/Service/WindowsAzure/Diagnostics/DirectoryConfigurationSubscription.php

@@ -0,0 +1,62 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property	string	Path					Path
+ * @property	string	Container				Container
+ * @property	int		DirectoryQuotaInMB		Directory quota in MB
+ */
+class Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Constructor
+     * 
+	 * @param	string	$path					Path
+	 * @param	string	$container				Container
+	 * @param	int		$directoryQuotaInMB		Directory quota in MB
+	 */
+    public function __construct($path, $container, $directoryQuotaInMB = 1024) 
+    {	        
+        $this->_data = array(
+            'path'      			=> $path,
+            'container' 			=> $container,
+        	'directoryquotainmb' 	=> $directoryQuotaInMB
+        );
+    }
+}

+ 38 - 0
library/Zend/Service/WindowsAzure/Diagnostics/Exception.php

@@ -0,0 +1,38 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Exception.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_WindowsAzure_Diagnostics_Exception
+	extends Zend_Service_WindowsAzure_Exception
+{
+}

+ 39 - 0
library/Zend/Service/WindowsAzure/Diagnostics/LogLevel.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_WindowsAzure_Diagnostics_LogLevel
+{
+	const UNDEFINED 	= 'Undefined';
+	const CRITICAL 		= 'Critical';
+	const ERROR 		= 'Error';
+	const WARNING 		= 'Warning';
+	const INFORMATION 	= 'Information';
+	const VERBOSE 		= 'Verbose';
+}

+ 191 - 0
library/Zend/Service/WindowsAzure/Diagnostics/Manager.php

@@ -0,0 +1,191 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Storage_Blob
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationInstance.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_WindowsAzure_Diagnostics_Manager
+{
+	/**
+	 * Blob storage client
+	 * 
+	 * @var Zend_Service_WindowsAzure_Storage_Blob
+	 */
+	protected $_blobStorageClient = null;
+	
+	/**
+	 * Control container name
+	 * 
+	 * @var string
+	 */
+	protected $_controlContainer = '';
+
+	/**
+	 * Create a new instance of Zend_Service_WindowsAzure_Diagnostics_Manager
+	 * 
+	 * @param Zend_Service_WindowsAzure_Storage_Blob $blobStorageClient Blob storage client
+	 * @param string $controlContainer Control container name
+	 */
+	public function __construct(Zend_Service_WindowsAzure_Storage_Blob $blobStorageClient = null, $controlContainer = 'wad-control-container')
+	{
+		$this->_blobStorageClient = $blobStorageClient;
+		$this->_controlContainer = $controlContainer;
+
+		$this->_ensureStorageInitialized();
+	}
+
+	/**
+	 * Ensure storage has been initialized
+	 */
+	protected function _ensureStorageInitialized()
+	{
+		if (!$this->_blobStorageClient->containerExists($this->_controlContainer)) {
+			$this->_blobStorageClient->createContainer($this->_controlContainer);
+		}
+	}
+	
+	/**
+	 * Get default configuration values
+	 * 
+	 * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
+	 */
+	public function getDefaultConfiguration()
+	{
+		return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
+	}
+	
+	/**
+	 * Checks if a configuration for a specific role instance exists.
+	 * 
+	 * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
+	 * @return boolean
+	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+	 */
+	public function configurationForRoleInstanceExists($roleInstance = null)
+	{
+		if (is_null($roleInstance)) {
+			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
+		}
+
+		return $this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance);
+	}
+	
+	/**
+	 * Checks if a configuration for current role instance exists. Only works on Development Fabric or Windows Azure Fabric.
+	 * 
+	 * @return boolean
+	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+	 */
+	public function configurationForCurrentRoleInstanceExists()
+	{
+		if (!isset($_SERVER['RdRoleId'])) {
+			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
+		}
+
+		return $this->_blobStorageClient->blobExists($this->_controlContainer, $_SERVER['RdRoleId']);
+	}
+	
+	/**
+	 * Get configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
+	 * 
+	 * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
+	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+	 */
+	public function getConfigurationForCurrentRoleInstance()
+	{
+		if (!isset($_SERVER['RdRoleId'])) {
+			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
+		}
+		return $this->getConfigurationForRoleInstance($_SERVER['RdRoleId']);
+	}
+	
+	/**
+	 * Set configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
+	 * 
+	 * @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
+	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+	 */
+	public function setConfigurationForCurrentRoleInstance(Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration)
+	{
+		if (!isset($_SERVER['RdRoleId'])) {
+			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
+		}
+		$this->setConfigurationForRoleInstance($_SERVER['RdRoleId'], $configuration);
+	}
+	
+	/**
+	 * Get configuration for a specific role instance
+	 * 
+	 * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
+	 * @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
+	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+	 */
+	public function getConfigurationForRoleInstance($roleInstance = null)
+	{
+		if (is_null($roleInstance)) {
+			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
+		}
+
+		if ($this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance)) {
+			$configurationInstance = new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
+			$configurationInstance->loadXml( $this->_blobStorageClient->getBlobData($this->_controlContainer, $roleInstance) );
+			return $configurationInstance;
+		}
+
+		return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
+	}
+	
+	/**
+	 * Set configuration for a specific role instance
+	 * 
+	 * @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
+	 * @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
+	 * @throws Zend_Service_WindowsAzure_Diagnostics_Exception
+	 */
+	public function setConfigurationForRoleInstance($roleInstance = null, Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration)
+	{
+		if (is_null($roleInstance)) {
+			throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
+		}
+
+		$this->_blobStorageClient->putBlobData($this->_controlContainer, $roleInstance, $configuration->toXml(), array(), null, array('Content-Type' => 'text/xml'));
+	}
+}

+ 59 - 0
library/Zend/Service/WindowsAzure/Diagnostics/PerformanceCounterSubscription.php

@@ -0,0 +1,59 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Diagnostics
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ *
+ * @property	string	CounterSpecifier					Counter specifier
+ * @property	int		SampleRateInSeconds					Sample rate in seconds
+ */
+class Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription
+	extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
+{
+    /**
+     * Constructor
+     * 
+ 	 * @param	string	$counterSpecifier					Counter specifier
+ 	 * @param	int		$sampleRateInSeconds				Sample rate in seconds
+	 */
+    public function __construct($counterSpecifier, $sampleRateInSeconds = 1) 
+    {	        
+        $this->_data = array(
+            'counterspecifier'      => $counterSpecifier,
+            'samplerateinseconds' 	=> $sampleRateInSeconds
+        );
+    }
+}

+ 69 - 13
library/Zend/Service/WindowsAzure/Storage.php

@@ -84,11 +84,18 @@ class Zend_Service_WindowsAzure_Storage
 	const RESOURCE_QUEUE       = "q";
 	
 	/**
+	 * HTTP header prefixes
+	 */
+	const PREFIX_PROPERTIES      = "x-ms-prop-";
+	const PREFIX_METADATA        = "x-ms-meta-";
+	const PREFIX_STORAGE_HEADER  = "x-ms-";
+	
+	/**
 	 * Current API version
 	 * 
 	 * @var string
 	 */
-	protected $_apiVersion = '2009-04-14';
+	protected $_apiVersion = '2009-09-19';
 	
 	/**
 	 * Storage host name
@@ -198,13 +205,13 @@ class Zend_Service_WindowsAzure_Storage
 			$this->_usePathStyleUri = true;
 		}
 		
-		if ($this->_credentials === null) {
+		if (is_null($this->_credentials)) {
 		    $this->_credentials = new Zend_Service_WindowsAzure_Credentials_SharedKey(
 		    	$this->_accountName, $this->_accountKey, $this->_usePathStyleUri);
 		}
 		
 		$this->_retryPolicy = $retryPolicy;
-		if ($this->_retryPolicy === null) {
+		if (is_null($this->_retryPolicy)) {
 		    $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
 		}
 		
@@ -240,7 +247,7 @@ class Zend_Service_WindowsAzure_Storage
 	public function setRetryPolicy(Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
 	{
 		$this->_retryPolicy = $retryPolicy;
-		if ($this->_retryPolicy === null) {
+		if (is_null($this->_retryPolicy)) {
 		    $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
 		}
 	}
@@ -262,9 +269,7 @@ class Zend_Service_WindowsAzure_Storage
 	    
 	    if ($this->_useProxy) {
 	    	$credentials = explode(':', $this->_proxyCredentials);
-	    	if(!isset($credentials[1])) {
-	    	    $credentials[1] = '';
-	    	}
+	    	
 	    	$this->_httpClientChannel->setConfig(array(
 				'proxy_host' => $this->_proxyUrl,
 	    		'proxy_port' => $this->_proxyPort,
@@ -357,7 +362,7 @@ class Zend_Service_WindowsAzure_Storage
 		}
 			
 		// Clean headers
-		if ($headers === null) {
+		if (is_null($headers)) {
 		    $headers = array();
 		}
 		
@@ -380,14 +385,14 @@ class Zend_Service_WindowsAzure_Storage
 		$requestUrl     = $this->_credentials
 						  ->signRequestUrl($this->getBaseUrl() . $path . $queryString, $resourceType, $requiredPermission);
 		$requestHeaders = $this->_credentials
-						  ->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission);
+						  ->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission, $rawData);
 
 		// Prepare request
 		$this->_httpClientChannel->resetParameters(true);
 		$this->_httpClientChannel->setUri($requestUrl);
 		$this->_httpClientChannel->setHeaders($requestHeaders);
 		$this->_httpClientChannel->setRawData($rawData);
-		
+				
 		// Execute request
 		$response = $this->_retryPolicy->execute(
 		    array($this->_httpClientChannel, 'request'),
@@ -406,7 +411,7 @@ class Zend_Service_WindowsAzure_Storage
 	 */
 	protected function _parseResponse(Zend_Http_Response $response = null)
 	{
-		if ($response === null) {
+		if (is_null($response)) {
 			throw new Zend_Service_WindowsAzure_Exception('Response should not be null.');
 		}
 		
@@ -446,13 +451,18 @@ class Zend_Service_WindowsAzure_Storage
 			if (strpos($value, "\r") !== false || strpos($value, "\n") !== false) {
 				throw new Zend_Service_WindowsAzure_Exception('Metadata cannot contain newline characters.');
 			}
+			
+			if (!self::isValidMetadataName($key)) {
+		    	throw new Zend_Service_WindowsAzure_Exception('Metadata name does not adhere to metadata naming conventions. See http://msdn.microsoft.com/en-us/library/aa664670(VS.71).aspx for more information.');
+			}
+			
 		    $headers["x-ms-meta-" . strtolower($key)] = $value;
 		}
 		return $headers;
 	}
 	
 	/**
-	 * Parse metadata errors
+	 * Parse metadata headers
 	 * 
 	 * @param array $headers HTTP headers containing metadata
 	 * @return array
@@ -475,6 +485,22 @@ class Zend_Service_WindowsAzure_Storage
 	}
 	
 	/**
+	 * Parse metadata XML
+	 * 
+	 * @param SimpleXMLElement $parentElement Element containing the Metadata element.
+	 * @return array
+	 */
+	protected function _parseMetadataElement($element = null)
+	{
+		// Metadata present?
+		if (!is_null($element) && isset($element->Metadata) && !is_null($element->Metadata)) {
+			return get_object_vars($element->Metadata);
+		}
+
+		return array();
+	}
+	
+	/**
 	 * Generate ISO 8601 compliant date string in UTC time zone
 	 * 
 	 * @param int $timestamp
@@ -485,7 +511,7 @@ class Zend_Service_WindowsAzure_Storage
 	    $tz = @date_default_timezone_get();
 	    @date_default_timezone_set('UTC');
 	    
-	    if ($timestamp === null) {
+	    if (is_null($timestamp)) {
 	        $timestamp = time();
 	    }
 	        
@@ -504,4 +530,34 @@ class Zend_Service_WindowsAzure_Storage
 	{
 	    return str_replace(' ', '%20', $value);
 	}
+	
+	/**
+	 * Is valid metadata name?
+	 *
+	 * @param string $metadataName Metadata name
+	 * @return boolean
+	 */
+    public static function isValidMetadataName($metadataName = '')
+    {
+        if (preg_match("/^[a-zA-Z0-9_@][a-zA-Z0-9_]*$/", $metadataName) === 0) {
+            return false;
+        }
+    
+        if ($metadataName == '') {
+            return false;
+        }
+
+        return true;
+    }
+    
+    /**
+     * Builds a query string from an array of elements
+     * 
+     * @param array     Array of elements
+     * @return string   Assembled query string
+     */
+    public static function createQueryStringFromArray($queryString)
+    {
+    	return count($queryString) > 0 ? '?' . implode('&', $queryString) : '';
+    }	
 }

+ 2 - 2
library/Zend/Service/WindowsAzure/Storage/Batch.php

@@ -149,7 +149,7 @@ class Zend_Service_WindowsAzure_Storage_Batch
 		}
 			
 		// Clean headers
-		if ($headers === null) {
+		if (is_null($headers)) {
 		    $headers = array();
 		}
 		    
@@ -161,7 +161,7 @@ class Zend_Service_WindowsAzure_Storage_Batch
 		$requestUrl     = $this->getBaseUrl() . $path . $queryString;
 		
 		// Generate $rawData
-		if ($rawData === null) {
+		if (is_null($rawData)) {
 		    $rawData = '';
 		}
 		    

+ 6 - 2
library/Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php

@@ -75,7 +75,7 @@ abstract class Zend_Service_WindowsAzure_Storage_BatchStorageAbstract
      */
     public function setCurrentBatch(Zend_Service_WindowsAzure_Storage_Batch $batch = null)
     {
-        if ($batch !== null && $this->isInBatch()) {
+        if (!is_null($batch) && $this->isInBatch()) {
             throw new Zend_Service_WindowsAzure_Exception('Only one batch can be active at a time.');
         }
         $this->_currentBatch = $batch;
@@ -98,7 +98,7 @@ abstract class Zend_Service_WindowsAzure_Storage_BatchStorageAbstract
      */
     public function isInBatch()
     {
-        return $this->_currentBatch !== null;
+        return !is_null($this->_currentBatch);
     }
     
     /**
@@ -134,6 +134,10 @@ abstract class Zend_Service_WindowsAzure_Storage_BatchStorageAbstract
 		// Add version header
 		$headers['x-ms-version'] = $this->_apiVersion;
 		
+		// Add dataservice headers
+		$headers['DataServiceVersion'] = '1.0;NetFx';
+		$headers['MaxDataServiceVersion'] = '1.0;NetFx';
+		
 		// Add content-type header
 		$headers['Content-Type'] = 'multipart/mixed; boundary=' . $batchBoundary;
 

File diff suppressed because it is too large
+ 366 - 256
library/Zend/Service/WindowsAzure/Storage/Blob.php


+ 3 - 3
library/Zend/Service/WindowsAzure/Storage/Blob/Stream.php

@@ -90,7 +90,7 @@ class Zend_Service_WindowsAzure_Storage_Blob_Stream
      */
     protected function _getStorageClient($path = '')
     {
-        if ($this->_storageClient === null) {
+        if (is_null($this->_storageClient)) {
             $url = explode(':', $path);
             if (!$url) {
                 throw new Zend_Service_WindowsAzure_Exception('Could not parse path "' . $path . '".');
@@ -371,7 +371,7 @@ class Zend_Service_WindowsAzure_Storage_Blob_Stream
         } catch (Zend_Service_WindowsAzure_Exception $ex) {
             // Unexisting file...
         }
-        if ($info !== null) {
+        if (!is_null($info)) {
             $stat['size']  = $info->Size;
             $stat['atime'] = time();
         }     
@@ -456,7 +456,7 @@ class Zend_Service_WindowsAzure_Storage_Blob_Stream
         } catch (Zend_Service_WindowsAzure_Exception $ex) {
             // Unexisting file...
         }
-        if ($info !== null) {
+        if (!is_null($info)) {
             $stat['size']  = $info->Size;
             $stat['atime'] = time();
         } 

+ 4 - 0
library/Zend/Service/WindowsAzure/Storage/BlobContainer.php

@@ -25,6 +25,10 @@
  */
 require_once 'Zend/Service/WindowsAzure/Exception.php';
 
+/**
+ * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
 
 /**
  * @category   Zend

+ 17 - 1
library/Zend/Service/WindowsAzure/Storage/BlobInstance.php

@@ -25,6 +25,10 @@
  */
 require_once 'Zend/Service/WindowsAzure/Exception.php';
 
+/**
+ * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
 
 /**
  * @category   Zend
@@ -35,6 +39,7 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  * 
  * @property string  $Container       Container name
  * @property string  $Name            Name
+ * @property string  $SnapshotId      Snapshot id
  * @property string  $Etag            Etag
  * @property string  $LastModified    Last modified date
  * @property string  $Url             Url
@@ -42,6 +47,9 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  * @property string  $ContentType     Content Type
  * @property string  $ContentEncoding Content Encoding
  * @property string  $ContentLanguage Content Language
+ * @property string  $CacheControl    Cache control
+ * @property string  $BlobType        Blob type
+ * @property string  $LeaseStatus     Lease status
  * @property boolean $IsPrefix        Is Prefix?
  * @property array   $Metadata        Key/value pairs of meta data
  */
@@ -59,6 +67,7 @@ class Zend_Service_WindowsAzure_Storage_BlobInstance
      * 
      * @param string  $containerName   Container name
      * @param string  $name            Name
+     * @param string  $snapshotId      Snapshot id
      * @param string  $etag            Etag
      * @param string  $lastModified    Last modified date
      * @param string  $url             Url
@@ -66,14 +75,18 @@ class Zend_Service_WindowsAzure_Storage_BlobInstance
      * @param string  $contentType     Content Type
      * @param string  $contentEncoding Content Encoding
      * @param string  $contentLanguage Content Language
+     * @param string  $cacheControl    Cache control
+     * @param string  $blobType        Blob type
+     * @param string  $leaseStatus     Lease status
      * @param boolean $isPrefix        Is Prefix?
      * @param array   $metadata        Key/value pairs of meta data
      */
-    public function __construct($containerName, $name, $etag, $lastModified, $url = '', $size = 0, $contentType = '', $contentEncoding = '', $contentLanguage = '', $isPrefix = false, $metadata = array()) 
+    public function __construct($containerName, $name, $snapshotId, $etag, $lastModified, $url = '', $size = 0, $contentType = '', $contentEncoding = '', $contentLanguage = '', $cacheControl = '', $blobType = '', $leaseStatus = '', $isPrefix = false, $metadata = array()) 
     {	        
         $this->_data = array(
             'container'        => $containerName,
             'name'             => $name,
+        	'snapshotid'	   => $snapshotId,
             'etag'             => $etag,
             'lastmodified'     => $lastModified,
             'url'              => $url,
@@ -81,6 +94,9 @@ class Zend_Service_WindowsAzure_Storage_BlobInstance
             'contenttype'      => $contentType,
             'contentencoding'  => $contentEncoding,
             'contentlanguage'  => $contentLanguage,
+            'cachecontrol'     => $cacheControl,
+            'blobtype'         => $blobType,
+            'leasestatus'      => $leaseStatus,
             'isprefix'         => $isPrefix,
             'metadata'         => $metadata
         );

+ 1 - 1
library/Zend/Service/WindowsAzure/Storage/DynamicTableEntity.php

@@ -86,7 +86,7 @@ class Zend_Service_WindowsAzure_Storage_DynamicTableEntity extends Zend_Service_
         } else {
             if (!array_key_exists(strtolower($name), $this->_dynamicProperties)) {
                 // Determine type?
-                if ($type === null) {
+                if (is_null($type)) {
                     $type = 'Edm.String';
                     if (is_int($value)) {
                         $type = 'Edm.Int32';

+ 65 - 0
library/Zend/Service/WindowsAzure/Storage/LeaseInstance.php

@@ -0,0 +1,65 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Storage
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Storage
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * 
+ * @property string  $Container       Container name
+ * @property string  $Name            Name
+ * @property string  $LeaseId         Lease id
+ * @property string  $LeaseTime       Time remaining in the lease period, in seconds. This header is returned only for a successful request to break the lease. It provides an approximation as to when the lease period will expire.
+ */
+class Zend_Service_WindowsAzure_Storage_LeaseInstance
+	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+{
+    /**
+     * Constructor
+     * 
+     * @param string  $containerName   Container name
+     * @param string  $name            Name
+     * @param string  $leaseId         Lease id
+     * @param string  $leaseTime       Time remaining in the lease period, in seconds. This header is returned only for a successful request to break the lease. It provides an approximation as to when the lease period will expire.
+     */
+    public function __construct($containerName, $name, $leaseId, $leaseTime) 
+    {	        
+        $this->_data = array(
+            'container'        => $containerName,
+            'name'             => $name,
+        	'leaseid'          => $leaseId,
+            'leasetime'        => $leaseTime
+        );
+    }
+}

+ 59 - 0
library/Zend/Service/WindowsAzure/Storage/PageRegionInstance.php

@@ -0,0 +1,59 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Storage
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Exception.php';
+
+/**
+ * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Storage
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * 
+ * @property int  $start   Page range start
+ * @property int  $end     Page range end
+ */
+class Zend_Service_WindowsAzure_Storage_PageRegionInstance
+	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+{
+    /**
+     * Constructor
+     * 
+     * @param int  $start   Page range start
+     * @param int  $end     Page range end
+     */
+    public function __construct($start = 0, $end = 0) 
+    {	        
+        $this->_data = array(
+            'start'        => $start,
+            'end'             => $end
+        );
+    }
+}

+ 36 - 28
library/Zend/Service/WindowsAzure/Storage/Queue.php

@@ -94,7 +94,7 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
 		parent::__construct($host, $accountName, $accountKey, $usePathStyleUri, $retryPolicy);
 		
 		// API version
-		$this->_apiVersion = '2009-04-14';
+		$this->_apiVersion = '2009-09-19';
 	}
 	
 	/**
@@ -145,7 +145,7 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
 		$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata)); 
 		
 		// Perform request
-		$response = $this->_performRequest($queueName, '', Zend_Http_Client::PUT, $headers);			
+		$response = $this->_performRequest($queueName, '', Zend_Http_Client::PUT, $headers);	
 		if ($response->isSuccessful()) {
 		    return new Zend_Service_WindowsAzure_Storage_QueueInstance(
 		        $queueName,
@@ -270,23 +270,28 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
 	 * @param string $prefix     Optional. Filters the results to return only queues whose name begins with the specified prefix.
 	 * @param int    $maxResults Optional. Specifies the maximum number of queues to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000)
 	 * @param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
+	 * @param string $include    Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. (allowed values: '', 'metadata')
 	 * @param int    $currentResultCount Current result count (internal use)
 	 * @return array
 	 * @throws Zend_Service_WindowsAzure_Exception
 	 */
-	public function listQueues($prefix = null, $maxResults = null, $marker = null, $currentResultCount = 0)
+	public function listQueues($prefix = null, $maxResults = null, $marker = null, $include = null, $currentResultCount = 0)
 	{
 	    // Build query string
-	    $queryString = '?comp=list';
-	    if ($prefix !== null) {
-	        $queryString .= '&prefix=' . $prefix;
+		$queryString = array('comp=list');
+        if (!is_null($prefix)) {
+	        $queryString[] = 'prefix=' . $prefix;
+        }
+	    if (!is_null($maxResults)) {
+	        $queryString[] = 'maxresults=' . $maxResults;
 	    }
-	    if ($maxResults !== null) {
-	        $queryString .= '&maxresults=' . $maxResults;
+	    if (!is_null($marker)) {
+	        $queryString[] = 'marker=' . $marker;
 	    }
-	    if ($marker !== null) {
-	        $queryString .= '&marker=' . $marker;
+		if (!is_null($include)) {
+	        $queryString[] = 'include=' . $include;
 	    }
+	    $queryString = self::createQueryStringFromArray($queryString);
 	        
 		// Perform request
 		$response = $this->_performRequest('', $queryString, Zend_Http_Client::GET);	
@@ -295,20 +300,21 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
 			$xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
 
 			$queues = array();
-			if ($xmlQueues !== null) {
+			if (!is_null($xmlQueues)) {
 				for ($i = 0; $i < count($xmlQueues); $i++) {
 					$queues[] = new Zend_Service_WindowsAzure_Storage_QueueInstance(
-						(string)$xmlQueues[$i]->QueueName
+						(string)$xmlQueues[$i]->Name,
+						$this->_parseMetadataElement($xmlQueues[$i])
 					);
 				}
 			}
 			$currentResultCount = $currentResultCount + count($queues);
-			if ($maxResults !== null && $currentResultCount < $maxResults) {
-    			if ($xmlMarker !== null && $xmlMarker != '') {
-    			    $queues = array_merge($queues, $this->listQueues($prefix, $maxResults, $xmlMarker, $currentResultCount));
+			if (!is_null($maxResults) && $currentResultCount < $maxResults) {
+    			if (!is_null($xmlMarker) && $xmlMarker != '') {
+    			    $queues = array_merge($queues, $this->listQueues($prefix, $maxResults, $xmlMarker, $include, $currentResultCount));
     			}
 			}
-			if ($maxResults !== null && count($queues) > $maxResults) {
+			if (!is_null($maxResults) && count($queues) > $maxResults) {
 			    $queues = array_slice($queues, 0, $maxResults);
 			}
 			    
@@ -340,15 +346,16 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
 		if ($message == '') {
 		    throw new Zend_Service_WindowsAzure_Exception('Message is not specified.');
 		}
-		if ($ttl !== null && ($ttl <= 0 || $ttl > self::MAX_MESSAGE_SIZE)) {
+		if (!is_null($ttl) && ($ttl <= 0 || $ttl > self::MAX_MESSAGE_SIZE)) {
 		    throw new Zend_Service_WindowsAzure_Exception('Message TTL is invalid. Maximal TTL is 7 days (' . self::MAX_MESSAGE_SIZE . ' seconds) and should be greater than zero.');
 		}
 		    
 	    // Build query string
-	    $queryString = '';
-	    if ($ttl !== null) {
-	        $queryString .= '?messagettl=' . $ttl;
-	    }
+		$queryString = array();
+        if (!is_null($ttl)) {
+	        $queryString[] = 'messagettl=' . $ttl;
+        }
+	    $queryString = self::createQueryStringFromArray($queryString);
 	        
 	    // Build body
 	    $rawData = '';
@@ -385,22 +392,22 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
 		if ($numOfMessages < 1 || $numOfMessages > 32 || intval($numOfMessages) != $numOfMessages) {
 		    throw new Zend_Service_WindowsAzure_Exception('Invalid number of messages to retrieve.');
 		}
-		if ($visibilityTimeout !== null && ($visibilityTimeout <= 0 || $visibilityTimeout > 7200)) {
+		if (!is_null($visibilityTimeout) && ($visibilityTimeout <= 0 || $visibilityTimeout > 7200)) {
 		    throw new Zend_Service_WindowsAzure_Exception('Visibility timeout is invalid. Maximum value is 2 hours (7200 seconds) and should be greater than zero.');
 		}
 		    
 	    // Build query string
-	    $query = array();
+		$queryString = array();
     	if ($peek) {
-    	    $query[] = 'peekonly=true';
+    	    $queryString[] = 'peekonly=true';
     	}
     	if ($numOfMessages > 1) {
-	        $query[] = 'numofmessages=' . $numOfMessages;
+	        $queryString[] = 'numofmessages=' . $numOfMessages;
     	}
-    	if (!$peek && $visibilityTimeout !== null) {
-	        $query[] = 'visibilitytimeout=' . $visibilityTimeout;
+    	if (!$peek && !is_null($visibilityTimeout)) {
+	        $queryString[] = 'visibilitytimeout=' . $visibilityTimeout;
     	}   
-    	$queryString = '?' . implode('&', $query);
+	    $queryString = self::createQueryStringFromArray($queryString);
 	        
 		// Perform request
 		$response = $this->_performRequest($queueName . '/messages', $queryString, Zend_Http_Client::GET);	
@@ -426,6 +433,7 @@ class Zend_Service_WindowsAzure_Storage_Queue extends Zend_Service_WindowsAzure_
 					(string)$xmlMessages[$i]->ExpirationTime,
 					($peek ? '' : (string)$xmlMessages[$i]->PopReceipt),
 					($peek ? '' : (string)$xmlMessages[$i]->TimeNextVisible),
+					(string)$xmlMessages[$i]->DequeueCount,
 					base64_decode((string)$xmlMessages[$i]->MessageText)
 			    );
 			}

+ 5 - 35
library/Zend/Service/WindowsAzure/Storage/QueueInstance.php

@@ -25,6 +25,10 @@
  */
 require_once 'Zend/Service/WindowsAzure/Exception.php';
 
+/**
+ * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
 
 /**
  * @category   Zend
@@ -38,15 +42,9 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  * @property integer $ApproximateMessageCount  The approximate number of messages in the queue
  */
 class Zend_Service_WindowsAzure_Storage_QueueInstance
+	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
-     * Data
-     * 
-     * @var array
-     */
-    protected $_data = null;
-    
-    /**
      * Constructor
      * 
      * @param string $name          Name
@@ -60,32 +58,4 @@ class Zend_Service_WindowsAzure_Storage_QueueInstance
             'approximatemessagecount' => 0
         );
     }
-    
-    /**
-     * Magic overload for setting properties
-     * 
-     * @param string $name     Name of the property
-     * @param string $value    Value to set
-     */
-    public function __set($name, $value) {
-        if (array_key_exists(strtolower($name), $this->_data)) {
-            $this->_data[strtolower($name)] = $value;
-            return;
-        }
-
-        throw new Exception("Unknown property: " . $name);
-    }
-
-    /**
-     * Magic overload for getting properties
-     * 
-     * @param string $name     Name of the property
-     */
-    public function __get($name) {
-        if (array_key_exists(strtolower($name), $this->_data)) {
-            return $this->_data[strtolower($name)];
-        }
-
-        throw new Exception("Unknown property: " . $name);
-    }
 }

+ 9 - 36
library/Zend/Service/WindowsAzure/Storage/QueueMessage.php

@@ -25,6 +25,10 @@
  */
 require_once 'Zend/Service/WindowsAzure/Exception.php';
 
+/**
+ * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
 
 /**
  * @category   Zend
@@ -38,18 +42,13 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  * @property string $ExpirationTime    Expiration time
  * @property string $PopReceipt  	   Receipt verification for deleting the message from queue.
  * @property string $TimeNextVisible   Next time the message is visible in the queue
+ * @property int    $DequeueCount      Number of times the message has been dequeued. This value is incremented each time the message is subsequently dequeued.
  * @property string $MessageText       Message text
  */
 class Zend_Service_WindowsAzure_Storage_QueueMessage
+	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
-     * Data
-     * 
-     * @var array
-     */
-    protected $_data = null;
-    
-    /**
      * Constructor
      * 
      * @param string $messageId         Message ID
@@ -57,9 +56,10 @@ class Zend_Service_WindowsAzure_Storage_QueueMessage
      * @param string $expirationTime    Expiration time
      * @param string $popReceipt  	    Receipt verification for deleting the message from queue.
      * @param string $timeNextVisible   Next time the message is visible in the queue
+     * @param int    $dequeueCount      Number of times the message has been dequeued. This value is incremented each time the message is subsequently dequeued.
      * @param string $messageText       Message text
      */
-    public function __construct($messageId, $insertionTime, $expirationTime, $popReceipt, $timeNextVisible, $messageText) 
+    public function __construct($messageId, $insertionTime, $expirationTime, $popReceipt, $timeNextVisible, $dequeueCount, $messageText) 
     {
         $this->_data = array(
             'messageid'       => $messageId,
@@ -67,35 +67,8 @@ class Zend_Service_WindowsAzure_Storage_QueueMessage
             'expirationtime'  => $expirationTime,
             'popreceipt'      => $popReceipt,
             'timenextvisible' => $timeNextVisible,
+        	'dequeuecount'    => $dequeueCount,
             'messagetext'     => $messageText
         );
     }
-    
-    /**
-     * Magic overload for setting properties
-     * 
-     * @param string $name     Name of the property
-     * @param string $value    Value to set
-     */
-    public function __set($name, $value) {
-        if (array_key_exists(strtolower($name), $this->_data)) {
-            $this->_data[strtolower($name)] = $value;
-            return;
-        }
-
-        throw new Exception("Unknown property: " . $name);
-    }
-
-    /**
-     * Magic overload for getting properties
-     * 
-     * @param string $name     Name of the property
-     */
-    public function __get($name) {
-        if (array_key_exists(strtolower($name), $this->_data)) {
-            return $this->_data[strtolower($name)];
-        }
-
-        throw new Exception("Unknown property: " . $name);
-    }
 }

+ 6 - 35
library/Zend/Service/WindowsAzure/Storage/SignedIdentifier.php

@@ -26,6 +26,11 @@
 require_once 'Zend/Service/WindowsAzure/Exception.php';
 
 /**
+ * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
+
+/**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage Storage
@@ -38,15 +43,9 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  * @property string $Permissions  Signed permissions - read (r), write (w), delete (d) and list (l)
  */
 class Zend_Service_WindowsAzure_Storage_SignedIdentifier
+	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
-     * Data
-     * 
-     * @var array
-     */
-    protected $_data = null;
-    
-    /**
      * Constructor
      * 
      * @param string $id           Id for the signed identifier
@@ -63,32 +62,4 @@ class Zend_Service_WindowsAzure_Storage_SignedIdentifier
             'permissions'  => $permissions
         );
     }
-    
-    /**
-     * Magic overload for setting properties
-     * 
-     * @param string $name     Name of the property
-     * @param string $value    Value to set
-     */
-    public function __set($name, $value) {
-        if (array_key_exists(strtolower($name), $this->_data)) {
-            $this->_data[strtolower($name)] = $value;
-            return;
-        }
-
-        throw new Exception("Unknown property: " . $name);
-    }
-
-    /**
-     * Magic overload for getting properties
-     * 
-     * @param string $name     Name of the property
-     */
-    public function __get($name) {
-        if (array_key_exists(strtolower($name), $this->_data)) {
-            return $this->_data[strtolower($name)];
-        }
-
-        throw new Exception("Unknown property: " . $name);
-    }
 }

+ 73 - 0
library/Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php

@@ -0,0 +1,73 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Storage
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Service_WindowsAzure_Exception
+ */
+require_once 'Zend/Service/WindowsAzure/Exception.php';
+
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage Storage
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * 
+ */
+abstract class Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+{
+    /**
+     * Data
+     * 
+     * @var array
+     */
+    protected $_data = null;
+    
+    /**
+     * Magic overload for setting properties
+     * 
+     * @param string $name     Name of the property
+     * @param string $value    Value to set
+     */
+    public function __set($name, $value) {
+        if (array_key_exists(strtolower($name), $this->_data)) {
+            $this->_data[strtolower($name)] = $value;
+            return;
+        }
+
+        throw new Exception("Unknown property: " . $name);
+    }
+
+    /**
+     * Magic overload for getting properties
+     * 
+     * @param string $name     Name of the property
+     */
+    public function __get($name) {
+        if (array_key_exists(strtolower($name), $this->_data)) {
+            return $this->_data[strtolower($name)];
+        }
+
+        throw new Exception("Unknown property: " . $name);
+    }
+}

+ 53 - 12
library/Zend/Service/WindowsAzure/Storage/Table.php

@@ -113,7 +113,7 @@ class Zend_Service_WindowsAzure_Storage_Table
 	    $this->_credentials = new Zend_Service_WindowsAzure_Credentials_SharedKeyLite($accountName, $accountKey, $this->_usePathStyleUri);
 	    
 	    // API version
-		$this->_apiVersion = '2009-04-14';
+		$this->_apiVersion = '2009-09-19';
 	}
 	
 	/**
@@ -129,7 +129,7 @@ class Zend_Service_WindowsAzure_Storage_Table
 		}
 			
 		// List tables
-        $tables = $this->listTables($tableName);
+        $tables = $this->listTables(); // 2009-09-19 does not support $this->listTables($tableName); all of a sudden...
         foreach ($tables as $table) {
             if ($table->Name == $tableName) {
                 return true;
@@ -149,10 +149,11 @@ class Zend_Service_WindowsAzure_Storage_Table
 	public function listTables($nextTableName = '')
 	{
 	    // Build query string
-	    $queryString = '';
+		$queryString = array();
 	    if ($nextTableName != '') {
-	        $queryString = '?NextTableName=' . $nextTableName;
+	        $queryString[] = 'NextTableName=' . $nextTableName;
 	    }
+	    $queryString = self::createQueryStringFromArray($queryString);
 	    
 		// Perform request
 		$response = $this->_performRequest('Tables', $queryString, Zend_Http_Client::GET, null, true);
@@ -297,7 +298,7 @@ class Zend_Service_WindowsAzure_Storage_Table
 		if ($tableName === '') {
 			throw new Zend_Service_WindowsAzure_Exception('Table name is not specified.');
 		}
-		if ($entity === null) {
+		if (is_null($entity)) {
 			throw new Zend_Service_WindowsAzure_Exception('Entity is not specified.');
 		}
 		                     
@@ -367,7 +368,7 @@ class Zend_Service_WindowsAzure_Storage_Table
 		if ($tableName === '') {
 			throw new Zend_Service_WindowsAzure_Exception('Table name is not specified.');
 		}
-		if ($entity === null) {
+		if (is_null($entity)) {
 			throw new Zend_Service_WindowsAzure_Exception('Entity is not specified.');
 		}
 		                     
@@ -503,7 +504,7 @@ class Zend_Service_WindowsAzure_Storage_Table
     	    
     		// Filter?
     		if ($filter !== '') {
-    		    $query[] = '$filter=' . rawurlencode($filter);
+    		    $query[] = '$filter=' . Zend_Service_WindowsAzure_Storage_TableEntityQuery::encodeQuery($filter);
     		}
     		    
     	    // Build queryString
@@ -523,7 +524,7 @@ class Zend_Service_WindowsAzure_Storage_Table
 		}
 		
 		// Add continuation querystring parameters?
-		if ($nextPartitionKey !== null && $nextRowKey !== null) {
+		if (!is_null($nextPartitionKey) && !is_null($nextRowKey)) {
 		    if ($queryString !== '') {
 		        $queryString .= '&';
 		    }
@@ -545,7 +546,7 @@ class Zend_Service_WindowsAzure_Storage_Table
 		} else {
 		    $response = $this->_performRequest($tableName, $queryString, Zend_Http_Client::GET, array(), true, null);
 		}
-		
+
 		if ($response->isSuccessful()) {
 		    // Parse result
 		    $result = $this->_parseResponse($response);
@@ -689,7 +690,7 @@ class Zend_Service_WindowsAzure_Storage_Table
 		if ($tableName === '') {
 			throw new Zend_Service_WindowsAzure_Exception('Table name is not specified.');
 		}
-		if ($entity === null) {
+		if (is_null($entity)) {
 			throw new Zend_Service_WindowsAzure_Exception('Entity is not specified.');
 		}
 		                     
@@ -794,12 +795,12 @@ class Zend_Service_WindowsAzure_Storage_Table
 		    if ($azureValue->Type != '') {
 		        $value[] = ' m:type="' . $azureValue->Type . '"';
 		    }
-		    if ($azureValue->Value === null) {
+		    if (is_null($azureValue->Value)) {
 		        $value[] = ' m:null="true"'; 
 		    }
 		    $value[] = '>';
 		    
-		    if ($azureValue->Value !== null) {
+		    if (!is_null($azureValue->Value)) {
 		        if (strtolower($azureValue->Type) == 'edm.boolean') {
 		            $value[] = ($azureValue->Value == true ? '1' : '0');
 		        } else {
@@ -813,4 +814,44 @@ class Zend_Service_WindowsAzure_Storage_Table
 
 		return implode('', $azureRepresentation);
 	}
+	
+		/**
+	 * Perform request using Zend_Http_Client channel
+	 *
+	 * @param string $path Path
+	 * @param string $queryString Query string
+	 * @param string $httpVerb HTTP verb the request will use
+	 * @param array $headers x-ms headers to add
+	 * @param boolean $forTableStorage Is the request for table storage?
+	 * @param mixed $rawData Optional RAW HTTP data to be sent over the wire
+	 * @param string $resourceType Resource type
+	 * @param string $requiredPermission Required permission
+	 * @return Zend_Http_Response
+	 */
+	protected function _performRequest(
+		$path = '/',
+		$queryString = '',
+		$httpVerb = Zend_Http_Client::GET,
+		$headers = array(),
+		$forTableStorage = false,
+		$rawData = null,
+		$resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN,
+		$requiredPermission = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ
+	) {
+		// Add headers
+		$headers['DataServiceVersion'] = '1.0;NetFx';
+		$headers['MaxDataServiceVersion'] = '1.0;NetFx';
+
+		// Perform request
+		return parent::_performRequest(
+			$path,
+			$queryString,
+			$httpVerb,
+			$headers,
+			$forTableStorage,
+			$rawData,
+			$resourceType,
+			$requiredPermission
+		);
+	}
 }

+ 2 - 2
library/Zend/Service/WindowsAzure/Storage/TableEntity.php

@@ -263,7 +263,7 @@ class Zend_Service_WindowsAzure_Storage_TableEntity
         $properties = $type->getProperties();
         foreach ($properties as $property) {
             $accessor = self::getAzureAccessor($property);
-            if ($accessor !== null) {
+            if (!is_null($accessor)) {
                 $azureAccessors[] = $accessor;
             }
         }
@@ -272,7 +272,7 @@ class Zend_Service_WindowsAzure_Storage_TableEntity
         $methods = $type->getMethods();
         foreach ($methods as $method) {
             $accessor = self::getAzureAccessor($method);
-            if ($accessor !== null) {
+            if (!is_null($accessor)) {
                 $azureAccessors[] = $accessor;
             }
         }

+ 31 - 7
library/Zend/Service/WindowsAzure/Storage/TableEntityQuery.php

@@ -129,7 +129,7 @@ class Zend_Service_WindowsAzure_Storage_TableEntityQuery
 	{
 	    $condition = $this->_replaceOperators($condition);
 	    
-	    if ($value !== null) {
+	    if (!is_null($value)) {
 	        $condition = $this->_quoteInto($condition, $value);
 	    }
 	    
@@ -203,15 +203,15 @@ class Zend_Service_WindowsAzure_Storage_TableEntityQuery
 		$query = array();
 		if (count($this->_where) != 0) {
 		    $filter = implode('', $this->_where);
-			$query[] = '$filter=' . ($urlEncode ? urlencode($filter) : $filter);
+			$query[] = '$filter=' . ($urlEncode ? self::encodeQuery($filter) : $filter);
 		}
 		
 		if (count($this->_orderBy) != 0) {
 		    $orderBy = implode(',', $this->_orderBy);
-			$query[] = '$orderby=' . ($urlEncode ? urlencode($orderBy) : $orderBy);
+			$query[] = '$orderby=' . ($urlEncode ? self::encodeQuery($orderBy) : $orderBy);
 		}
 		
-		if ($this->_top !== null) {
+		if (!is_null($this->_top)) {
 			$query[] = '$top=' . $this->_top;
 		}
 		
@@ -234,15 +234,15 @@ class Zend_Service_WindowsAzure_Storage_TableEntityQuery
 	    if ($includeParentheses) {
 	        $identifier .= '(';
 	        
-	        if ($this->_partitionKey !== null) {
+	        if (!is_null($this->_partitionKey)) {
 	            $identifier .= 'PartitionKey=\'' . $this->_partitionKey . '\'';
 	        }
 	            
-	        if ($this->_partitionKey !== null && $this->_rowKey !== null) {
+	        if (!is_null($this->_partitionKey) && !is_null($this->_rowKey)) {
 	            $identifier .= ', ';
 	        }
 	            
-	        if ($this->_rowKey !== null) {
+	        if (!is_null($this->_rowKey)) {
 	            $identifier .= 'RowKey=\'' . $this->_rowKey . '\'';
 	        }
 	            
@@ -315,6 +315,30 @@ class Zend_Service_WindowsAzure_Storage_TableEntityQuery
 	}
 	
 	/**
+	 * urlencode a query
+	 * 
+	 * @param string $query Query to encode
+	 * @return string Encoded query
+	 */
+	public static function encodeQuery($query)
+	{
+		$query = str_replace('/', '%2F', $query);
+		$query = str_replace('?', '%3F', $query);
+		$query = str_replace(':', '%3A', $query);
+		$query = str_replace('@', '%40', $query);
+		$query = str_replace('&', '%26', $query);
+		$query = str_replace('=', '%3D', $query);
+		$query = str_replace('+', '%2B', $query);
+		$query = str_replace(',', '%2C', $query);
+		$query = str_replace('$', '%24', $query);
+		
+		
+		$query = str_replace(' ', '%20', $query);
+		
+		return $query;
+	}
+	
+	/**
 	 * __toString overload
 	 * 
 	 * @return string

+ 5 - 35
library/Zend/Service/WindowsAzure/Storage/TableInstance.php

@@ -25,6 +25,10 @@
  */
 require_once 'Zend/Service/WindowsAzure/Exception.php';
 
+/**
+ * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
+ */
+require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
 
 /**
  * @category   Zend
@@ -39,15 +43,9 @@ require_once 'Zend/Service/WindowsAzure/Exception.php';
  * @property string  $Updated         Updated
  */
 class Zend_Service_WindowsAzure_Storage_TableInstance
+	extends Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
 {
     /**
-     * Data
-     * 
-     * @var array
-     */
-    protected $_data = null;
-    
-    /**
      * Constructor
      * 
      * @param string  $id              Id
@@ -64,32 +62,4 @@ class Zend_Service_WindowsAzure_Storage_TableInstance
             'updated'          => $updated
         );
     }
-    
-    /**
-     * Magic overload for setting properties
-     * 
-     * @param string $name     Name of the property
-     * @param string $value    Value to set
-     */
-    public function __set($name, $value) {
-        if (array_key_exists(strtolower($name), $this->_data)) {
-            $this->_data[strtolower($name)] = $value;
-            return;
-        }
-
-        throw new Exception("Unknown property: " . $name);
-    }
-
-    /**
-     * Magic overload for getting properties
-     * 
-     * @param string $name     Name of the property
-     */
-    public function __get($name) {
-        if (array_key_exists(strtolower($name), $this->_data)) {
-            return $this->_data[strtolower($name)];
-        }
-
-        throw new Exception("Unknown property: " . $name);
-    }
 }

+ 11 - 671
tests/TestConfiguration.php.dist

@@ -1,5 +1,4 @@
 <?php
-
 /**
  * Zend Framework
  *
@@ -15,635 +14,9 @@
  *
  * @category   Zend
  * @package    UnitTests
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * This file defines configuration for running the unit tests for the Zend
- * Framework.  Some tests have dependencies to PHP extensions or databases
- * which may not necessary installed on the target system.  For these cases,
- * the ability to disable or configure testing is provided below.  Tests for
- * components which should run universally are always run by the master
- * suite and cannot be disabled.
- *
- * Do not edit this file. Instead, copy this file to TestConfiguration.php,
- * and edit the new file. Never commit plaintext passwords to the source
- * code repository.
- */
-
-/**
- * GENERAL SETTINGS
- *
- * OB_ENABLED should be enabled for some tests to check if all functionality
- * works as expected. Such tests include those for Zend_Soap and Zend_Session,
- * which require that headers not be sent in order to work.
- */
-define('TESTS_ZEND_OB_ENABLED', false);
-
-/**
- * Zend_Auth_Adapter_DbTable tests
- */
-define('TESTS_ZEND_AUTH_ADAPTER_DBTABLE_PDO_SQLITE_ENABLED', false);
-define('TESTS_ZEND_AUTH_ADAPTER_DBTABLE_PDO_SQLITE_DATABASE', ':memory:');
-
-/**
- * Zend_Auth_Adapter_Ldap online tests
- * (See also TESTS_ZEND_LDAP_* configuration constants below)
- */
-define('TESTS_ZEND_AUTH_ADAPTER_LDAP_ONLINE_ENABLED', false);
-
-/**
- * Zend_Cache
- *
- * TESTS_ZEND_CACHE_SQLITE_ENABLED    => sqlite extension has to be enabled
- * TESTS_ZEND_CACHE_APC_ENABLED       => apc extension has to be enabled
- * TESTS_ZEND_CACHE_MEMCACHED_ENABLED => memcache extension has to be enabled and
- *                                       a memcached server has to be available
- * TESTS_ZEND_CACHE_XCACHE_ENABLED    => xcache extension has to be enabled
- */
-define('TESTS_ZEND_CACHE_SQLITE_ENABLED', false);
-define('TESTS_ZEND_CACHE_APC_ENABLED', false);
-define('TESTS_ZEND_CACHE_XCACHE_ENABLED', true);
-define('TESTS_ZEND_CACHE_XCACHE_USER', null);
-define('TESTS_ZEND_CACHE_XCACHE_PASSWORD', null);
-define('TESTS_ZEND_CACHE_PLATFORM_ENABLED', false);
-define('TESTS_ZEND_CACHE_MEMCACHED_ENABLED', false);
-define('TESTS_ZEND_CACHE_MEMCACHED_HOST', '127.0.0.1');
-define('TESTS_ZEND_CACHE_MEMCACHED_PORT', 11211);
-define('TESTS_ZEND_CACHE_MEMCACHED_PERSISTENT', true);
-
-/**
- * Zend_Controller
- *
- * TESTS_ZEND_CONTROLLER_DISPATCHER_OB => test disabling output buffering in
- *                                        dispatcher
- */
-define('TESTS_ZEND_CONTROLLER_DISPATCHER_OB', false);
-
-/**
- * Zend_Db_Adapter_Pdo_Mysql and Zend_Db_Adapter_Mysqli
- *
- * There are separate properties to enable tests for the PDO_MYSQL adapter and
- * the native Mysqli adapters, but the other properties are shared between the
- * two MySQL-related Zend_Db adapters.
- */
-define('TESTS_ZEND_DB_ADAPTER_PDO_MYSQL_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_MYSQLI_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_MYSQL_HOSTNAME', '127.0.0.1');
-define('TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME', null);
-define('TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD', null);
-define('TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE', 'test');
-define('TESTS_ZEND_DB_ADAPTER_MYSQL_PORT', 3306);
-
-/**
- * Zend_Db_Adapter_Pdo_Sqlite
- *
- * Username and password are irrelevant for SQLite.
- */
-define('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_DATABASE', ':memory:');
-
-/**
- * Zend_Db_Adapter_Pdo_Mssql
- *
- * Note that you need to patch your ntwdblib.dll, the one that
- * comes with PHP does not work.  See user comments at
- * http://us2.php.net/manual/en/ref.mssql.php
- */
-define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_HOSTNAME', '127.0.0.1');
-define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_USERNAME', null);
-define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_PASSWORD', null);
-define('TESTS_ZEND_DB_ADAPTER_PDO_MSSQL_DATABASE', 'test');
-
-/**
- * Zend_Db_Adapter_Pdo_Pgsql
- */
-define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_HOSTNAME', '127.0.0.1');
-define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_USERNAME', null);
-define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_PASSWORD', null);
-define('TESTS_ZEND_DB_ADAPTER_PDO_PGSQL_DATABASE', 'postgres');
-
-/**
- * Zend_Db_Adapter_Oracle and Zend_Db_Adapter_Pdo_Oci
- *
- * There are separate properties to enable tests for the PDO_OCI adapter and
- * the native Oracle adapter, but the other properties are shared between the
- * two Oracle-related Zend_Db adapters.
- */
-define('TESTS_ZEND_DB_ADAPTER_PDO_OCI_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_ORACLE_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_ORACLE_HOSTNAME', '127.0.0.1');
-define('TESTS_ZEND_DB_ADAPTER_ORACLE_USERNAME', null);
-define('TESTS_ZEND_DB_ADAPTER_ORACLE_PASSWORD', null);
-define('TESTS_ZEND_DB_ADAPTER_ORACLE_SID',      'xe');
-
-/**
- * Zend_Db_Adapter_Db2 and Zend_Db_Adapter_Pdo_Ibm
- * There are separate properties to enable tests for the PDO_IBM adapter and
- * the native DB2 adapter, but the other properties are shared between the
- * two related Zend_Db adapters.
- */
-define('TESTS_ZEND_DB_ADAPTER_PDO_IBM_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_DB2_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_DB2_HOSTNAME', '127.0.0.1');
-define('TESTS_ZEND_DB_ADAPTER_DB2_PORT', 50000);
-define('TESTS_ZEND_DB_ADAPTER_DB2_USERNAME', null);
-define('TESTS_ZEND_DB_ADAPTER_DB2_PASSWORD', null);
-define('TESTS_ZEND_DB_ADAPTER_DB2_DATABASE', 'sample');
-
-/**
- * Zend_Db_Adapter_Sqlsrv
- * Note: Make sure that you create the "test" database and set a
- * username and password
- *
- */
-define('TESTS_ZEND_DB_ADAPTER_SQLSRV_ENABLED',  false);
-define('TESTS_ZEND_DB_ADAPTER_SQLSRV_HOSTNAME', 'localhost\SQLEXPRESS');
-define('TESTS_ZEND_DB_ADAPTER_SQLSRV_USERNAME', null);
-define('TESTS_ZEND_DB_ADAPTER_SQLSRV_PASSWORD', null);
-define('TESTS_ZEND_DB_ADAPTER_SQLSRV_DATABASE', 'test');
-
-/**
- * Zend_Feed_Reader tests
- *
- * If the ONLINE_ENABLED property is false, only tests that can be executed
- * without network connectivity are run; when enabled, all tests will run.
- */
-define('TESTS_ZEND_FEED_READER_ONLINE_ENABLED', false);
-
-/**
- * Zend_Gdata tests
- *
- * If the ONLINE_ENABLED property is false, only tests that can be executed with
- * a mock HTTP client are run.  No request is sent to the Google Gdata servers.
- * If ONLINE_ENABLED is true, some tests may make requests to the remote
- * servers.  This does not work if you are running tests on a disconnected
- * client host.  Also, the tests may show as failures if the Google servers
- * cannot be reached or if they do not respond for another reason.
- *
- * If the CLIENTLOGIN_ENABLED property below is false, the authenticated
- * tests are reported Skipped in the test run.  Set this property to true
- * to enable tests that require ClientLogin authentication.  Enter your
- * Google login credentials in the EMAIL and PASSWORD properties below.
- *
- * Edit TestConfiguration.php, not TestConfiguration.php.dist.
- * Never commit plaintext passwords to the source code repository.
- *
- * Note: the GData tests currently require that the TZID env variable
- * be set or the timezone otherwise configured.  You'll see errors from the
- * tests if this is not the case.
- */
-define('TESTS_ZEND_GDATA_ONLINE_ENABLED', false);
-define('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED', false);
-
-/*
- * The credentials provided here should be only for a TEST account.
- * Data for various services in this account may be added to, updated,
- * or deleted based upon the actions of these test accounts.
- */
-define('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL', 'example@example.com');
-define('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD', 'password');
-
-/*
- * This is the ID of a blank blog.  There is no need to have
- * any content in this blog.  Also, blogs can only be used
- * several times for the purpose of these test cases before
- * they must be deleted and recreated.  Otherwise, the tests
- * will start failing, as posts to Blogger will return a 201 Created
- * response even though the entry was not posted to the blog.
- * This problem is being investigated.
- */
-define('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED', false);
-define('TESTS_ZEND_GDATA_BLOG_ID', '1111111111111111111');
-
-/*
- * This is the key for a spreadsheet with data only in the first row of
- * the spreadsheet.  The strings 'a1', 'b1', 'c1', 'd1' should be in the
- * corresponding cell locations.
- */
-define('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED', false);
-define('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY', 'o01111111111111111111.1111111111111111111');
-define('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID', 'default');
-
-/*
- * This indicates that online tests for the Google Calendar API should
- * be performed. The default calendar will be used.
- */
-define('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED', false);
-
-/*
- * This is the fully-qualified domain name for a domiain hosted using
- * Google Apps. This domain must be registered with Google Apps and
- * have API access enabled.  This should be a TEST domain only.
- */
-define('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED', false);
-define('TESTS_ZEND_GDATA_GAPPS_DOMAIN', 'example.com.invalid');
-define('TESTS_ZEND_GDATA_GAPPS_EMAIL', 'example@example.com');
-define('TESTS_ZEND_GDATA_GAPPS_PASSWORD', 'password');
-
-/*
- * This is the ONLINE_ENABLED property for Google Base.
- */
-define('TESTS_ZEND_GDATA_GBASE_ONLINE_ENABLED', false);
-
-/*
- * This indicates that online tests for the Books Search data API
- * should be performed.
- */
-define('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED', false);
-
-/*
- * This indicates that online tests for the YouTube data API should
- * be performed.
- */
-define('TESTS_ZEND_GDATA_YOUTUBE_ONLINE_ENABLED', false);
-
-/*
- * This is the username to use for retrieving subscriptions, etc
- */
-define('TESTS_ZEND_GDATA_YOUTUBE_ACCOUNT', 'zfgdata');
-
-/*
- * This is the developer key to access the YouTube API
- */
-define('TESTS_ZEND_GDATA_YOUTUBE_DEVELOPER_KEY', 'your_developer_key_here');
-
-/*
- * This is the client ID to access the YouTube API
- */
-define('TESTS_ZEND_GDATA_YOUTUBE_CLIENT_ID', 'ZF_UnitTests_unknown');
-
-/*
- * This indicates that online tests for the Google Documents API should
- * be performed.
- */
-define('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED', false);
-
-/*
- * This indicates that online tests for the GData Photos API should
- * be performed.
- */
-define('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED', false);
-
-/*
- * This indicates that online tests for the Google Health API should
- * be performed.
- */
-define('TESTS_ZEND_GDATA_HEALTH_ONLINE_ENABLED', false);
-
-/**
- * Zend_Http_Client tests
- *
- * To enable the dynamic Zend_Http_Client tests, you will need to symbolically
- * link or copy the files in tests/Zend/Http/Client/_files to a directory
- * under your web server(s) document root and set this constant to point to the
- * URL of this directory.
- */
-define('TESTS_ZEND_HTTP_CLIENT_BASEURI', false);
-
-/**
- * Zend_Http_Client_Proxy tests
- *
- * HTTP proxy to be used for testing the Proxy adapter. Set to a string of
- * the form 'host:port'. Set to null to skip HTTP proxy tests.
- */
-define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY', false);
-define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_USER', '');
-define('TESTS_ZEND_HTTP_CLIENT_HTTP_PROXY_PASS', '');
-
-/**
- * Zend_Loader_Autoloader multi-version support tests
- *
- * ENABLED:      whether or not to run the multi-version tests
- * PATH:         path to a directory containing multiple ZF version installs
- * LATEST:       most recent ZF version in the PATH
- *               e.g., "1.9.2"
- * LATEST_MAJOR: most recent ZF major version in the PATH to test against
- *               e.g., "1.9.2"
- * LATEST_MINOR: most recent ZF minor version in the PATH to test against
- *               e.g., "1.8.4PL1"
- * SPECIFIC:     specific ZF version in the PATH to test against
- *               e.g., "1.7.6"
- * As an example, consider the following tree:
- *     ZendFramework/
- *     |-- 1.9.2
- *     |-- ZendFramework-1.9.1-minimal
- *     |-- 1.8.4PL1
- *     |-- 1.8.4
- *     |-- ZendFramework-1.8.3
- *     |-- 1.7.8
- *     |-- 1.7.7
- *     |-- 1.7.6
- * You would then set the value of "LATEST" and "LATEST_MAJOR" to "1.9.2", and
- * could choose between "1.9.2", "1.8.4PL1", and "1.7.8" for "LATEST_MINOR",
- * and any version number for "SPECIFIC". "PATH" would point to the parent
- * "ZendFramework" directory.
- */
-define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_ENABLED', false);
-define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_PATH', false);
-define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST', false);
-define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MAJOR', false);
-define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MINOR', false);
-define('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_SPECIFIC', false);
-
-/**
- * Zend_Ldap online tests
- */
-define('TESTS_ZEND_LDAP_ONLINE_ENABLED', false);
-
-/* These largely map to the options described in the Zend_Ldap and
- * Zend_Auth_Adapter_Ldap documentation.
- *
- * Example Configuration for Active Directory:
- *                      HOST: dc1.w.net
- *             USE_START_TLS: true
- *                   USE_SSL: false
- *                  USERNAME: CN=User 1,CN=Users,DC=w,DC=net
- *            PRINCIPAL_NAME: user1@w.net
- *             LDAP_PASSWORD: pass1
- *                   BASE_DN: CN=Users,DC=w,DC=net
- *               DOMAIN_NAME: w.net
- * ACCOUNT_DOMAIN_NAME_SHORT: W
- *              ALT_USERNAME: user2
- *                    ALT_DN: CN=User 2,CN=Users,DC=w,DC=net
- *              ALT_PASSWORD: pass2
- *
- * Example Configuration for OpenLDAP
- *                      HOST: s0.foo.net
- *                  USERNAME: CN=user1,DC=foo,DC=net
- *            PRINCIPAL_NAME: user1@foo.net
- *             LDAP_PASSWORD: pass1
- *          BIND_REQUIRES_DN: true
- *                   BASE_DN: OU=Sales,DC=w,DC=net
- *               DOMAIN_NAME: foo.net
- * ACCOUNT_DOMAIN_NAME_SHORT: FOO
- *              ALT_USERNAME: abaker
- *                    ALT_DN: CN=Alice Baker,OU=Sales,DC=foo,DC=net
- *              ALT_PASSWORD: apass
- */
-define('TESTS_ZEND_LDAP_HOST', 'localhost');
-//define('TESTS_ZEND_LDAP_PORT', 389);
-define('TESTS_ZEND_LDAP_USE_START_TLS', true);
-//define('TESTS_ZEND_LDAP_USE_SSL', false);
-define('TESTS_ZEND_LDAP_USERNAME', 'CN=someUser,DC=example,DC=com');
-define('TESTS_ZEND_LDAP_PRINCIPAL_NAME', 'someUser@example.com');
-define('TESTS_ZEND_LDAP_PASSWORD', null);
-define('TESTS_ZEND_LDAP_BIND_REQUIRES_DN', true);
-define('TESTS_ZEND_LDAP_BASE_DN', 'OU=Sales,DC=example,DC=com');
-//define('TESTS_ZEND_LDAP_ACCOUNT_FILTER_FORMAT', '(&(objectClass=posixAccount)(uid=%s))');
-define('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME', 'example.com');
-define('TESTS_ZEND_LDAP_ACCOUNT_DOMAIN_NAME_SHORT', 'EXAMPLE');
-define('TESTS_ZEND_LDAP_ALT_USERNAME', 'anotherUser');
-define('TESTS_ZEND_LDAP_ALT_DN', 'CN=Another User,OU=Sales,DC=example,DC=com');
-define('TESTS_ZEND_LDAP_ALT_PASSWORD', null);
-
-/**
- * Zend_Locale tests
- *
- * If the TESTS_ZEND_LOCALE_FORMAT_SETLOCALE property below is a valid,
- * locally recognized locale (try "locale -a"), then all tests in
- * tests/Zend/Locale/ test suites will execute *after*
- *    setlocale(LC_ALL, TESTS_ZEND_LOCALE_FORMAT_SETLOCALE);
- * Primarily, this switches certain PHP functions to emit "localized" output,
- * including the built-in "to string" for integer and float conversions.
- * Thus, a locale of 'fr_FR' yields number-to-string conversions in a
- * localized form with the decimal place separator chosen via:
- *    setlocale(LC_ALL, 'fr_FR@euro');
- */
-//define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', 'fr');
-//define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', 'fr_FR@euro');
-define('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE', false);
-
-/**
- * Zend_Date tests
- *
- * If the BCMATH_ENABLED property below is false, all arithmetic
- * operations will use ordinary PHP math operators and functions.
- * Otherwise, the bcmath functions will be used for unlimited precision.
- *
- * If the EXTENDED_COVERAGE property below is false, most of the I18N
- * unit tests will not be computed... this speeds tests up to 80 minutes
- * when doing reports. *
- * Edit TestConfiguration.php, not TestConfiguration.php.dist.
- */
-define('TESTS_ZEND_LOCALE_BCMATH_ENABLED', true);
-define('TESTS_ZEND_I18N_EXTENDED_COVERAGE', true);
-
-/**
- * Zend_Mail_Storage tests
- *
- * TESTS_ZEND_MAIL_SERVER_TESTDIR and TESTS_ZEND_MAIL_SERVER_FORMAT are used for POP3 and IMAP tests.
- * TESTS_ZEND_MAIL_SERVER_FORMAT is the format your test mail server uses: 'mbox' or 'maildir'. The mail
- * storage for the user specified in your POP3 or IMAP tests should be TESTS_ZEND_MAIL_SERVER_TESTDIR. Be
- * careful: it's cleared before copying the files. If you want to copy the files manually set the dir
- * to null (or anything == null).
- *
- * TESTS_ZEND_MAIL_TEMPDIR is used for testing write operations in local storages. If not set (== null)
- * tempnam() is used.
- */
-define('TESTS_ZEND_MAIL_SERVER_TESTDIR', null);
-define('TESTS_ZEND_MAIL_SERVER_FORMAT', 'mbox');
-define('TESTS_ZEND_MAIL_TEMPDIR', null);
-
-/**
- * Zend_Mail_Storage_Pop3 / Zend_Mail_Transport_Pop3
- *
- * IMPORTANT: you need to copy tests/Zend/Mail/_files/test.mbox to your mail
- * if you haven't set TESTS_ZEND_MAIL_SERVER_TESTDIR
- */
-define('TESTS_ZEND_MAIL_POP3_ENABLED', false);
-define('TESTS_ZEND_MAIL_POP3_HOST', 'localhost');
-define('TESTS_ZEND_MAIL_POP3_USER', 'test');
-define('TESTS_ZEND_MAIL_POP3_PASSWORD', '');
-// test SSL connections if enabled in your test server
-define('TESTS_ZEND_MAIL_POP3_SSL', true);
-define('TESTS_ZEND_MAIL_POP3_TLS', true);
-// WRONG_PORT should be an existing server port,
-// INVALID_PORT should be a non existing (each on defined host)
-define('TESTS_ZEND_MAIL_POP3_WRONG_PORT', 80);
-define('TESTS_ZEND_MAIL_POP3_INVALID_PORT', 3141);
-
-/**
- * Zend_Mail_Storage_Imap / Zend_Mail_Transport_Imap
- *
- * IMPORTANT: you need to copy tests/Zend/Mail/_files/test.mbox to your mail
- * if you haven't set TESTS_ZEND_MAIL_SERVER_TESTDIR
- */
-define('TESTS_ZEND_MAIL_IMAP_ENABLED', false);
-define('TESTS_ZEND_MAIL_IMAP_HOST', 'localhost');
-define('TESTS_ZEND_MAIL_IMAP_USER', 'test');
-define('TESTS_ZEND_MAIL_IMAP_PASSWORD', '');
-// test SSL connections if enabled in your test server
-define('TESTS_ZEND_MAIL_IMAP_SSL', true);
-define('TESTS_ZEND_MAIL_IMAP_TLS', true);
-// WRONG_PORT should be an existing server port,
-// INVALID_PORT should be a non-existing (each on defined host)
-define('TESTS_ZEND_MAIL_IMAP_WRONG_PORT', 80);
-define('TESTS_ZEND_MAIL_IMAP_INVALID_PORT', 3141);
-
-
-/**
- * Zend_Mail_Storage_Maildir test
- *
- * Before enabling this test you have to unpack messages.tar in
- * Zend/Mail/_files/test.maildir/cur/ and remove the tar for this test to work.
- * That's because the messages files have a colon in the filename and that's a
- * forbidden character on Windows.
- */
-define('TESTS_ZEND_MAIL_MAILDIR_ENABLED', false);
-
-/**
- * Zend_Mail_Transport_Smtp
- *
- * @todo TO be implemented
- */
-define('TESTS_ZEND_MAIL_SMTP_ENABLED', false);
-define('TESTS_ZEND_MAIL_SMTP_HOST', 'localhost');
-define('TESTS_ZEND_MAIL_SMTP_PORT', 25);
-define('TESTS_ZEND_MAIL_SMTP_USER', 'testuser');
-define('TESTS_ZEND_MAIL_SMTP_PASSWORD', 'testpassword');
-define('TESTS_ZEND_MAIL_SMTP_AUTH', false);
-// AUTH can be set to false or a string of AUTH method (e.g. LOGIN, PLAIN, CRAMMD5 or DIGESTMD5)
-
-/**
- * Zend_Queue Test Configuration constants
- *
- * The Zend_Queue_Adapter_Db constant should be a JSON-encoded string
- * representing a configuration object for Zend_Db::factory(). For example:
- * {
- *     type: "pdo_mysql",
- *     host: "127.0.0.1",
- *     port: 3306,
- *     username: "queue",
- *     password: "queue",
- *     dbname: "queue"
- * }
- *
- * The PlatformJobQueue adapter expects two parameters, the host and password.
- * The HOST string should include both the host and port (typically 10003):
- *     127.0.0.1:10003
- * When running tests against PlatformJobQueue, it's best to do so where
- * Platform is installed on localhost and has maximum workers set to 20
- * (default is 5); do so with this zend.ini setting:
- *     zend_jq.max_num_of_request_workers=20
- *
- * Selectively define the below in order to run tests for them.
- */
-define('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME', false);
-define('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST', false);
-define('TESTS_ZEND_QUEUE_ACTIVEMQ_PORT', false);
-define('TESTS_ZEND_QUEUE_DB', false);
-define('TESTS_ZEND_QUEUE_MEMCACHEQ_HOST', false);
-define('TESTS_ZEND_QUEUE_MEMCACHEQ_PORT', false);
-define('TESTS_ZEND_QUEUE_PLATFORMJQ_HOST', false);
-define('TESTS_ZEND_QUEUE_PLATFORMJQ_PASS', false);
-
-/**
- * Zend_Serializer adapter tests
- * 
- * TESTS_ZEND_SERIALIZER_ADAPTER_WDDX_ENABLED:
- *   - enable wddx adapter tests
- *   - needs wddx and SimpleXml php extension installed
- *
- * TESTS_ZEND_SERIALIZER_ADAPTER_IGBINARY_ENABLED:
- *   - enable igbinary adapter tests
- *   - needs igbinary php extension installed
- */
-define('TESTS_ZEND_SERIALIZER_ADAPTER_WDDX_ENABLED', false);
-define('TESTS_ZEND_SERIALIZER_ADAPTER_IGBINARY_ENABLED', false);
-
-/**
- * Zend_Service_Amazon online tests
- */
-define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ENABLED', false);
-define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID', 'Enter AWSAccessKeyId here');
-define('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY', 'Enter AWSSecretKey here');
-define('TESTS_ZEND_SERVICE_AMAZON_S3_BUCKET', 'zftestamazons3bucket');
-define('TESTS_ZEND_SERVICE_AMAZON_SQS_QUEUE', 'zftestamazonsqsqueuename');
-
-/**
- * Zend_Service_Delicious tests
- */
-define('TESTS_ZEND_SERVICE_DELICIOUS_ENABLED', false);
-
-/**
- * Zend_Service_DeveloperGarden tests
- * Setup your Username and Password to test this Service
- */
-define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_ENABLED', false);
-define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN', 'ZF_Username');
-define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD', 'ZF_Password');
- 
-/**
- * Zend_Service_Flickr online tests
- */
-define('TESTS_ZEND_SERVICE_FLICKR_ONLINE_ENABLED', false);
-define('TESTS_ZEND_SERVICE_FLICKR_ONLINE_APIKEY', 'Enter API key here');
-
-/**
- * Zend_Service_LiveDocx configuration
- *
- * Define username and password in order to run unit tests for LiveDocX web
- * services.
- *
- * phpunit/phpunit will typically work.
- */
-define('TESTS_ZEND_SERVICE_LIVEDOCX_USERNAME', false);
-define('TESTS_ZEND_SERVICE_LIVEDOCX_PASSWORD', false);
-
-/**
- * Zend_Service_ReCaptcha tests
- */
-define('TESTS_ZEND_SERVICE_RECAPTCHA_ENABLED', false);
-define('TESTS_ZEND_SERVICE_RECAPTCHA_ONLINE_ENABLED', false);
-define('TESTS_ZEND_SERVICE_RECAPTCHA_PUBLIC_KEY', 'public key');
-define('TESTS_ZEND_SERVICE_RECAPTCHA_PRIVATE_KEY', 'private key');
-define('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PUBLIC_KEY', 'public mailhide key');
-define('TESTS_ZEND_SERVICE_RECAPTCHA_MAILHIDE_PRIVATE_KEY', 'private mailhide key');
-
-/**
- * Zend_Service_Simpy tests
- */
-define('TESTS_ZEND_SERVICE_SIMPY_ENABLED', false);
-define('TESTS_ZEND_SERVICE_SIMPY_USERNAME', 'syapizend');
-define('TESTS_ZEND_SERVICE_SIMPY_PASSWORD', 'mgt37ge');
-
-/**
- * Zend_Service_SlideShare tests
- */
-define('TESTS_ZEND_SERVICE_SLIDESHARE_USERNAME', '');
-define('TESTS_ZEND_SERVICE_SLIDESHARE_PASSWORD', '');
-define('TESTS_ZEND_SERVICE_SLIDESHARE_SHAREDSECRET', '');
-define('TESTS_ZEND_SERVICE_SLIDESHARE_APIKEY', '');
-
-// The slide show ID to retrieve during tests
-define('TESTS_ZEND_SERVICE_SLIDESHARE_SLIDESHOWID', 0);
-
-// The tag to retrieve during tests
-define('TESTS_ZEND_SERVICE_SLIDESHARE_TAG', 'zend');
-
-// The group to retrieve during tests
-define('TESTS_ZEND_SERVICE_SLIDESHARE_GROUP', '');
-
-/**
- * Zend_Service_Twitter tests
- *
- * ONLINE_ENABLED indicates whether or not to run tests requiring a network
- * connection.
- *
- * TWITTER_USER and TWITTER_PASS are valid Twitter credentials you wish to use
- * when testing.
- */
-define('TESTS_ZEND_SERVICE_TWITTER_ONLINE_ENABLED', false);
-define('TESTS_ZEND_SERVICE_TWITTER_USER', 'zftestuser');
-define('TESTS_ZEND_SERVICE_TWITTER_PASS', 'zftestuser');
-
-/**
- * Zend_Service_WindowsAzure  tests
  */
 
 /**
@@ -675,8 +48,7 @@ define('TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_PROD',                'I+ebY
 /**
  * Blob storage tests
  */
-// Enable this tests only when you have a working account
-define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNTESTS',                   false);
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNTESTS',                   true);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNONPROD',                  false);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNLARGEBLOB',               true);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_CONTAINER_PREFIX',           'phpazuretestblob');
@@ -686,65 +58,33 @@ define('TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOBSA_CONTAINER_PREFIX',         'phpaz
 /**
  * Table storage tests
  */
-// Enable this tests only when you have a working account
-define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNTESTS',                  false);
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNTESTS',                  true);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_RUNONPROD',                 false);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_TABLENAME_PREFIX',          'phpazuretesttable');
 
 /**
  * Queue storage tests
  */
-define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS',                  false);
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS',                  true);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNONPROD',                 false);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_PREFIX',                    'phpazuretestqueue');
 
 /**
  * SessionHandler tests
  */
-define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS',         false);
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS',         true);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNONPROD',        false);
 define('TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_TABLENAME_PREFIX', 'phpazuretestsession');
 
 /**
- * Zend_Service_Yahoo online tests
- */
-define('TESTS_ZEND_SERVICE_YAHOO_ONLINE_ENABLED', false);
-define('TESTS_ZEND_SERVICE_YAHOO_ONLINE_APPID', 'Enter APPID here');
-
-/**
- * Zend_Soap_AutoDiscover scenario tests for complex objects and wsdl generation
- *
- * Copy all the files of zf/tests/Zend/Soap/_files/fulltests into a directory
- * that can be reached by webserver and enter the base uri to this directory
- * into the variable. The test "Zend_Soap_AutoDiscover_OnlineTest" makes use
- * of the servers and AutoDiscover feature.
- *
- * NOTE: Make sure the servers are using the correct Zend Framework copy,
- * when having more than one version installed and include paths are changing.
- */
-define('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI', false);
-
-/**
- * Zend_Uri tests
- *
- * Setting CRASH_TEST_ENABLED to true will enable some tests that may
- * potentially crash PHP on some systems, due to very deep-nesting regular
- * expressions.
- *
- * Only do this if you know what you are doing!
- */
-define('TESTS_ZEND_URI_CRASH_TEST_ENABLED', false);
-
-/**
- * Zend_Validate tests
- *
- * Set ONLINE_ENABLED if you wish to run validators that require network
- * connectivity.
+ * Diagnostics tests
  */
-define('TESTS_ZEND_VALIDATE_ONLINE_ENABLED', false);
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_RUNTESTS',            true);
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_RUNONPROD',           false);
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_CONTAINER_PREFIX',    'phpazuretestdiag');
 
 /**
  * PHPUnit Code Coverage / Test Report
  */
-define('TESTS_GENERATE_REPORT', false);
-define('TESTS_GENERATE_REPORT_TARGET', '/path/to/target');
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_GENERATE_REPORT',                 true);
+define('TESTS_ZEND_SERVICE_WINDOWSAZURE_GENERATE_REPORT_TARGET',          '/path/to/target');

+ 25 - 32
tests/TestHelper.php

@@ -13,14 +13,18 @@
  * to license@zend.com so we can send you a copy immediately.
  *
  * @category   Zend
- * @package    Zend
- * @subpackage UnitTests
+ * @package    UnitTests
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
  */
 
 /*
+ * Start output buffering
+ */
+ob_start();
+
+/*
  * Include PHPUnit dependencies
  */
 require_once 'PHPUnit/Framework.php';
@@ -32,7 +36,7 @@ require_once 'PHPUnit/TextUI/TestRunner.php';
 require_once 'PHPUnit/Util/Filter.php';
 
 /*
- * Set error reporting to the level to which Zend Framework code must comply.
+ * Set error reporting to the highest level.
  */
 error_reporting( E_ALL | E_STRICT );
 
@@ -40,13 +44,20 @@ error_reporting( E_ALL | E_STRICT );
  * Determine the root, library, and tests directories of the framework
  * distribution.
  */
-$zfRoot        = realpath(dirname(dirname(__FILE__)));
+$zfRoot        = dirname(__FILE__) . '/..';
 $zfCoreLibrary = "$zfRoot/library";
 $zfCoreTests   = "$zfRoot/tests";
 
 /*
- * Prepend the Zend Framework library/ and tests/ directories to the
- * include_path. This allows the tests to run out of the box and helps prevent
+ * Omit from code coverage reports the contents of the tests directory
+ */
+foreach (array('php', 'phtml', 'csv') as $suffix) {
+    PHPUnit_Util_Filter::addDirectoryToFilter($zfCoreTests, ".$suffix");
+}
+
+/*
+ * Prepend the library/ and tests/ directories to the include_path.
+ * This allows the tests to run out of the box and helps prevent
  * loading other copies of the framework code and tests that would supersede
  * this copy.
  */
@@ -67,33 +78,15 @@ if (is_readable($zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
     require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
 }
 
-if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true &&
+/*
+ * Add library/ directory to the PHPUnit code coverage whitelist.
+ * This has the effect that only production code source files appear
+ * in the code coverage report and that all production code source files, even
+ * those that are not covered by a test yet, are processed.
+ */
+if (defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_GENERATE_REPORT') && TESTS_ZEND_SERVICE_WINDOWSAZURE_GENERATE_REPORT === true &&
     version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
-
-    /*
-     * Add Zend Framework library/ directory to the PHPUnit code coverage
-     * whitelist. This has the effect that only production code source files
-     * appear in the code coverage report and that all production code source
-     * files, even those that are not covered by a test yet, are processed.
-     */
     PHPUnit_Util_Filter::addDirectoryToWhitelist($zfCoreLibrary);
-
-    /*
-     * Omit from code coverage reports the contents of the tests directory
-     */
-    foreach (array('.php', '.phtml', '.csv', '.inc') as $suffix) {
-        PHPUnit_Util_Filter::addDirectoryToFilter($zfCoreTests, $suffix);
-    }
-    PHPUnit_Util_Filter::addDirectoryToFilter(PEAR_INSTALL_DIR);
-    PHPUnit_Util_Filter::addDirectoryToFilter(PHP_LIBDIR);
-}
-
-
-/**
- * Start output buffering, if enabled
- */
-if (defined('TESTS_ZEND_OB_ENABLED') && constant('TESTS_ZEND_OB_ENABLED')) {
-    ob_start();
 }
 
 /*

+ 6 - 4
tests/Zend/Service/WindowsAzure/AllTests.php

@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: AllTests.php 35999 2009-12-21 07:56:42Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
@@ -30,6 +30,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
 }
 
 require_once 'Zend/Service/WindowsAzure/Credentials/AllTests.php';
+require_once 'Zend/Service/WindowsAzure/Diagnostics/AllTests.php';
 require_once 'Zend/Service/WindowsAzure/RetryPolicyTest.php';
 require_once 'Zend/Service/WindowsAzure/StorageTest.php';
 require_once 'Zend/Service/WindowsAzure/BlobStorageTest.php';
@@ -46,7 +47,7 @@ require_once 'Zend/Service/WindowsAzure/SessionHandlerTest.php';
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: AllTests.php 35999 2009-12-21 07:56:42Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
@@ -59,9 +60,10 @@ class Zend_Service_WindowsAzure_AllTests
 
     public static function suite()
     {
-        $suite = new PHPUnit_Framework_TestSuite('Zend_Service_WindowsAzure test suite');
+        $suite = new PHPUnit_Framework_TestSuite(__CLASS__);
 
-        $suite->addTestSuite(Zend_Service_WindowsAzure_Credentials_AllTests::suite());
+        $suite->addTest(Zend_Service_WindowsAzure_Credentials_AllTests::suite());
+        $suite->addTest(Zend_Service_WindowsAzure_Diagnostics_AllTests::suite());
         
         $suite->addTestSuite('Zend_Service_WindowsAzure_RetryPolicyTest');
         $suite->addTestSuite('Zend_Service_WindowsAzure_StorageTest');

+ 10 - 12
tests/Zend/Service/WindowsAzure/BlobStorageSharedAccessTest.php

@@ -15,35 +15,33 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageSharedAccessTest.php 25258 2009-08-14 08:40:41Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_BlobStorageSharedAccessTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Storage_Blob 
- */
+/** Zend_Service_WindowsAzure_Storage_Blob */
 require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Credentials_SharedAccessSignature 
- */
+/** Zend_Service_WindowsAzure_Credentials_SharedAccessSignature */
 require_once 'Zend/Service/WindowsAzure/Credentials/SharedAccessSignature.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_BlobStorageSharedAccessTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageSharedAccessTest.php 25258 2009-08-14 08:40:41Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */

File diff suppressed because it is too large
+ 579 - 266
tests/Zend/Service/WindowsAzure/BlobStorageTest.php


+ 9 - 9
tests/Zend/Service/WindowsAzure/BlobStreamTest.php

@@ -15,30 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStreamTest.php 24354 2009-07-24 08:48:54Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_BlobStreamTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Storage_Blob 
- */
+/** Zend_Service_WindowsAzure_Storage_Blob */
 require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_BlobStreamTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStreamTest.php 24354 2009-07-24 08:48:54Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */

+ 4 - 3
tests/Zend/Service/WindowsAzure/Credentials/AllTests.php

@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: AllTests.php 35709 2009-12-14 14:14:14Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
@@ -32,11 +32,12 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
 require_once 'Zend/Service/WindowsAzure/Credentials/SharedKeyTest.php';
 require_once 'Zend/Service/WindowsAzure/Credentials/SharedKeyLiteTest.php';
 require_once 'Zend/Service/WindowsAzure/Credentials/SharedAccessSignatureTest.php';
+
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: AllTests.php 35709 2009-12-14 14:14:14Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
@@ -49,7 +50,7 @@ class Zend_Service_WindowsAzure_Credentials_AllTests
 
     public static function suite()
     {
-        $suite = new PHPUnit_Framework_TestSuite('Zend_Service_WindowsAzure_Credentials test suite');
+        $suite = new PHPUnit_Framework_TestSuite(__CLASS__);
 
         $suite->addTestSuite('Zend_Service_WindowsAzure_Credentials_SharedKeyTest');
         $suite->addTestSuite('Zend_Service_WindowsAzure_Credentials_SharedKeyLiteTest');

+ 9 - 10
tests/Zend/Service/WindowsAzure/Credentials/SharedAccessSignatureTest.php

@@ -15,31 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: SharedKeyCredentialsTest.php 22847 2009-06-24 06:51:14Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_Credentials_SharedAccessSignatureTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Credentials_SharedAccessSignature 
- */
+/** Zend_Service_WindowsAzure_Credentials_SharedAccessSignature */
 require_once 'Zend/Service/WindowsAzure/Credentials/SharedAccessSignature.php';
 
-
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_SharedAccessSignatureCredentialsTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: SharedKeyCredentialsTest.php 22847 2009-06-24 06:51:14Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */

+ 15 - 15
tests/Zend/Service/WindowsAzure/Credentials/SharedKeyLiteTest.php

@@ -15,30 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: SharedKeyCredentialsTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_Credentials_SharedKeyLiteTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Credentials_SharedKeyLite 
- */
+/** Zend_Service_WindowsAzure_Credentials_SharedKeyLite */
 require_once 'Zend/Service/WindowsAzure/Credentials/SharedKeyLite.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_SharedKeyLiteCredentialsTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: SharedKeyCredentialsTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
@@ -61,7 +61,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLiteTest extends PHPUnit_Fr
                               '/',
                               '',
                               array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"),
-                              false
+                              true
                           );
                           
         $this->assertType('array', $signedHeaders);
@@ -80,7 +80,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLiteTest extends PHPUnit_Fr
                               '/test',
                               '',
                               array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"),
-                              false
+                              true
                           );
   
         $this->assertType('array', $signedHeaders);
@@ -99,7 +99,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLiteTest extends PHPUnit_Fr
                               '/',
                               '?test=true',
                               array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"),
-                              false
+                              true
                           );
   
         $this->assertType('array', $signedHeaders);
@@ -118,7 +118,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLiteTest extends PHPUnit_Fr
                               '/',
                               '',
                               array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"),
-                              false
+                              true
                           );
                           
         $this->assertType('array', $signedHeaders);
@@ -137,7 +137,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLiteTest extends PHPUnit_Fr
                               '/test',
                               '',
                               array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"),
-                              false
+                              true
                           );
   
         $this->assertType('array', $signedHeaders);
@@ -156,7 +156,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyLiteTest extends PHPUnit_Fr
                               '/',
                               '?test=true',
                               array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"),
-                              false
+                              true
                           );
   
         $this->assertType('array', $signedHeaders);

+ 14 - 12
tests/Zend/Service/WindowsAzure/Credentials/SharedKeyTest.php

@@ -15,19 +15,21 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: SharedKeyTest.php 35999 2009-12-21 07:56:42Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_Credentials_SharedKeyTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../../TestHelper.php';
-
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_SharedKeyCredentialsTest::main');
-}
+require_once dirname(__FILE__) . '/../../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
 /** Zend_Service_WindowsAzure_Credentials_SharedKey */
 require_once 'Zend/Service/WindowsAzure/Credentials/SharedKey.php';
@@ -36,7 +38,7 @@ require_once 'Zend/Service/WindowsAzure/Credentials/SharedKey.php';
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: SharedKeyTest.php 35999 2009-12-21 07:56:42Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
@@ -64,7 +66,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyTest extends PHPUnit_Framew
                           
         $this->assertType('array', $signedHeaders);
         $this->assertEquals(2, count($signedHeaders));
-        $this->assertEquals("SharedKey devstoreaccount1:ijwRTxfJgqvmfdWPSLCpgxfvHpl6Kbbo/qJTzlI7wUw=", $signedHeaders["Authorization"]);
+        $this->assertEquals("SharedKey devstoreaccount1:9tokqwSDIqvRioVZ1k0mv5m/iseHsGRYmAMGJVu6NcU=", $signedHeaders["Authorization"]);
     }
     
     /**
@@ -83,7 +85,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyTest extends PHPUnit_Framew
   
         $this->assertType('array', $signedHeaders);
         $this->assertEquals(2, count($signedHeaders));
-        $this->assertEquals("SharedKey devstoreaccount1:ZLs/nBsEaoyCqHpqcQUfXO5zIHBTMcrzVaIxwQNBL9k=", $signedHeaders["Authorization"]);
+        $this->assertEquals("SharedKey devstoreaccount1:YHPfUXoeL/XZjEYii2pfSZi3CsOB++5sA4QT7CAvPig=", $signedHeaders["Authorization"]);
     }
     
     /**
@@ -102,7 +104,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyTest extends PHPUnit_Framew
   
         $this->assertType('array', $signedHeaders);
         $this->assertEquals(2, count($signedHeaders));
-        $this->assertEquals("SharedKey devstoreaccount1:ijwRTxfJgqvmfdWPSLCpgxfvHpl6Kbbo/qJTzlI7wUw=", $signedHeaders["Authorization"]);
+        $this->assertEquals("SharedKey devstoreaccount1:S1+AcI8z19N0EP0eRTEj4UUCtPbKyUcZDAt299AWudw=", $signedHeaders["Authorization"]);
     }
     
     /**
@@ -121,7 +123,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyTest extends PHPUnit_Framew
                           
         $this->assertType('array', $signedHeaders);
         $this->assertEquals(2, count($signedHeaders));
-        $this->assertEquals("SharedKey testing:TEYBENKs+6laykL+zCxlIbUT9v019rtMWECYwgP/OuU=", $signedHeaders["Authorization"]);
+        $this->assertEquals("SharedKey testing:amg3/Z6Yx0KxwhRz9yn1ZCPZXYWIp5aEDCeZ1H5UIwo=", $signedHeaders["Authorization"]);
     }
     
     /**
@@ -140,7 +142,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyTest extends PHPUnit_Framew
   
         $this->assertType('array', $signedHeaders);
         $this->assertEquals(2, count($signedHeaders));
-        $this->assertEquals("SharedKey testing:d2kcDGCQ603wPuZ3KHbeILtNhIXMXyTNVn2x9d5aF60=", $signedHeaders["Authorization"]);
+        $this->assertEquals("SharedKey testing:ISA0m0Gy2SrxxjBO9ogtIbz0xNNyJ/GujUv5s1ibQrY=", $signedHeaders["Authorization"]);
     }
     
     /**
@@ -159,7 +161,7 @@ class Zend_Service_WindowsAzure_Credentials_SharedKeyTest extends PHPUnit_Framew
   
         $this->assertType('array', $signedHeaders);
         $this->assertEquals(2, count($signedHeaders));
-        $this->assertEquals("SharedKey testing:TEYBENKs+6laykL+zCxlIbUT9v019rtMWECYwgP/OuU=", $signedHeaders["Authorization"]);
+        $this->assertEquals("SharedKey testing:vlfVjEbBaRVTv35e924cR4B/Z5zCaSYjbtMz9/k3UCY=", $signedHeaders["Authorization"]);
     }
 }
 

+ 61 - 0
tests/Zend/Service/WindowsAzure/Diagnostics/AllTests.php

@@ -0,0 +1,61 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage UnitTests
+ * @version    $Id$
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+
+/**
+ * Test helpers
+ */
+require_once dirname(__FILE__) . '/../../../../TestHelper.php';
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_Diagnostics_AllTests::main');
+}
+
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ManagerTest.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage UnitTests
+ * @version    $Id$
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_WindowsAzure_Diagnostics_AllTests
+{
+    public static function main()
+    {
+        PHPUnit_TextUI_TestRunner::run(self::suite());
+    }
+
+    public static function suite()
+    {
+        $suite = new PHPUnit_Framework_TestSuite(__CLASS__);
+
+        $suite->addTestSuite('Zend_Service_WindowsAzure_Diagnostics_ManagerTest');
+        
+        return $suite;
+    }
+}
+
+if (PHPUnit_MAIN_METHOD == 'Zend_Service_WindowsAzure_Diagnostics_AllTests::main') {
+    Zend_Service_WindowsAzure_Diagnostics_AllTests::main();
+}

+ 188 - 0
tests/Zend/Service/WindowsAzure/Diagnostics/ManagerTest.php

@@ -0,0 +1,188 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage UnitTests
+ * @version    $Id$
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_Diagnostics_ManagerTest::main');
+}
+
+/**
+ * Test helpers
+ */
+require_once dirname(__FILE__) . '/../../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
+
+/** Zend_Service_WindowsAzure_Storage_Blob */
+require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
+
+/** Zend_Service_WindowsAzure_Diagnostics_Manager */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
+
+/** Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance */
+require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationInstance.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_WindowsAzure
+ * @subpackage UnitTests
+ * @version    $Id$
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_WindowsAzure_Diagnostics_ManagerTest extends PHPUnit_Framework_TestCase
+{
+    public static function main()
+    {
+        $suite  = new PHPUnit_Framework_TestSuite("Zend_Service_WindowsAzure_Diagnostics_ManagerTest");
+        $result = PHPUnit_TextUI_TestRunner::run($suite);
+    }
+
+    /**
+     * Test teardown
+     */
+    protected function tearDown()
+    {
+        $storageClient = $this->createStorageInstance();
+        for ($i = 1; $i <= self::$uniqId; $i++)
+        {
+            try { $storageClient->deleteContainer(TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_CONTAINER_PREFIX . $i); } catch (Exception $e) { }
+        }
+    }
+
+    protected function createStorageInstance()
+    {
+        $storageClient = null;
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_RUNONPROD)
+        {
+            $storageClient = new Zend_Service_WindowsAzure_Storage_Blob(TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_PROD, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_PROD, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_PROD, false, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::retryN(10, 250));
+        } else {
+            $storageClient = new Zend_Service_WindowsAzure_Storage_Blob(TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_HOST_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV, true, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::retryN(10, 250));
+        }
+        
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY) {
+            $storageClient->setProxy(TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS);
+        }
+
+        return $storageClient;
+    }
+    
+    protected static $uniqId = 0;
+    
+    protected function generateName()
+    {
+        self::$uniqId++;
+        return TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_CONTAINER_PREFIX . self::$uniqId;
+    }
+    
+    /**
+     * Test manager initialize
+     */
+    public function testManagerInitialize()
+    {
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_RUNTESTS) {
+    		$controlContainer = $this->generateName();
+    		
+    		$storageClient = $this->createStorageInstance();
+            $manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient, $controlContainer);
+            
+            $result = $storageClient->containerExists($controlContainer);
+            $this->assertTrue($result);
+    	}
+    }
+    
+	/**
+     * Test manager default configuration
+     */
+    public function testManagerDefaultConfiguration()
+    {
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_RUNTESTS) {
+    		$controlContainer = $this->generateName();
+    		
+    		$storageClient = $this->createStorageInstance();
+            $manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient, $controlContainer);
+            
+            $configuration = $manager->getDefaultConfiguration();
+            $manager->setConfigurationForRoleInstance('test', $configuration);
+            
+            $this->assertEquals($configuration->toXml(), $manager->getConfigurationForRoleInstance('test')->toXml());
+    	}
+    }
+    
+	/**
+     * Test manager custom configuration
+     */
+    public function testManagerCustomConfiguration()
+    {
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_RUNTESTS) {
+    		$controlContainer = $this->generateName();
+    		
+    		$storageClient = $this->createStorageInstance();
+            $manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient, $controlContainer);
+            
+            $configuration = $manager->getDefaultConfiguration();
+			$configuration->DataSources->OverallQuotaInMB = 1;
+			$configuration->DataSources->Logs->BufferQuotaInMB = 1;
+			$configuration->DataSources->Logs->ScheduledTransferPeriodInMinutes = 1;
+			$configuration->DataSources->PerformanceCounters->BufferQuotaInMB = 1;
+			$configuration->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes = 1;
+			$configuration->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB = 1;
+			$configuration->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes = 1;
+			$configuration->DataSources->PerformanceCounters->addSubscription('\Processor(*)\% Processor Time', 1);
+			$configuration->DataSources->WindowsEventLog->addSubscription('System!*');
+			$configuration->DataSources->WindowsEventLog->addSubscription('Application!*');
+            $manager->setConfigurationForRoleInstance('test', $configuration);
+            
+            $result = $manager->getConfigurationForRoleInstance('test');
+            
+            $this->assertEquals($configuration->toXml(), $result->toXml());
+            $this->assertEquals(1, count($result->DataSources->PerformanceCounters->Subscriptions));
+            $this->assertEquals(2, count($result->DataSources->WindowsEventLog->Subscriptions));
+    	}
+    }
+    
+	/**
+     * Test manager configuration exists
+     */
+    public function testManagerConfigurationExists()
+    {
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_DIAGNOSTICS_RUNTESTS) {
+    		$controlContainer = $this->generateName();
+    		
+    		$storageClient = $this->createStorageInstance();
+            $manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient, $controlContainer);
+            
+            $result = $manager->configurationForRoleInstanceExists('test');
+            $this->assertFalse($result);
+            
+            $configuration = $manager->getDefaultConfiguration();
+            $manager->setConfigurationForRoleInstance('test', $configuration);
+            
+            $result = $manager->configurationForRoleInstanceExists('test');
+            $this->assertTrue($result);
+    	}
+    }
+}
+
+// Call Zend_Service_WindowsAzure_Credentials_SharedKeyTest::main() if this source file is executed directly.
+if (PHPUnit_MAIN_METHOD == "Zend_Service_WindowsAzure_Diagnostics_ManagerTest::main") {
+    Zend_Service_WindowsAzure_Diagnostics_ManagerTest::main();
+}

+ 9 - 10
tests/Zend/Service/WindowsAzure/DynamicTableEntityTest.php

@@ -15,31 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_DynamicTableEntityTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Storage_DynamicTableEntity 
- */
+/** Zend_Service_WindowsAzure_Storage_DynamicTableEntity */
 require_once 'Zend/Service/WindowsAzure/Storage/DynamicTableEntity.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_DynamicTableEntityTest::main');
-}
-
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */

+ 226 - 161
tests/Zend/Service/WindowsAzure/QueueStorageTest.php

@@ -15,30 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: QueueStorageTest.php 24241 2009-07-22 09:43:13Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_QueueStorageTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Storage_Queue 
- */
+/** Zend_Service_WindowsAzure_Storage_Queue */
 require_once 'Zend/Service/WindowsAzure/Storage/Queue.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_QueueStorageTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: QueueStorageTest.php 24241 2009-07-22 09:43:13Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
@@ -46,20 +46,19 @@ class Zend_Service_WindowsAzure_QueueStorageTest extends PHPUnit_Framework_TestC
 {
     public static function main()
     {
-        $suite  = new PHPUnit_Framework_TestSuite("Zend_Service_WindowsAzure_QueueStorageTest");
-        $result = PHPUnit_TextUI_TestRunner::run($suite);
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS)  {
+            $suite  = new PHPUnit_Framework_TestSuite("Zend_Service_WindowsAzure_QueueStorageTest");
+            $result = PHPUnit_TextUI_TestRunner::run($suite);
+        }
     }
-
+   
     /**
      * Test setup
      */
     protected function setUp()
     {
-        if (!TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
-            $this->markTestSkipped('Windows Azure Tests disabled');
-        }
     }
-
+    
     /**
      * Test teardown
      */
@@ -80,223 +79,289 @@ class Zend_Service_WindowsAzure_QueueStorageTest extends PHPUnit_Framework_TestC
         } else {
             $storageClient = new Zend_Service_WindowsAzure_Storage_Queue(TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV, true, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::retryN(10, 250));
         }
-
+        
         if (TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY) {
             $storageClient->setProxy(TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS);
         }
 
         return $storageClient;
     }
-
+    
     protected static $uniqId = 0;
-
+    
     protected function generateName()
     {
         self::$uniqId++;
         return TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_PREFIX . self::$uniqId;
     }
-
+    
     /**
      * Test queue exists
      */
     public function testQueueExists()
     {
-        $queueName1 = $this->generateName();
-        $queueName2 = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName1);
-        $storageClient->createQueue($queueName2);
-
-        $result = $storageClient->queueExists($queueName1);
-        $this->assertTrue($result);
-
-        $result = $storageClient->queueExists(md5(time()));
-        $this->assertFalse($result);
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName1 = $this->generateName();
+            $queueName2 = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName1);
+            $storageClient->createQueue($queueName2);
+
+            $result = $storageClient->queueExists($queueName1);
+            $this->assertTrue($result);
+            
+            $result = $storageClient->queueExists(md5(time()));
+            $this->assertFalse($result);
+        }
     }
-
+    
     /**
      * Test create queue
      */
     public function testCreateQueue()
     {
-        $queueName = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $result = $storageClient->createQueue($queueName);
-        $this->assertEquals($queueName, $result->Name);
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $result = $storageClient->createQueue($queueName);
+            $this->assertEquals($queueName, $result->Name);
+        }
     }
-
+    
     /**
      * Test set queue metadata
      */
     public function testSetQueueMetadata()
     {
-        $queueName = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName);
-
-        $storageClient->setQueueMetadata($queueName, array(
-            'createdby' => 'PHPAzure',
-        ));
-
-        $metadata = $storageClient->getQueueMetadata($queueName);
-        $this->assertEquals('PHPAzure', $metadata['createdby']);
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName);
+            
+            $storageClient->setQueueMetadata($queueName, array(
+                'createdby' => 'PHPAzure',
+            ));
+            
+            $metadata = $storageClient->getQueueMetadata($queueName);
+            $this->assertEquals('PHPAzure', $metadata['createdby']);
+        }
     }
-
+    
     /**
      * Test get queue
      */
     public function testGetQueue()
     {
-        $queueName = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName);
-
-        $queue = $storageClient->getQueue($queueName);
-        $this->assertEquals($queueName, $queue->Name);
-        $this->assertEquals(0, $queue->ApproximateMessageCount);
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName);
+            
+            $queue = $storageClient->getQueue($queueName);
+            $this->assertEquals($queueName, $queue->Name);
+            $this->assertEquals(0, $queue->ApproximateMessageCount);
+        }
     }
-
+    
     /**
      * Test list queues
      */
     public function testListQueues()
     {
-        $queueName1 = 'testlist1';
-        $queueName2 = 'testlist2';
-        $queueName3 = 'testlist3';
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName1);
-        $storageClient->createQueue($queueName2);
-        $storageClient->createQueue($queueName3);
-        $result1 = $storageClient->listQueues('testlist');
-        $result2 = $storageClient->listQueues('testlist', 1);
-
-        // cleanup first
-        $storageClient->deleteQueue($queueName1);
-        $storageClient->deleteQueue($queueName2);
-        $storageClient->deleteQueue($queueName3);
-
-        $this->assertEquals(3, count($result1));
-        $this->assertEquals($queueName2, $result1[1]->Name);
-
-        $this->assertEquals(1, count($result2));
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName1 = 'testlist1';
+            $queueName2 = 'testlist2';
+            $queueName3 = 'testlist3';
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName1);
+            $storageClient->createQueue($queueName2);
+            $storageClient->createQueue($queueName3);
+            $result1 = $storageClient->listQueues('testlist');
+            $result2 = $storageClient->listQueues('testlist', 1);
+    
+            // cleanup first
+            $storageClient->deleteQueue($queueName1);
+            $storageClient->deleteQueue($queueName2);
+            $storageClient->deleteQueue($queueName3);
+            
+            $this->assertEquals(3, count($result1));
+            $this->assertEquals($queueName2, $result1[1]->Name);
+            
+            $this->assertEquals(1, count($result2));
+        }
     }
-
+    
+    /**
+     * Test list queues with metadata
+     */
+    public function testListQueuesWithMetadata()
+    {
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName, array(
+                'createdby' => 'PHPAzure',
+                'ownedby' => 'PHPAzure',
+            ));
+            
+            $result = $storageClient->listQueues($queueName, null, null, 'metadata');
+            
+            $this->assertEquals('PHPAzure', $result[0]->Metadata['createdby']);
+            $this->assertEquals('PHPAzure', $result[0]->Metadata['ownedby']);
+        }
+    }
+    
     /**
      * Test put message
      */
     public function testPutMessage()
     {
-        $queueName = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName);
-        $storageClient->putMessage($queueName, 'Test message', 120);
-
-        sleep(45); // wait for the message to appear in the queue...
-
-        $messages = $storageClient->getMessages($queueName);
-        $this->assertEquals(1, count($messages));
-        $this->assertEquals('Test message', $messages[0]->MessageText);
+    	if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName);
+            $storageClient->putMessage($queueName, 'Test message', 120);
+            
+            sleep(5); // wait for the message to appear in the queue...
+            
+            $messages = $storageClient->getMessages($queueName);
+            $this->assertEquals(1, count($messages));
+            $this->assertEquals('Test message', $messages[0]->MessageText);
+        }
     }
-
+    
     /**
      * Test get messages
      */
     public function testGetMessages()
     {
-        $queueName = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName);
-        $storageClient->putMessage($queueName, 'Test message 1', 120);
-        $storageClient->putMessage($queueName, 'Test message 2', 120);
-        $storageClient->putMessage($queueName, 'Test message 3', 120);
-        $storageClient->putMessage($queueName, 'Test message 4', 120);
-
-        sleep(45); // wait for the messages to appear in the queue...
-
-        $messages1 = $storageClient->getMessages($queueName, 2);
-        $messages2 = $storageClient->getMessages($queueName, 2);
-        $messages3 = $storageClient->getMessages($queueName);
-
-        $this->assertEquals(2, count($messages1));
-        $this->assertEquals(2, count($messages2));
-        $this->assertEquals(0, count($messages3));
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName);
+            $storageClient->putMessage($queueName, 'Test message 1', 120);
+            $storageClient->putMessage($queueName, 'Test message 2', 120);
+            $storageClient->putMessage($queueName, 'Test message 3', 120);
+            $storageClient->putMessage($queueName, 'Test message 4', 120);
+            
+            sleep(5); // wait for the messages to appear in the queue...
+            
+            $messages1 = $storageClient->getMessages($queueName, 2);
+            $messages2 = $storageClient->getMessages($queueName, 2);
+            $messages3 = $storageClient->getMessages($queueName);
+            
+            $this->assertEquals(2, count($messages1));
+            $this->assertEquals(2, count($messages2));
+            $this->assertEquals(0, count($messages3));
+        }
     }
-
+    
     /**
      * Test peek messages
      */
     public function testPeekMessages()
     {
-        $queueName = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName);
-        $storageClient->putMessage($queueName, 'Test message 1', 120);
-        $storageClient->putMessage($queueName, 'Test message 2', 120);
-        $storageClient->putMessage($queueName, 'Test message 3', 120);
-        $storageClient->putMessage($queueName, 'Test message 4', 120);
-
-        sleep(45); // wait for the messages to appear in the queue...
-
-        $messages1 = $storageClient->peekMessages($queueName, 4);
-        $messages2 = $storageClient->getMessages($queueName, 4);
-
-        $this->assertEquals(4, count($messages1));
-        $this->assertEquals(4, count($messages2));
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName);
+            $storageClient->putMessage($queueName, 'Test message 1', 120);
+            $storageClient->putMessage($queueName, 'Test message 2', 120);
+            $storageClient->putMessage($queueName, 'Test message 3', 120);
+            $storageClient->putMessage($queueName, 'Test message 4', 120);
+            
+            sleep(5); // wait for the messages to appear in the queue...
+            
+            $messages1 = $storageClient->peekMessages($queueName, 4);
+            $messages2 = $storageClient->getMessages($queueName, 4);
+            
+            $this->assertEquals(4, count($messages1));
+            $this->assertEquals(4, count($messages2));
+        }
     }
-
+    
+    /**
+     * Test dequeuecount
+     */
+    public function testDequeueCount()
+    {
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName);
+            $storageClient->putMessage($queueName, 'Test message 1', 120);
+            
+            sleep(5); // wait for the message to appear in the queue...
+            
+            $expectedDequeueCount = 3;
+            for ($i = 0; $i < $expectedDequeueCount - 1; $i++) {
+	            $storageClient->getMessages($queueName, 1, 1);
+	            sleep(3);
+            }
+            
+            $messages = $storageClient->getMessages($queueName, 1);
+            
+            $this->assertEquals($expectedDequeueCount, $messages[0]->DequeueCount);
+        }
+    }
+    
     /**
      * Test clear messages
      */
     public function testClearMessages()
     {
-        $queueName = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName);
-        $storageClient->putMessage($queueName, 'Test message 1', 120);
-        $storageClient->putMessage($queueName, 'Test message 2', 120);
-        $storageClient->putMessage($queueName, 'Test message 3', 120);
-        $storageClient->putMessage($queueName, 'Test message 4', 120);
-
-        sleep(45); // wait for the messages to appear in the queue...
-
-        $messages1 = $storageClient->peekMessages($queueName, 4);
-        $storageClient->clearMessages($queueName);
-
-        sleep(45); // wait for the GC...
-
-        $messages2 = $storageClient->peekMessages($queueName, 4);
-
-        $this->assertEquals(4, count($messages1));
-        $this->assertEquals(0, count($messages2));
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName);
+            $storageClient->putMessage($queueName, 'Test message 1', 120);
+            $storageClient->putMessage($queueName, 'Test message 2', 120);
+            $storageClient->putMessage($queueName, 'Test message 3', 120);
+            $storageClient->putMessage($queueName, 'Test message 4', 120);
+            
+            sleep(5); // wait for the messages to appear in the queue...
+            
+            $messages1 = $storageClient->peekMessages($queueName, 4);
+            $storageClient->clearMessages($queueName);
+            
+            sleep(5); // wait for the GC...
+            
+            $messages2 = $storageClient->peekMessages($queueName, 4);
+            
+            $this->assertEquals(4, count($messages1));
+            $this->assertEquals(0, count($messages2));
+        }
     }
-
+    
     /**
      * Test delete message
      */
     public function testDeleteMessage()
     {
-        $queueName = $this->generateName();
-        $storageClient = $this->createStorageInstance();
-        $storageClient->createQueue($queueName);
-        $storageClient->putMessage($queueName, 'Test message 1', 120);
-        $storageClient->putMessage($queueName, 'Test message 2', 120);
-        $storageClient->putMessage($queueName, 'Test message 3', 120);
-        $storageClient->putMessage($queueName, 'Test message 4', 120);
-
-        sleep(45); // wait for the messages to appear in the queue...
-
-        $messages1 = $storageClient->getMessages($queueName, 2, 10);
-        foreach ($messages1 as $message) {
-            $storageClient->deleteMessage($queueName, $message);
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) {
+            $queueName = $this->generateName();
+            $storageClient = $this->createStorageInstance();
+            $storageClient->createQueue($queueName);
+            $storageClient->putMessage($queueName, 'Test message 1', 120);
+            $storageClient->putMessage($queueName, 'Test message 2', 120);
+            $storageClient->putMessage($queueName, 'Test message 3', 120);
+            $storageClient->putMessage($queueName, 'Test message 4', 120);
+            
+            sleep(5); // wait for the messages to appear in the queue...
+            
+            $messages1 = $storageClient->getMessages($queueName, 2, 10);
+            foreach ($messages1 as $message)
+            {
+                $storageClient->deleteMessage($queueName, $message);
+            }
+            
+            sleep(5); // wait for the GC...
+            
+            $messages2 = $storageClient->getMessages($queueName, 4);
+            
+            $this->assertEquals(2, count($messages1));
+            $this->assertEquals(2, count($messages2));
         }
-
-        sleep(45); // wait for the GC...
-
-        $messages2 = $storageClient->getMessages($queueName, 4);
-
-        $this->assertEquals(2, count($messages1));
-        $this->assertEquals(2, count($messages2));
     }
 }
 

+ 9 - 9
tests/Zend/Service/WindowsAzure/RetryPolicyTest.php

@@ -15,30 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: RetryPolicyTest.php 35709 2009-12-14 14:14:14Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_RetryPolicyTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract
- */
+/** Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract */
 require_once 'Zend/Service/WindowsAzure/RetryPolicy/RetryPolicyAbstract.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_RetryPolicyTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: RetryPolicyTest.php 35709 2009-12-14 14:14:14Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */

+ 120 - 107
tests/Zend/Service/WindowsAzure/SessionHandlerTest.php

@@ -15,35 +15,33 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_SessionHandlerTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_SessionHandler 
- */
+/** Zend_Service_WindowsAzure_SessionHandler */
 require_once 'Zend/Service/WindowsAzure/SessionHandler.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Storage_Table 
- */
+/** Zend_Service_WindowsAzure_Storage_Table */
 require_once 'Zend/Service/WindowsAzure/Storage/Table.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_SessionHandlerTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
@@ -52,23 +50,22 @@ class Zend_Service_WindowsAzure_SessionHandlerTest extends PHPUnit_Framework_Tes
     public function __construct()
     {
     }
-
+    
     public static function main()
     {
-        $suite  = new PHPUnit_Framework_TestSuite("Zend_Service_WindowsAzure_SessionHandlerTest");
-        $result = PHPUnit_TextUI_TestRunner::run($suite);
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
+            $suite  = new PHPUnit_Framework_TestSuite("Zend_Service_WindowsAzure_SessionHandlerTest");
+            $result = PHPUnit_TextUI_TestRunner::run($suite);
+        }
     }
-
+    
     /**
      * Test setup
      */
     protected function setUp()
     {
-        if (!TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
-            $this->markTestSkipped('Windows Azure Tests disabled');
-        }
     }
-
+    
     /**
      * Test teardown
      */
@@ -80,7 +77,7 @@ class Zend_Service_WindowsAzure_SessionHandlerTest extends PHPUnit_Framework_Tes
             try { $storageClient->deleteTable(TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_TABLENAME_PREFIX . $i); } catch (Exception $e) { }
         }
     }
-
+    
     protected function createStorageInstance()
     {
         $storageClient = null;
@@ -89,14 +86,14 @@ class Zend_Service_WindowsAzure_SessionHandlerTest extends PHPUnit_Framework_Tes
         } else {
             $storageClient = new Zend_Service_WindowsAzure_Storage_Table(TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV, true, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::retryN(10, 250));
         }
-
+        
         if (TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY) {
             $storageClient->setProxy(TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS);
         }
 
         return $storageClient;
     }
-
+    
     protected function createSessionHandler($storageInstance, $tableName)
     {
         $sessionHandler = new Zend_Service_WindowsAzure_SessionHandler(
@@ -105,137 +102,153 @@ class Zend_Service_WindowsAzure_SessionHandlerTest extends PHPUnit_Framework_Tes
         );
         return $sessionHandler;
     }
-
+    
     protected static $uniqId = 0;
-
+    
     protected function generateName()
     {
         self::$uniqId++;
         return TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_TABLENAME_PREFIX . self::$uniqId;
     }
-
+    
     /**
      * Test register
      */
     public function testRegister()
     {
-        $storageClient = $this->createStorageInstance();
-        $tableName = $this->generateName();
-        $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
-        $result = $sessionHandler->register();
-
-        $this->assertTrue($result);
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
+            $storageClient = $this->createStorageInstance();
+            $tableName = $this->generateName();
+            $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
+            $result = $sessionHandler->register();
+            
+            $this->assertTrue($result);
+        }
     }
-
+    
     /**
      * Test open
      */
     public function testOpen()
     {
-        $storageClient = $this->createStorageInstance();
-        $tableName = $this->generateName();
-        $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
-        $result = $sessionHandler->open();
-
-        $this->assertTrue($result);
-
-        $verifyResult = $storageClient->listTables();
-        $this->assertEquals($tableName, $verifyResult[0]->Name);
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
+            $storageClient = $this->createStorageInstance();
+            $tableName = $this->generateName();
+            $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
+            $result = $sessionHandler->open();
+
+            $this->assertTrue($result);
+            
+            
+            $verifyResult = $storageClient->listTables();
+            $this->assertEquals($tableName, $verifyResult[0]->Name);
+        }
     }
-
+    
     /**
      * Test close
      */
     public function testClose()
     {
-        $storageClient = $this->createStorageInstance();
-        $tableName = $this->generateName();
-        $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
-        $sessionHandler->open();
-        $result = $sessionHandler->close();
-
-        $this->assertTrue($result);
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
+            $storageClient = $this->createStorageInstance();
+            $tableName = $this->generateName();
+            $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
+            $sessionHandler->open();
+            $result = $sessionHandler->close();
+            
+            $this->assertTrue($result);
+        }
     }
-
+    
     /**
      * Test read
      */
     public function testRead()
     {
-        $storageClient = $this->createStorageInstance();
-        $tableName = $this->generateName();
-        $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
-        $sessionHandler->open();
-
-        $sessionId = $this->session_id();
-        $sessionData = serialize( 'PHPAzure' );
-        $sessionHandler->write($sessionId, $sessionData);
-
-        $result = unserialize( $sessionHandler->read($sessionId) );
-
-        $this->assertEquals('PHPAzure', $result);
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
+            $storageClient = $this->createStorageInstance();
+            $tableName = $this->generateName();
+            $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
+            $sessionHandler->open();
+            
+            $sessionId = $this->session_id();
+            $sessionData = serialize( 'PHPAzure' );
+            $sessionHandler->write($sessionId, $sessionData);
+            
+            $result = unserialize( $sessionHandler->read($sessionId) );
+            
+            $this->assertEquals('PHPAzure', $result);
+        }
     }
-
+    
     /**
      * Test write
      */
     public function testWrite()
     {
-        $storageClient = $this->createStorageInstance();
-        $tableName = $this->generateName();
-        $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
-        $sessionHandler->open();
-
-        $sessionId = $this->session_id();
-        $sessionData = serialize( 'PHPAzure' );
-        $sessionHandler->write($sessionId, $sessionData);
-
-        $verifyResult = $storageClient->retrieveEntities($tableName);
-        $this->assertEquals(1, count($verifyResult));
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
+            $storageClient = $this->createStorageInstance();
+            $tableName = $this->generateName();
+            $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
+            $sessionHandler->open();
+            
+            $sessionId = $this->session_id();
+            $sessionData = serialize( 'PHPAzure' );
+            $sessionHandler->write($sessionId, $sessionData);
+            
+            
+            $verifyResult = $storageClient->retrieveEntities($tableName);
+            $this->assertEquals(1, count($verifyResult));
+        }
     }
-
+    
     /**
      * Test destroy
      */
     public function testDestroy()
     {
-        $storageClient = $this->createStorageInstance();
-        $tableName = $this->generateName();
-        $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
-        $sessionHandler->open();
-
-        $sessionId = $this->session_id();
-        $sessionData = serialize( 'PHPAzure' );
-        $sessionHandler->write($sessionId, $sessionData);
-
-        $result = $sessionHandler->destroy($sessionId);
-        $this->assertTrue($result);
-
-        $verifyResult = $storageClient->retrieveEntities($tableName);
-        $this->assertEquals(0, count($verifyResult));
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
+            $storageClient = $this->createStorageInstance();
+            $tableName = $this->generateName();
+            $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
+            $sessionHandler->open();
+            
+            $sessionId = $this->session_id();
+            $sessionData = serialize( 'PHPAzure' );
+            $sessionHandler->write($sessionId, $sessionData);
+            
+            $result = $sessionHandler->destroy($sessionId);
+            $this->assertTrue($result);
+            
+            $verifyResult = $storageClient->retrieveEntities($tableName);
+            $this->assertEquals(0, count($verifyResult));
+        }
     }
-
+    
     /**
      * Test gc
      */
     public function testGc()
     {
-        $storageClient = $this->createStorageInstance();
-        $tableName = $this->generateName();
-        $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
-        $sessionHandler->open();
-
-        $sessionId = $this->session_id();
-        $sessionData = serialize( 'PHPAzure' );
-        $sessionHandler->write($sessionId, $sessionData);
-
-        sleep(1); // let time() tick
-
-        $result = $sessionHandler->gc(0);
-        $this->assertTrue($result);
-
-        $verifyResult = $storageClient->retrieveEntities($tableName);
-        $this->assertEquals(0, count($verifyResult));
+        if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNTESTS) {
+            $storageClient = $this->createStorageInstance();
+            $tableName = $this->generateName();
+            $sessionHandler = $this->createSessionHandler($storageClient, $tableName);
+            $sessionHandler->open();
+            
+            $sessionId = $this->session_id();
+            $sessionData = serialize( 'PHPAzure' );
+            $sessionHandler->write($sessionId, $sessionData);
+            
+            sleep(1); // let time() tick
+            
+            $result = $sessionHandler->gc(0);
+            $this->assertTrue($result);
+            
+            $verifyResult = $storageClient->retrieveEntities($tableName);
+            $this->assertEquals(0, count($verifyResult));
+        }
     }
 
     protected function session_id()

+ 9 - 9
tests/Zend/Service/WindowsAzure/StorageTest.php

@@ -15,30 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: StorageTest.php 28585 2009-09-07 12:12:56Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_StorageTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Storage
- */
+/** Zend_Service_WindowsAzure_Storage */
 require_once 'Zend/Service/WindowsAzure/Storage.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_StorageTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: StorageTest.php 28585 2009-09-07 12:12:56Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */

+ 9 - 9
tests/Zend/Service/WindowsAzure/TableEntityQueryTest.php

@@ -15,30 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_TableEntityQueryTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Storage_TableEntityQuery
- */
+/** Zend_Service_WindowsAzure_Storage_TableEntityQuery */
 require_once 'Zend/Service/WindowsAzure/Storage/TableEntityQuery.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_TableEntityQueryTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */

+ 9 - 9
tests/Zend/Service/WindowsAzure/TableEntityTest.php

@@ -15,30 +15,30 @@
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_TableEntityTest::main');
+}
+
 /**
  * Test helpers
  */
 require_once dirname(__FILE__) . '/../../../TestHelper.php';
+require_once dirname(__FILE__) . '/../../../TestConfiguration.php.dist';
+require_once 'PHPUnit/Framework/TestCase.php';
 
-/**
- * @see Zend_Service_WindowsAzure_Storage_TableEntity 
- */
+/** Zend_Service_WindowsAzure_Storage_TableEntity */
 require_once 'Zend/Service/WindowsAzure/Storage/TableEntity.php';
 
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Zend_Service_WindowsAzure_TableEntityTest::main');
-}
-
 /**
  * @category   Zend
  * @package    Zend_Service_WindowsAzure
  * @subpackage UnitTests
- * @version    $Id: BlobStorageTest.php 14561 2009-05-07 08:05:12Z unknown $
+ * @version    $Id$
  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */

File diff suppressed because it is too large
+ 534 - 449
tests/Zend/Service/WindowsAzure/TableStorageTest.php


Some files were not shown because too many files changed in this diff