Checking in vendor folder for ease of using go get.
This commit is contained in:
parent
7a1251853b
commit
cdb4b5a1d0
3554 changed files with 1270116 additions and 0 deletions
32
vendor/git.apache.org/thrift.git/lib/cpp/test/qt/CMakeLists.txt
generated
vendored
Normal file
32
vendor/git.apache.org/thrift.git/lib/cpp/test/qt/CMakeLists.txt
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
find_package(Qt5 REQUIRED COMPONENTS Test Network)
|
||||
set(TQTcpServerTest_Qt5_SOURCES
|
||||
TQTcpServerTest.cpp
|
||||
)
|
||||
add_executable(TQTcpServerTest_Qt5 ${TQTcpServerTest_Qt5_SOURCES})
|
||||
target_link_libraries(TQTcpServerTest_Qt5 testgencpp_cob)
|
||||
LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thriftqt5)
|
||||
LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest_Qt5 thrift)
|
||||
target_link_libraries(TQTcpServerTest_Qt5 Qt5::Test Qt5::Network)
|
||||
|
||||
add_test(NAME TQTcpServerTest_Qt5 COMMAND TQTcpServerTest_Qt5)
|
||||
|
114
vendor/git.apache.org/thrift.git/lib/cpp/test/qt/TQTcpServerTest.cpp
generated
vendored
Normal file
114
vendor/git.apache.org/thrift.git/lib/cpp/test/qt/TQTcpServerTest.cpp
generated
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
#define BOOST_TEST_MODULE TQTcpServerTest
|
||||
#include <QTest>
|
||||
#include <iostream>
|
||||
|
||||
#include <QTcpServer>
|
||||
#include <QTcpSocket>
|
||||
#include <QHostAddress>
|
||||
#include <QThread>
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#include <boost/smart_ptr.hpp>
|
||||
#include "thrift/protocol/TBinaryProtocol.h"
|
||||
#include "thrift/async/TAsyncProcessor.h"
|
||||
#include "thrift/qt/TQTcpServer.h"
|
||||
#include "thrift/qt/TQIODeviceTransport.h"
|
||||
|
||||
#include "gen-cpp/ParentService.h"
|
||||
#endif
|
||||
|
||||
using namespace apache::thrift;
|
||||
|
||||
struct AsyncHandler : public test::ParentServiceCobSvIf {
|
||||
std::vector<std::string> strings;
|
||||
virtual void addString(tcxx::function<void()> cob, const std::string& s) {
|
||||
strings.push_back(s);
|
||||
cob();
|
||||
}
|
||||
virtual void getStrings(tcxx::function<void(std::vector<std::string> const& _return)> cob) {
|
||||
cob(strings);
|
||||
}
|
||||
|
||||
// Overrides not used in this test
|
||||
virtual void incrementGeneration(tcxx::function<void(int32_t const& _return)> cob) {}
|
||||
virtual void getGeneration(tcxx::function<void(int32_t const& _return)> cob) {}
|
||||
virtual void getDataWait(tcxx::function<void(std::string const& _return)> cob,
|
||||
const int32_t length) {}
|
||||
virtual void onewayWait(tcxx::function<void()> cob) {}
|
||||
virtual void exceptionWait(
|
||||
tcxx::function<void()> cob,
|
||||
tcxx::function<void(::apache::thrift::TDelayedException* _throw)> /* exn_cob */,
|
||||
const std::string& message) {}
|
||||
virtual void unexpectedExceptionWait(tcxx::function<void()> cob, const std::string& message) {}
|
||||
};
|
||||
|
||||
class TQTcpServerTest : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void test_communicate();
|
||||
|
||||
private:
|
||||
boost::shared_ptr<QThread> serverThread;
|
||||
boost::shared_ptr<async::TQTcpServer> server;
|
||||
boost::shared_ptr<test::ParentServiceClient> client;
|
||||
};
|
||||
|
||||
void TQTcpServerTest::initTestCase() {
|
||||
// setup server
|
||||
boost::shared_ptr<QTcpServer> serverSocket = boost::make_shared<QTcpServer>();
|
||||
server.reset(new async::TQTcpServer(serverSocket,
|
||||
boost::make_shared<test::ParentServiceAsyncProcessor>(
|
||||
boost::make_shared<AsyncHandler>()),
|
||||
boost::make_shared<protocol::TBinaryProtocolFactory>()));
|
||||
QVERIFY(serverSocket->listen(QHostAddress::LocalHost));
|
||||
int port = serverSocket->serverPort();
|
||||
QVERIFY(port > 0);
|
||||
|
||||
//setup server thread and move server to it
|
||||
serverThread.reset(new QThread());
|
||||
serverSocket->moveToThread(serverThread.get());
|
||||
server->moveToThread(serverThread.get());
|
||||
serverThread->start();
|
||||
|
||||
// setup client
|
||||
boost::shared_ptr<QTcpSocket> socket = boost::make_shared<QTcpSocket>();
|
||||
client.reset(new test::ParentServiceClient(boost::make_shared<protocol::TBinaryProtocol>(
|
||||
boost::make_shared<transport::TQIODeviceTransport>(socket))));
|
||||
socket->connectToHost(QHostAddress::LocalHost, port);
|
||||
QVERIFY(socket->waitForConnected());
|
||||
}
|
||||
|
||||
void TQTcpServerTest::cleanupTestCase() {
|
||||
//first, stop the thread which holds the server
|
||||
serverThread->quit();
|
||||
serverThread->wait();
|
||||
// now, it is safe to delete the server
|
||||
server.reset();
|
||||
// delete thread now
|
||||
serverThread.reset();
|
||||
|
||||
// cleanup client
|
||||
client.reset();
|
||||
}
|
||||
|
||||
void TQTcpServerTest::test_communicate() {
|
||||
client->addString("foo");
|
||||
client->addString("bar");
|
||||
|
||||
std::vector<std::string> reply;
|
||||
client->getStrings(reply);
|
||||
QCOMPARE(QString::fromStdString(reply[0]), QString("foo"));
|
||||
QCOMPARE(QString::fromStdString(reply[1]), QString("bar"));
|
||||
}
|
||||
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
QTEST_GUILESS_MAIN(TQTcpServerTest);
|
||||
#else
|
||||
#undef QT_GUI_LIB
|
||||
QTEST_MAIN(TQTcpServerTest);
|
||||
#endif
|
||||
#include "TQTcpServerTest.moc"
|
Loading…
Add table
Add a link
Reference in a new issue