summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/backupdiff/testbackupdiff.cpp1
-rw-r--r--test/backupstore/testbackupstore.cpp41
-rw-r--r--test/backupstorepatch/testbackupstorepatch.cpp6
-rw-r--r--test/basicserver/TestCommands.cpp9
-rw-r--r--test/basicserver/testbasicserver.cpp10
5 files changed, 39 insertions, 28 deletions
diff --git a/test/backupdiff/testbackupdiff.cpp b/test/backupdiff/testbackupdiff.cpp
index 816f50d1..ec3f24e2 100644
--- a/test/backupdiff/testbackupdiff.cpp
+++ b/test/backupdiff/testbackupdiff.cpp
@@ -15,6 +15,7 @@
#include "Test.h"
#include "BackupClientCryptoKeys.h"
#include "BackupStoreFile.h"
+#include "BackupStoreFileEncodeStream.h"
#include "BackupStoreFilenameClear.h"
#include "FileStream.h"
#include "BackupStoreFileWire.h"
diff --git a/test/backupstore/testbackupstore.cpp b/test/backupstore/testbackupstore.cpp
index 661973e0..b85d0fd7 100644
--- a/test/backupstore/testbackupstore.cpp
+++ b/test/backupstore/testbackupstore.cpp
@@ -22,6 +22,7 @@
#include "BackupStoreException.h"
#include "BackupStoreInfo.h"
#include "BackupStoreFilenameClear.h"
+#include "BackupStoreFileEncodeStream.h"
#include "BackupStoreRefCountDatabase.h"
#include "BackupStoreFile.h"
#include "BoxPortsAndFiles.h"
@@ -476,7 +477,7 @@ std::vector<uint32_t> ExpectedRefCounts;
void set_refcount(int64_t ObjectID, uint32_t RefCount = 1)
{
- if ((int64_t)ExpectedRefCounts.size() <= ObjectID);
+ if ((int64_t)ExpectedRefCounts.size() <= ObjectID)
{
ExpectedRefCounts.resize(ObjectID + 1, 0);
}
@@ -496,7 +497,7 @@ void create_file_in_dir(std::string name, std::string source, int64_t parentId,
0x7362383249872dfLL, /* attr hash */
0, /* diff from ID */
name_encoded,
- *upload));
+ upload));
int64_t objectId = stored->GetObjectID();
TEST_EQUAL(objectId, rRefCount.GetLastObjectIDUsed());
TEST_EQUAL(1, rRefCount.GetRefCount(objectId))
@@ -512,10 +513,9 @@ int64_t create_test_data_subdirs(BackupProtocolClient &protocol, int64_t indir,
{
// Create with dummy attributes
int attrS = 0;
- MemBlockStream attr(&attrS, sizeof(attrS));
+ std::auto_ptr<IOStream> attr(new MemBlockStream(&attrS, sizeof(attrS)));
std::auto_ptr<BackupProtocolSuccess> dirCreate(protocol.QueryCreateDirectory(
- indir,
- 9837429842987984LL, dirname, attr));
+ indir, 9837429842987984LL, dirname, attr));
subdirid = dirCreate->GetObjectID();
}
@@ -795,7 +795,7 @@ void test_server_1(BackupProtocolClient &protocol, BackupProtocolClient &protoco
// Then send it
int64_t store1objid = 0;
{
- FileStream upload("testfiles/file1_upload1");
+ std::auto_ptr<IOStream> upload(new FileStream("testfiles/file1_upload1"));
std::auto_ptr<BackupProtocolSuccess> stored(protocol.QueryStoreFile(
BackupProtocolListDirectory::RootDirectory,
0x123456789abcdefLL, /* modification time */
@@ -1087,7 +1087,7 @@ int test_server(const char *hostname)
modtime, /* use it for attr hash too */
0, /* diff from ID */
uploads[t].name,
- *upload));
+ upload));
uploads[t].allocated_objid = stored->GetObjectID();
uploads[t].mod_time = modtime;
if(maxID < stored->GetObjectID()) maxID = stored->GetObjectID();
@@ -1105,7 +1105,8 @@ int test_server(const char *hostname)
// Add some attributes onto one of them
{
TEST_NUM_FILES(UPLOAD_NUM + 1, 0, 0, 1);
- MemBlockStream attrnew(attr3, sizeof(attr3));
+ std::auto_ptr<IOStream> attrnew(
+ new MemBlockStream(attr3, sizeof(attr3)));
std::auto_ptr<BackupProtocolSuccess> set(apProtocol->QuerySetReplacementFileAttributes(
BackupProtocolListDirectory::RootDirectory,
32498749832475LL,
@@ -1234,7 +1235,7 @@ int test_server(const char *hostname)
// Upload it
int64_t patchedID = 0;
{
- FileStream uploadpatch(TEST_FILE_FOR_PATCHING ".patch");
+ std::auto_ptr<IOStream> uploadpatch(new FileStream(TEST_FILE_FOR_PATCHING ".patch"));
std::auto_ptr<BackupProtocolSuccess> stored(apProtocol->QueryStoreFile(
BackupProtocolListDirectory::RootDirectory,
modtime,
@@ -1265,7 +1266,8 @@ int test_server(const char *hostname)
BackupStoreFilenameClear dirname("lovely_directory");
{
// Attributes
- MemBlockStream attr(attr1, sizeof(attr1));
+ std::auto_ptr<IOStream> attr(
+ new MemBlockStream(attr1, sizeof(attr1)));
std::auto_ptr<BackupProtocolSuccess> dirCreate(apProtocol->QueryCreateDirectory(
BackupProtocolListDirectory::RootDirectory,
9837429842987984LL, dirname, attr));
@@ -1290,7 +1292,7 @@ int test_server(const char *hostname)
modtime, /* use for attr hash too */
0, /* diff from ID */
uploads[0].name,
- *upload));
+ upload));
subdirfileid = stored->GetObjectID();
TEST_NUM_FILES(UPLOAD_NUM + 1, 1, 1, 2);
@@ -1383,7 +1385,8 @@ int test_server(const char *hostname)
// Change attributes on the directory
{
- MemBlockStream attrnew(attr2, sizeof(attr2));
+ std::auto_ptr<IOStream> attrnew(
+ new MemBlockStream(attr2, sizeof(attr2)));
std::auto_ptr<BackupProtocolSuccess> changereply(apProtocol->QueryChangeDirAttributes(
subdirid,
329483209443598LL,
@@ -1503,13 +1506,15 @@ int test_server(const char *hostname)
{
BackupStoreFilenameClear nd("sub2");
// Attributes
- MemBlockStream attr(attr1, sizeof(attr1));
+ std::auto_ptr<IOStream> attr(new MemBlockStream(attr1,
+ sizeof(attr1)));
std::auto_ptr<BackupProtocolSuccess> dirCreate(apProtocol->QueryCreateDirectory(
subdirid,
9837429842987984LL, nd, attr));
subsubdirid = dirCreate->GetObjectID();
- FileStream upload("testfiles/file1_upload1");
+ std::auto_ptr<IOStream> upload(
+ new FileStream("testfiles/file1_upload1"));
BackupStoreFilenameClear nf("file2");
std::auto_ptr<BackupProtocolSuccess> stored(apProtocol->QueryStoreFile(
subsubdirid,
@@ -2115,17 +2120,17 @@ int test3(int argc, const char *argv[])
modtime, /* use it for attr hash too */
0, /* diff from ID */
fnx,
- *upload)),
+ upload)),
ConnectionException, Conn_Protocol_UnexpectedReply);
- MemBlockStream attr(&modtime, sizeof(modtime));
+ std::auto_ptr<IOStream> attr(new MemBlockStream(&modtime, sizeof(modtime)));
BackupStoreFilenameClear fnxd("exceed-limit-dir");
- TEST_CHECK_THROWS(std::auto_ptr<BackupProtocolSuccess> dirCreate(protocol.QueryCreateDirectory(
+ TEST_CHECK_THROWS(std::auto_ptr<BackupProtocolSuccess> dirCreate(
+ protocol.QueryCreateDirectory(
BackupProtocolListDirectory::RootDirectory,
9837429842987984LL, fnxd, attr)),
ConnectionException, Conn_Protocol_UnexpectedReply);
-
// Finish the connection
protocol.QueryFinished();
}
diff --git a/test/backupstorepatch/testbackupstorepatch.cpp b/test/backupstorepatch/testbackupstorepatch.cpp
index fab56523..42594652 100644
--- a/test/backupstorepatch/testbackupstorepatch.cpp
+++ b/test/backupstorepatch/testbackupstorepatch.cpp
@@ -22,6 +22,7 @@
#include "BackupStoreDirectory.h"
#include "BackupStoreException.h"
#include "BackupStoreFile.h"
+#include "BackupStoreFileEncodeStream.h"
#include "BackupStoreFilenameClear.h"
#include "BackupStoreInfo.h"
#include "BoxPortsAndFiles.h"
@@ -370,7 +371,7 @@ int test(int argc, const char *argv[])
BackupProtocolListDirectory::RootDirectory, storeFilename));
std::auto_ptr<BackupProtocolSuccess> stored(protocol.QueryStoreFile(
BackupProtocolListDirectory::RootDirectory, ModificationTime,
- ModificationTime, 0 /* no diff from file ID */, storeFilename, *upload));
+ ModificationTime, 0 /* no diff from file ID */, storeFilename, upload));
test_files[0].IDOnServer = stored->GetObjectID();
test_files[0].IsCompletelyDifferent = true;
ModificationTime += MODIFICATION_TIME_INC;
@@ -409,7 +410,8 @@ int test(int argc, const char *argv[])
// Upload the patch to the store
std::auto_ptr<BackupProtocolSuccess> stored(protocol.QueryStoreFile(
BackupProtocolListDirectory::RootDirectory, ModificationTime,
- ModificationTime, isCompletelyDifferent?(0):(diffFromID), storeFilename, *patchStream));
+ ModificationTime, isCompletelyDifferent?(0):(diffFromID),
+ storeFilename, patchStream));
ModificationTime += MODIFICATION_TIME_INC;
// Store details
diff --git a/test/basicserver/TestCommands.cpp b/test/basicserver/TestCommands.cpp
index 5238819f..a0022f72 100644
--- a/test/basicserver/TestCommands.cpp
+++ b/test/basicserver/TestCommands.cpp
@@ -48,7 +48,8 @@ public:
std::auto_ptr<TestProtocolMessage> TestProtocolGetStream::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const
{
// make a new stream object
- CollectInBufferStream *pstream = mUncertainSize?(new UncertainBufferStream):(new CollectInBufferStream);
+ std::auto_ptr<CollectInBufferStream> apStream(
+ mUncertainSize?(new UncertainBufferStream):(new CollectInBufferStream));
// Data.
int values[24273];
@@ -59,14 +60,14 @@ std::auto_ptr<TestProtocolMessage> TestProtocolGetStream::DoCommand(TestProtocol
{
values[x] = v++;
}
- pstream->Write(values, sizeof(values));
+ apStream->Write(values, sizeof(values));
}
// Finished
- pstream->SetForReading();
+ apStream->SetForReading();
// Get it to be sent
- rProtocol.SendStreamAfterCommand(pstream);
+ rProtocol.SendStreamAfterCommand((std::auto_ptr<IOStream>)apStream);
return std::auto_ptr<TestProtocolMessage>(new TestProtocolGetStream(mStartingValue, mUncertainSize));
}
diff --git a/test/basicserver/testbasicserver.cpp b/test/basicserver/testbasicserver.cpp
index 976bdd92..5a13cb45 100644
--- a/test/basicserver/testbasicserver.cpp
+++ b/test/basicserver/testbasicserver.cpp
@@ -719,11 +719,13 @@ int test(int argc, const char *argv[])
// Try to send a stream
{
- CollectInBufferStream s;
+ std::auto_ptr<CollectInBufferStream>
+ s(new CollectInBufferStream());
char buf[1663];
- s.Write(buf, sizeof(buf));
- s.SetForReading();
- std::auto_ptr<TestProtocolGetStream> reply(protocol.QuerySendStream(0x73654353298ffLL, s));
+ s->Write(buf, sizeof(buf));
+ s->SetForReading();
+ std::auto_ptr<TestProtocolGetStream> reply(protocol.QuerySendStream(0x73654353298ffLL,
+ (std::auto_ptr<IOStream>)s));
TEST_THAT(reply->GetStartingValue() == sizeof(buf));
}