mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 04:17:55 +01:00
submitted 1.2.0
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DNSTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/DNSTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/DNSTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,18 +33,18 @@
|
||||
#include "DNSTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/DNS.h"
|
||||
#include "Net/HostEntry.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/DNS.h"
|
||||
#include "Poco/Net/HostEntry.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
|
||||
|
||||
using Net::DNS;
|
||||
using Net::IPAddress;
|
||||
using Net::HostEntry;
|
||||
using Net::InvalidAddressException;
|
||||
using Net::HostNotFoundException;
|
||||
using Net::ServiceNotFoundException;
|
||||
using Net::NoAddressFoundException;
|
||||
using Poco::Net::DNS;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Net::HostEntry;
|
||||
using Poco::Net::InvalidAddressException;
|
||||
using Poco::Net::HostNotFoundException;
|
||||
using Poco::Net::ServiceNotFoundException;
|
||||
using Poco::Net::NoAddressFoundException;
|
||||
|
||||
|
||||
DNSTest::DNSTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DNSTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/DNSTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/DNSTest.h#1 $
|
||||
//
|
||||
// Definition of the DNSTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define DNSTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DNSTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DatagramSocketTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/DatagramSocketTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/DatagramSocketTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,22 +34,22 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "UDPEchoServer.h"
|
||||
#include "Net/DatagramSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Foundation/Stopwatch.h"
|
||||
#include "Poco/Net/DatagramSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Stopwatch.h"
|
||||
|
||||
|
||||
using Net::Socket;
|
||||
using Net::DatagramSocket;
|
||||
using Net::SocketAddress;
|
||||
using Net::IPAddress;
|
||||
using Foundation::Timespan;
|
||||
using Foundation::Stopwatch;
|
||||
using Foundation::TimeoutException;
|
||||
using Foundation::InvalidArgumentException;
|
||||
using Foundation::IOException;
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::DatagramSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Timespan;
|
||||
using Poco::Stopwatch;
|
||||
using Poco::TimeoutException;
|
||||
using Poco::InvalidArgumentException;
|
||||
using Poco::IOException;
|
||||
|
||||
|
||||
DatagramSocketTest::DatagramSocketTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DatagramSocketTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/DatagramSocketTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/DatagramSocketTest.h#1 $
|
||||
//
|
||||
// Definition of the DatagramSocketTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define DatagramSocketTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DatagramSocketTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DialogServer.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/DialogServer.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/DialogServer.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,17 +31,17 @@
|
||||
|
||||
|
||||
#include "DialogServer.h"
|
||||
#include "Net/DialogSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Poco/Net/DialogSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Net::Socket;
|
||||
using Net::DialogSocket;
|
||||
using Net::SocketAddress;
|
||||
using Foundation::FastMutex;
|
||||
using Foundation::Thread;
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::DialogSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::FastMutex;
|
||||
using Poco::Thread;
|
||||
|
||||
|
||||
DialogServer::DialogServer(bool acceptCommands):
|
||||
@@ -63,7 +63,7 @@ DialogServer::~DialogServer()
|
||||
}
|
||||
|
||||
|
||||
Foundation::UInt16 DialogServer::port() const
|
||||
Poco::UInt16 DialogServer::port() const
|
||||
{
|
||||
return _socket.address().port();
|
||||
}
|
||||
@@ -72,7 +72,7 @@ Foundation::UInt16 DialogServer::port() const
|
||||
void DialogServer::run()
|
||||
{
|
||||
_ready.set();
|
||||
Foundation::Timespan span(250000);
|
||||
Poco::Timespan span(250000);
|
||||
while (!_stop)
|
||||
{
|
||||
if (_socket.poll(span, Socket::SELECT_READ))
|
||||
@@ -106,7 +106,7 @@ void DialogServer::run()
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Foundation::Exception& exc)
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
std::cerr << "DialogServer: " << exc.displayText() << std::endl;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DialogServer.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/DialogServer.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/DialogServer.h#1 $
|
||||
//
|
||||
// Definition of the DialogServer class.
|
||||
//
|
||||
@@ -36,31 +36,16 @@
|
||||
#define DialogServer_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef Net_ServerSocket_INCLUDED
|
||||
#include "Net/ServerSocket.h"
|
||||
#endif
|
||||
#ifndef Net_StreamSocket_INCLUDED
|
||||
#include "Net/StreamSocket.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Thread_INCLUDED
|
||||
#include "Foundation/Thread.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Event_INCLUDED
|
||||
#include "Foundation/Event.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Mutex_INCLUDED
|
||||
#include "Foundation/Mutex.h"
|
||||
#endif
|
||||
#ifndef STD_VECTOR_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Event.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include <vector>
|
||||
#define STD_VECTOR_INCLUDED
|
||||
#endif
|
||||
|
||||
|
||||
class DialogServer: public Foundation::Runnable
|
||||
class DialogServer: public Poco::Runnable
|
||||
/// A server for testing FTPClientSession and friends.
|
||||
{
|
||||
public:
|
||||
@@ -70,7 +55,7 @@ public:
|
||||
~DialogServer();
|
||||
/// Destroys the DialogServer.
|
||||
|
||||
Foundation::UInt16 port() const;
|
||||
Poco::UInt16 port() const;
|
||||
/// Returns the port the echo server is
|
||||
/// listening on.
|
||||
|
||||
@@ -103,15 +88,15 @@ public:
|
||||
/// Enables or disables logging to stdout.
|
||||
|
||||
private:
|
||||
Net::ServerSocket _socket;
|
||||
Foundation::Thread _thread;
|
||||
Foundation::Event _ready;
|
||||
mutable Foundation::FastMutex _mutex;
|
||||
bool _stop;
|
||||
std::vector<std::string> _nextResponses;
|
||||
std::vector<std::string> _lastCommands;
|
||||
bool _acceptCommands;
|
||||
bool _log;
|
||||
Poco::Net::ServerSocket _socket;
|
||||
Poco::Thread _thread;
|
||||
Poco::Event _ready;
|
||||
mutable Poco::FastMutex _mutex;
|
||||
bool _stop;
|
||||
std::vector<std::string> _nextResponses;
|
||||
std::vector<std::string> _lastCommands;
|
||||
bool _acceptCommands;
|
||||
bool _log;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DialogSocketTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/DialogSocketTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/DialogSocketTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,12 +34,12 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "EchoServer.h"
|
||||
#include "Net/DialogSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Poco/Net/DialogSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
|
||||
|
||||
using Net::DialogSocket;
|
||||
using Net::SocketAddress;
|
||||
using Poco::Net::DialogSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
|
||||
|
||||
DialogSocketTest::DialogSocketTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DialogSocketTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/DialogSocketTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/DialogSocketTest.h#1 $
|
||||
//
|
||||
// Definition of the DialogSocketTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define DialogSocketTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class DialogSocketTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Driver.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/Driver.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/Driver.cpp#1 $
|
||||
//
|
||||
// Console-based test driver for Poco Net.
|
||||
//
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// EchoServer.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/EchoServer.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/EchoServer.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,15 +31,15 @@
|
||||
|
||||
|
||||
#include "EchoServer.h"
|
||||
#include "Net/StreamSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Net::Socket;
|
||||
using Net::StreamSocket;
|
||||
using Net::SocketAddress;
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::StreamSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
|
||||
|
||||
EchoServer::EchoServer():
|
||||
@@ -59,7 +59,7 @@ EchoServer::~EchoServer()
|
||||
}
|
||||
|
||||
|
||||
Foundation::UInt16 EchoServer::port() const
|
||||
Poco::UInt16 EchoServer::port() const
|
||||
{
|
||||
return _socket.address().port();
|
||||
}
|
||||
@@ -68,7 +68,7 @@ Foundation::UInt16 EchoServer::port() const
|
||||
void EchoServer::run()
|
||||
{
|
||||
_ready.set();
|
||||
Foundation::Timespan span(250000);
|
||||
Poco::Timespan span(250000);
|
||||
while (!_stop)
|
||||
{
|
||||
if (_socket.poll(span, Socket::SELECT_READ))
|
||||
@@ -84,7 +84,7 @@ void EchoServer::run()
|
||||
n = ss.receiveBytes(buffer, sizeof(buffer));
|
||||
}
|
||||
}
|
||||
catch (Foundation::Exception& exc)
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
std::cerr << "EchoServer: " << exc.displayText() << std::endl;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// EchoServer.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/EchoServer.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/EchoServer.h#1 $
|
||||
//
|
||||
// Definition of the EchoServer class.
|
||||
//
|
||||
@@ -36,21 +36,13 @@
|
||||
#define EchoServer_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef Net_ServerSocket_INCLUDED
|
||||
#include "Net/ServerSocket.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Thread_INCLUDED
|
||||
#include "Foundation/Thread.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Event_INCLUDED
|
||||
#include "Foundation/Event.h"
|
||||
#endif
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Event.h"
|
||||
|
||||
|
||||
class EchoServer: public Foundation::Runnable
|
||||
class EchoServer: public Poco::Runnable
|
||||
/// A simple sequential echo server.
|
||||
{
|
||||
public:
|
||||
@@ -60,7 +52,7 @@ public:
|
||||
~EchoServer();
|
||||
/// Destroys the EchoServer.
|
||||
|
||||
Foundation::UInt16 port() const;
|
||||
Poco::UInt16 port() const;
|
||||
/// Returns the port the echo server is
|
||||
/// listening on.
|
||||
|
||||
@@ -68,10 +60,10 @@ public:
|
||||
/// Does the work.
|
||||
|
||||
private:
|
||||
Net::ServerSocket _socket;
|
||||
Foundation::Thread _thread;
|
||||
Foundation::Event _ready;
|
||||
bool _stop;
|
||||
Poco::Net::ServerSocket _socket;
|
||||
Poco::Thread _thread;
|
||||
Poco::Event _ready;
|
||||
bool _stop;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FTPClientSessionTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/FTPClientSessionTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/FTPClientSessionTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,24 +34,24 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "DialogServer.h"
|
||||
#include "Net/FTPClientSession.h"
|
||||
#include "Net/DialogSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Foundation/ActiveMethod.h"
|
||||
#include "Foundation/StreamCopier.h"
|
||||
#include "Poco/Net/FTPClientSession.h"
|
||||
#include "Poco/Net/DialogSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/ActiveMethod.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::FTPClientSession;
|
||||
using Net::DialogSocket;
|
||||
using Net::SocketAddress;
|
||||
using Net::FTPException;
|
||||
using Foundation::ActiveMethod;
|
||||
using Foundation::ActiveResult;
|
||||
using Foundation::StreamCopier;
|
||||
using Foundation::Thread;
|
||||
using Poco::Net::FTPClientSession;
|
||||
using Poco::Net::DialogSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::FTPException;
|
||||
using Poco::ActiveMethod;
|
||||
using Poco::ActiveResult;
|
||||
using Poco::StreamCopier;
|
||||
using Poco::Thread;
|
||||
|
||||
|
||||
namespace
|
||||
@@ -321,7 +321,7 @@ void FTPClientSessionTest::testDownloadPORT()
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "RETR test.txt");
|
||||
|
||||
SocketAddress sa("localhost", (Foundation::UInt16) port);
|
||||
SocketAddress sa("localhost", (Poco::UInt16) port);
|
||||
DialogSocket dataSock;
|
||||
dataSock.connect(sa);
|
||||
|
||||
@@ -369,7 +369,7 @@ void FTPClientSessionTest::testDownloadEPRT()
|
||||
cmd = server.popCommandWait();
|
||||
assert (cmd == "RETR test.txt");
|
||||
|
||||
SocketAddress sa("localhost", (Foundation::UInt16) port);
|
||||
SocketAddress sa("localhost", (Poco::UInt16) port);
|
||||
DialogSocket dataSock;
|
||||
dataSock.connect(sa);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FTPClientSessionTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/FTPClientSessionTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/FTPClientSessionTest.h#1 $
|
||||
//
|
||||
// Definition of the FTPClientSessionTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define FTPClientSessionTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class FTPClientSessionTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FTPClientTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/FTPClientTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/FTPClientTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FTPClientTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/FTPClientTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/FTPClientTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the FTPClientTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define FTPClientTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class FTPClientTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FTPStreamFactoryTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/FTPStreamFactoryTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/FTPStreamFactoryTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,23 +34,23 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "DialogServer.h"
|
||||
#include "Net/FTPStreamFactory.h"
|
||||
#include "Net/DialogSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Foundation/URI.h"
|
||||
#include "Foundation/StreamCopier.h"
|
||||
#include "Poco/Net/FTPStreamFactory.h"
|
||||
#include "Poco/Net/DialogSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/URI.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
|
||||
|
||||
using Net::FTPStreamFactory;
|
||||
using Net::FTPPasswordProvider;
|
||||
using Net::DialogSocket;
|
||||
using Net::SocketAddress;
|
||||
using Net::FTPException;
|
||||
using Foundation::URI;
|
||||
using Foundation::StreamCopier;
|
||||
using Poco::Net::FTPStreamFactory;
|
||||
using Poco::Net::FTPPasswordProvider;
|
||||
using Poco::Net::DialogSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::FTPException;
|
||||
using Poco::URI;
|
||||
using Poco::StreamCopier;
|
||||
|
||||
|
||||
namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FTPStreamFactoryTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/FTPStreamFactoryTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/FTPStreamFactoryTest.h#1 $
|
||||
//
|
||||
// Definition of the FTPStreamFactoryTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define FTPStreamFactoryTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class FTPStreamFactoryTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTMLFormTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTMLFormTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTMLFormTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,21 +33,21 @@
|
||||
#include "HTMLFormTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/HTMLForm.h"
|
||||
#include "Net/PartSource.h"
|
||||
#include "Net/StringPartSource.h"
|
||||
#include "Net/PartHandler.h"
|
||||
#include "Net/HTTPRequest.h"
|
||||
#include "Poco/Net/HTMLForm.h"
|
||||
#include "Poco/Net/PartSource.h"
|
||||
#include "Poco/Net/StringPartSource.h"
|
||||
#include "Poco/Net/PartHandler.h"
|
||||
#include "Poco/Net/HTTPRequest.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::HTMLForm;
|
||||
using Net::PartSource;
|
||||
using Net::StringPartSource;
|
||||
using Net::PartHandler;
|
||||
using Net::HTTPRequest;
|
||||
using Net::HTTPMessage;
|
||||
using Net::MessageHeader;
|
||||
using Poco::Net::HTMLForm;
|
||||
using Poco::Net::PartSource;
|
||||
using Poco::Net::StringPartSource;
|
||||
using Poco::Net::PartHandler;
|
||||
using Poco::Net::HTTPRequest;
|
||||
using Poco::Net::HTTPMessage;
|
||||
using Poco::Net::MessageHeader;
|
||||
|
||||
|
||||
namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTMLFormTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTMLFormTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTMLFormTest.h#1 $
|
||||
//
|
||||
// Definition of the HTMLFormTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HTMLFormTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTMLFormTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTMLTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTMLTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTMLTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTMLTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTMLTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTMLTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the HTMLTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define HTMLTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTMLTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPClientSessionTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPClientSessionTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPClientSessionTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,21 +33,21 @@
|
||||
#include "HTTPClientSessionTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/HTTPClientSession.h"
|
||||
#include "Net/HTTPRequest.h"
|
||||
#include "Net/HTTPResponse.h"
|
||||
#include "Foundation/StreamCopier.h"
|
||||
#include "Poco/Net/HTTPClientSession.h"
|
||||
#include "Poco/Net/HTTPRequest.h"
|
||||
#include "Poco/Net/HTTPResponse.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include "HTTPTestServer.h"
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::HTTPClientSession;
|
||||
using Net::HTTPRequest;
|
||||
using Net::HTTPResponse;
|
||||
using Net::HTTPMessage;
|
||||
using Foundation::StreamCopier;
|
||||
using Poco::Net::HTTPClientSession;
|
||||
using Poco::Net::HTTPRequest;
|
||||
using Poco::Net::HTTPResponse;
|
||||
using Poco::Net::HTTPMessage;
|
||||
using Poco::StreamCopier;
|
||||
|
||||
|
||||
HTTPClientSessionTest::HTTPClientSessionTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPClientSessionTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPClientSessionTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPClientSessionTest.h#1 $
|
||||
//
|
||||
// Definition of the HTTPClientSessionTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HTTPClientSessionTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPClientSessionTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPClientTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPClientTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPClientTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPClientTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPClientTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPClientTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the HTTPClientTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define HTTPClientTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPClientTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPCookieTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPCookieTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPCookieTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,10 +33,10 @@
|
||||
#include "HTTPCookieTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/HTTPCookie.h"
|
||||
#include "Poco/Net/HTTPCookie.h"
|
||||
|
||||
|
||||
using Net::HTTPCookie;
|
||||
using Poco::Net::HTTPCookie;
|
||||
|
||||
|
||||
HTTPCookieTest::HTTPCookieTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPCookieTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPCookieTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPCookieTest.h#1 $
|
||||
//
|
||||
// Definition of the HTTPCookieTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HTTPCookieTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPCookieTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPCredentialsTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPCredentialsTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPCredentialsTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,14 +33,14 @@
|
||||
#include "HTTPCredentialsTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/HTTPRequest.h"
|
||||
#include "Net/HTTPBasicCredentials.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/HTTPRequest.h"
|
||||
#include "Poco/Net/HTTPBasicCredentials.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
|
||||
|
||||
using Net::HTTPRequest;
|
||||
using Net::HTTPBasicCredentials;
|
||||
using Net::NotAuthenticatedException;
|
||||
using Poco::Net::HTTPRequest;
|
||||
using Poco::Net::HTTPBasicCredentials;
|
||||
using Poco::Net::NotAuthenticatedException;
|
||||
|
||||
|
||||
HTTPCredentialsTest::HTTPCredentialsTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPCredentialsTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPCredentialsTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPCredentialsTest.h#1 $
|
||||
//
|
||||
// Definition of the HTTPCredentialsTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HTTPCredentialsTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPCredentialsTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPRequestTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPRequestTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPRequestTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "HTTPRequestTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/HTTPRequest.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/HTTPRequest.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::HTTPRequest;
|
||||
using Net::HTTPMessage;
|
||||
using Net::MessageException;
|
||||
using Net::NameValueCollection;
|
||||
using Poco::Net::HTTPRequest;
|
||||
using Poco::Net::HTTPMessage;
|
||||
using Poco::Net::MessageException;
|
||||
using Poco::Net::NameValueCollection;
|
||||
|
||||
|
||||
HTTPRequestTest::HTTPRequestTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPRequestTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPRequestTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPRequestTest.h#1 $
|
||||
//
|
||||
// Definition of the HTTPRequestTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HTTPRequestTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPRequestTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPResponseTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPResponseTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPResponseTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,16 +33,16 @@
|
||||
#include "HTTPResponseTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/HTTPResponse.h"
|
||||
#include "Net/HTTPCookie.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/HTTPResponse.h"
|
||||
#include "Poco/Net/HTTPCookie.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::HTTPResponse;
|
||||
using Net::HTTPMessage;
|
||||
using Net::HTTPCookie;
|
||||
using Net::MessageException;
|
||||
using Poco::Net::HTTPResponse;
|
||||
using Poco::Net::HTTPMessage;
|
||||
using Poco::Net::HTTPCookie;
|
||||
using Poco::Net::MessageException;
|
||||
|
||||
|
||||
HTTPResponseTest::HTTPResponseTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -107,22 +107,6 @@ void HTTPResponseTest::testRead2()
|
||||
}
|
||||
|
||||
|
||||
void HTTPResponseTest::testRead3()
|
||||
{
|
||||
std::string s("HTTP/1.0 100 Continue\r\nHTTP/1.0 301 Moved Permanently\r\nLocation: http://www.appinf.com/index.html\r\nServer: Poco/1.0\r\n\r\n");
|
||||
std::istringstream istr(s);
|
||||
HTTPResponse response;
|
||||
response.read(istr);
|
||||
assert (response.getStatus() == HTTPResponse::HTTP_MOVED_PERMANENTLY);
|
||||
assert (response.getReason() == "Moved Permanently");
|
||||
assert (response.getVersion() == HTTPMessage::HTTP_1_0);
|
||||
assert (response.size() == 2);
|
||||
assert (response["Location"] == "http://www.appinf.com/index.html");
|
||||
assert (response["Server"] == "Poco/1.0");
|
||||
assert (istr.get() == -1);
|
||||
}
|
||||
|
||||
|
||||
void HTTPResponseTest::testInvalid1()
|
||||
{
|
||||
std::string s(256, 'x');
|
||||
@@ -233,7 +217,6 @@ CppUnit::Test* HTTPResponseTest::suite()
|
||||
CppUnit_addTest(pSuite, HTTPResponseTest, testWrite2);
|
||||
CppUnit_addTest(pSuite, HTTPResponseTest, testRead1);
|
||||
CppUnit_addTest(pSuite, HTTPResponseTest, testRead2);
|
||||
CppUnit_addTest(pSuite, HTTPResponseTest, testRead3);
|
||||
CppUnit_addTest(pSuite, HTTPResponseTest, testInvalid1);
|
||||
CppUnit_addTest(pSuite, HTTPResponseTest, testInvalid2);
|
||||
CppUnit_addTest(pSuite, HTTPResponseTest, testInvalid3);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPResponseTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPResponseTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPResponseTest.h#1 $
|
||||
//
|
||||
// Definition of the HTTPResponseTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HTTPResponseTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPResponseTest: public CppUnit::TestCase
|
||||
@@ -54,7 +50,6 @@ public:
|
||||
void testWrite2();
|
||||
void testRead1();
|
||||
void testRead2();
|
||||
void testRead3();
|
||||
void testInvalid1();
|
||||
void testInvalid2();
|
||||
void testInvalid3();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPServerTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPServerTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,32 +33,32 @@
|
||||
#include "HTTPServerTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/HTTPServer.h"
|
||||
#include "Net/HTTPServerParams.h"
|
||||
#include "Net/HTTPRequestHandler.h"
|
||||
#include "Net/HTTPRequestHandlerFactory.h"
|
||||
#include "Net/HTTPClientSession.h"
|
||||
#include "Net/HTTPRequest.h"
|
||||
#include "Net/HTTPServerRequest.h"
|
||||
#include "Net/HTTPResponse.h"
|
||||
#include "Net/HTTPServerResponse.h"
|
||||
#include "Net/ServerSocket.h"
|
||||
#include "Foundation/StreamCopier.h"
|
||||
#include "Poco/Net/HTTPServer.h"
|
||||
#include "Poco/Net/HTTPServerParams.h"
|
||||
#include "Poco/Net/HTTPRequestHandler.h"
|
||||
#include "Poco/Net/HTTPRequestHandlerFactory.h"
|
||||
#include "Poco/Net/HTTPClientSession.h"
|
||||
#include "Poco/Net/HTTPRequest.h"
|
||||
#include "Poco/Net/HTTPServerRequest.h"
|
||||
#include "Poco/Net/HTTPResponse.h"
|
||||
#include "Poco/Net/HTTPServerResponse.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::HTTPServer;
|
||||
using Net::HTTPServerParams;
|
||||
using Net::HTTPRequestHandler;
|
||||
using Net::HTTPRequestHandlerFactory;
|
||||
using Net::HTTPClientSession;
|
||||
using Net::HTTPRequest;
|
||||
using Net::HTTPServerRequest;
|
||||
using Net::HTTPResponse;
|
||||
using Net::HTTPServerResponse;
|
||||
using Net::HTTPMessage;
|
||||
using Net::ServerSocket;
|
||||
using Foundation::StreamCopier;
|
||||
using Poco::Net::HTTPServer;
|
||||
using Poco::Net::HTTPServerParams;
|
||||
using Poco::Net::HTTPRequestHandler;
|
||||
using Poco::Net::HTTPRequestHandlerFactory;
|
||||
using Poco::Net::HTTPClientSession;
|
||||
using Poco::Net::HTTPRequest;
|
||||
using Poco::Net::HTTPServerRequest;
|
||||
using Poco::Net::HTTPResponse;
|
||||
using Poco::Net::HTTPServerResponse;
|
||||
using Poco::Net::HTTPMessage;
|
||||
using Poco::Net::ServerSocket;
|
||||
using Poco::StreamCopier;
|
||||
|
||||
|
||||
namespace
|
||||
@@ -168,6 +168,29 @@ void HTTPServerTest::testIdentityRequest()
|
||||
}
|
||||
|
||||
|
||||
void HTTPServerTest::testPutIdentityRequest()
|
||||
{
|
||||
ServerSocket svs(0);
|
||||
HTTPServerParams* pParams = new HTTPServerParams;
|
||||
pParams->setKeepAlive(false);
|
||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||
srv.start();
|
||||
|
||||
HTTPClientSession cs("localhost", svs.address().port());
|
||||
std::string body(5000, 'x');
|
||||
HTTPRequest request("PUT", "/echoBody");
|
||||
request.setContentLength((int) body.length());
|
||||
request.setContentType("text/plain");
|
||||
cs.sendRequest(request) << body;
|
||||
HTTPResponse response;
|
||||
std::string rbody;
|
||||
cs.receiveResponse(response) >> rbody;
|
||||
assert (response.getContentLength() == body.size());
|
||||
assert (response.getContentType() == "text/plain");
|
||||
assert (rbody == body);
|
||||
}
|
||||
|
||||
|
||||
void HTTPServerTest::testChunkedRequest()
|
||||
{
|
||||
ServerSocket svs(0);
|
||||
@@ -407,6 +430,7 @@ CppUnit::Test* HTTPServerTest::suite()
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("HTTPServerTest");
|
||||
|
||||
CppUnit_addTest(pSuite, HTTPServerTest, testIdentityRequest);
|
||||
CppUnit_addTest(pSuite, HTTPServerTest, testPutIdentityRequest);
|
||||
CppUnit_addTest(pSuite, HTTPServerTest, testChunkedRequest);
|
||||
CppUnit_addTest(pSuite, HTTPServerTest, testClosedRequest);
|
||||
CppUnit_addTest(pSuite, HTTPServerTest, testIdentityRequestKeepAlive);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPServerTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPServerTest.h#1 $
|
||||
//
|
||||
// Definition of the HTTPServerTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HTTPServerTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPServerTest: public CppUnit::TestCase
|
||||
@@ -51,6 +47,7 @@ public:
|
||||
~HTTPServerTest();
|
||||
|
||||
void testIdentityRequest();
|
||||
void testPutIdentityRequest();
|
||||
void testChunkedRequest();
|
||||
void testClosedRequest();
|
||||
void testIdentityRequestKeepAlive();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPServerTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPServerTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPServerTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPServerTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the HTTPServerTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define HTTPServerTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPServerTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPStreamFactoryTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPStreamFactoryTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPStreamFactoryTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,20 +33,20 @@
|
||||
#include "HTTPStreamFactoryTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/HTTPStreamFactory.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Foundation/URI.h"
|
||||
#include "Foundation/StreamCopier.h"
|
||||
#include "Poco/Net/HTTPStreamFactory.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/URI.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include "HTTPTestServer.h"
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
|
||||
|
||||
using Net::HTTPStreamFactory;
|
||||
using Net::NetException;
|
||||
using Net::HTTPException;
|
||||
using Foundation::URI;
|
||||
using Foundation::StreamCopier;
|
||||
using Poco::Net::HTTPStreamFactory;
|
||||
using Poco::Net::NetException;
|
||||
using Poco::Net::HTTPException;
|
||||
using Poco::URI;
|
||||
using Poco::StreamCopier;
|
||||
|
||||
|
||||
HTTPStreamFactoryTest::HTTPStreamFactoryTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPStreamFactoryTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPStreamFactoryTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPStreamFactoryTest.h#1 $
|
||||
//
|
||||
// Definition of the HTTPStreamFactoryTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define HTTPStreamFactoryTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPStreamFactoryTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPTestServer.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPTestServer.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPTestServer.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,17 +31,17 @@
|
||||
|
||||
|
||||
#include "HTTPTestServer.h"
|
||||
#include "Net/StreamSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Foundation/NumberFormatter.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Net::Socket;
|
||||
using Net::StreamSocket;
|
||||
using Net::SocketAddress;
|
||||
using Foundation::NumberFormatter;
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::StreamSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::NumberFormatter;
|
||||
|
||||
|
||||
const std::string HTTPTestServer::SMALL_BODY("This is some random text data returned by the server");
|
||||
@@ -66,7 +66,7 @@ HTTPTestServer::~HTTPTestServer()
|
||||
}
|
||||
|
||||
|
||||
Foundation::UInt16 HTTPTestServer::port() const
|
||||
Poco::UInt16 HTTPTestServer::port() const
|
||||
{
|
||||
return _socket.address().port();
|
||||
}
|
||||
@@ -81,7 +81,7 @@ const std::string& HTTPTestServer::lastRequest() const
|
||||
void HTTPTestServer::run()
|
||||
{
|
||||
_ready.set();
|
||||
Foundation::Timespan span(250000);
|
||||
Poco::Timespan span(250000);
|
||||
while (!_stop)
|
||||
{
|
||||
if (_socket.poll(span, Socket::SELECT_READ))
|
||||
@@ -102,9 +102,9 @@ void HTTPTestServer::run()
|
||||
}
|
||||
std::string response = handleRequest();
|
||||
ss.sendBytes(response.data(), (int) response.size());
|
||||
Foundation::Thread::sleep(1000);
|
||||
Poco::Thread::sleep(1000);
|
||||
}
|
||||
catch (Foundation::Exception& exc)
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
std::cerr << "HTTPTestServer: " << exc.displayText() << std::endl;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPTestServer.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPTestServer.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPTestServer.h#1 $
|
||||
//
|
||||
// Definition of the HTTPTestServer class.
|
||||
//
|
||||
@@ -36,21 +36,13 @@
|
||||
#define HTTPTestServer_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef Net_ServerSocket_INCLUDED
|
||||
#include "Net/ServerSocket.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Thread_INCLUDED
|
||||
#include "Foundation/Thread.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Event_INCLUDED
|
||||
#include "Foundation/Event.h"
|
||||
#endif
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Event.h"
|
||||
|
||||
|
||||
class HTTPTestServer: public Foundation::Runnable
|
||||
class HTTPTestServer: public Poco::Runnable
|
||||
/// A simple sequential echo server.
|
||||
{
|
||||
public:
|
||||
@@ -60,7 +52,7 @@ public:
|
||||
~HTTPTestServer();
|
||||
/// Destroys the HTTPTestServer.
|
||||
|
||||
Foundation::UInt16 port() const;
|
||||
Poco::UInt16 port() const;
|
||||
/// Returns the port the echo server is
|
||||
/// listening on.
|
||||
|
||||
@@ -78,11 +70,11 @@ protected:
|
||||
std::string handleRequest() const;
|
||||
|
||||
private:
|
||||
Net::ServerSocket _socket;
|
||||
Foundation::Thread _thread;
|
||||
Foundation::Event _ready;
|
||||
bool _stop;
|
||||
std::string _lastRequest;
|
||||
Poco::Net::ServerSocket _socket;
|
||||
Poco::Thread _thread;
|
||||
Poco::Event _ready;
|
||||
bool _stop;
|
||||
std::string _lastRequest;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/HTTPTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/HTTPTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the HTTPTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define HTTPTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class HTTPTestSuite
|
||||
|
||||
152
Net/testsuite/src/ICMPClientTest.cpp
Normal file
152
Net/testsuite/src/ICMPClientTest.cpp
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// ICMPClientTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/Net/testsuite/src/ICMPClientTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "ICMPClientTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Net/ICMPSocket.h"
|
||||
#include "Poco/Net/ICMPClient.h"
|
||||
#include "Poco/Net/ICMPEventArgs.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Delegate.h"
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::Net::ICMPSocket;
|
||||
using Poco::Net::ICMPClient;
|
||||
using Poco::Net::ICMPEventArgs;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Net::HostNotFoundException;
|
||||
using Poco::Delegate;
|
||||
using Poco::AutoPtr;
|
||||
|
||||
|
||||
ICMPClientTest::ICMPClientTest(const std::string& name):
|
||||
CppUnit::TestCase(name),
|
||||
_icmpClient(IPAddress::IPv4)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ICMPClientTest::~ICMPClientTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ICMPClientTest::testPing()
|
||||
{
|
||||
assert(ICMPClient::pingIPv4("localhost") > 0);
|
||||
|
||||
assert(_icmpClient.ping("localhost") > 0);
|
||||
assert(_icmpClient.ping("www.appinf.com", 4) > 0);
|
||||
|
||||
// warning: may fail depending on the existence of the addresses at test site
|
||||
// if so, adjust accordingly (i.e. specify non-existent or unreachable IP addresses)
|
||||
assert(0 == _icmpClient.ping("192.168.243.1"));
|
||||
assert(0 == _icmpClient.ping("10.0.0.1"));
|
||||
}
|
||||
|
||||
|
||||
void ICMPClientTest::setUp()
|
||||
{
|
||||
_icmpClient.pingBegin += Delegate<ICMPClientTest, ICMPEventArgs>(this, &ICMPClientTest::onBegin);
|
||||
_icmpClient.pingReply += Delegate<ICMPClientTest, ICMPEventArgs>(this, &ICMPClientTest::onReply);
|
||||
_icmpClient.pingError += Delegate<ICMPClientTest, ICMPEventArgs>(this, &ICMPClientTest::onError);
|
||||
_icmpClient.pingEnd += Delegate<ICMPClientTest, ICMPEventArgs>(this, &ICMPClientTest::onEnd);
|
||||
}
|
||||
|
||||
|
||||
void ICMPClientTest::tearDown()
|
||||
{
|
||||
_icmpClient.pingBegin -= Delegate<ICMPClientTest, ICMPEventArgs>(this, &ICMPClientTest::onBegin);
|
||||
_icmpClient.pingReply -= Delegate<ICMPClientTest, ICMPEventArgs>(this, &ICMPClientTest::onReply);
|
||||
_icmpClient.pingError -= Delegate<ICMPClientTest, ICMPEventArgs>(this, &ICMPClientTest::onError);
|
||||
_icmpClient.pingEnd -= Delegate<ICMPClientTest, ICMPEventArgs>(this, &ICMPClientTest::onEnd);
|
||||
}
|
||||
|
||||
|
||||
void ICMPClientTest::onBegin(const void* pSender, ICMPEventArgs& args)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << std::endl << "Pinging " << args.hostName() << " [" << args.hostAddress() << "] with "
|
||||
<< args.dataSize() << " bytes of data:"
|
||||
<< std::endl << "-------------------------------------------------------" << std::endl;
|
||||
std::cout << os.str() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void ICMPClientTest::onReply(const void* pSender, ICMPEventArgs& args)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "Reply from " << args.hostAddress()
|
||||
<< " bytes=" << args.dataSize()
|
||||
<< " time=" << args.replyTime() << "ms"
|
||||
<< " TTL=" << args.ttl();
|
||||
std::cout << os.str() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void ICMPClientTest::onError(const void* pSender, ICMPEventArgs& args)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << args.error();
|
||||
std::cerr << os.str() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void ICMPClientTest::onEnd(const void* pSender, ICMPEventArgs& args)
|
||||
{
|
||||
std::ostringstream os;
|
||||
int received = args.received();
|
||||
os << std::endl << "--- Ping statistics for " << args.hostAddress() << " ---"
|
||||
<< std::endl << "Packets: Sent=" << args.sent() << ", Received=" << received
|
||||
<< " Lost=" << args.repetitions() - received << " (" << 100.0 - args.percent() << "% loss),"
|
||||
<< std::endl << "Approximate round trip times in milliseconds: " << std::endl
|
||||
<< "Minimum=" << args.minRTT() << "ms, Maximum=" << args.maxRTT()
|
||||
<< "ms, Average=" << args.avgRTT() << "ms"
|
||||
<< std::endl << "-----------------------------------------------" << std::endl;
|
||||
std::cout << os.str() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* ICMPClientTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ICMPClientTest");
|
||||
|
||||
CppUnit_addTest(pSuite, ICMPClientTest, testPing);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
68
Net/testsuite/src/ICMPClientTest.h
Normal file
68
Net/testsuite/src/ICMPClientTest.h
Normal file
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ICMPClientTest.h
|
||||
//
|
||||
// $Id: //poco/1.2/Net/testsuite/src/ICMPClientTest.h#1 $
|
||||
//
|
||||
// Definition of the ICMPClientTest class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ICMPClientTest_INCLUDED
|
||||
#define ICMPClientTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#include "Poco/Net/ICMPClient.h"
|
||||
#include "Poco/Net/ICMPEventArgs.h"
|
||||
|
||||
|
||||
class ICMPClientTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
ICMPClientTest(const std::string& name);
|
||||
~ICMPClientTest();
|
||||
|
||||
void testPing();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
void onBegin(const void* pSender, Poco::Net::ICMPEventArgs& args);
|
||||
void onReply(const void* pSender, Poco::Net::ICMPEventArgs& args);
|
||||
void onError(const void* pSender, Poco::Net::ICMPEventArgs& args);
|
||||
void onEnd(const void* pSender, Poco::Net::ICMPEventArgs& args);
|
||||
|
||||
private:
|
||||
Poco::Net::ICMPClient _icmpClient;
|
||||
};
|
||||
|
||||
|
||||
#endif // ICMPClientTest_INCLUDED
|
||||
44
Net/testsuite/src/ICMPClientTestSuite.cpp
Normal file
44
Net/testsuite/src/ICMPClientTestSuite.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ICMPClientTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/Net/testsuite/src/ICMPClientTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "ICMPClientTestSuite.h"
|
||||
#include "ICMPClientTest.h"
|
||||
|
||||
|
||||
CppUnit::Test* ICMPClientTestSuite::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ICMPClientTestSuite");
|
||||
|
||||
pSuite->addTest(ICMPClientTest::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
49
Net/testsuite/src/ICMPClientTestSuite.h
Normal file
49
Net/testsuite/src/ICMPClientTestSuite.h
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// ICMPClientTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.2/Net/testsuite/src/ICMPClientTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the ICMPClientTestSuite class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ICMPClientTestSuite_INCLUDED
|
||||
#define ICMPClientTestSuite_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/TestSuite.h"
|
||||
|
||||
|
||||
class ICMPClientTestSuite
|
||||
{
|
||||
public:
|
||||
static CppUnit::Test* suite();
|
||||
};
|
||||
|
||||
|
||||
#endif // ICMPClientTestSuite_INCLUDED
|
||||
115
Net/testsuite/src/ICMPSocketTest.cpp
Normal file
115
Net/testsuite/src/ICMPSocketTest.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// ICMPSocketTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/Net/testsuite/src/ICMPSocketTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "ICMPSocketTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "UDPEchoServer.h"
|
||||
#include "Poco/Net/ICMPSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Stopwatch.h"
|
||||
|
||||
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::ICMPSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Timespan;
|
||||
using Poco::Stopwatch;
|
||||
using Poco::TimeoutException;
|
||||
using Poco::Net::ICMPException;
|
||||
|
||||
|
||||
ICMPSocketTest::ICMPSocketTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ICMPSocketTest::~ICMPSocketTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ICMPSocketTest::testAssign()
|
||||
{
|
||||
ICMPSocket s1(IPAddress::IPv4);
|
||||
ICMPSocket s2(s1);
|
||||
}
|
||||
|
||||
void ICMPSocketTest::testSendToReceiveFrom()
|
||||
{
|
||||
ICMPSocket ss(IPAddress::IPv4);
|
||||
|
||||
SocketAddress sa("www.appinf.com", 0);
|
||||
SocketAddress sr(sa);
|
||||
|
||||
try
|
||||
{
|
||||
ss.receiveFrom(sa);
|
||||
fail("must throw");
|
||||
}
|
||||
catch(ICMPException&)
|
||||
{
|
||||
}
|
||||
catch(TimeoutException&)
|
||||
{
|
||||
}
|
||||
|
||||
ss.sendTo(sa);
|
||||
ss.receiveFrom(sa);
|
||||
|
||||
assert(sr.host().toString() == sa.host().toString());
|
||||
ss.close();
|
||||
}
|
||||
|
||||
|
||||
void ICMPSocketTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ICMPSocketTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* ICMPSocketTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ICMPSocketTest");
|
||||
|
||||
CppUnit_addTest(pSuite, ICMPSocketTest, testSendToReceiveFrom);
|
||||
CppUnit_addTest(pSuite, ICMPSocketTest, testAssign);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
61
Net/testsuite/src/ICMPSocketTest.h
Normal file
61
Net/testsuite/src/ICMPSocketTest.h
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// ICMPSocketTest.h
|
||||
//
|
||||
// $Id: //poco/1.2/Net/testsuite/src/ICMPSocketTest.h#1 $
|
||||
//
|
||||
// Definition of the ICMPSocketTest class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ICMPSocketTest_INCLUDED
|
||||
#define ICMPSocketTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class ICMPSocketTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
ICMPSocketTest(const std::string& name);
|
||||
~ICMPSocketTest();
|
||||
|
||||
void testSendToReceiveFrom();
|
||||
void testAssign();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // ICMPSocketTest_INCLUDED
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// IPAddressTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/IPAddressTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/IPAddressTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,12 +33,12 @@
|
||||
#include "IPAddressTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/IPAddress.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/IPAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
|
||||
|
||||
using Net::IPAddress;
|
||||
using Net::InvalidAddressException;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Net::InvalidAddressException;
|
||||
|
||||
|
||||
IPAddressTest::IPAddressTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// IPAddressTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/IPAddressTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/IPAddressTest.h#1 $
|
||||
//
|
||||
// Definition of the IPAddressTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define IPAddressTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class IPAddressTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MailMessageTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MailMessageTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MailMessageTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,23 +33,23 @@
|
||||
#include "MailMessageTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/MailMessage.h"
|
||||
#include "Net/MailRecipient.h"
|
||||
#include "Net/PartHandler.h"
|
||||
#include "Net/StringPartSource.h"
|
||||
#include "Net/MediaType.h"
|
||||
#include "Foundation/Timestamp.h"
|
||||
#include "Poco/Net/MailMessage.h"
|
||||
#include "Poco/Net/MailRecipient.h"
|
||||
#include "Poco/Net/PartHandler.h"
|
||||
#include "Poco/Net/StringPartSource.h"
|
||||
#include "Poco/Net/MediaType.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
using Net::MailMessage;
|
||||
using Net::MailRecipient;
|
||||
using Net::MessageHeader;
|
||||
using Net::PartHandler;
|
||||
using Net::MediaType;
|
||||
using Net::StringPartSource;
|
||||
using Foundation::Timestamp;
|
||||
using Poco::Net::MailMessage;
|
||||
using Poco::Net::MailRecipient;
|
||||
using Poco::Net::MessageHeader;
|
||||
using Poco::Net::PartHandler;
|
||||
using Poco::Net::MediaType;
|
||||
using Poco::Net::StringPartSource;
|
||||
using Poco::Timestamp;
|
||||
|
||||
|
||||
namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MailMessageTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MailMessageTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MailMessageTest.h#1 $
|
||||
//
|
||||
// Definition of the MailMessageTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MailMessageTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MailMessageTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MailStreamTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MailStreamTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MailStreamTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,14 +33,14 @@
|
||||
#include "MailStreamTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/MailStream.h"
|
||||
#include "Foundation/StreamCopier.h"
|
||||
#include "Poco/Net/MailStream.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::MailInputStream;
|
||||
using Net::MailOutputStream;
|
||||
using Foundation::StreamCopier;
|
||||
using Poco::Net::MailInputStream;
|
||||
using Poco::Net::MailOutputStream;
|
||||
using Poco::StreamCopier;
|
||||
|
||||
|
||||
MailStreamTest::MailStreamTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MailStreamTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MailStreamTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MailStreamTest.h#1 $
|
||||
//
|
||||
// Definition of the MailStreamTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MailStreamTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MailStreamTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MailTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MailTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MailTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MailTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MailTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MailTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the MailTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define MailTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MailTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MediaTypeTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MediaTypeTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MediaTypeTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,10 +33,10 @@
|
||||
#include "MediaTypeTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/MediaType.h"
|
||||
#include "Poco/Net/MediaType.h"
|
||||
|
||||
|
||||
using Net::MediaType;
|
||||
using Poco::Net::MediaType;
|
||||
|
||||
|
||||
MediaTypeTest::MediaTypeTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MediaTypeTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MediaTypeTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MediaTypeTest.h#1 $
|
||||
//
|
||||
// Definition of the MediaTypeTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MediaTypeTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MediaTypeTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MessageHeaderTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MessageHeaderTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MessageHeaderTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,14 +33,14 @@
|
||||
#include "MessageHeaderTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/MessageHeader.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/MessageHeader.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::MessageHeader;
|
||||
using Net::NameValueCollection;
|
||||
using Net::MessageException;
|
||||
using Poco::Net::MessageHeader;
|
||||
using Poco::Net::NameValueCollection;
|
||||
using Poco::Net::MessageException;
|
||||
|
||||
|
||||
MessageHeaderTest::MessageHeaderTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MessageHeaderTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MessageHeaderTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MessageHeaderTest.h#1 $
|
||||
//
|
||||
// Definition of the MessageHeaderTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MessageHeaderTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MessageHeaderTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MessagesTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MessagesTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MessagesTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MessagesTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MessagesTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MessagesTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the MessagesTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define MessagesTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MessagesTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MulticastEchoServer.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MulticastEchoServer.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MulticastEchoServer.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -31,15 +31,15 @@
|
||||
|
||||
|
||||
#include "MulticastEchoServer.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Net::Socket;
|
||||
using Net::DatagramSocket;
|
||||
using Net::SocketAddress;
|
||||
using Net::IPAddress;
|
||||
using Net::NetworkInterface;
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::DatagramSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Net::NetworkInterface;
|
||||
|
||||
|
||||
MulticastEchoServer::MulticastEchoServer():
|
||||
@@ -63,7 +63,7 @@ MulticastEchoServer::~MulticastEchoServer()
|
||||
}
|
||||
|
||||
|
||||
Foundation::UInt16 MulticastEchoServer::port() const
|
||||
Poco::UInt16 MulticastEchoServer::port() const
|
||||
{
|
||||
return _socket.address().port();
|
||||
}
|
||||
@@ -72,7 +72,7 @@ Foundation::UInt16 MulticastEchoServer::port() const
|
||||
void MulticastEchoServer::run()
|
||||
{
|
||||
_ready.set();
|
||||
Foundation::Timespan span(250000);
|
||||
Poco::Timespan span(250000);
|
||||
while (!_stop)
|
||||
{
|
||||
if (_socket.poll(span, Socket::SELECT_READ))
|
||||
@@ -84,7 +84,7 @@ void MulticastEchoServer::run()
|
||||
int n = _socket.receiveFrom(buffer, sizeof(buffer), sender);
|
||||
_socket.sendTo(buffer, n, sender);
|
||||
}
|
||||
catch (Foundation::Exception& exc)
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
std::cerr << "MulticastEchoServer: " << exc.displayText() << std::endl;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ const NetworkInterface& MulticastEchoServer::interface() const
|
||||
}
|
||||
|
||||
|
||||
Net::NetworkInterface MulticastEchoServer::findInterface()
|
||||
Poco::Net::NetworkInterface MulticastEchoServer::findInterface()
|
||||
{
|
||||
NetworkInterface::NetworkInterfaceList ifs = NetworkInterface::list();
|
||||
for (NetworkInterface::NetworkInterfaceList::const_iterator it = ifs.begin(); it != ifs.end(); ++it)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MulticastEchoServer.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MulticastEchoServer.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MulticastEchoServer.h#1 $
|
||||
//
|
||||
// Definition of the MulticastEchoServer class.
|
||||
//
|
||||
@@ -36,27 +36,15 @@
|
||||
#define MulticastEchoServer_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef Net_MulticastSocket_INCLUDED
|
||||
#include "Net/MulticastSocket.h"
|
||||
#endif
|
||||
#ifndef Net_SocketAddress_INCLUDED
|
||||
#include "Net/SocketAddress.h"
|
||||
#endif
|
||||
#ifndef Net_NetworkInterface_INCLUDED
|
||||
#include "Net/NetworkInterface.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Thread_INCLUDED
|
||||
#include "Foundation/Thread.h"
|
||||
#endif
|
||||
#ifndef Net_Foundation_Event_INCLUDED
|
||||
#include "Foundation/Event.h"
|
||||
#endif
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/MulticastSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetworkInterface.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Event.h"
|
||||
|
||||
|
||||
class MulticastEchoServer: public Foundation::Runnable
|
||||
class MulticastEchoServer: public Poco::Runnable
|
||||
/// A simple sequential Multicast echo server.
|
||||
{
|
||||
public:
|
||||
@@ -66,31 +54,31 @@ public:
|
||||
~MulticastEchoServer();
|
||||
/// Destroys the MulticastEchoServer.
|
||||
|
||||
Foundation::UInt16 port() const;
|
||||
Poco::UInt16 port() const;
|
||||
/// Returns the port the echo server is
|
||||
/// listening on.
|
||||
|
||||
void run();
|
||||
/// Does the work.
|
||||
|
||||
const Net::SocketAddress& group() const;
|
||||
const Poco::Net::SocketAddress& group() const;
|
||||
/// Returns the group address where the server listens.
|
||||
|
||||
const Net::NetworkInterface& interface() const;
|
||||
const Poco::Net::NetworkInterface& interface() const;
|
||||
/// Returns the network interface for multicasting.
|
||||
|
||||
protected:
|
||||
static Net::NetworkInterface findInterface();
|
||||
static Poco::Net::NetworkInterface findInterface();
|
||||
/// Finds an appropriate network interface for
|
||||
/// multicasting.
|
||||
|
||||
private:
|
||||
Net::MulticastSocket _socket;
|
||||
Net::SocketAddress _group;
|
||||
Net::NetworkInterface _if;
|
||||
Foundation::Thread _thread;
|
||||
Foundation::Event _ready;
|
||||
bool _stop;
|
||||
Poco::Net::MulticastSocket _socket;
|
||||
Poco::Net::SocketAddress _group;
|
||||
Poco::Net::NetworkInterface _if;
|
||||
Poco::Thread _thread;
|
||||
Poco::Event _ready;
|
||||
bool _stop;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MulticastSocketTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MulticastSocketTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MulticastSocketTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,22 +34,22 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "MulticastEchoServer.h"
|
||||
#include "Net/MulticastSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Foundation/Stopwatch.h"
|
||||
#include "Poco/Net/MulticastSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Stopwatch.h"
|
||||
|
||||
|
||||
using Net::Socket;
|
||||
using Net::MulticastSocket;
|
||||
using Net::SocketAddress;
|
||||
using Net::IPAddress;
|
||||
using Foundation::Timespan;
|
||||
using Foundation::Stopwatch;
|
||||
using Foundation::TimeoutException;
|
||||
using Foundation::InvalidArgumentException;
|
||||
using Foundation::IOException;
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::MulticastSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Timespan;
|
||||
using Poco::Stopwatch;
|
||||
using Poco::TimeoutException;
|
||||
using Poco::InvalidArgumentException;
|
||||
using Poco::IOException;
|
||||
|
||||
|
||||
MulticastSocketTest::MulticastSocketTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MulticastSocketTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MulticastSocketTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MulticastSocketTest.h#1 $
|
||||
//
|
||||
// Definition of the MulticastSocketTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MulticastSocketTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MulticastSocketTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MultipartReaderTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MultipartReaderTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MultipartReaderTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "MultipartReaderTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/MultipartReader.h"
|
||||
#include "Net/MessageHeader.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/MultipartReader.h"
|
||||
#include "Poco/Net/MessageHeader.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::MultipartReader;
|
||||
using Net::MessageHeader;
|
||||
using Net::MultipartException;
|
||||
using Poco::Net::MultipartReader;
|
||||
using Poco::Net::MessageHeader;
|
||||
using Poco::Net::MultipartException;
|
||||
|
||||
|
||||
MultipartReaderTest::MultipartReaderTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MultipartReaderTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MultipartReaderTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MultipartReaderTest.h#1 $
|
||||
//
|
||||
// Definition of the MultipartReaderTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MultipartReaderTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MultipartReaderTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MultipartWriterTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MultipartWriterTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MultipartWriterTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,13 +33,13 @@
|
||||
#include "MultipartWriterTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/MultipartWriter.h"
|
||||
#include "Net/MessageHeader.h"
|
||||
#include "Poco/Net/MultipartWriter.h"
|
||||
#include "Poco/Net/MessageHeader.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::MultipartWriter;
|
||||
using Net::MessageHeader;
|
||||
using Poco::Net::MultipartWriter;
|
||||
using Poco::Net::MessageHeader;
|
||||
|
||||
|
||||
MultipartWriterTest::MultipartWriterTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// MultipartWriterTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/MultipartWriterTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/MultipartWriterTest.h#1 $
|
||||
//
|
||||
// Definition of the MultipartWriterTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define MultipartWriterTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class MultipartWriterTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NameValueCollectionTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/NameValueCollectionTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/NameValueCollectionTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,12 +33,12 @@
|
||||
#include "NameValueCollectionTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/NameValueCollection.h"
|
||||
#include "Foundation/Exception.h"
|
||||
#include "Poco/Net/NameValueCollection.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
using Net::NameValueCollection;
|
||||
using Foundation::NotFoundException;
|
||||
using Poco::Net::NameValueCollection;
|
||||
using Poco::NotFoundException;
|
||||
|
||||
|
||||
NameValueCollectionTest::NameValueCollectionTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -86,6 +86,9 @@ void NameValueCollectionTest::testNameValueCollection()
|
||||
catch (NotFoundException&)
|
||||
{
|
||||
}
|
||||
|
||||
assert (nvc.get("name", "default") == "value");
|
||||
assert (nvc.get("name3", "default") == "default");
|
||||
|
||||
assert (nvc.has("name"));
|
||||
assert (nvc.has("name2"));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NameValueCollectionTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/NameValueCollectionTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/NameValueCollectionTest.h#1 $
|
||||
//
|
||||
// Definition of the NameValueCollectionTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define NameValueCollectionTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class NameValueCollectionTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NetCoreTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/NetCoreTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/NetCoreTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NetCoreTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/NetCoreTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/NetCoreTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the NetCoreTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define NetCoreTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class NetCoreTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NetTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/NetTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/NetTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "ReactorTestSuite.h"
|
||||
#include "FTPClientTestSuite.h"
|
||||
#include "MailTestSuite.h"
|
||||
#include "ICMPClientTestSuite.h"
|
||||
|
||||
|
||||
CppUnit::Test* NetTestSuite::suite()
|
||||
@@ -59,6 +60,7 @@ CppUnit::Test* NetTestSuite::suite()
|
||||
pSuite->addTest(ReactorTestSuite::suite());
|
||||
pSuite->addTest(FTPClientTestSuite::suite());
|
||||
pSuite->addTest(MailTestSuite::suite());
|
||||
pSuite->addTest(ICMPClientTestSuite::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NetTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/NetTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/NetTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the NetTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define NetTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class NetTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NetworkInterfaceTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/NetworkInterfaceTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/NetworkInterfaceTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,11 +33,11 @@
|
||||
#include "NetworkInterfaceTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/NetworkInterface.h"
|
||||
#include "Poco/Net/NetworkInterface.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Net::NetworkInterface;
|
||||
using Poco::Net::NetworkInterface;
|
||||
|
||||
|
||||
NetworkInterfaceTest::NetworkInterfaceTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NetworkInterfaceTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/NetworkInterfaceTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/NetworkInterfaceTest.h#1 $
|
||||
//
|
||||
// Definition of the NetworkInterfaceTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define NetworkInterfaceTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class NetworkInterfaceTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// POP3ClientSessionTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/POP3ClientSessionTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/POP3ClientSessionTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,15 +34,15 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "DialogServer.h"
|
||||
#include "Net/POP3ClientSession.h"
|
||||
#include "Net/MailMessage.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/POP3ClientSession.h"
|
||||
#include "Poco/Net/MailMessage.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
|
||||
|
||||
using Net::POP3ClientSession;
|
||||
using Net::MessageHeader;
|
||||
using Net::MailMessage;
|
||||
using Net::POP3Exception;
|
||||
using Poco::Net::POP3ClientSession;
|
||||
using Poco::Net::MessageHeader;
|
||||
using Poco::Net::MailMessage;
|
||||
using Poco::Net::POP3Exception;
|
||||
|
||||
|
||||
POP3ClientSessionTest::POP3ClientSessionTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// POP3ClientSessionTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/POP3ClientSessionTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/POP3ClientSessionTest.h#1 $
|
||||
//
|
||||
// Definition of the POP3ClientSessionTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define POP3ClientSessionTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class POP3ClientSessionTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// QuotedPrintableTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/QuotedPrintableTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/QuotedPrintableTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,13 +33,13 @@
|
||||
#include "QuotedPrintableTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/QuotedPrintableEncoder.h"
|
||||
#include "Net/QuotedPrintableDecoder.h"
|
||||
#include "Poco/Net/QuotedPrintableEncoder.h"
|
||||
#include "Poco/Net/QuotedPrintableDecoder.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::QuotedPrintableEncoder;
|
||||
using Net::QuotedPrintableDecoder;
|
||||
using Poco::Net::QuotedPrintableEncoder;
|
||||
using Poco::Net::QuotedPrintableDecoder;
|
||||
|
||||
|
||||
QuotedPrintableTest::QuotedPrintableTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// QuotedPrintableTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/QuotedPrintableTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/QuotedPrintableTest.h#1 $
|
||||
//
|
||||
// Definition of the QuotedPrintableTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define QuotedPrintableTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class QuotedPrintableTest: public CppUnit::TestCase
|
||||
|
||||
127
Net/testsuite/src/RawSocketTest.cpp
Normal file
127
Net/testsuite/src/RawSocketTest.cpp
Normal file
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// RawSocketTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.2/Net/testsuite/src/RawSocketTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "RawSocketTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Net/RawSocket.h"
|
||||
#include "Poco/Net/RawSocketImpl.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Stopwatch.h"
|
||||
|
||||
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::RawSocket;
|
||||
using Poco::Net::RawSocketImpl;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Timespan;
|
||||
using Poco::Stopwatch;
|
||||
using Poco::TimeoutException;
|
||||
using Poco::InvalidArgumentException;
|
||||
using Poco::IOException;
|
||||
|
||||
|
||||
RawSocketTest::RawSocketTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
RawSocketTest::~RawSocketTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void RawSocketTest::testEchoIPv4()
|
||||
{
|
||||
SocketAddress sa("localhost", 0);
|
||||
RawSocket rs(IPAddress::IPv4);
|
||||
rs.connect(sa);
|
||||
|
||||
int n = rs.sendBytes("hello", 5);
|
||||
assert (5 == n);
|
||||
|
||||
char buffer[256] = "";
|
||||
unsigned char* ptr = (unsigned char*) buffer;
|
||||
|
||||
n = rs.receiveBytes(buffer, sizeof(buffer));
|
||||
int shift = ((buffer[0] & 0x0F) * 4);
|
||||
ptr += shift;
|
||||
|
||||
assert (5 == (n - shift));
|
||||
assert ("hello" == std::string((char*)ptr, 5));
|
||||
|
||||
rs.close();
|
||||
}
|
||||
|
||||
|
||||
void RawSocketTest::testSendToReceiveFromIPv4()
|
||||
{
|
||||
RawSocket rs(IPAddress::IPv4);
|
||||
|
||||
int n = rs.sendTo("hello", 5, SocketAddress("localhost", 0));
|
||||
assert (n == 5);
|
||||
|
||||
char buffer[256] = "";
|
||||
unsigned char* ptr = (unsigned char*) buffer;
|
||||
SocketAddress sa;
|
||||
n = rs.receiveFrom(buffer, sizeof(buffer), sa);
|
||||
int shift = ((buffer[0] & 0x0F) * 4);
|
||||
ptr += shift;
|
||||
|
||||
assert ((n - shift) == 5);
|
||||
assert ("hello" == std::string((char*)ptr, 5));
|
||||
rs.close();
|
||||
}
|
||||
|
||||
|
||||
void RawSocketTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void RawSocketTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* RawSocketTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("RawSocketTest");
|
||||
|
||||
CppUnit_addTest(pSuite, RawSocketTest, testEchoIPv4);
|
||||
CppUnit_addTest(pSuite, RawSocketTest, testSendToReceiveFromIPv4);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
61
Net/testsuite/src/RawSocketTest.h
Normal file
61
Net/testsuite/src/RawSocketTest.h
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// RawSocketTest.h
|
||||
//
|
||||
// $Id: //poco/1.2/Net/testsuite/src/RawSocketTest.h#1 $
|
||||
//
|
||||
// Definition of the RawSocketTest class.
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef RawSocketTest_INCLUDED
|
||||
#define RawSocketTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class RawSocketTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
RawSocketTest(const std::string& name);
|
||||
~RawSocketTest();
|
||||
|
||||
void testEchoIPv4();
|
||||
void testSendToReceiveFromIPv4();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // RawSocketTest_INCLUDED
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ReactorTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/ReactorTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/ReactorTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ReactorTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/ReactorTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/ReactorTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the ReactorTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define ReactorTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class ReactorTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SMTPClientSessionTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SMTPClientSessionTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SMTPClientSessionTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,16 +34,16 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "DialogServer.h"
|
||||
#include "Net/SMTPClientSession.h"
|
||||
#include "Net/MailMessage.h"
|
||||
#include "Net/MailRecipient.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/SMTPClientSession.h"
|
||||
#include "Poco/Net/MailMessage.h"
|
||||
#include "Poco/Net/MailRecipient.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
|
||||
|
||||
using Net::SMTPClientSession;
|
||||
using Net::MailMessage;
|
||||
using Net::MailRecipient;
|
||||
using Net::SMTPException;
|
||||
using Poco::Net::SMTPClientSession;
|
||||
using Poco::Net::MailMessage;
|
||||
using Poco::Net::MailRecipient;
|
||||
using Poco::Net::SMTPException;
|
||||
|
||||
|
||||
SMTPClientSessionTest::SMTPClientSessionTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SMTPClientSessionTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SMTPClientSessionTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SMTPClientSessionTest.h#1 $
|
||||
//
|
||||
// Definition of the SMTPClientSessionTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define SMTPClientSessionTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class SMTPClientSessionTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketAddressTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketAddressTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketAddressTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,16 +33,17 @@
|
||||
#include "SocketAddressTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
|
||||
|
||||
using Net::SocketAddress;
|
||||
using Net::IPAddress;
|
||||
using Net::InvalidAddressException;
|
||||
using Net::HostNotFoundException;
|
||||
using Net::ServiceNotFoundException;
|
||||
using Net::NoAddressFoundException;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::IPAddress;
|
||||
using Poco::Net::InvalidAddressException;
|
||||
using Poco::Net::HostNotFoundException;
|
||||
using Poco::Net::ServiceNotFoundException;
|
||||
using Poco::Net::NoAddressFoundException;
|
||||
using Poco::InvalidArgumentException;
|
||||
|
||||
|
||||
SocketAddressTest::SocketAddressTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -106,6 +107,32 @@ void SocketAddressTest::testSocketAddress()
|
||||
catch (ServiceNotFoundException&)
|
||||
{
|
||||
}
|
||||
|
||||
SocketAddress sa7("192.168.2.120:88");
|
||||
assert (sa7.host().toString() == "192.168.2.120");
|
||||
assert (sa7.port() == 88);
|
||||
|
||||
SocketAddress sa8("[192.168.2.120]:88");
|
||||
assert (sa8.host().toString() == "192.168.2.120");
|
||||
assert (sa8.port() == 88);
|
||||
|
||||
try
|
||||
{
|
||||
SocketAddress sa9("[192.168.2.260]");
|
||||
fail("invalid address - must throw");
|
||||
}
|
||||
catch (InvalidArgumentException&)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
SocketAddress sa9("[192.168.2.260:88");
|
||||
fail("invalid address - must throw");
|
||||
}
|
||||
catch (InvalidArgumentException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketAddressTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketAddressTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketAddressTest.h#1 $
|
||||
//
|
||||
// Definition of the SocketAddressTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define SocketAddressTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class SocketAddressTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketReactorTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketReactorTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketReactorTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,29 +33,29 @@
|
||||
#include "SocketReactorTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/SocketReactor.h"
|
||||
#include "Net/SocketNotification.h"
|
||||
#include "Net/SocketConnector.h"
|
||||
#include "Net/SocketAcceptor.h"
|
||||
#include "Net/StreamSocket.h"
|
||||
#include "Net/ServerSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Foundation/Observer.h"
|
||||
#include "Poco/Net/SocketReactor.h"
|
||||
#include "Poco/Net/SocketNotification.h"
|
||||
#include "Poco/Net/SocketConnector.h"
|
||||
#include "Poco/Net/SocketAcceptor.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Observer.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Net::SocketReactor;
|
||||
using Net::SocketConnector;
|
||||
using Net::SocketAcceptor;
|
||||
using Net::StreamSocket;
|
||||
using Net::ServerSocket;
|
||||
using Net::SocketAddress;
|
||||
using Net::SocketNotification;
|
||||
using Net::ReadableNotification;
|
||||
using Net::WritableNotification;
|
||||
using Net::TimeoutNotification;
|
||||
using Net::ShutdownNotification;
|
||||
using Foundation::Observer;
|
||||
using Poco::Net::SocketReactor;
|
||||
using Poco::Net::SocketConnector;
|
||||
using Poco::Net::SocketAcceptor;
|
||||
using Poco::Net::StreamSocket;
|
||||
using Poco::Net::ServerSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::SocketNotification;
|
||||
using Poco::Net::ReadableNotification;
|
||||
using Poco::Net::WritableNotification;
|
||||
using Poco::Net::TimeoutNotification;
|
||||
using Poco::Net::ShutdownNotification;
|
||||
using Poco::Observer;
|
||||
|
||||
|
||||
namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketReactorTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketReactorTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketReactorTest.h#1 $
|
||||
//
|
||||
// Definition of the SocketReactorTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define SocketReactorTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class SocketReactorTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketStreamTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketStreamTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketStreamTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,25 +34,25 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "EchoServer.h"
|
||||
#include "Net/SocketStream.h"
|
||||
#include "Net/StreamSocket.h"
|
||||
#include "Net/ServerSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Foundation/Stopwatch.h"
|
||||
#include "Poco/Net/SocketStream.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Stopwatch.h"
|
||||
|
||||
|
||||
using Net::Socket;
|
||||
using Net::SocketStream;
|
||||
using Net::StreamSocket;
|
||||
using Net::ServerSocket;
|
||||
using Net::SocketAddress;
|
||||
using Net::ConnectionRefusedException;
|
||||
using Foundation::Timespan;
|
||||
using Foundation::Stopwatch;
|
||||
using Foundation::TimeoutException;
|
||||
using Foundation::InvalidArgumentException;
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::SocketStream;
|
||||
using Poco::Net::StreamSocket;
|
||||
using Poco::Net::ServerSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::ConnectionRefusedException;
|
||||
using Poco::Timespan;
|
||||
using Poco::Stopwatch;
|
||||
using Poco::TimeoutException;
|
||||
using Poco::InvalidArgumentException;
|
||||
|
||||
|
||||
SocketStreamTest::SocketStreamTest(const std::string& name): CppUnit::TestCase(name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketStreamTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketStreamTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketStreamTest.h#1 $
|
||||
//
|
||||
// Definition of the SocketStreamTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define SocketStreamTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class SocketStreamTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -34,24 +34,24 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "EchoServer.h"
|
||||
#include "Net/StreamSocket.h"
|
||||
#include "Net/ServerSocket.h"
|
||||
#include "Net/SocketAddress.h"
|
||||
#include "Net/NetException.h"
|
||||
#include "Foundation/Timespan.h"
|
||||
#include "Foundation/Stopwatch.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Stopwatch.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Net::Socket;
|
||||
using Net::StreamSocket;
|
||||
using Net::ServerSocket;
|
||||
using Net::SocketAddress;
|
||||
using Net::ConnectionRefusedException;
|
||||
using Foundation::Timespan;
|
||||
using Foundation::Stopwatch;
|
||||
using Foundation::TimeoutException;
|
||||
using Foundation::InvalidArgumentException;
|
||||
using Poco::Net::Socket;
|
||||
using Poco::Net::StreamSocket;
|
||||
using Poco::Net::ServerSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Net::ConnectionRefusedException;
|
||||
using Poco::Timespan;
|
||||
using Poco::Stopwatch;
|
||||
using Poco::TimeoutException;
|
||||
using Poco::InvalidArgumentException;
|
||||
|
||||
|
||||
SocketTest::SocketTest(const std::string& name): CppUnit::TestCase(name)
|
||||
@@ -138,7 +138,7 @@ void SocketTest::testConnectRefused()
|
||||
ServerSocket serv;
|
||||
serv.bind(SocketAddress());
|
||||
serv.listen();
|
||||
Foundation::UInt16 port = serv.address().port();
|
||||
Poco::UInt16 port = serv.address().port();
|
||||
serv.close();
|
||||
StreamSocket ss;
|
||||
Timespan timeout(250000);
|
||||
@@ -158,7 +158,7 @@ void SocketTest::testConnectRefusedNB()
|
||||
ServerSocket serv;
|
||||
serv.bind(SocketAddress());
|
||||
serv.listen();
|
||||
Foundation::UInt16 port = serv.address().port();
|
||||
Poco::UInt16 port = serv.address().port();
|
||||
serv.close();
|
||||
StreamSocket ss;
|
||||
Timespan timeout(10000);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketTest.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketTest.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketTest.h#1 $
|
||||
//
|
||||
// Definition of the SocketTest class.
|
||||
//
|
||||
@@ -36,12 +36,8 @@
|
||||
#define SocketTest_INCLUDED
|
||||
|
||||
|
||||
#ifndef Net_Net_INCLUDED
|
||||
#include "Net/Net.h"
|
||||
#endif
|
||||
#ifndef CppUnit_TestCase_INCLUDED
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#endif
|
||||
|
||||
|
||||
class SocketTest: public CppUnit::TestCase
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketsTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketsTestSuite.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketsTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "NetworkInterfaceTest.h"
|
||||
#include "MulticastSocketTest.h"
|
||||
#include "DialogSocketTest.h"
|
||||
#include "RawSocketTest.h"
|
||||
|
||||
|
||||
CppUnit::Test* SocketsTestSuite::suite()
|
||||
@@ -49,6 +50,7 @@ CppUnit::Test* SocketsTestSuite::suite()
|
||||
pSuite->addTest(NetworkInterfaceTest::suite());
|
||||
pSuite->addTest(MulticastSocketTest::suite());
|
||||
pSuite->addTest(DialogSocketTest::suite());
|
||||
pSuite->addTest(RawSocketTest::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketsTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/SocketsTestSuite.h#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/SocketsTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the SocketsTestSuite class.
|
||||
//
|
||||
@@ -36,9 +36,7 @@
|
||||
#define SocketsTestSuite_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_TestSuite_INCLUDED
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#endif
|
||||
|
||||
|
||||
class SocketsTestSuite
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TCPServerTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/Net/testsuite/src/TCPServerTest.cpp#2 $
|
||||
// $Id: //poco/1.2/Net/testsuite/src/TCPServerTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@@ -33,25 +33,25 @@
|
||||
#include "TCPServerTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Net/TCPServer.h"
|
||||
#include "Net/TCPServerConnection.h"
|
||||
#include "Net/TCPServerConnectionFactory.h"
|
||||
#include "Net/TCPServerParams.h"
|
||||
#include "Net/StreamSocket.h"
|
||||
#include "Net/ServerSocket.h"
|
||||
#include "Foundation/Thread.h"
|
||||
#include "Poco/Net/TCPServer.h"
|
||||
#include "Poco/Net/TCPServerConnection.h"
|
||||
#include "Poco/Net/TCPServerConnectionFactory.h"
|
||||
#include "Poco/Net/TCPServerParams.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Net::TCPServer;
|
||||
using Net::TCPServerConnection;
|
||||
using Net::TCPServerConnectionFactory;
|
||||
using Net::TCPServerConnectionFactoryImpl;
|
||||
using Net::TCPServerParams;
|
||||
using Net::StreamSocket;
|
||||
using Net::ServerSocket;
|
||||
using Net::SocketAddress;
|
||||
using Foundation::Thread;
|
||||
using Poco::Net::TCPServer;
|
||||
using Poco::Net::TCPServerConnection;
|
||||
using Poco::Net::TCPServerConnectionFactory;
|
||||
using Poco::Net::TCPServerConnectionFactoryImpl;
|
||||
using Poco::Net::TCPServerParams;
|
||||
using Poco::Net::StreamSocket;
|
||||
using Poco::Net::ServerSocket;
|
||||
using Poco::Net::SocketAddress;
|
||||
using Poco::Thread;
|
||||
|
||||
|
||||
namespace
|
||||
@@ -76,7 +76,7 @@ namespace
|
||||
n = ss.receiveBytes(buffer, sizeof(buffer));
|
||||
}
|
||||
}
|
||||
catch (Foundation::Exception& exc)
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
std::cerr << "EchoConnection: " << exc.displayText() << std::endl;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user