diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-21 09:14:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-21 09:14:35 +0200 |
commit | 991249b70460b61f3b73b53387dbc20357aedaa1 (patch) | |
tree | 7862378237365b2d0abbf51965f0620f165db0c9 /document/src/tests/documentidtest.cpp | |
parent | cb00b309ed537867e36e97dd2c9801c01d84489b (diff) |
Revert "Revert "doc: -> id:""
Diffstat (limited to 'document/src/tests/documentidtest.cpp')
-rw-r--r-- | document/src/tests/documentidtest.cpp | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/document/src/tests/documentidtest.cpp b/document/src/tests/documentidtest.cpp index 9befac431f6..a6255cc148a 100644 --- a/document/src/tests/documentidtest.cpp +++ b/document/src/tests/documentidtest.cpp @@ -23,14 +23,6 @@ TEST(DocumentIdTest, generateJavaComplianceFile) { // Generate file with globalids and bucket ID of various document ids, // which java will use to ensure equal implementations. std::ostringstream ost; - writeGlobalIdBucketId(ost, "doc:ns:specific"); - writeGlobalIdBucketId(ost, "doc:another:specific"); - writeGlobalIdBucketId(ost, "doc:ns:another"); - for (uint32_t i=0; i<20; ++i) { - std::ostringstream ost2; - ost2 << i; - writeGlobalIdBucketId(ost, "doc:ns:"+ost2.str()); - } writeGlobalIdBucketId(ost, "id:ns:type::specific"); writeGlobalIdBucketId(ost, "id:another:type::specific"); writeGlobalIdBucketId(ost, "id:ns:type::another"); @@ -51,17 +43,16 @@ TEST(DocumentIdTest, generateJavaComplianceFile) TEST(DocumentIdTest, testOutput) { - DocumentId id(DocIdString("crawler", "http://www.yahoo.com")); + DocumentId id("id:ns:news::crawler:http://www.yahoo.com"); std::ostringstream ost; ost << id; - std::string expected("doc:crawler:http://www.yahoo.com"); + std::string expected("id:ns:news::crawler:http://www.yahoo.com"); EXPECT_EQ(expected, ost.str()); EXPECT_EQ(vespalib::string(expected), id.toString()); - expected = "DocumentId(id = doc:crawler:http://www.yahoo.com, " - "gid(0x928baffb39cf32004542fb60))"; + expected = "DocumentId(id = id:ns:news::crawler:http://www.yahoo.com, gid(0xa516a5abd7c7fa26944b72f7))"; EXPECT_EQ(expected, static_cast<Printable&>(id).toString(true)); } @@ -77,11 +68,11 @@ namespace { TEST(DocumentIdTest, testEqualityOperator) { - std::string uri(DocIdString("crawler", "http://www.yahoo.com").toString()); + std::string uri("id:ns:news::crawler:http://www.yahoo.com"); DocumentId id1(uri); DocumentId id2(uri); - DocumentId id3("doc:crawler:http://www.yahoo.no/"); + DocumentId id3("id:ns:news::crawler:http://www.yahoo.no/"); EXPECT_EQ(id1, id2); EXPECT_NE(id1, id3); @@ -89,11 +80,11 @@ TEST(DocumentIdTest, testEqualityOperator) TEST(DocumentIdTest, testCopying) { - std::string uri(DocIdString("crawler", "http://www.yahoo.com/").toString()); + std::string uri("id:crawler:news::http://www.yahoo.com"); DocumentId id1(uri); DocumentId id2(id1); - DocumentId id3("doc:ns:foo"); + DocumentId id3("id:ns:foo::"); id3 = id2; EXPECT_EQ(id1, id2); @@ -102,21 +93,8 @@ TEST(DocumentIdTest, testCopying) TEST(DocumentIdTest, checkNtnuGlobalId) { - DocumentId id("doc:crawler:http://www.ntnu.no/"); - EXPECT_EQ(vespalib::string("gid(0xb8863740be14221c0ac77896)"), id.getGlobalId().toString()); -} - -TEST(DocumentIdTest, testDocGlobalId) -{ - // Test that location of doc scheme documents are set correctly, such - // that the location is the first bytes of the original GID. - std::string id("doc:crawler:http://www.ntnu.no/"); - DocumentId did(id); - - unsigned char key[16]; - fastc_md5sum(reinterpret_cast<const unsigned char*>(id.c_str()), id.size(), key); - - EXPECT_EQ(GlobalId(key), did.getGlobalId()); + DocumentId id("id:ns:news::crawler:http://www.ntnu.no/"); + EXPECT_EQ(vespalib::string("gid(0x1e9d7fc69ac6c1da44dd87e0)"), id.getGlobalId().toString()); } TEST(DocumentIdTest, freestandingLocationFromGroupNameFuncMatchesIdLocation) |