2009-11-19 17:24:41 +00:00
|
|
|
// Cyphesis Online RPG Server and AI Engine
|
|
|
|
|
// Copyright (C) 2009 Alistair Riddoch
|
|
|
|
|
//
|
|
|
|
|
// This program 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 2 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program 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 for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
|
|
|
2011-02-15 09:30:46 +00:00
|
|
|
#ifdef NDEBUG
|
|
|
|
|
#undef NDEBUG
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef DEBUG
|
|
|
|
|
#define DEBUG
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
#include "TestBase.h"
|
2012-08-01 19:42:36 +01:00
|
|
|
#include "null_stream.h"
|
|
|
|
|
|
2009-11-19 17:24:41 +00:00
|
|
|
#include "server/Connection.h"
|
2010-03-23 00:06:54 +00:00
|
|
|
|
|
|
|
|
#include "server/Account.h"
|
2012-11-23 16:11:21 +00:00
|
|
|
#include "rulesets/ExternalMind.h"
|
2012-11-23 23:58:56 +00:00
|
|
|
#include "rulesets/ExternalProperty.h"
|
2010-03-23 00:06:54 +00:00
|
|
|
#include "server/Lobby.h"
|
|
|
|
|
#include "server/Player.h"
|
2009-11-19 17:24:41 +00:00
|
|
|
#include "server/ServerRouting.h"
|
2010-03-23 00:06:54 +00:00
|
|
|
|
|
|
|
|
#include "rulesets/Character.h"
|
2009-11-19 17:24:41 +00:00
|
|
|
|
2009-11-20 17:13:52 +00:00
|
|
|
#include "common/compose.hpp"
|
2010-03-23 00:06:54 +00:00
|
|
|
#include "common/Inheritance.h"
|
|
|
|
|
#include "common/log.h"
|
2011-10-31 12:47:56 +01:00
|
|
|
#include "common/SystemTime.h"
|
2014-02-03 12:19:42 +01:00
|
|
|
#include "common/CommSocket.h"
|
2014-09-29 19:24:05 +02:00
|
|
|
#include "common/Property_impl.h"
|
2009-11-20 17:13:52 +00:00
|
|
|
|
|
|
|
|
#include <Atlas/Objects/Anonymous.h>
|
|
|
|
|
#include <Atlas/Objects/Operation.h>
|
|
|
|
|
#include <Atlas/Objects/SmartPtr.h>
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
|
2009-11-19 17:24:41 +00:00
|
|
|
#include <cassert>
|
|
|
|
|
|
2009-11-20 17:13:52 +00:00
|
|
|
using Atlas::Message::ListType;
|
|
|
|
|
using Atlas::Message::MapType;
|
|
|
|
|
using Atlas::Objects::Root;
|
|
|
|
|
using Atlas::Objects::Entity::RootEntity;
|
|
|
|
|
using Atlas::Objects::Entity::Anonymous;
|
|
|
|
|
using Atlas::Objects::Operation::Create;
|
|
|
|
|
using Atlas::Objects::Operation::Get;
|
|
|
|
|
using Atlas::Objects::Operation::Login;
|
|
|
|
|
using Atlas::Objects::Operation::Logout;
|
|
|
|
|
using Atlas::Objects::Operation::Move;
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
class TestCommSocket : public CommSocket
|
|
|
|
|
{
|
2009-11-19 17:24:41 +00:00
|
|
|
public:
|
2014-02-03 12:19:42 +01:00
|
|
|
TestCommSocket() : CommSocket(*(boost::asio::io_service*)0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void disconnect()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual int flush()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-19 17:24:41 +00:00
|
|
|
};
|
|
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
class Connectiontest : public Cyphesis::TestBase
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
ServerRouting * m_server;
|
2014-02-03 12:19:42 +01:00
|
|
|
CommSocket * m_tcc;
|
2012-11-25 13:22:44 +00:00
|
|
|
Connection * m_connection;
|
2018-04-25 20:09:14 +02:00
|
|
|
Inheritance * m_inheritance;
|
|
|
|
|
|
2009-11-19 17:24:41 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
static bool Router_error_called;
|
|
|
|
|
static bool Router_clientError_called;
|
|
|
|
|
public:
|
|
|
|
|
Connectiontest();
|
|
|
|
|
|
|
|
|
|
void setup();
|
|
|
|
|
void teardown();
|
|
|
|
|
|
|
|
|
|
void test_addNewAccount();
|
|
|
|
|
void test_CreateOperation_empty();
|
|
|
|
|
void test_CreateOperation_root_arg();
|
|
|
|
|
void test_CreateOperation_restricted();
|
|
|
|
|
void test_CreateOperation_empty_arg();
|
|
|
|
|
void test_CreateOperation_account_by_id();
|
|
|
|
|
void test_CreateOperation_number_username();
|
|
|
|
|
void test_CreateOperation_no_passed();
|
|
|
|
|
void test_CreateOperation_empty_password();
|
|
|
|
|
void test_CreateOperation_username();
|
|
|
|
|
void test_CreateOperation();
|
|
|
|
|
void test_foo();
|
|
|
|
|
void test_disconnectAccount_empty();
|
|
|
|
|
void test_disconnectAccount_unused_Character();
|
|
|
|
|
void test_disconnectAccount_used_Character();
|
|
|
|
|
void test_disconnectAccount_others_used_Character();
|
|
|
|
|
void test_disconnectAccount_unlinked_Character();
|
|
|
|
|
void test_disconnectAccount_non_Character();
|
|
|
|
|
|
|
|
|
|
static void set_Router_error_called();
|
|
|
|
|
static void set_Router_clientError_called();
|
|
|
|
|
};
|
2009-11-19 17:24:41 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
bool Connectiontest::Router_error_called = false;
|
|
|
|
|
bool Connectiontest::Router_clientError_called = false;
|
2009-11-20 17:13:52 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
void Connectiontest::set_Router_error_called()
|
|
|
|
|
{
|
|
|
|
|
Router_error_called = true;
|
|
|
|
|
}
|
2009-11-20 17:13:52 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
void Connectiontest::set_Router_clientError_called()
|
|
|
|
|
{
|
|
|
|
|
Router_clientError_called = true;
|
|
|
|
|
}
|
2009-11-20 17:13:52 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
Connectiontest::Connectiontest()
|
|
|
|
|
{
|
|
|
|
|
ADD_TEST(Connectiontest::test_addNewAccount);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_empty);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_root_arg);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_restricted);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_empty_arg);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_account_by_id);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_number_username);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_no_passed);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_empty_password);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation_username);
|
|
|
|
|
ADD_TEST(Connectiontest::test_CreateOperation);
|
|
|
|
|
ADD_TEST(Connectiontest::test_foo);
|
|
|
|
|
ADD_TEST(Connectiontest::test_disconnectAccount_empty);
|
|
|
|
|
ADD_TEST(Connectiontest::test_disconnectAccount_empty);
|
|
|
|
|
ADD_TEST(Connectiontest::test_disconnectAccount_unused_Character);
|
|
|
|
|
ADD_TEST(Connectiontest::test_disconnectAccount_used_Character);
|
|
|
|
|
ADD_TEST(Connectiontest::test_disconnectAccount_others_used_Character);
|
|
|
|
|
ADD_TEST(Connectiontest::test_disconnectAccount_unlinked_Character);
|
|
|
|
|
ADD_TEST(Connectiontest::test_disconnectAccount_non_Character);
|
|
|
|
|
}
|
2009-11-19 17:24:41 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
void Connectiontest::setup()
|
2009-11-19 17:24:41 +00:00
|
|
|
{
|
2018-04-25 20:09:14 +02:00
|
|
|
m_inheritance = new Inheritance();
|
2012-11-25 13:22:44 +00:00
|
|
|
Router_error_called = false;
|
2009-11-19 17:24:41 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
m_server = new ServerRouting(*(BaseWorld*)0, "noruleset", "unittesting",
|
|
|
|
|
"1", 1, "2", 2);
|
2012-10-25 10:40:41 -04:00
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
m_tcc = new TestCommSocket();
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection = new Connection(*m_tcc, *m_server, "addr", "3", 3);
|
|
|
|
|
}
|
2009-11-19 17:24:41 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
void Connectiontest::teardown()
|
|
|
|
|
{
|
2018-04-25 20:09:14 +02:00
|
|
|
delete m_inheritance;
|
2012-11-25 13:22:44 +00:00
|
|
|
}
|
2009-11-19 17:24:41 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
void Connectiontest::test_addNewAccount()
|
|
|
|
|
{
|
|
|
|
|
Account * ac = m_connection->addNewAccount("player", "bob", "foo");
|
2009-11-20 17:13:52 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
ASSERT_NOT_NULL(ac);
|
2009-11-20 17:13:52 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->disconnectObject(m_connection->m_objects.find(ac->getIntId()),
|
|
|
|
|
"test_event");
|
|
|
|
|
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_empty()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_error_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_root_arg()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
op->setArgs1(Root());
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_error_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_restricted()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
restricted_flag = true;
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_error_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_empty_arg()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
restricted_flag = false;
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_error_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_account_by_id()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
op_arg->setId("jim");
|
|
|
|
|
// Legacy op
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_error_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_number_username()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
op_arg->setAttr("username", 1);
|
|
|
|
|
// Malformed username
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_error_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_no_passed()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
op_arg->setAttr("username", "jim");
|
|
|
|
|
// username, no password
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_error_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_empty_password()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
op_arg->setAttr("username", "jim");
|
|
|
|
|
op_arg->setAttr("password", "");
|
|
|
|
|
// zero length password
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_clientError_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation_username()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
op_arg->setAttr("username", "");
|
|
|
|
|
op_arg->setAttr("password", "foo");
|
|
|
|
|
// zero length username
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 0u);
|
|
|
|
|
ASSERT_TRUE(Router_clientError_called);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_CreateOperation()
|
|
|
|
|
{
|
|
|
|
|
Create op;
|
|
|
|
|
OpVector res;
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
op_arg->setAttr("username", "jim");
|
|
|
|
|
op_arg->setAttr("password", "foo");
|
|
|
|
|
// valid username and password
|
|
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
ASSERT_EQUAL(m_connection->m_objects.size(), 1u);
|
|
|
|
|
}
|
2009-11-20 17:13:52 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
void Connectiontest::test_foo()
|
|
|
|
|
{
|
2009-11-20 17:13:52 +00:00
|
|
|
{
|
|
|
|
|
Login op;
|
|
|
|
|
OpVector res;
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op->setArgs1(Root());
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
Anonymous op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setId("bob");
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setAttr("username", 1);
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setAttr("username", "");
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setAttr("username", "bob");
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setAttr("password", "foo");
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
|
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Get op;
|
|
|
|
|
OpVector res;
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
Root op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setId("1");
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setId("game_entity");
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Logout op;
|
|
|
|
|
OpVector res;
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op->setSerialno(24);
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
Root op_arg;
|
|
|
|
|
op->setArgs1(op_arg);
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setId("-1");
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
op_arg->setId("23");
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
// How to determine the real ID?
|
2012-11-25 13:22:44 +00:00
|
|
|
const RouterMap rm = m_connection->m_objects;
|
2009-11-20 17:13:52 +00:00
|
|
|
RouterMap::const_iterator I = rm.begin();
|
|
|
|
|
for (;I != rm.end(); ++I) {
|
|
|
|
|
std::string object_id = String::compose("%1", I->first);
|
|
|
|
|
std::cout << "ID: " << object_id << std::endl;
|
|
|
|
|
op_arg->setId(object_id);
|
2012-11-25 13:22:44 +00:00
|
|
|
m_connection->operation(op, res);
|
2009-11-20 17:13:52 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-11-19 17:24:41 +00:00
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_disconnectAccount_empty()
|
|
|
|
|
{
|
|
|
|
|
// setup
|
|
|
|
|
Account * ac = new Player(m_connection,
|
|
|
|
|
"jim",
|
|
|
|
|
"1e0ce8e9-304b-470c-83c4-feab11f9a2e4",
|
|
|
|
|
"4", 4);
|
|
|
|
|
|
|
|
|
|
ac->m_connection = m_connection;
|
|
|
|
|
m_connection->m_objects[ac->getIntId()] = ac;
|
|
|
|
|
|
|
|
|
|
RouterMap::iterator I = m_connection-> m_objects.find(ac->getIntId());
|
|
|
|
|
assert(I != m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
m_connection->disconnectAccount(ac, I, "test_disconnect_account");
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(ac->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_disconnectAccount_unused_Character()
|
|
|
|
|
{
|
|
|
|
|
// setup
|
|
|
|
|
Account * ac = new Player(m_connection,
|
|
|
|
|
"jim",
|
|
|
|
|
"1e0ce8e9-304b-470c-83c4-feab11f9a2e4",
|
|
|
|
|
"4", 4);
|
|
|
|
|
|
|
|
|
|
ac->m_connection = m_connection;
|
|
|
|
|
m_connection->m_objects[ac->getIntId()] = ac;
|
|
|
|
|
|
|
|
|
|
RouterMap::iterator I = m_connection-> m_objects.find(ac->getIntId());
|
|
|
|
|
assert(I != m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
Character * avatar = new Character("5", 5);
|
|
|
|
|
m_connection->m_objects[avatar->getIntId()] = avatar;
|
|
|
|
|
ac->addCharacter(avatar);
|
|
|
|
|
|
|
|
|
|
m_connection->disconnectAccount(ac, I, "test_disconnect_account");
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(ac->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(avatar->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_disconnectAccount_used_Character()
|
|
|
|
|
{
|
|
|
|
|
// setup
|
|
|
|
|
Account * ac = new Player(m_connection,
|
|
|
|
|
"jim",
|
|
|
|
|
"1e0ce8e9-304b-470c-83c4-feab11f9a2e4",
|
|
|
|
|
"4", 4);
|
|
|
|
|
|
|
|
|
|
ac->m_connection = m_connection;
|
|
|
|
|
m_connection->m_objects[ac->getIntId()] = ac;
|
|
|
|
|
|
|
|
|
|
RouterMap::iterator I = m_connection-> m_objects.find(ac->getIntId());
|
|
|
|
|
assert(I != m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
Character * avatar = new Character("5", 5);
|
|
|
|
|
avatar->m_externalMind = new ExternalMind(*avatar);
|
|
|
|
|
avatar->m_externalMind->linkUp(m_connection);
|
|
|
|
|
m_connection->m_objects[avatar->getIntId()] = avatar;
|
|
|
|
|
ac->addCharacter(avatar);
|
|
|
|
|
|
|
|
|
|
m_connection->disconnectAccount(ac, I, "test_disconnect_account");
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(ac->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
// The Character was in use, so it stays connected
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(avatar->getIntId()) !=
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_disconnectAccount_others_used_Character()
|
|
|
|
|
{
|
|
|
|
|
// setup
|
|
|
|
|
Account * ac = new Player(m_connection,
|
|
|
|
|
"jim",
|
|
|
|
|
"1e0ce8e9-304b-470c-83c4-feab11f9a2e4",
|
|
|
|
|
"4", 4);
|
|
|
|
|
|
|
|
|
|
ac->m_connection = m_connection;
|
|
|
|
|
m_connection->m_objects[ac->getIntId()] = ac;
|
|
|
|
|
|
|
|
|
|
RouterMap::iterator I = m_connection-> m_objects.find(ac->getIntId());
|
|
|
|
|
assert(I != m_connection->m_objects.end());
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
CommSocket * otcc = new TestCommSocket();
|
2012-11-25 13:22:44 +00:00
|
|
|
Connection * other_con = new Connection(*otcc, *m_server, "addr", "6", 6);
|
|
|
|
|
|
|
|
|
|
Character * avatar = new Character("5", 5);
|
|
|
|
|
avatar->m_externalMind = new ExternalMind(*avatar);
|
|
|
|
|
avatar->m_externalMind->linkUp(other_con);
|
|
|
|
|
m_connection->m_objects[avatar->getIntId()] = avatar;
|
|
|
|
|
ac->addCharacter(avatar);
|
|
|
|
|
|
|
|
|
|
m_connection->disconnectAccount(ac, I, "test_disconnect_account");
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(ac->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
// The Character was in use by another connection, so it is removed
|
|
|
|
|
// from this one.
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(avatar->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_disconnectAccount_unlinked_Character()
|
|
|
|
|
{
|
|
|
|
|
// setup
|
|
|
|
|
Account * ac = new Player(m_connection,
|
|
|
|
|
"jim",
|
|
|
|
|
"1e0ce8e9-304b-470c-83c4-feab11f9a2e4",
|
|
|
|
|
"4", 4);
|
|
|
|
|
|
|
|
|
|
ac->m_connection = m_connection;
|
|
|
|
|
m_connection->m_objects[ac->getIntId()] = ac;
|
|
|
|
|
|
|
|
|
|
RouterMap::iterator I = m_connection-> m_objects.find(ac->getIntId());
|
|
|
|
|
assert(I != m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
Character * avatar = new Character("5", 5);
|
|
|
|
|
avatar->m_externalMind = new ExternalMind(*avatar);
|
|
|
|
|
m_connection->m_objects[avatar->getIntId()] = avatar;
|
|
|
|
|
ac->addCharacter(avatar);
|
|
|
|
|
|
|
|
|
|
m_connection->disconnectAccount(ac, I, "test_disconnect_account");
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(ac->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(avatar->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Connectiontest::test_disconnectAccount_non_Character()
|
|
|
|
|
{
|
|
|
|
|
// setup
|
|
|
|
|
Account * ac = new Player(m_connection,
|
|
|
|
|
"jim",
|
|
|
|
|
"1e0ce8e9-304b-470c-83c4-feab11f9a2e4",
|
|
|
|
|
"4", 4);
|
|
|
|
|
|
|
|
|
|
ac->m_connection = m_connection;
|
|
|
|
|
m_connection->m_objects[ac->getIntId()] = ac;
|
|
|
|
|
|
|
|
|
|
RouterMap::iterator I = m_connection-> m_objects.find(ac->getIntId());
|
|
|
|
|
assert(I != m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
Entity * avatar = new Thing("5", 5);
|
|
|
|
|
m_connection->m_objects[avatar->getIntId()] = avatar;
|
|
|
|
|
ac->addCharacter(avatar);
|
|
|
|
|
|
|
|
|
|
m_connection->disconnectAccount(ac, I, "test_disconnect_account");
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(ac->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(m_connection-> m_objects.find(avatar->getIntId()) ==
|
|
|
|
|
m_connection->m_objects.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
Connectiontest t;
|
|
|
|
|
|
|
|
|
|
return t.run();
|
2009-11-19 17:24:41 +00:00
|
|
|
}
|
2010-03-23 00:06:54 +00:00
|
|
|
|
|
|
|
|
// Stubs
|
|
|
|
|
|
2013-01-17 10:17:07 +00:00
|
|
|
#include "common/BaseWorld.h"
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
bool restricted_flag;
|
|
|
|
|
|
|
|
|
|
namespace Atlas { namespace Objects { namespace Operation {
|
|
|
|
|
int UPDATE_NO = -1;
|
|
|
|
|
} } }
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
CommSocket::CommSocket(boost::asio::io_service & svr) : m_io_service(svr) { }
|
2010-03-23 00:06:54 +00:00
|
|
|
|
|
|
|
|
CommSocket::~CommSocket()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-01 19:42:36 +01:00
|
|
|
int CommSocket::flush()
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-25 21:05:59 +02:00
|
|
|
#include "stubs/server/stubPlayer.h"
|
2010-03-23 00:06:54 +00:00
|
|
|
|
|
|
|
|
Account::Account(Connection * conn,
|
|
|
|
|
const std::string & uname,
|
|
|
|
|
const std::string & passwd,
|
|
|
|
|
const std::string & id,
|
|
|
|
|
long intId) :
|
2012-11-13 00:09:05 +00:00
|
|
|
ConnectableRouter(id, intId, conn),
|
2010-12-13 14:16:09 +00:00
|
|
|
m_username(uname), m_password(passwd)
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char * Account::getType() const
|
|
|
|
|
{
|
|
|
|
|
return "testaccount";
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-25 13:22:44 +00:00
|
|
|
// Simplified stub version to allow us to test Connection::disconnectObject
|
2013-01-17 10:17:07 +00:00
|
|
|
void Account::addCharacter(LocatedEntity * chr)
|
2012-11-25 13:22:44 +00:00
|
|
|
{
|
|
|
|
|
m_charactersDict[chr->getIntId()] = chr;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
void Account::store() const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-25 21:42:24 +02:00
|
|
|
bool Account::isPersisted() const {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
void Account::addToMessage(Atlas::Message::MapType &) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Account::addToEntity(const Atlas::Objects::Entity::RootEntity &) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-06 00:11:18 +00:00
|
|
|
void Account::createObject(const std::string & type_str,
|
|
|
|
|
const Root & arg,
|
|
|
|
|
const Operation & op,
|
|
|
|
|
OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
2010-03-23 00:06:54 +00:00
|
|
|
|
2014-01-24 11:06:20 +01:00
|
|
|
LocatedEntity * Account::createCharacterEntity(const std::string &,
|
|
|
|
|
const Atlas::Objects::Entity::RootEntity &,
|
|
|
|
|
const Atlas::Objects::Root &)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void Account::externalOperation(const Operation &, Link &)
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-13 23:33:23 +00:00
|
|
|
void Account::operation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
2010-03-23 00:06:54 +00:00
|
|
|
|
|
|
|
|
void Account::LogoutOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Account::CreateOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Account::SetOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Account::ImaginaryOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Account::TalkOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Account::LookOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Account::GetOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Account::OtherOperation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-13 00:09:05 +00:00
|
|
|
ConnectableRouter::ConnectableRouter(const std::string & id,
|
2010-12-13 14:16:09 +00:00
|
|
|
long iid,
|
|
|
|
|
Connection *c) :
|
|
|
|
|
Router(id, iid),
|
|
|
|
|
m_connection(c)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
ServerRouting::ServerRouting(BaseWorld & wrld,
|
|
|
|
|
const std::string & ruleset,
|
|
|
|
|
const std::string & name,
|
|
|
|
|
const std::string & id, long intId,
|
|
|
|
|
const std::string & lId, long lIntId) :
|
|
|
|
|
Router(id, intId),
|
|
|
|
|
m_svrRuleset(ruleset), m_svrName(name),
|
|
|
|
|
m_numClients(0), m_world(wrld), m_lobby(*(Lobby*)0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ServerRouting::~ServerRouting()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addToMessage(Atlas::Message::MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Account * ServerRouting::getAccountByName(const std::string & username)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::addAccount(Account * a)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void ServerRouting::externalOperation(const Operation & op, Link &)
|
2012-11-14 00:12:02 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ServerRouting::operation(const Operation &, OpVector &)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
Lobby::Lobby(ServerRouting & s, const std::string & id, long intId) :
|
|
|
|
|
Router(id, intId),
|
|
|
|
|
m_server(s)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Lobby::~Lobby()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Lobby::delAccount(Account * ac)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Lobby::addToMessage(MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Lobby::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Lobby::addAccount(Account * ac)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void Lobby::externalOperation(const Operation &, Link &)
|
2012-11-13 23:33:23 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
void Lobby::operation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-18 19:21:46 +00:00
|
|
|
ExternalMind::ExternalMind(LocatedEntity & e) : Router(e.getId(), e.getIntId()),
|
2018-02-08 21:46:49 +01:00
|
|
|
m_link(0), m_entity(e)
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 20:39:35 +00:00
|
|
|
void ExternalMind::externalOperation(const Operation &, Link &)
|
2012-11-13 23:33:23 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
void ExternalMind::operation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-24 16:51:49 +00:00
|
|
|
ExternalProperty::ExternalProperty(ExternalMind * & data) : m_data(data)
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-29 17:36:26 +01:00
|
|
|
int ExternalProperty::get(Atlas::Message::Element & val) const
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
2011-09-29 17:36:26 +01:00
|
|
|
return 0;
|
2010-03-23 00:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExternalProperty::set(const Atlas::Message::Element & val)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExternalProperty::add(const std::string & s,
|
|
|
|
|
Atlas::Message::MapType & map) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExternalProperty::add(const std::string & s,
|
|
|
|
|
const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-07 23:03:25 +00:00
|
|
|
ExternalProperty * ExternalProperty::copy() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
const std::string & ExternalMind::connectionId()
|
|
|
|
|
{
|
2018-02-08 21:46:49 +01:00
|
|
|
assert(m_link != 0);
|
|
|
|
|
return m_link->getId();
|
2010-03-23 00:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
2012-08-13 22:08:22 +01:00
|
|
|
void ExternalMind::linkUp(Link * c)
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
2018-02-08 21:46:49 +01:00
|
|
|
m_link = c;
|
2010-03-23 00:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
2014-09-29 19:24:05 +02:00
|
|
|
#include "stubs/rulesets/stubCharacter.h"
|
|
|
|
|
#include "stubs/rulesets/stubThing.h"
|
|
|
|
|
#include "stubs/rulesets/stubEntity.h"
|
|
|
|
|
#include "stubs/rulesets/stubLocatedEntity.h"
|
2016-12-19 22:01:23 +01:00
|
|
|
#include "stubs/common/stubLink.h"
|
2017-07-05 15:24:55 +02:00
|
|
|
#include "stubs/common/stubid.h"
|
2012-08-01 19:42:36 +01:00
|
|
|
|
2010-03-23 00:06:54 +00:00
|
|
|
Router::Router(const std::string & id, long intId) : m_id(id),
|
|
|
|
|
m_intId(intId)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Router::~Router()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::addToMessage(Atlas::Message::MapType & omap) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::addToEntity(const Atlas::Objects::Entity::RootEntity & ent) const
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::error(const Operation & op,
|
|
|
|
|
const std::string & errstring,
|
|
|
|
|
OpVector & res,
|
|
|
|
|
const std::string & to) const
|
|
|
|
|
{
|
2012-11-25 13:22:44 +00:00
|
|
|
Connectiontest::set_Router_error_called();
|
2010-03-23 00:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Router::clientError(const Operation & op,
|
|
|
|
|
const std::string & errstring,
|
|
|
|
|
OpVector & res,
|
|
|
|
|
const std::string & to) const
|
|
|
|
|
{
|
2012-11-25 13:22:44 +00:00
|
|
|
Connectiontest::set_Router_clientError_called();
|
2010-03-23 00:06:54 +00:00
|
|
|
}
|
2014-09-29 19:24:05 +02:00
|
|
|
#include "stubs/common/stubTypeNode.h"
|
|
|
|
|
#include "stubs/modules/stubLocation.h"
|
|
|
|
|
#include "stubs/common/stubProperty.h"
|
|
|
|
|
#include "stubs/common/stubBaseWorld.h"
|
2015-05-23 16:47:45 +02:00
|
|
|
#include "stubs/server/stubExternalMindsManager.h"
|
|
|
|
|
#include "stubs/server/stubExternalMindsConnection.h"
|
2010-03-23 00:06:54 +00:00
|
|
|
|
2018-04-25 20:09:14 +02:00
|
|
|
#define STUB_Inheritance_getClass
|
|
|
|
|
const Atlas::Objects::Root& Inheritance::getClass(const std::string & parent)
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
2018-04-25 20:09:14 +02:00
|
|
|
return noClass;
|
2010-03-23 00:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 20:09:14 +02:00
|
|
|
#define STUB_Inheritance_getType
|
|
|
|
|
const TypeNode* Inheritance::getType(const std::string & parent)
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
|
|
|
|
TypeNodeDict::const_iterator I = atlasObjects.find(parent);
|
|
|
|
|
if (I == atlasObjects.end()) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2018-04-25 20:09:14 +02:00
|
|
|
return I->second;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "stubs/common/stubInheritance.h"
|
2010-03-23 00:06:54 +00:00
|
|
|
|
|
|
|
|
|
2012-10-25 10:40:41 -04:00
|
|
|
void log(LogLevel lvl, const std::string & msg)
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
|
|
|
|
}
|
2012-10-25 10:40:41 -04:00
|
|
|
void hash_password(const std::string & pwd, const std::string & salt,
|
|
|
|
|
std::string & hash )
|
2010-03-23 00:06:54 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void logEvent(LogEvent lev, const std::string & msg)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static long idGenerator = 0;
|
|
|
|
|
|
|
|
|
|
long newId(std::string & id)
|
|
|
|
|
{
|
|
|
|
|
static char buf[32];
|
|
|
|
|
long new_id = ++idGenerator;
|
|
|
|
|
sprintf(buf, "%ld", new_id);
|
|
|
|
|
id = buf;
|
|
|
|
|
assert(!id.empty());
|
|
|
|
|
return new_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addToEntity(const Vector3D & v, std::vector<double> & vd)
|
|
|
|
|
{
|
|
|
|
|
vd.resize(3);
|
|
|
|
|
vd[0] = v[0];
|
|
|
|
|
vd[1] = v[1];
|
|
|
|
|
vd[2] = v[2];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int check_password(const std::string & pwd, const std::string & hash)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2012-10-25 10:40:41 -04:00
|
|
|
|
|
|
|
|
#include <common/Shaker.h>
|
|
|
|
|
|
|
|
|
|
Shaker::Shaker()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
std::string Shaker::generateSalt(size_t length)
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|