#4460 #4424 Adding Exit() to the gRPC interface plus implemented test framework

This commit is contained in:
Gaute Lindkvist
2019-06-04 12:59:06 +02:00
parent 930abbf02f
commit 3530c8b3de
17 changed files with 146 additions and 79 deletions

View File

@@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
//////////////////////////////////////////////////////////////////////////////////
#include "RiaGrpcAppService.h"
#include "RiaVersionInfo.h"
#include "RiaGrpcCallbacks.h"
#include "RiaGrpcServer.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
grpc::Status RiaGrpcAppService::GetVersion(grpc::ServerContext* context, const rips::Empty* request, rips::Version* reply)
{
reply->set_major_version(RESINSIGHT_MAJOR_VERSION);
reply->set_minor_version(RESINSIGHT_MINOR_VERSION);
reply->set_patch_version(RESINSIGHT_PATCH_VERSION);
return grpc::Status::OK;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
grpc::Status RiaGrpcAppService::Exit(grpc::ServerContext* context, const rips::Empty* request, rips::Empty* reply)
{
RiaGrpcServer::setReceivedExitRequest();
return grpc::Status::OK;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RiaGrpcCallbackInterface*> RiaGrpcAppService::createCallbacks()
{
typedef RiaGrpcAppService Self;
return { new RiaGrpcUnaryCallback<Self, rips::Empty, rips::Version>(this, &Self::GetVersion, &Self::RequestGetVersion),
new RiaGrpcUnaryCallback<Self, rips::Empty, rips::Empty>(this, &Self::Exit, &Self::RequestExit) };
}
static bool RiaGrpcAppInfoService_init =
RiaGrpcServiceFactory::instance()->registerCreator<RiaGrpcAppService>(typeid(RiaGrpcAppService).hash_code());