Commit 7c128290 authored by Eric Cano's avatar Eric Cano
Browse files

Revived the first DataTransferSessionTest unit test (still DISABLED).

parent 30017fb6
......@@ -33,6 +33,7 @@
#include <zlib.h>
#include <sys/utsname.h>
#include <sys/prctl.h>
#include <iomanip>
using cta::exception::Exception;
......@@ -577,11 +578,23 @@ void toUpper(std::string &str) {
// getAdler32
//------------------------------------------------------------------------------
uint32_t getAdler32(const uint8_t *buf, const uint32_t len)
throw() {
{
const uint32_t checksum = adler32(0L, Z_NULL, 0);
return adler32(checksum, (const Bytef*)buf, len);
}
//------------------------------------------------------------------------------
// getAdler32String
//------------------------------------------------------------------------------
std::string getAdler32String(const uint8_t *buf, const uint32_t len)
{
const uint32_t checksum = adler32(0L, Z_NULL, 0);
std::stringstream ret;
ret << std::showbase << std::hex << std::setw(8) << std::setfill('0') << std::uppercase
<< adler32(checksum, (const Bytef*)buf, len);
return ret.str();
}
//------------------------------------------------------------------------------
// getShortHostname
//------------------------------------------------------------------------------
......
......@@ -229,7 +229,17 @@ namespace utils {
* @param len The length of the buffer in bytes.
* @return the alder32 checksum of the specified buffer.
*/
uint32_t getAdler32(const uint8_t *buf, const uint32_t len) throw();
uint32_t getAdler32(const uint8_t *buf, const uint32_t len);
/**
* Returns the alder32 checksum of the specified buffer in string format,
* CTA style that is with leading 0x, 8 digits with leading 0 and uppercase.
*
* @param buf The buffer.
* @param len The length of the buffer in bytes.
* @return the alder32 checksum of the specified buffer.
*/
std::string getAdler32String(const uint8_t *buf, const uint32_t len);
/**
* Returns true if the attributes of the current process indicate that it will
......
......@@ -40,6 +40,8 @@
namespace unitTests {
namespace {
/**
* This structure is used to parameterize scheduler tests.
*/
......@@ -52,6 +54,8 @@ struct SchedulerTestParam {
}
}; // struct SchedulerTestParam
}
/**
* The scheduler test is a parameterized test. It takes a pair of name server
* and scheduler database factories as a parameter.
......@@ -59,7 +63,7 @@ struct SchedulerTestParam {
class SchedulerTest: public ::testing::TestWithParam<SchedulerTestParam> {
public:
SchedulerTest() throw() {
SchedulerTest() {
}
class FailedToGetCatalogue: public std::exception {
......
......@@ -77,6 +77,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
foreach(CTATAPESERVERDAEMON_LIBRARY_SRC
${CTATAPESERVERDAEMON_LIBRARY_SRCS}
CatalogueTest.cpp
DataTransferSessionTest.cpp
DiskReadTaskTest.cpp
DiskWriteTaskTest.cpp
DiskWriteTaskTest.cpp
......@@ -113,7 +114,7 @@ install(TARGETS ctatapeserverdaemonutils DESTINATION usr/${CMAKE_INSTALL_LIBDIR}
add_library(ctatapeserverdaemonunittests SHARED
CatalogueDriveStateTest.cpp
CatalogueTest.cpp
# DataTransferSessionTest.cpp
DataTransferSessionTest.cpp
DiskReadTaskTest.cpp
DiskWriteTaskTest.cpp
DiskWriteThreadPoolTest.cpp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment