Changeset 3448
- Timestamp:
- 02/25/10 17:22:18 (5 months ago)
- Location:
- tests/trunk/ScriptLoginTest
- Files:
-
- 1 added
- 5 modified
-
. (modified) (1 prop)
-
Account.sql (added)
-
LoginTest.cpp (modified) (1 diff)
-
config.xml.example (modified) (1 diff)
-
loginTest.lua (modified) (1 diff)
-
main.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/trunk/ScriptLoginTest
- Property svn:ignore
-
old new 1 1 CMakeLists.txt 2 Community.sqlite 2 3 config.xml 3 4 loginTest.bat
-
- Property svn:ignore
-
tests/trunk/ScriptLoginTest/LoginTest.cpp
r3333 r3448 81 81 if (m_pScriptObject == NULL) 82 82 { 83 // Register the script engine. This cannot be done earlier84 m_pEventService->registerScriptEngine(m_pModule->getScriptModule()->getScriptEngine());85 86 83 m_pScriptObject = new ScriptWrapper_type(m_pModule->getScriptModule(), 87 84 m_pModule->getScriptModule()->getScriptType(getScriptTypeName()), -
tests/trunk/ScriptLoginTest/config.xml.example
r3315 r3448 3 3 <application 4 4 id="ConsoleTest" 5 name="IndieZen Script Test Application"6 version="0. 1.0"5 name="IndieZen Script Login Test Application" 6 version="0.6.0" 7 7 provider-name="IndieZen.org"> 8 8 9 9 <plugin-path path="C:/dev/Zen/plugins"/> 10 <plugin-path path="C:/dev/Zen/Community" /> 10 11 <module-path path="C:/dev/bin"/> 11 12 12 ` <requires> 13 <import plugin="ZPython"/> 14 <import plugin="ZLua"/> 15 </requires> 13 <requires> 14 <import plugin="ZLua" /> 15 <import plugin="ZSQLite" /> 16 <import plugin="ZBoostNetworking" /> 17 <import plugin="SessionClient" /> 18 <import plugin="SessionServer" /> 19 </requires> 20 21 <databases> 22 <database type="sqlite" name="sessionConnection"> 23 <fileName value="Community.sqlite" /> 24 </database> 25 </databases> 26 27 <applications> 28 <application type="SessionClient" location="/loginClient" /> 29 <application type="SessionServer" location="/loginServer" > 30 <database connection="sessionConnection" /> 31 </application> 32 </applications> 33 34 <protocols> 35 <protocol type="tcp-binary" address="localhost" port="10000" threads="2" name="sessionServer" /> 36 <protocol type="tcp-binary" name="sessionClient" threads="2" /> 37 </protocols> 16 38 17 39 </application> -
tests/trunk/ScriptLoginTest/loginTest.lua
r3333 r3448 1 1 2 -- Create the script event queue 3 local eventQueue = eventService:getEventQueue("script"); 2 print("starting loginTest"); 4 3 5 local sessionEvent = sessionClient:getSessionEvent(); 4 function runLoginTest() 5 -- Create the script event queue 6 print("Getting event queue"); 7 local eventQueue = eventService:getEventQueue("script"); 6 8 7 SessionEventHandler = {} 9 print("Getting session event"); 10 local sessionEvent = sessionClient:getSessionEvent(); 8 11 9 function SessionEventHandler:onSessionChanged(session) 10 -- Handle session change events. 12 SessionEventHandler = {} 13 14 SessionStates = 15 { 16 INITIALIZED = 0, 17 CONNECTED = 1, 18 NOT_AUTHORIZED = 2, 19 DISCONNECTED = 3, 20 } 21 22 SessionStates[SessionStates.INITIALIZED] = "Initialized"; 23 SessionStates[SessionStates.CONNECTED] = "Connected"; 24 SessionStates[SessionStates.NOT_AUTHORIZED] = "Not Authorized"; 25 SessionStates[SessionStates.DISCONNECTED] = "Disconnected"; 26 27 28 function SessionEventHandler:onSessionChanged(session) 29 -- Handle session change events. 30 print("Session state: " .. SessionStates[session:getSessionState()]); 31 end 32 33 -- Connect 34 SessionEventHandler.connection = sessionEvent:connect(SessionEventHandler, SessionEventHandler.onSessionChanged); 35 36 sessionClient:requestLogin("localhost", "10000", "test user", "test password"); 37 38 -- TODO Eventually we are going to have to call loginTest:quit() 39 -- Possibly use the one second tick that's in LoginTest and after a period of time, exit. 40 41 --errorHere:notAnObject(); 42 43 -- Run. This will continue running and processing events until 44 -- loginTest:quit() is called. 45 loginTest:run(); 46 11 47 end 12 48 13 -- Connect14 SessionEventHandler.connection = sessionEvent:connect(SessionEventHandler, SessionEventHandler.onSessionChanged);15 49 16 sessionClient:requestLogin("localhost", "10000", "sgtflame", "test");50 print("calling runLoginTest"); 17 51 18 -- TODO Eventually we are going to have to call loginTest:quit()19 -- Possibly use the one second tick that's in LoginTest and after a period of time, exit.20 52 21 -- Run. This will continue running and processing events until 22 -- loginTest:quit() is called. 23 loginTest:run(); 53 runLoginTest(); -
tests/trunk/ScriptLoginTest/main.cpp
r3368 r3448 1 #include <Zen/Core/Event/I_EventManager.hpp> 2 #include <Zen/Core/Event/I_EventService.hpp> 3 1 4 #include <Zen/Enterprise/AppServer/I_Container.hpp> 2 5 #include <Zen/Enterprise/AppServer/I_ApplicationServer.hpp> … … 5 8 6 9 #include "LoginTest.hpp" 10 11 #include <iostream> 7 12 8 13 int main(int _argc, const char* _argv[]) … … 23 28 module.activate(); 24 29 30 Zen::Event::I_EventManager::pEventService_type pEventService = 31 Zen::Event::I_EventManager::getSingleton().create("eventService"); 32 33 pEventService->registerScriptEngine(module.getScriptModule()->getScriptEngine()); 34 25 35 // Run the container. This should invoke the script and when the script 26 36 // returns, we should shutdown the app server and exit. 27 int rc = container.run(); 37 try 38 { 39 int rc = container.run(); 28 40 29 // TODO Shutdown the app server.41 // TODO Shutdown the app server. 30 42 31 return rc; 43 return rc; 44 } 45 catch(Zen::Utility::runtime_exception& _ex) 46 { 47 std::cout << "Caught unhandled exception: " << _ex.what() << std::endl; 48 } 49 50 return 1; 32 51 }
