Instructions Jenkins Doxygen

[added] commands lua parsing test 72/972/1
authorVictor Popovici <theanswer@swgemu.com>
Sun, 20 Oct 2013 21:09:22 +0000 (23:09 +0200)
committerVictor Popovici <theanswer@swgemu.com>
Sun, 20 Oct 2013 21:09:22 +0000 (23:09 +0200)
Change-Id: Ia527935a7e0a84236662d5db32986136a8cb895d

MMOCoreORB/src/Makefile.am
MMOCoreORB/src/server/zone/managers/objectcontroller/command/CommandConfigManager.cpp
MMOCoreORB/src/server/zone/managers/objectcontroller/command/CommandConfigManager.h
MMOCoreORB/src/server/zone/managers/objectcontroller/command/tests/CommandLuaTest.cpp [new file with mode: 0644]

index 854b46a..d29d027 100644 (file)
@@ -93,7 +93,8 @@ core3_TESTS =         server/zone/objects/area/areashapes/tests/CircularAreaShapeTest.c
                                server/zone/objects/area/areashapes/tests/RingAreaShapeTest.cpp \
                                server/zone/tests/DeadlockTestBase.cpp \
                                server/zone/objects/terrain/tests/BasicTerrainTest.cpp \
-                               server/zone/tests/ZoneTest.cpp
+                               server/zone/tests/ZoneTest.cpp \
+                               server/zone/managers/objectcontroller/command/tests/CommandLuaTest.cpp
 
 core3_IDLS =   autogen/server/zone/objects/intangible/PetControlObserver.cpp \
                                autogen/server/zone/objects/intangible/PetControlDevice.cpp \
index e502beb..f75d717 100644 (file)
@@ -58,6 +58,7 @@ which carries forward this exception.
 
 CommandList* CommandConfigManager::slashCommands = NULL;
 ZoneProcessServer* CommandConfigManager::server = NULL;
+int CommandConfigManager::ERROR_CODE = 0;
 
 CommandConfigManager::CommandConfigManager(ZoneProcessServer* serv) {
        server = serv;
@@ -72,6 +73,17 @@ CommandConfigManager::CommandConfigManager(ZoneProcessServer* serv) {
        registerCommands();
 }
 
+CommandConfigManager::~CommandConfigManager() {
+       server = NULL;
+
+       if (slashCommands != NULL)
+               delete slashCommands;
+
+       slashCommands = NULL;
+
+       ERROR_CODE = 0;
+}
+
 void CommandConfigManager::loadCommandData(const String& filename) {
        int num = 0;
 
@@ -454,7 +466,10 @@ int CommandConfigManager::runSlashCommandsFile(lua_State* L) {
 
        filename = getStringParameter(L);
 
-       runFile("scripts/commands/" + filename, L);
+       bool res = runFile("scripts/commands/" + filename, L);
+
+       if (!res)
+               ERROR_CODE = GENERAL_ERROR;
 
        return 0;
 }
index bf0a893..6db1bf0 100644 (file)
@@ -154,8 +154,11 @@ public:
 
        static ZoneProcessServer* server;
        static CommandList* slashCommands;
+       enum LUA_ERROR_CODE { NO_ERROR = 0, GENERAL_ERROR};
+       static int ERROR_CODE;
 
        CommandConfigManager(ZoneProcessServer* serv);
+       ~CommandConfigManager();
 
        void registerFunctions();
        void registerGlobals();
@@ -169,8 +172,12 @@ public:
                loadCommandData("datatables/command/command_tables_shared.iff");
                loadCommandData("datatables/command/command_tables_shared_ground.iff");
                //loadCommandData("datatables/command/command_tables_shared_space.iff"); disabled cause taunt is conflicting
+               bool res = runFile("scripts/commands/commands.lua");
 
-               return runFile("scripts/commands/commands.lua");
+               if (!res)
+                       ERROR_CODE = GENERAL_ERROR;
+
+               return res;
        }
 
        bool contains(String name) {
diff --git a/MMOCoreORB/src/server/zone/managers/objectcontroller/command/tests/CommandLuaTest.cpp b/MMOCoreORB/src/server/zone/managers/objectcontroller/command/tests/CommandLuaTest.cpp
new file mode 100644 (file)
index 0000000..fbff1c2
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * CommandLuaTest.cpp
+ *
+ *  Created on: 20/10/2013
+ *      Author: victor
+ */
+
+#include "gtest/gtest.h"
+#include "gmock/gmock.h"
+
+#include "server/zone/managers/templates/DataArchiveStore.h"
+#include "server/zone/managers/objectcontroller/command/CommandConfigManager.h"
+#include "server/zone/managers/objectcontroller/command/CommandList.h"
+#include "server/conf/ConfigManager.h"
+
+class CommandLuaTest : public ::testing::Test {
+public:
+
+       CommandLuaTest() {
+               // Perform creation setup here.
+               ConfigManager::instance()->loadConfigData();
+               DataArchiveStore::instance()->loadTres(ConfigManager::instance()->getTrePath(), ConfigManager::instance()->getTreFiles());
+       }
+
+       ~CommandLuaTest() {
+       }
+
+       void SetUp() {
+               // Perform setup of common constructs here.
+       }
+
+       void TearDown() {
+               // Perform clean up of common constructs here.
+       }
+};
+
+TEST_F(CommandLuaTest, LoadCommandLuas) {
+       CommandConfigManager* man = new CommandConfigManager(NULL);
+       CommandList* list = new CommandList();
+
+       man->registerSpecialCommands(list);
+       man->loadSlashCommandsFile();
+
+
+       ASSERT_EQ(CommandConfigManager::ERROR_CODE, 0);
+
+       delete man;
+}