@@ -607,7 +607,7 @@ SUITE(Blob)
607
607
m_context.set_response_received (std::function<void (web::http::http_request &, const web::http::http_response&, azure::storage::operation_context)>());
608
608
}
609
609
610
- TEST_FIXTURE (page_blob_test_base, page_blob_prevsnapshot )
610
+ TEST_FIXTURE (page_blob_test_base, page_blob_prevsnapshot_time )
611
611
{
612
612
m_blob.create (2048 , 0 , azure::storage::access_condition (), azure::storage::blob_request_options (), m_context);
613
613
@@ -686,6 +686,90 @@ SUITE(Blob)
686
686
}
687
687
}
688
688
689
+ // TEST_FIXTURE(page_blob_test_base, page_blob_prevsnapshot_url)
690
+ // {
691
+ // auto get_snapshot_url = [](azure::storage::cloud_page_blob& snapshot)
692
+ // {
693
+ // return snapshot.uri().primary_uri().to_string() + _XPLATSTR("?snapshot=") + snapshot.snapshot_time();
694
+ // };
695
+
696
+ // m_blob.create(2048, 0, azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
697
+
698
+ // azure::storage::cloud_page_blob snapshot1 = m_blob.create_snapshot(azure::storage::cloud_metadata(), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
699
+ // auto diff = m_blob.download_page_ranges_diff_md(get_snapshot_url(snapshot1), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
700
+ // CHECK(0 == diff.size());
701
+
702
+ // {
703
+ // utility::string_t content(2048, _XPLATSTR('A'));
704
+ // auto utf8_body = utility::conversions::to_utf8string(content);
705
+ // auto stream = concurrency::streams::bytestream::open_istream(std::move(utf8_body));
706
+ // m_blob.upload_pages(stream, 0, _XPLATSTR(""));
707
+ // diff = m_blob.download_page_ranges_diff_md(get_snapshot_url(snapshot1), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
708
+ // CHECK(1 == diff.size());
709
+ // CHECK_EQUAL(false, diff[0].is_cleared_rage());
710
+ // CHECK(0 == diff[0].start_offset());
711
+ // CHECK(2047 == diff[0].end_offset());
712
+ // }
713
+
714
+ // azure::storage::cloud_page_blob snapshot2 = m_blob.create_snapshot(azure::storage::cloud_metadata(), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
715
+ // auto diff2 = snapshot2.download_page_ranges_diff_md(get_snapshot_url(snapshot1), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
716
+ // CHECK_EQUAL(false, diff[0].is_cleared_rage());
717
+ // CHECK(0 == diff[0].start_offset());
718
+ // CHECK(2047 == diff[0].end_offset());
719
+
720
+ // {
721
+ // utility::string_t content(512, _XPLATSTR('B'));
722
+ // auto utf8_body = utility::conversions::to_utf8string(content);
723
+ // auto stream = concurrency::streams::bytestream::open_istream(std::move(utf8_body));
724
+ // m_blob.upload_pages(stream, 0, _XPLATSTR(""));
725
+ // m_blob.clear_pages(512, 512);
726
+ // diff = m_blob.download_page_ranges_diff_md(get_snapshot_url(snapshot2), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
727
+ // CHECK(2 == diff.size());
728
+ // if (diff[0].is_cleared_rage() == true)
729
+ // {
730
+ // auto temp = diff[0];
731
+ // diff[0] = diff[1];
732
+ // diff[1] = temp;
733
+ // }
734
+ // CHECK_EQUAL(false, diff[0].is_cleared_rage());
735
+ // CHECK(0 == diff[0].start_offset());
736
+ // CHECK(511 == diff[0].end_offset());
737
+
738
+ // CHECK_EQUAL(true, diff[1].is_cleared_rage());
739
+ // CHECK(512 == diff[1].start_offset());
740
+ // CHECK(1023 == diff[1].end_offset());
741
+ // }
742
+
743
+ // azure::storage::cloud_page_blob snapshot3 = m_blob.create_snapshot(azure::storage::cloud_metadata(), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
744
+ // auto diff3 = snapshot3.download_page_ranges_diff_md(get_snapshot_url(snapshot2), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
745
+ // CHECK(2 == diff.size());
746
+ // if (diff[0].is_cleared_rage() == true)
747
+ // {
748
+ // auto temp = diff[0];
749
+ // diff[0] = diff[1];
750
+ // diff[1] = temp;
751
+ // }
752
+ // CHECK_EQUAL(false, diff[0].is_cleared_rage());
753
+ // CHECK(0 == diff[0].start_offset());
754
+ // CHECK(511 == diff[0].end_offset());
755
+
756
+ // CHECK_EQUAL(true, diff[1].is_cleared_rage());
757
+ // CHECK(512 == diff[1].start_offset());
758
+ // CHECK(1023 == diff[1].end_offset());
759
+
760
+ // {
761
+ // utility::string_t content(2048, _XPLATSTR('A'));
762
+ // auto utf8_body = utility::conversions::to_utf8string(content);
763
+ // auto stream = concurrency::streams::bytestream::open_istream(std::move(utf8_body));
764
+ // m_blob.upload_pages(stream, 0, _XPLATSTR(""));
765
+ // diff = m_blob.download_page_ranges_diff_md(get_snapshot_url(snapshot1), azure::storage::access_condition(), azure::storage::blob_request_options(), m_context);
766
+ // CHECK(1 == diff.size());
767
+ // CHECK_EQUAL(false, diff[0].is_cleared_rage());
768
+ // CHECK(0 == diff[0].start_offset());
769
+ // CHECK(2047 == diff[0].end_offset());
770
+ // }
771
+ // }
772
+
689
773
TEST_FIXTURE (page_blob_test_base, page_blob_incremental_copy)
690
774
{
691
775
// get sas token for test
0 commit comments