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
|
|
|
|
|
|
2020-01-20 23:17:55 +01: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"
|
2020-04-13 11:17:52 +02:00
|
|
|
#include "rules/simulation/WorldRouter.h"
|
2009-11-16 21:07:52 +00:00
|
|
|
|
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
|
|
|
|
2020-01-20 23:17:55 +01:00
|
|
|
#include "../TestWorld.h"
|
|
|
|
|
#include "../DatabaseNull.h"
|
2020-03-22 23:36:52 +01:00
|
|
|
#include "../TestPropertyManager.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
|
|
|
|
2019-09-09 20:45:16 +02:00
|
|
|
Atlas::Objects::Factories factories;
|
|
|
|
|
|
|
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
class TestCommSocket : public CommSocket
|
|
|
|
|
{
|
2020-08-11 15:21:34 +02:00
|
|
|
public:
|
|
|
|
|
TestCommSocket() : CommSocket(*(boost::asio::io_context*) 0)
|
|
|
|
|
{
|
|
|
|
|
}
|
2014-02-03 12:19:42 +01:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
virtual void disconnect()
|
|
|
|
|
{
|
|
|
|
|
}
|
2014-02-03 12:19:42 +01:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
virtual int flush()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2014-02-03 12:19:42 +01:00
|
|
|
|
2009-11-16 21:07:52 +00:00
|
|
|
};
|
|
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
class TestAccount : public Account
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TestAccount(Connection* conn, const std::string& username,
|
|
|
|
|
const std::string& passwd,
|
2022-07-04 15:37:51 +02:00
|
|
|
RouterId id) :
|
|
|
|
|
Account(conn, username, passwd, std::move(id))
|
2020-08-11 15:21:34 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual int characterError(const Operation& op,
|
|
|
|
|
const Atlas::Objects::Root& ent,
|
|
|
|
|
OpVector& res) const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2009-11-16 21:07:52 +00:00
|
|
|
};
|
|
|
|
|
|
2012-12-13 14:27:34 +00:00
|
|
|
class Accountintegration : public Cyphesis::TestBase
|
2009-11-16 21:07:52 +00:00
|
|
|
{
|
2020-08-11 15:21:34 +02:00
|
|
|
DatabaseNull m_database;
|
|
|
|
|
Persistence* m_persistence;
|
|
|
|
|
|
|
|
|
|
WorldRouter* m_world;
|
|
|
|
|
|
|
|
|
|
ServerRouting* m_server;
|
2018-05-19 23:18:40 +02:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
CommSocket* m_tc;
|
|
|
|
|
Connection* m_c;
|
|
|
|
|
TestAccount* m_ac;
|
2021-05-27 17:38:58 +02:00
|
|
|
EntityRuleHandler* m_entityRuleHandler;
|
2012-12-13 14:27:34 +00:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
public:
|
|
|
|
|
Accountintegration();
|
2012-12-13 14:27:34 +00:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
void setup();
|
2012-12-13 14:27:34 +00:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
void teardown();
|
2012-12-13 14:27:34 +00:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
void test_addNewCharacter();
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
void test_getType();
|
|
|
|
|
|
|
|
|
|
void test_addToMessage();
|
|
|
|
|
|
|
|
|
|
void test_addToEntity();
|
|
|
|
|
|
|
|
|
|
void test_CreateOperation();
|
|
|
|
|
|
|
|
|
|
void test_GetOperation();
|
|
|
|
|
|
|
|
|
|
void test_ImaginaryOperation();
|
|
|
|
|
|
|
|
|
|
void test_LookOperation();
|
|
|
|
|
|
|
|
|
|
void test_SetOperation();
|
|
|
|
|
|
|
|
|
|
void test_TalkOperation();
|
|
|
|
|
|
|
|
|
|
void test_LogoutOperation();
|
|
|
|
|
|
|
|
|
|
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;
|
2020-03-22 23:36:52 +01:00
|
|
|
PropertyManager* m_propertyManager;
|
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
|
|
|
}
|
|
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
Atlas::Objects::Root composeDeclaration(std::string class_name, std::string parent, Atlas::Message::MapType rawAttributes)
|
|
|
|
|
{
|
2018-04-29 11:58:35 +02:00
|
|
|
|
|
|
|
|
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{
|
2020-08-11 15:21:34 +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()
|
|
|
|
|
{
|
2022-07-04 15:37:51 +02:00
|
|
|
m_rootEntity = new Entity(0);
|
2018-05-19 23:18:40 +02:00
|
|
|
m_persistence = new Persistence(m_database);
|
2019-09-10 22:42:28 +02:00
|
|
|
m_inheritance = new Inheritance(factories);
|
2018-08-04 01:12:45 +02:00
|
|
|
m_eb = new EntityBuilder();
|
2020-03-22 23:36:52 +01:00
|
|
|
m_propertyManager = new TestPropertyManager();
|
2021-05-27 17:38:58 +02:00
|
|
|
m_entityRuleHandler = new EntityRuleHandler(*m_eb, *m_propertyManager);
|
2018-01-19 21:35:48 +01:00
|
|
|
|
2020-08-11 15:21:34 +02:00
|
|
|
m_world = new WorldRouter(m_rootEntity, *m_eb, []() { return std::chrono::milliseconds(0); });
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2021-08-01 23:17:40 +02:00
|
|
|
m_server = new ServerRouting(*m_world, *m_persistence, "noruleset", "unittesting",
|
2023-10-19 23:04:04 +02:00
|
|
|
2, AssetsHandler({}));
|
2009-11-16 21:07:52 +00:00
|
|
|
|
2014-02-03 12:19:42 +01:00
|
|
|
m_tc = new TestCommSocket();
|
2022-07-04 15:37:51 +02:00
|
|
|
m_c = new Connection(*m_tc, *m_server, "addr", 3);
|
|
|
|
|
m_ac = new TestAccount(m_c, "user", "password", 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;
|
2021-05-27 17:38:58 +02:00
|
|
|
m_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()
|
|
|
|
|
{
|
2021-05-27 17:38:58 +02:00
|
|
|
delete m_entityRuleHandler;
|
|
|
|
|
delete m_c;
|
2018-08-04 01:12:45 +02:00
|
|
|
delete m_server;
|
2012-12-13 14:27:34 +00:00
|
|
|
delete m_ac;
|
2021-05-27 17:38:58 +02:00
|
|
|
delete m_tc;
|
|
|
|
|
m_world->shutdown();
|
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;
|
2020-03-22 23:36:52 +01:00
|
|
|
delete m_propertyManager;
|
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
|
|
|
{
|
2020-06-22 22:36:30 +02:00
|
|
|
// WorldRouter::instance().createSpawnPoint(Atlas::Message::MapType{
|
|
|
|
|
// {"name", "foo"},
|
|
|
|
|
// {"entities", Atlas::Message::MapType{{"thing", Atlas::Message::MapType{}}}}
|
|
|
|
|
// }, m_rootEntity.get());
|
|
|
|
|
//
|
|
|
|
|
// OpVector res;
|
|
|
|
|
// Anonymous new_char;
|
|
|
|
|
// RootEntity args;
|
|
|
|
|
// args->setAttr("spawn_name", "foo");
|
|
|
|
|
// args->setParent("thing");
|
|
|
|
|
// auto chr = m_ac->addNewCharacter(new_char, args, res);
|
|
|
|
|
// assert(chr);
|
|
|
|
|
//
|
|
|
|
|
// std::cout << "Test 1" << std::endl << std::flush;
|
2012-12-14 09:04:06 +00:00
|
|
|
}
|
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
|
|
|
{
|
2020-06-22 22:36:30 +02:00
|
|
|
// WorldRouter::instance().createSpawnPoint(Atlas::Message::MapType{
|
|
|
|
|
// {"name", "foo"},
|
|
|
|
|
// {"entities", Atlas::Message::MapType{{"thing", Atlas::Message::MapType{}}}}
|
|
|
|
|
// }, m_rootEntity.get());
|
|
|
|
|
//
|
|
|
|
|
// OpVector res;
|
|
|
|
|
// Anonymous new_char;
|
|
|
|
|
// RootEntity args;
|
|
|
|
|
// args->setAttr("spawn_name", "foo");
|
|
|
|
|
// args->setParent("thing");
|
|
|
|
|
// auto chr = m_ac->addNewCharacter(new_char, args, res);
|
|
|
|
|
//
|
|
|
|
|
// Anonymous op_arg;
|
|
|
|
|
// op_arg->setId("1");
|
|
|
|
|
// op_arg->setId(chr->getId());
|
|
|
|
|
//
|
|
|
|
|
// Look op;
|
|
|
|
|
// op->setArgs1(op_arg);
|
|
|
|
|
//
|
|
|
|
|
// m_ac->operation(op, res);
|
|
|
|
|
//
|
|
|
|
|
// // 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
|
|
|
{
|
2020-06-22 22:36:30 +02:00
|
|
|
// WorldRouter::instance().createSpawnPoint(Atlas::Message::MapType{
|
|
|
|
|
// {"name", "foo"},
|
|
|
|
|
// {"entities", Atlas::Message::MapType{{"thing", Atlas::Message::MapType{}}}}
|
|
|
|
|
// }, m_rootEntity.get());
|
|
|
|
|
//
|
|
|
|
|
// OpVector res;
|
|
|
|
|
// Anonymous new_char;
|
|
|
|
|
// RootEntity args;
|
|
|
|
|
// args->setAttr("spawn_name", "foo");
|
|
|
|
|
// args->setParent("thing");
|
|
|
|
|
// auto chr = m_ac->addNewCharacter(new_char, args, res);
|
|
|
|
|
//
|
|
|
|
|
// BBox newBox(WFMath::Point<3>(-0.5, 0.0, -0.5),
|
|
|
|
|
// WFMath::Point<3>(-0.5, 2.0, -0.5));
|
|
|
|
|
// chr->m_location.setBBox(newBox);
|
|
|
|
|
//
|
|
|
|
|
// Anonymous op_arg;
|
|
|
|
|
//
|
|
|
|
|
// op_arg->setId(chr->getId());
|
|
|
|
|
// op_arg->setAttr("guise", "foo");
|
|
|
|
|
// op_arg->setAttr("height", 3.0);
|
|
|
|
|
// op_arg->setAttr("tasks", ListType());
|
|
|
|
|
//
|
|
|
|
|
// Set op;
|
|
|
|
|
// op->setArgs1(op_arg);
|
|
|
|
|
//
|
|
|
|
|
// m_ac->operation(op, res);
|
|
|
|
|
//
|
|
|
|
|
// // 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;
|
2022-07-04 15:37:51 +02:00
|
|
|
Ref<Entity> e = new Entity(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
|
|
|
{
|
2022-07-04 15:37:51 +02:00
|
|
|
Ref<Entity> e = new Entity(8);
|
2018-10-27 13:13:45 +02:00
|
|
|
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;
|
2021-07-10 18:48:18 +02:00
|
|
|
ExternalMindsManager externalMindsManager(possesionAuthenticator);
|
2018-10-27 13:13:45 +02:00
|
|
|
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/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/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/LineProperty.h"
|
2020-03-25 23:50:00 +01:00
|
|
|
#include "server/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/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/DomainProperty.h"
|
2020-01-20 23:17:55 +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"
|
2023-10-19 23:04:04 +02:00
|
|
|
#include "../stubs/common/stubAssetsHandler.h"
|
2018-01-19 21:35:48 +01:00
|
|
|
|