2009-11-16 21:07:52 +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-12-13 14:27:34 +00:00
|
|
|
#include "TestBase.h"
|
2012-08-01 19:42:36 +01:00
|
|
|
|
2009-11-16 21:07:52 +00:00
|
|
|
#include "server/Account.h"
|
2012-12-14 09:04:06 +00:00
|
|
|
#include "server/EntityBuilder.h"
|
2018-01-19 21:35:48 +01:00
|
|
|
#include "server/EntityRuleHandler.h"
|
2012-12-14 09:04:06 +00:00
|
|
|
#include "server/Ruleset.h"
|
2009-11-16 21:07:52 +00:00
|
|
|
#include "server/ServerRouting.h"
|
|
|
|
|
#include "server/Connection.h"
|
|
|
|
|
#include "server/WorldRouter.h"
|
|
|
|
|
|
2018-10-31 21:38:35 +01:00
|
|
|
#include "rules/Domain.h"
|
|
|
|
|
#include "rules/simulation/Entity.h"
|
2018-11-03 16:43:33 +01:00
|
|
|
#include "rules/simulation/ExternalMind.h"
|
|
|
|
|
#include "rules/simulation/MindsProperty.h"
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-14 09:04:06 +00:00
|
|
|
#include "common/CommSocket.h"
|
|
|
|
|
#include "common/Inheritance.h"
|
2011-10-31 12:47:56 +01:00
|
|
|
#include "common/SystemTime.h"
|
|
|
|
|
|
2009-11-16 21:07:52 +00:00
|
|
|
#include "TestWorld.h"
|
2018-05-19 23:18:40 +02:00
|
|
|
#include "DatabaseNull.h"
|
2009-11-16 21:07:52 +00:00
|
|
|
|
|
|
|
|
#include <Atlas/Objects/SmartPtr.h>
|
|
|
|
|
#include <Atlas/Objects/Anonymous.h>
|
2009-11-17 01:37:14 +00:00
|
|
|
#include <Atlas/Objects/Operation.h>
|
2009-11-16 21:07:52 +00:00
|
|
|
|
|
|
|
|
#include <cassert>
|
2018-05-19 23:18:40 +02:00
|
|
|
#include <server/Persistence.h>
|
2018-10-27 13:13:45 +02:00
|
|
|
#include <common/Monitors.h>
|
|
|
|
|
#include <server/ExternalMindsManager.h>
|
|
|
|
|
#include <server/PossessionAuthenticator.h>
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-17 09:32:28 +00:00
|
|
|
using Atlas::Message::Element;
|
2009-11-17 12:37:40 +00:00
|
|
|
using Atlas::Message::ListType;
|
2009-11-17 01:37:14 +00:00
|
|
|
using Atlas::Message::MapType;
|
2009-11-17 12:37:40 +00:00
|
|
|
using Atlas::Objects::Root;
|
2009-11-17 01:37:14 +00:00
|
|
|
using Atlas::Objects::Entity::RootEntity;
|
2009-11-16 21:07:52 +00:00
|
|
|
using Atlas::Objects::Entity::Anonymous;
|
2009-11-17 01:37:14 +00:00
|
|
|
using Atlas::Objects::Operation::Create;
|
|
|
|
|
using Atlas::Objects::Operation::Get;
|
|
|
|
|
using Atlas::Objects::Operation::Imaginary;
|
|
|
|
|
using Atlas::Objects::Operation::Logout;
|
|
|
|
|
using Atlas::Objects::Operation::Look;
|
|
|
|
|
using Atlas::Objects::Operation::Set;
|
|
|
|
|
using Atlas::Objects::Operation::Talk;
|
2009-11-17 02:10:08 +00:00
|
|
|
using Atlas::Objects::Operation::Move;
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
class TestCommSocket : public CommSocket
|
|
|
|
|
{
|
2009-11-16 21:07:52 +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-16 21:07:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TestAccount : public Account {
|
|
|
|
|
public:
|
|
|
|
|
TestAccount(Connection * conn, const std::string & username,
|
|
|
|
|
const std::string & passwd,
|
|
|
|
|
const std::string & id, long intId) :
|
|
|
|
|
Account(conn, username, passwd, id, intId) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual int characterError(const Operation & op,
|
2010-12-03 22:01:22 +00:00
|
|
|
const Atlas::Objects::Root & ent,
|
2009-11-16 21:07:52 +00:00
|
|
|
OpVector & res) const {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2012-12-13 14:27:34 +00:00
|
|
|
class Accountintegration : public Cyphesis::TestBase
|
2009-11-16 21:07:52 +00:00
|
|
|
{
|
2018-05-19 23:18:40 +02:00
|
|
|
DatabaseNull m_database;
|
|
|
|
|
Persistence* m_persistence;
|
|
|
|
|
|
2012-12-13 14:27:34 +00:00
|
|
|
SystemTime * m_time;
|
|
|
|
|
WorldRouter * m_world;
|
|
|
|
|
|
|
|
|
|
ServerRouting * m_server;
|
|
|
|
|
|
2012-12-14 09:04:06 +00:00
|
|
|
CommSocket * m_tc;
|
2012-12-13 14:27:34 +00:00
|
|
|
Connection * m_c;
|
|
|
|
|
TestAccount * m_ac;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Accountintegration();
|
|
|
|
|
|
|
|
|
|
void setup();
|
|
|
|
|
void teardown();
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-14 20:28:43 +00:00
|
|
|
void test_addNewCharacter();
|
|
|
|
|
void test_getType();
|
|
|
|
|
void test_addToMessage();
|
|
|
|
|
void test_addToEntity();
|
2012-12-14 20:27:16 +00:00
|
|
|
void test_CreateOperation();
|
2012-12-14 20:25:52 +00:00
|
|
|
void test_GetOperation();
|
2012-12-14 20:24:39 +00:00
|
|
|
void test_ImaginaryOperation();
|
2012-12-14 20:22:20 +00:00
|
|
|
void test_LookOperation();
|
2012-12-14 20:14:28 +00:00
|
|
|
void test_SetOperation();
|
2012-12-14 19:56:12 +00:00
|
|
|
void test_TalkOperation();
|
2012-12-14 19:49:30 +00:00
|
|
|
void test_LogoutOperation();
|
2012-12-14 12:39:53 +00:00
|
|
|
void test_connectCharacter_entity();
|
|
|
|
|
void test_connectCharacter_character();
|
2018-04-25 20:09:14 +02:00
|
|
|
|
|
|
|
|
Inheritance* m_inheritance;
|
2018-10-27 13:13:45 +02:00
|
|
|
Ref<Entity> m_rootEntity;
|
2018-08-04 01:12:45 +02:00
|
|
|
EntityBuilder* m_eb;
|
2012-12-13 14:27:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Accountintegration::Accountintegration()
|
|
|
|
|
{
|
2012-12-14 20:28:43 +00:00
|
|
|
ADD_TEST(Accountintegration::test_addNewCharacter);
|
|
|
|
|
ADD_TEST(Accountintegration::test_getType);
|
|
|
|
|
ADD_TEST(Accountintegration::test_addToMessage);
|
|
|
|
|
ADD_TEST(Accountintegration::test_addToEntity);
|
2012-12-14 20:27:16 +00:00
|
|
|
ADD_TEST(Accountintegration::test_CreateOperation);
|
2012-12-14 20:25:52 +00:00
|
|
|
ADD_TEST(Accountintegration::test_GetOperation);
|
2012-12-14 20:24:39 +00:00
|
|
|
ADD_TEST(Accountintegration::test_ImaginaryOperation);
|
2012-12-14 20:22:20 +00:00
|
|
|
ADD_TEST(Accountintegration::test_LookOperation);
|
2012-12-14 20:14:28 +00:00
|
|
|
ADD_TEST(Accountintegration::test_SetOperation);
|
2012-12-14 19:56:12 +00:00
|
|
|
ADD_TEST(Accountintegration::test_TalkOperation);
|
2012-12-14 19:49:30 +00:00
|
|
|
ADD_TEST(Accountintegration::test_LogoutOperation);
|
2012-12-14 12:39:53 +00:00
|
|
|
ADD_TEST(Accountintegration::test_connectCharacter_entity);
|
|
|
|
|
ADD_TEST(Accountintegration::test_connectCharacter_character);
|
2012-12-13 14:27:34 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-29 11:58:35 +02:00
|
|
|
Atlas::Objects::Root composeDeclaration(std::string class_name, std::string parent, Atlas::Message::MapType rawAttributes) {
|
|
|
|
|
|
|
|
|
|
Atlas::Objects::Root decl;
|
|
|
|
|
decl->setObjtype("class");
|
|
|
|
|
decl->setId(class_name);
|
|
|
|
|
decl->setParent(parent);
|
|
|
|
|
|
|
|
|
|
Atlas::Message::MapType composed;
|
|
|
|
|
for (const auto& entry : rawAttributes) {
|
|
|
|
|
composed[entry.first] = Atlas::Message::MapType{
|
2018-07-30 13:24:52 +02:00
|
|
|
{"default", entry.second}
|
2018-04-29 11:58:35 +02:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
decl->setAttr("attributes", composed);
|
|
|
|
|
return decl;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2012-12-13 14:27:34 +00:00
|
|
|
void Accountintegration::setup()
|
|
|
|
|
{
|
2018-07-24 21:18:50 +02:00
|
|
|
m_rootEntity = new Entity("", 0);
|
2018-05-19 23:18:40 +02:00
|
|
|
m_persistence = new Persistence(m_database);
|
2018-04-25 20:09:14 +02:00
|
|
|
m_inheritance = new Inheritance();
|
2012-12-13 14:27:34 +00:00
|
|
|
m_time = new SystemTime;
|
2018-08-04 01:12:45 +02:00
|
|
|
m_eb = new EntityBuilder();
|
|
|
|
|
auto entityRuleHandler = new EntityRuleHandler(m_eb);
|
2018-01-19 21:35:48 +01:00
|
|
|
|
2018-07-24 21:18:50 +02:00
|
|
|
m_world = new WorldRouter(*m_time, m_rootEntity);
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-13 14:27:34 +00:00
|
|
|
m_server = new ServerRouting(*m_world, "noruleset", "unittesting",
|
2009-11-16 21:07:52 +00:00
|
|
|
"1", 1, "2", 2);
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
m_tc = new TestCommSocket();
|
2012-12-13 14:27:34 +00:00
|
|
|
m_c = new Connection(*m_tc, *m_server, "addr", "3", 3);
|
|
|
|
|
m_ac = new TestAccount(m_c, "user", "password", "4", 4);
|
2018-04-29 11:58:35 +02:00
|
|
|
|
|
|
|
|
std::string dependent, reason;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
auto decl = composeDeclaration("thing", "game_entity", {});
|
2018-05-10 00:21:30 +02:00
|
|
|
std::map<const TypeNode*, TypeNode::PropertiesUpdate> changes;
|
|
|
|
|
entityRuleHandler->install(decl->getId(), decl->getParent(), decl, dependent, reason, changes);
|
2018-04-29 11:58:35 +02:00
|
|
|
}
|
2012-12-13 14:27:34 +00:00
|
|
|
}
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-13 14:27:34 +00:00
|
|
|
void Accountintegration::teardown()
|
|
|
|
|
{
|
2018-08-04 01:12:45 +02:00
|
|
|
delete m_server;
|
2012-12-13 14:27:34 +00:00
|
|
|
delete m_ac;
|
2012-12-14 09:04:06 +00:00
|
|
|
delete m_world;
|
2018-10-27 13:13:45 +02:00
|
|
|
m_rootEntity = nullptr;
|
2018-08-04 01:12:45 +02:00
|
|
|
delete m_eb;
|
2018-04-25 20:09:14 +02:00
|
|
|
delete m_inheritance;
|
2018-05-19 23:18:40 +02:00
|
|
|
delete m_persistence;
|
2012-12-13 14:27:34 +00:00
|
|
|
}
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-14 20:28:43 +00:00
|
|
|
void Accountintegration::test_addNewCharacter()
|
2012-12-13 14:27:34 +00:00
|
|
|
{
|
2018-10-27 13:13:45 +02:00
|
|
|
WorldRouter::instance().createSpawnPoint(Atlas::Message::MapType{
|
|
|
|
|
{"name", "foo"},
|
|
|
|
|
{"entities", Atlas::Message::MapType{{"thing", Atlas::Message::MapType{}}}}
|
|
|
|
|
}, m_rootEntity.get());
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
2012-12-14 09:04:06 +00:00
|
|
|
Anonymous new_char;
|
2018-10-27 13:13:45 +02:00
|
|
|
RootEntity args;
|
|
|
|
|
args->setAttr("spawn_name", "foo");
|
|
|
|
|
args->setParent("thing");
|
|
|
|
|
auto chr = m_ac->addNewCharacter(new_char, args, res);
|
2018-08-05 20:47:09 +02:00
|
|
|
assert(chr);
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-14 09:04:06 +00:00
|
|
|
std::cout << "Test 1" << std::endl << std::flush;
|
|
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 20:28:43 +00:00
|
|
|
void Accountintegration::test_getType()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
|
|
|
|
m_ac->getType();
|
|
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 20:28:43 +00:00
|
|
|
void Accountintegration::test_addToMessage()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
|
|
|
|
MapType emap;
|
|
|
|
|
m_ac->addToMessage(emap);
|
|
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 20:28:43 +00:00
|
|
|
void Accountintegration::test_addToEntity()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
|
|
|
|
RootEntity ent;
|
|
|
|
|
m_ac->addToEntity(ent);
|
|
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 20:27:16 +00:00
|
|
|
void Accountintegration::test_CreateOperation()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
|
|
|
|
Anonymous op_arg;
|
2017-07-24 13:39:22 +02:00
|
|
|
op_arg->setParent("game_entity");
|
2012-12-14 09:04:06 +00:00
|
|
|
op_arg->setName("Bob");
|
2012-12-14 20:27:16 +00:00
|
|
|
|
|
|
|
|
Create op;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
2012-12-14 09:04:06 +00:00
|
|
|
m_ac->operation(op, res);
|
|
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 20:25:52 +00:00
|
|
|
void Accountintegration::test_GetOperation()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
|
|
|
|
Anonymous op_arg;
|
2017-07-24 13:39:22 +02:00
|
|
|
op_arg->setParent("");
|
2012-12-14 20:25:52 +00:00
|
|
|
|
|
|
|
|
Get op;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
2012-12-14 09:04:06 +00:00
|
|
|
m_ac->operation(op, res);
|
|
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 20:24:39 +00:00
|
|
|
void Accountintegration::test_ImaginaryOperation()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op_arg->setLoc("2");
|
2012-12-14 20:24:39 +00:00
|
|
|
|
|
|
|
|
Imaginary op;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
op->setSerialno(1);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
2012-12-14 09:04:06 +00:00
|
|
|
m_ac->operation(op, res);
|
2012-12-14 20:24:39 +00:00
|
|
|
|
|
|
|
|
// FIXME Test response is sent to Lobby
|
2012-12-14 09:04:06 +00:00
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 20:22:20 +00:00
|
|
|
void Accountintegration::test_LookOperation()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
2018-10-27 13:13:45 +02:00
|
|
|
WorldRouter::instance().createSpawnPoint(Atlas::Message::MapType{
|
|
|
|
|
{"name", "foo"},
|
|
|
|
|
{"entities", Atlas::Message::MapType{{"thing", Atlas::Message::MapType{}}}}
|
|
|
|
|
}, m_rootEntity.get());
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
2012-12-14 09:04:06 +00:00
|
|
|
Anonymous new_char;
|
2018-10-27 13:13:45 +02:00
|
|
|
RootEntity args;
|
|
|
|
|
args->setAttr("spawn_name", "foo");
|
|
|
|
|
args->setParent("thing");
|
|
|
|
|
auto chr = m_ac->addNewCharacter(new_char, args, res);
|
2012-12-14 09:04:06 +00:00
|
|
|
|
|
|
|
|
Anonymous op_arg;
|
|
|
|
|
op_arg->setId("1");
|
|
|
|
|
op_arg->setId(chr->getId());
|
2012-12-14 20:22:20 +00:00
|
|
|
|
|
|
|
|
Look op;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
|
2012-12-14 09:04:06 +00:00
|
|
|
m_ac->operation(op, res);
|
2012-12-14 20:22:20 +00:00
|
|
|
|
|
|
|
|
// FIXME This doesn't test a lot
|
2012-12-14 09:04:06 +00:00
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 20:14:28 +00:00
|
|
|
void Accountintegration::test_SetOperation()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
2018-10-27 13:13:45 +02:00
|
|
|
WorldRouter::instance().createSpawnPoint(Atlas::Message::MapType{
|
|
|
|
|
{"name", "foo"},
|
|
|
|
|
{"entities", Atlas::Message::MapType{{"thing", Atlas::Message::MapType{}}}}
|
|
|
|
|
}, m_rootEntity.get());
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
2012-12-14 09:04:06 +00:00
|
|
|
Anonymous new_char;
|
2018-10-27 13:13:45 +02:00
|
|
|
RootEntity args;
|
|
|
|
|
args->setAttr("spawn_name", "foo");
|
|
|
|
|
args->setParent("thing");
|
|
|
|
|
auto chr = m_ac->addNewCharacter(new_char, args, res);
|
|
|
|
|
|
2018-01-10 15:11:20 +01:00
|
|
|
BBox newBox(WFMath::Point<3>(-0.5, 0.0, -0.5),
|
|
|
|
|
WFMath::Point<3>(-0.5, 2.0, -0.5));
|
2012-12-14 20:14:28 +00:00
|
|
|
chr->m_location.setBBox(newBox);
|
2012-12-14 09:04:06 +00:00
|
|
|
|
|
|
|
|
Anonymous op_arg;
|
2012-12-14 20:14:28 +00:00
|
|
|
|
2012-12-14 09:04:06 +00:00
|
|
|
op_arg->setId(chr->getId());
|
|
|
|
|
op_arg->setAttr("guise", "foo");
|
|
|
|
|
op_arg->setAttr("height", 3.0);
|
|
|
|
|
op_arg->setAttr("tasks", ListType());
|
2012-12-14 20:14:28 +00:00
|
|
|
|
|
|
|
|
Set op;
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
|
2012-12-14 09:04:06 +00:00
|
|
|
m_ac->operation(op, res);
|
2012-12-14 20:14:28 +00:00
|
|
|
|
|
|
|
|
// FIXME Ensure character has been modified
|
2012-12-14 09:04:06 +00:00
|
|
|
}
|
2009-11-17 01:37:14 +00:00
|
|
|
|
2012-12-14 19:56:12 +00:00
|
|
|
void Accountintegration::test_TalkOperation()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
|
|
|
|
Anonymous op_arg;
|
2017-07-24 13:39:22 +02:00
|
|
|
op_arg->setParent("");
|
2012-12-14 09:04:06 +00:00
|
|
|
op_arg->setLoc("1");
|
2012-12-14 19:56:12 +00:00
|
|
|
|
|
|
|
|
Talk op;
|
|
|
|
|
op->setSerialno(1);
|
|
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
2012-12-14 09:04:06 +00:00
|
|
|
m_ac->operation(op, res);
|
2012-12-14 19:56:12 +00:00
|
|
|
|
|
|
|
|
// FIXME Sound op should have been sent to the lobby
|
2012-12-14 09:04:06 +00:00
|
|
|
}
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-14 19:49:30 +00:00
|
|
|
void Accountintegration::test_LogoutOperation()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
|
|
|
|
Logout op;
|
|
|
|
|
op->setSerialno(1);
|
2012-12-14 19:49:30 +00:00
|
|
|
|
2012-12-14 09:04:06 +00:00
|
|
|
Anonymous op_arg;
|
2017-07-24 13:39:22 +02:00
|
|
|
op_arg->setParent("");
|
2012-12-14 19:49:30 +00:00
|
|
|
op->setArgs1(op_arg);
|
|
|
|
|
|
|
|
|
|
OpVector res;
|
2012-12-14 09:04:06 +00:00
|
|
|
m_ac->operation(op, res);
|
2012-12-14 19:49:30 +00:00
|
|
|
|
|
|
|
|
// FIXME Account should have been removed from Lobby, and also from
|
|
|
|
|
// Connection
|
2012-12-14 09:04:06 +00:00
|
|
|
}
|
2009-11-17 02:10:08 +00:00
|
|
|
|
2012-12-14 12:39:53 +00:00
|
|
|
void Accountintegration::test_connectCharacter_entity()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
2018-10-27 13:13:45 +02:00
|
|
|
OpVector res;
|
2018-08-05 14:31:04 +02:00
|
|
|
Ref<Entity> e = new Entity("7", 7);
|
2010-11-26 22:22:36 +00:00
|
|
|
|
2018-10-27 13:13:45 +02:00
|
|
|
int ret = m_ac->connectCharacter(e.get(), res);
|
|
|
|
|
ASSERT_EQUAL(ret, 0);
|
2012-12-14 09:04:06 +00:00
|
|
|
}
|
2010-11-26 22:22:36 +00:00
|
|
|
|
2012-12-14 12:39:53 +00:00
|
|
|
void Accountintegration::test_connectCharacter_character()
|
2012-12-14 09:04:06 +00:00
|
|
|
{
|
2018-10-27 13:13:45 +02:00
|
|
|
Ref<Entity> e = new Entity("8", 8);
|
|
|
|
|
OpVector res;
|
|
|
|
|
int ret = m_ac->connectCharacter(e.get(), res);
|
2012-12-14 12:39:53 +00:00
|
|
|
ASSERT_EQUAL(ret, 0);
|
2018-10-27 13:13:45 +02:00
|
|
|
ASSERT_NOT_NULL(e->getPropertyClassFixed<MindsProperty>());
|
|
|
|
|
ASSERT_FALSE(e->getPropertyClassFixed<MindsProperty>()->getMinds().empty());
|
2012-12-13 14:27:34 +00:00
|
|
|
}
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2012-12-13 14:27:34 +00:00
|
|
|
int main()
|
|
|
|
|
{
|
2018-10-27 13:13:45 +02:00
|
|
|
PossessionAuthenticator possesionAuthenticator;
|
|
|
|
|
ExternalMindsManager externalMindsManager;
|
|
|
|
|
Monitors m;
|
2012-12-13 14:27:34 +00:00
|
|
|
Accountintegration t;
|
|
|
|
|
|
|
|
|
|
return t.run();
|
2009-11-16 21:07:52 +00:00
|
|
|
}
|
2012-09-06 13:48:40 +01:00
|
|
|
|
2012-09-11 22:53:15 +01:00
|
|
|
|
2012-12-17 09:32:28 +00:00
|
|
|
|
|
|
|
|
// stubs
|
|
|
|
|
|
|
|
|
|
#include "server/ArithmeticBuilder.h"
|
|
|
|
|
#include "server/EntityFactory.h"
|
2013-10-23 22:36:55 +02:00
|
|
|
#include "server/ArchetypeFactory.h"
|
2012-12-17 09:32:28 +00:00
|
|
|
#include "server/Juncture.h"
|
|
|
|
|
#include "server/Persistence.h"
|
|
|
|
|
#include "server/Player.h"
|
|
|
|
|
#include "server/Ruleset.h"
|
2013-01-10 09:33:25 +00:00
|
|
|
#include "server/TeleportProperty.h"
|
2012-12-17 09:32:28 +00:00
|
|
|
|
2018-11-03 16:43:33 +01:00
|
|
|
#include "rules/simulation/AreaProperty.h"
|
2018-10-31 21:38:35 +01:00
|
|
|
#include "rules/AtlasProperties.h"
|
2018-12-16 20:33:13 +01:00
|
|
|
#include "rules/BBoxProperty.h"
|
2018-11-03 16:43:33 +01:00
|
|
|
#include "rules/simulation/BiomassProperty.h"
|
|
|
|
|
#include "rules/simulation/BurnSpeedProperty.h"
|
|
|
|
|
#include "rules/simulation/DecaysProperty.h"
|
|
|
|
|
#include "rules/simulation/CalendarProperty.h"
|
2018-10-31 21:38:35 +01:00
|
|
|
#include "rules/simulation/EntityProperty.h"
|
2018-11-03 16:43:33 +01:00
|
|
|
#include "rules/simulation/ExternalProperty.h"
|
|
|
|
|
#include "rules/simulation/InternalProperties.h"
|
|
|
|
|
#include "rules/simulation/LineProperty.h"
|
|
|
|
|
#include "rules/simulation/MindProperty.h"
|
2018-10-31 21:38:35 +01:00
|
|
|
#include "rules/SolidProperty.h"
|
2018-11-03 16:43:33 +01:00
|
|
|
#include "rules/simulation/SpawnProperty.h"
|
|
|
|
|
#include "rules/simulation/StatusProperty.h"
|
|
|
|
|
#include "rules/simulation/StatisticsProperty.h"
|
|
|
|
|
#include "rules/simulation/TasksProperty.h"
|
|
|
|
|
#include "rules/simulation/TerrainModProperty.h"
|
|
|
|
|
#include "rules/simulation/TerrainProperty.h"
|
|
|
|
|
#include "rules/simulation/TransientProperty.h"
|
|
|
|
|
#include "rules/simulation/VisibilityProperty.h"
|
|
|
|
|
#include "rules/simulation/SuspendedProperty.h"
|
|
|
|
|
#include "rules/simulation/SpawnerProperty.h"
|
|
|
|
|
#include "rules/simulation/ImmortalProperty.h"
|
|
|
|
|
#include "rules/simulation/RespawningProperty.h"
|
|
|
|
|
#include "rules/simulation/DefaultLocationProperty.h"
|
|
|
|
|
#include "rules/simulation/DomainProperty.h"
|
|
|
|
|
#include "rules/simulation/LimboProperty.h"
|
|
|
|
|
#include "rules/simulation/Stackable.h"
|
2018-12-16 20:33:13 +01:00
|
|
|
#include "stubs/rules/stubScaleProperty.h"
|
2012-12-17 09:32:28 +00:00
|
|
|
|
|
|
|
|
#include "common/const.h"
|
|
|
|
|
#include "common/globals.h"
|
|
|
|
|
#include "common/log.h"
|
|
|
|
|
#include "common/Monitors.h"
|
|
|
|
|
#include "common/PropertyFactory.h"
|
|
|
|
|
#include "common/system.h"
|
|
|
|
|
#include "common/TypeNode.h"
|
|
|
|
|
#include "common/Variable.h"
|
|
|
|
|
|
2018-01-19 21:35:48 +01:00
|
|
|
|
2018-11-03 16:43:33 +01:00
|
|
|
#include "rules/python/PythonScriptFactory.h"
|
2018-01-19 21:35:48 +01:00
|
|
|
|