Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
afb6d972
Commit
afb6d972
authored
May 08, 2019
by
Michael Davis
Browse files
[checksum] Adds cta::checksum namespace
parent
8eda7cda
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
catalogue/ArchiveFileRow.hpp
View file @
afb6d972
...
...
@@ -86,7 +86,7 @@ struct ArchiveFileRow {
/**
* Set of checksum types and values
*/
ChecksumBlob
checksumBlob
;
checksum
::
ChecksumBlob
checksumBlob
;
/**
* The name of the file's storage class.
...
...
catalogue/CatalogueTest.cpp
View file @
afb6d972
This diff is collapsed.
Click to expand it.
catalogue/OracleCatalogue.hpp
View file @
afb6d972
...
...
@@ -146,7 +146,7 @@ private:
*/
struct
FileSizeAndChecksum
{
uint64_t
fileSize
;
ChecksumBlob
checksumBlob
;
checksum
::
ChecksumBlob
checksumBlob
;
};
/**
...
...
catalogue/PostgresCatalogue.hpp
View file @
afb6d972
...
...
@@ -155,7 +155,7 @@ private:
*/
struct
FileSizeAndChecksum
{
uint64_t
fileSize
;
ChecksumBlob
checksumBlob
;
checksum
::
ChecksumBlob
checksumBlob
;
};
/**
...
...
catalogue/TapeFileWritten.hpp
View file @
afb6d972
...
...
@@ -86,7 +86,7 @@ struct TapeFileWritten: public TapeItemWritten {
/**
* Set of checksum types and values
*/
ChecksumBlob
checksumBlob
;
checksum
::
ChecksumBlob
checksumBlob
;
/**
* The name of the file's storage class.
...
...
common/CMakeLists.txt
View file @
afb6d972
...
...
@@ -171,7 +171,7 @@ target_link_libraries (ctacommon
)
set
(
COMMON_UNIT_TESTS_LIB_SRC_FILES
checksum/ChecksumTest.cpp
checksum/Checksum
Blob
Test.cpp
ConfigurationFileTests.cpp
SourcedParameterTests.cpp
dataStructures/ArchiveFileTest.cpp
...
...
common/checksum/ChecksumBlob.cpp
View file @
afb6d972
...
...
@@ -17,19 +17,36 @@
*/
#include
"ChecksumBlob.hpp"
#include
"
cta_common.pb.h
"
#include
"
ChecksumBlobSerDeser.hpp
"
namespace
cta
{
namespace
checksum
{
void
ChecksumBlob
::
insert
(
Checksum
::
ChecksumType
type
,
const
std
::
string
&
value
)
{
void
ChecksumBlob
::
insert
(
ChecksumType
type
,
const
std
::
string
&
value
)
{
throw
exception
::
Exception
(
"not implemented"
);
}
void
ChecksumBlob
::
insert
(
Checksum
::
ChecksumType
type
,
uint32_t
value
)
{
void
ChecksumBlob
::
insert
(
ChecksumType
type
,
uint32_t
value
)
{
throw
exception
::
Exception
(
"not implemented"
);
}
void
ChecksumBlob
::
validate
(
const
ChecksumBlob
&
blob
)
const
{
if
(
m_cs
.
size
()
!=
blob
.
m_cs
.
size
())
{
throw
exception
::
ChecksumBlobSizeMismatch
(
"Checksum blob size does not match. expected="
+
std
::
to_string
(
m_cs
.
size
())
+
" actual="
+
std
::
to_string
(
blob
.
m_cs
.
size
()));
}
auto
it1
=
m_cs
.
begin
();
auto
it2
=
blob
.
m_cs
.
begin
();
for
(
;
it1
!=
m_cs
.
end
();
++
it1
,
++
it2
)
{
throw
exception
::
Exception
(
"not implemented"
);
}
}
std
::
string
ChecksumBlob
::
serialize
()
const
{
throw
exception
::
Exception
(
"not implemented"
);
#if 0
common::ChecksumBlob csb;
for(auto &cs : m_cs) {
...
...
@@ -37,7 +54,6 @@ std::string ChecksumBlob::serialize() const {
switch(cs.getType()) {
case Checksum::CHECKSUMTYPE_NONE:
default:
throw
exception
::
Exception
(
"not implemented"
);
p_cs->set_type(common::ChecksumBlob::Checksum::NONE);
}
p_cs->set_value(cs.getByteArray());
...
...
@@ -46,6 +62,7 @@ std::string ChecksumBlob::serialize() const {
std::string s;
csb.SerializeToString(&s);
return s;
#endif
}
size_t
ChecksumBlob
::
length
()
const
{
...
...
@@ -57,13 +74,16 @@ void ChecksumBlob::deserialize(const std::string &bytearray) {
throw
exception
::
Exception
(
"not implemented"
);
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cta
::
ChecksumBlob
&
csb
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
ChecksumBlob
&
csb
)
{
throw
exception
::
Exception
(
"not implemented"
);
#if 0
os << "(";
for(auto &cs : csb.m_cs) {
os << " " << cs << " ";
}
os << ")";
#endif
return
os
;
}
}
// namespace cta
}
}
// namespace cta
::checksum
common/checksum/ChecksumBlob.hpp
View file @
afb6d972
...
...
@@ -18,54 +18,92 @@
#pragma once
#include
<
set
>
#include
<
map
>
#include
<common/checksum/Checksum.hpp>
#include
<common/exception/ChecksumBlobSizeMismatch.hpp>
#include
<common/exception/ChecksumTypeMismatch.hpp>
#include
<common/exception/ChecksumValueMismatch.hpp>
namespace
cta
{
namespace
checksum
{
/*!
* A set of one or more checksums
* Enumeration of the supported checksum types
*
* We allow all checksum types supported by EOS
*/
enum
ChecksumType
{
NONE
,
//!< No checksum specified
ADLER32
,
//!< Adler-32 checksum
CRC32
,
//!< CRC-32 checksum
CRC32C
,
//!< CRC-32C checksum
MD5
,
//!< MD5 128-bit hash
SHA1
//!< SHA-1 160-bit hash
};
/*!
* A class to store one or more checksums
*/
class
ChecksumBlob
{
public:
/*!
* Clear all of the checksums in this blob
*/
void
clear
()
{
m_cs
.
clear
();
}
/*!
* Insert a new checksum into the blob
*
* @param[in] value Little-endian byte array containing the checksum
*/
void
insert
(
Checksum
::
ChecksumType
type
,
const
std
::
string
&
value
);
void
insert
(
ChecksumType
type
,
const
std
::
string
&
value
);
/*!
* Insert a new 32-bit checksum into the blob
*
* Only valid for Adler-32, CRC-32 and CRC-32c checksums
*
* @param[in] value 32-bit unsigned integer containing the checksum
*/
void
insert
(
Checksum
::
ChecksumType
type
,
uint32_t
value
);
void
insert
(
ChecksumType
type
,
uint32_t
value
);
/*!
* Check all the checksums in the blob match, throw an exception if they don't
* Return the checksum for the specified key
*/
std
::
string
at
(
ChecksumType
type
)
{
return
m_cs
.
at
(
type
);
}
/*!
* Check that a single checksum is in the blob and that it has the value expected, throw an exception if not
*/
void
validate
(
const
ChecksumBlob
&
blob
)
const
{
if
(
m_cs
.
size
()
!=
blob
.
m_cs
.
size
())
{
throw
exception
::
ChecksumBlobSizeMismatch
(
"Checksum blob sizes of "
+
std
::
to_string
(
m_cs
.
size
())
+
" and "
+
std
::
to_string
(
blob
.
m_cs
.
size
())
+
" do not match."
);
}
auto
it1
=
m_cs
.
begin
();
auto
it2
=
blob
.
m_cs
.
begin
();
for
(
;
it1
!=
m_cs
.
end
();
++
it1
,
++
it2
)
{
it1
->
validate
(
*
it2
);
}
void
validate
(
ChecksumType
type
,
const
std
::
string
&
value
)
const
;
/*!
* Returns true if the checksum is in the blob and that it has the value expected
*/
bool
contains
(
ChecksumType
type
,
const
std
::
string
&
value
)
const
{
try
{
validate
(
type
,
value
);
}
catch
(
exception
::
ChecksumTypeMismatch
&
ex
)
{
return
false
;
}
catch
(
exception
::
ChecksumValueMismatch
&
ex
)
{
return
false
;
}
return
true
;
}
/*!
* Check all the checksums in the blob match, throw an exception if they don't
*/
void
validate
(
const
ChecksumBlob
&
blob
)
const
;
/*!
* Returns true if all the checksums in the blob match
*/
bool
operator
==
(
const
ChecksumBlob
&
blob
)
const
{
try
{
this
->
validate
(
blob
);
validate
(
blob
);
}
catch
(
exception
::
ChecksumBlobSizeMismatch
&
ex
)
{
return
false
;
}
catch
(
exception
::
ChecksumTypeMismatch
&
ex
)
{
...
...
@@ -98,7 +136,7 @@ public:
private:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
ChecksumBlob
&
csb
);
std
::
set
<
Checksum
>
m_cs
;
std
::
map
<
Checksum
Type
,
std
::
string
>
m_cs
;
};
}
// namespace cta
}
}
// namespace cta
::checksum
common/checksum/ChecksumBlobSerDeser.hpp
0 → 100644
View file @
afb6d972
/*!
* @project The CERN Tape Archive (CTA)
* @brief Convert checksum::ChecksumBlob to/from common::ChecksumBlob (EOS-CTA protobuf)
* @copyright Copyright 2019 CERN
* @license This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include
"common/checksum/ChecksumBlob.hpp"
#include
"cta_common.pb.h"
namespace
cta
{
namespace
checksum
{
void
ProtobufToChecksumBlob
(
const
common
::
ChecksumBlob
&
p_csb
,
checksum
::
ChecksumBlob
&
csb
)
{
csb
.
clear
();
for
(
auto
&
cs
:
p_csb
.
cs
())
{
checksum
::
ChecksumType
type
;
switch
(
cs
.
type
())
{
case
common
::
ChecksumBlob
::
Checksum
::
ADLER32
:
type
=
ADLER32
;
break
;
case
common
::
ChecksumBlob
::
Checksum
::
CRC32
:
type
=
CRC32
;
break
;
case
common
::
ChecksumBlob
::
Checksum
::
CRC32C
:
type
=
CRC32C
;
break
;
case
common
::
ChecksumBlob
::
Checksum
::
MD5
:
type
=
MD5
;
break
;
case
common
::
ChecksumBlob
::
Checksum
::
SHA1
:
type
=
SHA1
;
break
;
case
common
::
ChecksumBlob
::
Checksum
::
NONE
:
default:
type
=
NONE
;
break
;
}
csb
.
insert
(
type
,
cs
.
value
());
}
}
void
ChecksumBlobToProtobuf
(
const
checksum
::
ChecksumBlob
&
csb
,
common
::
ChecksumBlob
&
p_csb
)
{
throw
exception
::
Exception
(
"not implemented"
);
}
}}
// namespace cta::checksum
common/checksum/ChecksumTest.cpp
→
common/checksum/Checksum
Blob
Test.cpp
View file @
afb6d972
/*
/*
!
* The CERN Tape Archive (CTA) project
* Copyright (C) 201
5
CERN
* Copyright (C) 201
9
CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -16,13 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"common/checksum/Checksum.hpp"
#include
"common/checksum/Checksum
Blob
.hpp"
#include
<gtest/gtest.h>
#include
<arpa/inet.h>
namespace
unitTests
{
class
cta_ChecksumTest
:
public
::
testing
::
Test
{
class
cta_Checksum
Blob
Test
:
public
::
testing
::
Test
{
protected:
virtual
void
SetUp
()
{
}
...
...
@@ -31,39 +30,30 @@ protected:
}
};
TEST_F
(
cta_ChecksumTest
,
default_constructor
)
{
TEST_F
(
cta_Checksum
Blob
Test
,
default_constructor
)
{
using
namespace
cta
;
using
namespace
checksum
;
const
Checksum
checksum
;
const
Checksum
Blob
checksum
Blob
;
ASSERT_EQ
(
Checksum
::
CHECKSUMTYPE_NONE
,
checksum
.
getType
());
ASSERT_EQ
(
"-"
,
checksum
.
str
());
ASSERT_EQ
((
uint32_t
)
0
,
checksum
.
getByteArray
().
size
());
ASSERT_EQ
(
checksumBlob
.
length
(),
0
);
}
TEST_F
(
cta_ChecksumTest
,
two_param_constructor
)
{
TEST_F
(
cta_Checksum
Blob
Test
,
adler32
)
{
using
namespace
cta
;
using
namespace
checksum
;
const
Checksum
::
ChecksumType
checksumType
=
Checksum
::
CHECKSUMTYPE_ADLER32
;
c
onst
uint32_t
val
=
ntohl
(
0x0A141E28
);
const
Checksum
checksum
(
checksumType
,
val
);
Checksum
Blob
checksumBlob
;
c
hecksumBlob
.
insert
(
checksum
::
ADLER32
,
0x0A141E28
);
ASSERT_EQ
(
checksumBlob
.
length
(),
1
);
ASSERT_EQ
(
Checksum
::
CHECKSUMTYPE_ADLER32
,
checksum
.
getType
());
ASSERT_EQ
((
uint32_t
)
4
,
checksum
.
getByteArray
().
size
());
ASSERT_EQ
((
uint8_t
)
10
,
checksum
.
getByteArray
()[
0
]);
ASSERT_EQ
((
uint8_t
)
20
,
checksum
.
getByteArray
()[
1
]);
ASSERT_EQ
((
uint8_t
)
30
,
checksum
.
getByteArray
()[
2
]);
ASSERT_EQ
((
uint8_t
)
40
,
checksum
.
getByteArray
()[
3
]);
}
std
::
string
bytearray
=
checksumBlob
.
at
(
checksum
::
ADLER32
);
TEST_F
(
cta_ChecksumTest
,
url_constructor
)
{
using
namespace
cta
;
const
Checksum
checksum
(
"adler32:0x12345678"
);
ASSERT_EQ
(
Checksum
::
CHECKSUMTYPE_ADLER32
,
checksum
.
getType
());
ASSERT_EQ
(
0x12345678
,
checksum
.
getNumeric
<
uint32_t
>
());
ASSERT_EQ
(
4
,
bytearray
.
length
());
ASSERT_EQ
(
static_cast
<
uint8_t
>
(
10
),
bytearray
[
0
]);
ASSERT_EQ
(
static_cast
<
uint8_t
>
(
20
),
bytearray
[
1
]);
ASSERT_EQ
(
static_cast
<
uint8_t
>
(
30
),
bytearray
[
2
]);
ASSERT_EQ
(
static_cast
<
uint8_t
>
(
40
),
bytearray
[
3
]);
}
}
// namespace unitTests
common/dataStructures/ArchiveFile.hpp
View file @
afb6d972
...
...
@@ -53,7 +53,7 @@ struct ArchiveFile {
std
::
string
diskFileId
;
std
::
string
diskInstance
;
uint64_t
fileSize
;
ChecksumBlob
checksumBlob
;
checksum
::
ChecksumBlob
checksumBlob
;
std
::
string
storageClass
;
DiskFileInfo
diskFileInfo
;
/**
...
...
common/dataStructures/ArchiveFileTest.cpp
View file @
afb6d972
...
...
@@ -44,7 +44,7 @@ TEST_F(cta_common_dataStructures_ArchiveFileTest, copy_constructor) {
archiveFile1
.
archiveFileID
=
1234
;
archiveFile1
.
diskFileId
=
"EOS_file_ID"
;
archiveFile1
.
fileSize
=
1
;
archiveFile1
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1234"
);
archiveFile1
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1234"
);
archiveFile1
.
storageClass
=
"storage_class"
;
archiveFile1
.
diskInstance
=
"recovery_instance"
;
...
...
common/dataStructures/ArchiveRequest.hpp
View file @
afb6d972
...
...
@@ -48,7 +48,7 @@ struct ArchiveRequest {
std
::
string
srcURL
;
uint64_t
fileSize
;
ChecksumBlob
checksumBlob
;
checksum
::
ChecksumBlob
checksumBlob
;
std
::
string
storageClass
;
DiskFileInfo
diskFileInfo
;
std
::
string
archiveReportURL
;
...
...
common/dataStructures/TapeFile.hpp
View file @
afb6d972
...
...
@@ -73,7 +73,7 @@ struct TapeFile {
/**
* Set of checksum (type, value) pairs
*/
c
ta
::
ChecksumBlob
checksumBlob
;
c
hecksum
::
ChecksumBlob
checksumBlob
;
/**
* The vid of the tape file superseding this one (or empty string if not)
...
...
objectstore/AlgorithmsTest.cpp
View file @
afb6d972
...
...
@@ -50,7 +50,7 @@ void fillRetrieveRequests(
cta
::
common
::
dataStructures
::
RetrieveFileQueueCriteria
rqc
;
rqc
.
archiveFile
.
archiveFileID
=
123456789L
;
rqc
.
archiveFile
.
diskFileId
=
"eos://diskFile"
;
rqc
.
archiveFile
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
NONE
,
""
);
rqc
.
archiveFile
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
NONE
,
""
);
rqc
.
archiveFile
.
creationTime
=
0
;
rqc
.
archiveFile
.
reconciliationTime
=
0
;
rqc
.
archiveFile
.
diskFileInfo
=
cta
::
common
::
dataStructures
::
DiskFileInfo
();
...
...
@@ -129,7 +129,7 @@ TEST(ObjectStore, ArchiveQueueAlgorithms) {
cta
::
common
::
dataStructures
::
ArchiveFile
aFile
;
aFile
.
archiveFileID
=
123456789L
;
aFile
.
diskFileId
=
"eos://diskFile"
;
aFile
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
NONE
,
""
);
aFile
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
NONE
,
""
);
aFile
.
creationTime
=
0
;
aFile
.
reconciliationTime
=
0
;
aFile
.
diskFileInfo
=
cta
::
common
::
dataStructures
::
DiskFileInfo
();
...
...
objectstore/GarbageCollectorTest.cpp
View file @
afb6d972
...
...
@@ -360,7 +360,7 @@ TEST(ObjectStore, GarbageCollectorArchiveRequest) {
cta
::
common
::
dataStructures
::
ArchiveFile
aFile
;
aFile
.
archiveFileID
=
123456789L
;
aFile
.
diskFileId
=
"eos://diskFile"
;
aFile
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
NONE
,
""
);
aFile
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
NONE
,
""
);
aFile
.
creationTime
=
0
;
aFile
.
reconciliationTime
=
0
;
aFile
.
diskFileInfo
=
cta
::
common
::
dataStructures
::
DiskFileInfo
();
...
...
@@ -551,7 +551,7 @@ TEST(ObjectStore, GarbageCollectorRetrieveRequest) {
cta
::
common
::
dataStructures
::
RetrieveFileQueueCriteria
rqc
;
rqc
.
archiveFile
.
archiveFileID
=
123456789L
;
rqc
.
archiveFile
.
diskFileId
=
"eos://diskFile"
;
rqc
.
archiveFile
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
NONE
,
""
);
rqc
.
archiveFile
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
NONE
,
""
);
rqc
.
archiveFile
.
creationTime
=
0
;
rqc
.
archiveFile
.
reconciliationTime
=
0
;
rqc
.
archiveFile
.
diskFileInfo
=
cta
::
common
::
dataStructures
::
DiskFileInfo
();
...
...
scheduler/SchedulerDatabaseTest.cpp
View file @
afb6d972
...
...
@@ -166,7 +166,7 @@ TEST_P(SchedulerDatabaseTest, createManyArchiveJobs) {
afqc
.
mountPolicy
.
comment
=
"comment"
;
afqc
.
fileId
=
i
;
ar
.
archiveReportURL
=
""
;
ar
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
NONE
,
""
);
ar
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
NONE
,
""
);
ar
.
creationLog
=
{
"user"
,
"host"
,
time
(
nullptr
)};
uuid_t
fileUUID
;
uuid_generate
(
fileUUID
);
...
...
@@ -246,7 +246,7 @@ TEST_P(SchedulerDatabaseTest, createManyArchiveJobs) {
afqc
.
mountPolicy
.
comment
=
"comment"
;
afqc
.
fileId
=
i
;
ar
.
archiveReportURL
=
""
;
ar
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
NONE
,
""
);
ar
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
NONE
,
""
);
ar
.
creationLog
=
{
"user"
,
"host"
,
time
(
nullptr
)};
uuid_t
fileUUID
;
uuid_generate
(
fileUUID
);
...
...
scheduler/SchedulerTest.cpp
View file @
afb6d972
...
...
@@ -272,7 +272,7 @@ TEST_P(SchedulerTest, archive_to_new_file) {
diskFileInfo
.
owner_uid
=
CMS_USER
;
diskFileInfo
.
path
=
"path/to/file"
;
cta
::
common
::
dataStructures
::
ArchiveRequest
request
;
request
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1111"
);
request
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1111"
);
request
.
creationLog
=
creationLog
;
request
.
diskFileInfo
=
diskFileInfo
;
request
.
diskFileID
=
"diskFileID"
;
...
...
@@ -332,7 +332,7 @@ TEST_P(SchedulerTest, archive_to_new_file) {
// diskFileInfo.owner_uid=CMS_USER;
// diskFileInfo.path="path/to/file";
// cta::common::dataStructures::ArchiveRequest request;
// request.checksumBlob.insert(cta::
C
hecksum::
CHECKSUMTYPE_
ADLER32, "1111");
// request.checksumBlob.insert(cta::
c
hecksum::ADLER32, "1111");
// request.creationLog=creationLog;
// request.diskFileInfo=diskFileInfo;
// request.diskFileID="diskFileID";
...
...
@@ -405,7 +405,7 @@ TEST_P(SchedulerTest, archive_report_and_retrieve_new_file) {
diskFileInfo
.
owner_uid
=
CMS_USER
;
diskFileInfo
.
path
=
"path/to/file"
;
cta
::
common
::
dataStructures
::
ArchiveRequest
request
;
request
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1234abcd"
);
request
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1234abcd"
);
request
.
creationLog
=
creationLog
;
request
.
diskFileInfo
=
diskFileInfo
;
request
.
diskFileID
=
"diskFileID"
;
...
...
@@ -479,7 +479,7 @@ TEST_P(SchedulerTest, archive_report_and_retrieve_new_file) {
std
::
unique_ptr
<
ArchiveJob
>
archiveJob
=
std
::
move
(
archiveJobBatch
.
front
());
archiveJob
->
tapeFile
.
blockId
=
1
;
archiveJob
->
tapeFile
.
fSeq
=
1
;
archiveJob
->
tapeFile
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1234abcd"
);
archiveJob
->
tapeFile
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1234abcd"
);
archiveJob
->
tapeFile
.
fileSize
=
archiveJob
->
archiveFile
.
fileSize
;
archiveJob
->
tapeFile
.
copyNb
=
1
;
archiveJob
->
validate
();
...
...
@@ -603,7 +603,7 @@ TEST_P(SchedulerTest, archive_and_retrieve_failure) {
diskFileInfo
.
owner_uid
=
CMS_USER
;
diskFileInfo
.
path
=
"path/to/file"
;
cta
::
common
::
dataStructures
::
ArchiveRequest
request
;
request
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1234abcd"
);
request
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1234abcd"
);
request
.
creationLog
=
creationLog
;
request
.
diskFileInfo
=
diskFileInfo
;
request
.
diskFileID
=
"diskFileID"
;
...
...
@@ -677,7 +677,7 @@ TEST_P(SchedulerTest, archive_and_retrieve_failure) {
std
::
unique_ptr
<
ArchiveJob
>
archiveJob
=
std
::
move
(
archiveJobBatch
.
front
());
archiveJob
->
tapeFile
.
blockId
=
1
;
archiveJob
->
tapeFile
.
fSeq
=
1
;
archiveJob
->
tapeFile
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1234abcd"
);
archiveJob
->
tapeFile
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1234abcd"
);
archiveJob
->
tapeFile
.
fileSize
=
archiveJob
->
archiveFile
.
fileSize
;
archiveJob
->
tapeFile
.
copyNb
=
1
;
archiveJob
->
validate
();
...
...
@@ -852,7 +852,7 @@ TEST_P(SchedulerTest, archive_and_retrieve_report_failure) {
diskFileInfo
.
owner_uid
=
CMS_USER
;
diskFileInfo
.
path
=
"path/to/file"
;
cta
::
common
::
dataStructures
::
ArchiveRequest
request
;
request
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1234abcd"
);
request
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1234abcd"
);
request
.
creationLog
=
creationLog
;
request
.
diskFileInfo
=
diskFileInfo
;
request
.
diskFileID
=
"diskFileID"
;
...
...
@@ -926,7 +926,7 @@ TEST_P(SchedulerTest, archive_and_retrieve_report_failure) {
std
::
unique_ptr
<
ArchiveJob
>
archiveJob
=
std
::
move
(
archiveJobBatch
.
front
());
archiveJob
->
tapeFile
.
blockId
=
1
;
archiveJob
->
tapeFile
.
fSeq
=
1
;
archiveJob
->
tapeFile
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1234abcd"
);
archiveJob
->
tapeFile
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1234abcd"
);
archiveJob
->
tapeFile
.
fileSize
=
archiveJob
->
archiveFile
.
fileSize
;
archiveJob
->
tapeFile
.
copyNb
=
1
;
archiveJob
->
validate
();
...
...
@@ -1107,7 +1107,7 @@ TEST_P(SchedulerTest, retry_archive_until_max_reached) {
diskFileInfo
.
owner_uid
=
CMS_USER
;
diskFileInfo
.
path
=
"path/to/file"
;
cta
::
common
::
dataStructures
::
ArchiveRequest
request
;
request
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1111"
);
request
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1111"
);
request
.
creationLog
=
creationLog
;
request
.
diskFileInfo
=
diskFileInfo
;
request
.
diskFileID
=
"diskFileID"
;
...
...
@@ -1221,7 +1221,7 @@ TEST_P(SchedulerTest, showqueues) {
diskFileInfo
.
owner_uid
=
CMS_USER
;
diskFileInfo
.
path
=
"path/to/file"
;
cta
::
common
::
dataStructures
::
ArchiveRequest
request
;
request
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1111"
);
request
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1111"
);
request
.
creationLog
=
creationLog
;
request
.
diskFileInfo
=
diskFileInfo
;
request
.
diskFileID
=
"diskFileID"
;
...
...
@@ -1429,8 +1429,8 @@ TEST_P(SchedulerTest, expandRepackRequest) {
//Simulate the writing of 10 files per tape in the catalogue
std
::
set
<
catalogue
::
TapeItemWrittenPointer
>
tapeFilesWrittenCopy1
;
ChecksumBlob
checksumBlob
;
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"1234"
);
checksum
::
ChecksumBlob
checksumBlob
;
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"1234"
);
{
uint64_t
archiveFileId
=
1
;
for
(
uint64_t
i
=
1
;
i
<=
nbTapesToRepack
;
++
i
){
...
...
tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
View file @
afb6d972
...
...
@@ -437,7 +437,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionGooddayRecall) {
// Create file entry in the archive namespace
tapeFileWritten
.
archiveFileId
=
fseq
;
tapeFileWritten
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
cta
::
utils
::
getAdler32String
(
data
,
archiveFileSize
));
tapeFileWritten
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
cta
::
utils
::
getAdler32String
(
data
,
archiveFileSize
));
tapeFileWritten
.
vid
=
volInfo
.
vid
;
tapeFileWritten
.
size
=
archiveFileSize
;
tapeFileWritten
.
fSeq
=
fseq
;
...
...
@@ -616,7 +616,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongRecall) {
std
::
set
<
cta
::
catalogue
::
TapeItemWrittenPointer
>
tapeFileWrittenSet
;
tapeFileWrittenSet
.
insert
(
tapeFileWrittenUP
.
release
());
tapeFileWritten
.
archiveFileId
=
666
;
tapeFileWritten
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
"0xDEADBEEF"
);
tapeFileWritten
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
"0xDEADBEEF"
);
tapeFileWritten
.
vid
=
volInfo
.
vid
;
tapeFileWritten
.
size
=
archiveFileSize
;
tapeFileWritten
.
fSeq
=
fseq
;
...
...
@@ -639,7 +639,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionWrongRecall) {
std
::
set
<
cta
::
catalogue
::
TapeItemWrittenPointer
>
tapeFileWrittenSet
;
tapeFileWrittenSet
.
insert
(
tapeFileWrittenUP
.
release
());
tapeFileWritten
.
archiveFileId
=
1000
+
fseq
;
tapeFileWritten
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
cta
::
utils
::
getAdler32String
(
data
,
archiveFileSize
));
tapeFileWritten
.
checksumBlob
.
insert
(
cta
::
c
hecksum
::
ADLER32
,
cta
::
utils
::
getAdler32String
(
data
,
archiveFileSize
));
tapeFileWritten
.
vid
=
volInfo
.
vid
;
tapeFileWritten
.
size
=
archiveFileSize
;
tapeFileWritten
.
fSeq
=
fseq
+
1
;
...
...
@@ -814,7 +814,7 @@ TEST_P(DataTransferSessionTest, DataTransferSessionRAORecall) {
// Create file entry in the archive namespace
tapeFileWritten
.
archiveFileId
=
fseq
;
tapeFileWritten
.
checksumBlob
.
insert
(
cta
::
C
hecksum
::
CHECKSUMTYPE_
ADLER32
,
cta
::
utils
::
getAdler32String
(
data
,
archiveFileSize
));