Commit defcb3cc authored by Renato Figueiro Maia's avatar Renato Figueiro Maia

[OPENBUS-2184] Adaptação do código para ser compatível também com Lua 5.2

- Passa a utilizar o trunk do LOOP e OiL já devidamente adaptados para Lua 5.2 estrito (sem -DCOMPAT)
- Novos testes da API dos serviços básicos do núcleo do barramento (utiliza classes da LOOP-Lib ao invés do LATT).

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/sdk/lua/branches/02_00_00@148854 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 6e1a43fc
......@@ -59,3 +59,4 @@ end
-- free any resoures allocated
OpenBusAssistant:shutdown()
OpenBusAssistant.orb:shutdown()
......@@ -59,3 +59,4 @@ print(os.date(nil, timestamp))
-- free any resoures allocated
OpenBusAssistant:shutdown()
OpenBusAssistant.orb:shutdown()
......@@ -50,3 +50,4 @@ end
-- free any resoures allocated
OpenBusAssistant:shutdown()
OpenBusAssistant.orb:shutdown()
......@@ -46,3 +46,4 @@ end
-- free any resoures allocated
OpenBusAssistant:shutdown()
OpenBusAssistant.orb:shutdown()
......@@ -81,5 +81,6 @@ end
-- free any resoures allocated
OpenBusAssistant:shutdown()
OpenBusAssistant.orb:shutdown()
clock = true
......@@ -16,7 +16,8 @@ local params = {
-- setup the ORB and connect to the bus
local OpenBusContext = openbus.initORB().OpenBusContext
local orb = openbus.initORB()
local OpenBusContext = orb.OpenBusContext
OpenBusContext:setDefaultConnection(
OpenBusContext:createConnection(bushost, busport))
......@@ -66,3 +67,4 @@ end
-- free any resoures allocated
OpenBusContext:getCurrentConnection():logout()
orb:shutdown()
......@@ -22,7 +22,6 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......
......@@ -22,7 +22,6 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......
......@@ -89,7 +89,4 @@ until timestamp or not retry()
-- free any resoures allocated
conn:logout()
print(os.date(nil, timestamp))
orb:shutdown()
......@@ -32,7 +32,6 @@ end
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definition
local iface = orb:loadidl("interface Clock { double getTime(); };")
......
......@@ -18,7 +18,8 @@ local params = {
-- setup the ORB and connect to the bus
local OpenBusContext = openbus.initORB().OpenBusContext
local orb = openbus.initORB()
local OpenBusContext = orb.OpenBusContext
OpenBusContext:setDefaultConnection(
OpenBusContext:createConnection(bushost, busport))
......@@ -56,3 +57,4 @@ end
-- free any resoures allocated
OpenBusContext:getCurrentConnection():logout()
orb:shutdown()
......@@ -23,7 +23,6 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......
......@@ -16,7 +16,8 @@ local params = {
-- setup the ORB and connect to the bus
local OpenBusContext = openbus.initORB().OpenBusContext
local orb = openbus.initORB()
local OpenBusContext = orb.OpenBusContext
OpenBusContext:setDefaultConnection(
OpenBusContext:createConnection(bushost, busport))
......@@ -53,3 +54,4 @@ end
-- free any resoures allocated
OpenBusContext:getCurrentConnection():logout()
orb:shutdown()
......@@ -22,7 +22,6 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......
......@@ -109,3 +109,4 @@ end
-- login to the bus
conn:onInvalidLogin()
orb:shutdown()
......@@ -40,7 +40,6 @@ end)
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definition
local iface = orb:loadidl("interface Clock { double getTime(); };")
......
......@@ -18,7 +18,6 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......
......@@ -23,7 +23,6 @@ local params = {
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......
......@@ -7,7 +7,6 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definitions
orb:loadidlfile("idl/messages.idl")
......
......@@ -117,5 +117,6 @@ end
conn:loginByPassword("bill", "bill")
services.Forwarder.ref:cancelForward("willian")
conn:logout()
orb:shutdown()
assert(require("loop.debug.Matcher"){metatable=false}:match(actual, expected))
......@@ -8,7 +8,6 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definitions
orb:loadidlfile("idl/messages.idl")
......
......@@ -7,7 +7,6 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definitions
orb:loadidlfile("idl/messages.idl")
......
......@@ -60,3 +60,5 @@ for _, businfo in ipairs{
-- logout from the bus
conn:logout()
end
orb:shutdown()
......@@ -6,9 +6,7 @@ require "openbus.test.util"
-- setup and start the ORBs
local orb1 = openbus.initORB()
openbus.newThread(orb1.run, orb1)
local orb2 = openbus.initORB()
openbus.newThread(orb2.run, orb2)
-- load interface definition
orb1:loadidlfile("idl/hello.idl")
......
......@@ -41,3 +41,4 @@ end
-- logout from the bus
conn:logout()
orb:shutdown()
......@@ -7,7 +7,6 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definition
orb:loadidlfile("idl/hello.idl")
......
......@@ -7,7 +7,6 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definition
orb:loadidlfile("idl/hello.idl")
......
......@@ -49,3 +49,4 @@ end
-- logout from the bus
conn:logout()
orb:shutdown()
......@@ -7,7 +7,6 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definition
orb:loadidlfile("idl/hello/hello.idl")
......
......@@ -41,3 +41,4 @@ end
-- logout from the bus
conn:logout()
orb:shutdown()
......@@ -6,7 +6,6 @@ require "openbus.test.util"
-- setup and start the ORB
local orb = openbus.initORB()
openbus.newThread(orb.run, orb)
-- load interface definition
orb:loadidlfile("idl/hello.idl")
......
......@@ -27,7 +27,8 @@ local connprops = { accesskey = openbus.newKey() }
-- login as admin and provide additional functionality for the test
local invalidate, shutdown do
local OpenBusContext = openbus.initORB().OpenBusContext
local orb = openbus.initORB()
local OpenBusContext = orb.OpenBusContext
local conn = OpenBusContext:createConnection(bushost, busport)
conn:loginByPassword(admin, admpsw)
OpenBusContext:setDefaultConnection(conn)
......@@ -36,6 +37,7 @@ local invalidate, shutdown do
end
function shutdown()
conn:logout()
orb:shutdown()
end
end
......@@ -230,4 +232,5 @@ do log:TEST("Two threads getting invalid login and trying to relog")
OpenBusContext:setDefaultConnection(nil)
end
orb:shutdown()
shutdown()
......@@ -172,7 +172,8 @@ end
local WrongKey = openbus.newKey()
-- login as admin and provide additional functionality for the test
local invalidate, shutdown, leasetime do
local OpenBusContext = openbus.initORB().OpenBusContext
local orb = openbus.initORB()
local OpenBusContext = orb.OpenBusContext
local conn = OpenBusContext:createConnection(bushost, busport)
conn:loginByPassword(admin, admpsw)
OpenBusContext:setDefaultConnection(conn)
......@@ -182,6 +183,7 @@ local invalidate, shutdown, leasetime do
end
function shutdown()
conn:logout()
orb:shutdown()
end
end
......@@ -410,4 +412,5 @@ end
log:TEST(false)
orb:shutdown()
shutdown()
......@@ -28,12 +28,11 @@ local connprops = { accesskey = openbus.newKey() }
-- login as admin and provide additional functionality for the test
local invalidate, shutdown do
local OpenBusContext = openbus.initORB().OpenBusContext
local orb = openbus.initORB()
local OpenBusContext = orb.OpenBusContext
local conn = OpenBusContext:createConnection(bushost, busport)
conn:loginByPassword(admin, admpsw)
OpenBusContext:setDefaultConnection(conn)
local orb = OpenBusContext.orb
openbus.newThread(orb.run, orb)
function invalidate(loginId)
OpenBusContext:getLoginRegistry():invalidateLogin(loginId)
end
......@@ -86,9 +85,6 @@ do log:TEST("Get invalid login notification while dispathing a call")
local ior = tostring(orb:newservant({}, nil, "CORBA::InterfaceDef"))
local pxy = newproxy(ior, nil, "CORBA::InterfaceDef")
local orb = OpenBusContext.orb
openbus.newThread(orb.run, orb)
invalidate(conn.login.id)
local ok, ex = pcall(pxy._non_existent, pxy)
......@@ -97,8 +93,6 @@ do log:TEST("Get invalid login notification while dispathing a call")
assert(ex.completed == "COMPLETED_NO")
assert(ex.minor == idl.const.services.access_control.UnknownBusCode)
orb:shutdown()
assert(conn.login == nil)
OpenBusContext:setDefaultConnection(nil)
end
......@@ -143,17 +137,13 @@ do log:TEST("Relog while dispathing a call")
LoginObserverRepId))
local pxy = newproxy(ior, nil, LoginObserverRepId)
local orb = OpenBusContext.orb
openbus.newThread(orb.run, orb)
invalidate(conn.login.id)
pxy:entityLogout{id="???",entity="???"}
orb:shutdown()
assert(conn:logout())
OpenBusContext:setDefaultConnection(nil)
end
orb:shutdown()
shutdown()
......@@ -24,7 +24,7 @@ syskey = assert(decodeprvkey(readfrom(syskey)))
-- test initialization ---------------------------------------------------------
do -- connect to the bus
local bus = connectToBus(bushost, busport)
local bus, orb = connectToBus(bushost, busport)
local accesskey = newkey(EncryptedBlockSize)
local otherkey = newkey(EncryptedBlockSize)
......@@ -57,4 +57,5 @@ do -- connect to the bus
-- logout from the bus
login.busSession:newCred("logout")
bus.AccessControl:logout()
orb:shutdown()
end
......@@ -166,7 +166,7 @@ function connectToBus(host, port, orb)
[AccessControl] = true,
[OfferRegistry] = true,
}
}
}, orb
end
function initBusSession(bus, login)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment