Commit 879783ca authored by Hugo Roenick's avatar Hugo Roenick

[OPENBUS-2676] (Lua) Suportar um formato de codificação de cadeias oriundas de...

[OPENBUS-2676] (Lua) Suportar um formato de codificação de cadeias oriundas de chamadas legadas (OpenBus 1.5)
 - inclusão de target no tipo exportado


git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/sdk/lua/branches/02_00_01@158640 ae0415b3-e90b-0410-900d-d0be9363c56b
parent d0c28ed1
......@@ -823,6 +823,7 @@ function Context:makeChainFor(loginId)
local busid = conn.busid
local joined = self:getJoinedChain()
if joined ~= nil and joined.signature == nil then
local target = conn.LoginRegistry:getLoginInfo(loginId)
local originator
if #joined.originators > 0 and conn.legacyDelegOrig then
originator = joined.originators[1].entity
......@@ -831,6 +832,7 @@ function Context:makeChainFor(loginId)
end
return {
busid = busid,
target = target.entity,
caller = conn.login,
originators = {{id="<unknown>", entity=originator}}
}
......@@ -853,6 +855,7 @@ local EncodingValues = {
local originator = chain.originators[1]
return LegacyExportVersion, {
bus = chain.busid,
target = chain.target,
caller = chain.caller,
delegate = originator and originator.entity or "",
}
......@@ -875,6 +878,7 @@ local EncodingValues = {
end
return {
busid = decoded.bus,
target = decoded.target,
caller = decoded.caller,
originators = {originator},
}
......
......@@ -160,7 +160,7 @@ do log:TEST("Encode and decode legacy chains")
assert(type(stream) == "string")
local recovered = assert(OpenBusContext:decodeChain(stream))
assert(recovered.busid == legacy.busid)
assert(recovered.target == nil)
assert(recovered.target == legacy.target)
assert(recovered.caller.id == legacy.caller.id)
assert(recovered.caller.entity == legacy.caller.entity)
assert(#recovered.originators == 0)
......@@ -170,7 +170,7 @@ do log:TEST("Encode and decode legacy chains")
local legacyto2to1 = OpenBusContext:makeChainFor(conn1.login.id)
assert(legacyto2to1.busid == busid)
assert(legacyto2to1.target == nil)
assert(legacyto2to1.target == entity1)
assert(legacyto2to1.caller.id == login2)
assert(legacyto2to1.caller.entity == entity2)
assert(legacyto2to1.originators[1].id == "<unknown>")
......@@ -186,7 +186,7 @@ do log:TEST("Encode and decode legacy chains")
assert(type(stream) == "string")
recovered = assert(OpenBusContext:decodeChain(stream))
assert(recovered.busid == busid)
assert(recovered.target == nil)
assert(recovered.target == entity1)
assert(recovered.caller.id == login2)
assert(recovered.caller.entity == entity2)
assert(recovered.originators[1].id == "<unknown>")
......
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