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

Merge from branch 02_00_00 (159962)

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/sdk/lua/branches/02_00_01@159963 ae0415b3-e90b-0410-900d-d0be9363c56b
parents 47f4a97c 06f145fb
#!/bin/bash
CONSOLE="${OPENBUS_HOME}/bin/busconsole"
mode=$1
testcase=$2
services="server"
if [ "$1" == "DEBUG" ]; then
CONSOLE="$CONSOLE -d"
elif [ "$1" != "RELEASE" ]; then
echo "Usage: runtest.sh [RELEASE|DEBUG] <dir> [services]"
busconsole="${OPENBUS_SDKLUA_HOME}/bin/busconsole"
if [[ "$mode" == "DEBUG" ]]; then
busconsole="$busconsole -d"
elif [[ "$mode" != "RELEASE" ]]; then
echo "Usage: $0 <RELEASE|DEBUG> <test> [services...]"
exit 1
fi
if [[ ${#@} > 2 ]]; then
services="${@:3:${#@}}"
else
services="server"
fi
cd $2
cd $testcase
pid=
for service in $services; do
echo "Starting service '$service' of test '$2'"
$CONSOLE $service.lua $2 &
echo "Starting service '$service' of test '$testcase'"
$busconsole $service.lua $testcase &
pid="$pid $!"
trap "kill $pid > /dev/null 2> /dev/null" 0
trap "kill $pid > /dev/null 2>&1" 0
done
echo -n "Executing test '$2' ... "
$CONSOLE client.lua $2
echo -n "Executing test '$testcase' ... "
$busconsole client.lua $testcase
echo "OK"
cd ../../test
echo -n "Test protocol with server of test '$2' ... "
$CONSOLE openbus/test/Protocol.lua
echo -n "Test protocol with server of test '$testcase' ... "
$busconsole openbus/test/Protocol.lua
echo "OK"
cd ../interop
......@@ -140,58 +140,63 @@ end
do log:TEST("Encode and decode legacy chains")
local conn1 = OpenBusContext:createConnection(bushost, busport, connprops)
conn1:loginByPassword(user, password)
local conn2 = OpenBusContext:createConnection(bushost, busport, connprops)
conn2:loginByCertificate(system, syskey)
assert(conn1.busid == conn2.busid)
local busid = conn1.busid
local login1 = conn1.login.id
local entity1 = conn1.login.entity
local login2 = conn2.login.id
local entity2 = conn2.login.entity
local legacy = {
busid = "some fake busid",
target = "FakeEntity",
caller = { id = "fake login id", entity = "FakeEntity" },
originators = {},
}
local stream = assert(OpenBusContext:encodeChain(legacy))
assert(type(stream) == "string")
local recovered = assert(OpenBusContext:decodeChain(stream))
assert(recovered.busid == legacy.busid)
assert(recovered.target == legacy.target)
assert(recovered.caller.id == legacy.caller.id)
assert(recovered.caller.entity == legacy.caller.entity)
assert(#recovered.originators == 0)
OpenBusContext:setDefaultConnection(conn2)
OpenBusContext:joinChain(legacy)
local legacyto2to1 = OpenBusContext:makeChainFor(conn1.login.id)
assert(legacyto2to1.busid == busid)
assert(legacyto2to1.target == entity1)
assert(legacyto2to1.caller.id == login2)
assert(legacyto2to1.caller.entity == entity2)
assert(legacyto2to1.originators[1].id == "<unknown>")
assert(legacyto2to1.originators[1].entity == legacy.caller.entity)
assert(#legacyto2to1.originators == 1)
OpenBusContext:exitChain()
OpenBusContext:setDefaultConnection(conn1)
local enabled = conn1.legacy:isValid(conn1.login.id) -- legacy support is enabled
OpenBusContext:setDefaultConnection(nil)
if enabled then
local conn2 = OpenBusContext:createConnection(bushost, busport, connprops)
conn2:loginByCertificate(system, syskey)
assert(conn1.busid == conn2.busid)
local busid = conn1.busid
local login1 = conn1.login.id
local entity1 = conn1.login.entity
local login2 = conn2.login.id
local entity2 = conn2.login.entity
local legacy = {
busid = "some fake busid",
target = "FakeEntity",
caller = { id = "fake login id", entity = "FakeEntity" },
originators = {},
}
local stream = assert(OpenBusContext:encodeChain(legacy))
assert(type(stream) == "string")
local recovered = assert(OpenBusContext:decodeChain(stream))
assert(recovered.busid == legacy.busid)
assert(recovered.target == legacy.target)
assert(recovered.caller.id == legacy.caller.id)
assert(recovered.caller.entity == legacy.caller.entity)
assert(#recovered.originators == 0)
OpenBusContext:setDefaultConnection(conn2)
OpenBusContext:joinChain(legacy)
local legacyto2to1 = OpenBusContext:makeChainFor(conn1.login.id)
assert(legacyto2to1.busid == busid)
assert(legacyto2to1.target == entity1)
assert(legacyto2to1.caller.id == login2)
assert(legacyto2to1.caller.entity == entity2)
assert(legacyto2to1.originators[1].id == "<unknown>")
assert(legacyto2to1.originators[1].entity == legacy.caller.entity)
assert(#legacyto2to1.originators == 1)
OpenBusContext:exitChain()
OpenBusContext:setDefaultConnection(nil)
conn2:logout()
local stream = assert(OpenBusContext:encodeChain(legacyto2to1))
assert(type(stream) == "string")
recovered = assert(OpenBusContext:decodeChain(stream))
assert(recovered.busid == busid)
assert(recovered.target == entity1)
assert(recovered.caller.id == login2)
assert(recovered.caller.entity == entity2)
assert(recovered.originators[1].id == "<unknown>")
assert(recovered.originators[1].entity == legacy.caller.entity)
assert(#recovered.originators == 1)
end
conn1:logout()
conn2:logout()
local stream = assert(OpenBusContext:encodeChain(legacyto2to1))
assert(type(stream) == "string")
recovered = assert(OpenBusContext:decodeChain(stream))
assert(recovered.busid == busid)
assert(recovered.target == entity1)
assert(recovered.caller.id == login2)
assert(recovered.caller.entity == entity2)
assert(recovered.originators[1].id == "<unknown>")
assert(recovered.originators[1].entity == legacy.caller.entity)
assert(#recovered.originators == 1)
end
orb:shutdown()
......@@ -50,8 +50,11 @@ do -- connect to the bus
local function isnotnil(value) assert(value ~= nil) end
for _, offer in ipairs(offers) do
local service = offer.service_ref
testBusCall(bus, login, otherkey, isfalse, service, "_non_existent")
testBusCall(bus, login, otherkey, isnotnil, service, "getComponentId")
local ok, result = pcall(service._non_existent, service)
if (ok and not result)
or (not ok and result._repid ~= "IDL:omg.org/CORBA/TRANSIENT:1.0") then
testBusCall(bus, login, otherkey, isnotnil, service, "getComponentId")
end
end
-- logout from the bus
......
#!/bin/bash
CONSOLE="${OPENBUS_HOME}/bin/busconsole"
mode=$1
if [ "$1" == "DEBUG" ]; then
CONSOLE="$CONSOLE -d"
elif [ "$1" != "RELEASE" ]; then
echo "Usage: runall.sh [RELEASE|DEBUG] bushost busport [verbose]"
if [[ "$mode" == "" ]]; then
mode=RELEASE
elif [[ "$mode" != "RELEASE" && "$mode" != "DEBUG" ]]; then
echo "Usage: $0 <RELEASE|DEBUG>"
exit 1
fi
LUACASES="\
openbus/test/util/tickets \
openbus/test/util/database \
openbus/test/LoginLogout \
openbus/test/Concurrency \
openbus/test/NoLoginIceptorCalls \
openbus/test/MakeChainFor \
openbus/test/ChainExport \
openbus/test/assistant/LoginLogout \
openbus/test/assistant/Concurrency \
openbus/test/assistant/NoLoginIceptorCalls \
openbus/test/assistant/AssistantLoginLogout \
"
for case in ${LUACASES}; do
echo -n "Test '${case}' ... "
${CONSOLE} ${case}.lua ${@:2:${#@}} || exit $?
echo "OK"
done
bus1port=20011
bus2port=20021
leasetime=1
passwordpenalty=1
export OPENBUS_TESTCFG=$OPENBUS_TEMP/test.properties
echo "bus.host.port=$bus1port" > $OPENBUS_TESTCFG
echo "bus2.host.port=$bus2port" >> $OPENBUS_TESTCFG
echo "login.lease.time=$leasetime" >> $OPENBUS_TESTCFG
echo "password.penalty.time=$passwordpenalty" >> $OPENBUS_TESTCFG
#echo "openbus.test.verbose=yes" >> $OPENBUS_TESTCFG
source ${OPENBUS_CORE_TEST}/runbus.sh $mode BUS01 $bus1port
source ${OPENBUS_CORE_TEST}/runbus.sh $mode BUS02 $bus2port
genkey $OPENBUS_TEMP/testsyst
source ${OPENBUS_CORE_TEST}/runadmin.sh $mode localhost $bus1port --script=${OPENBUS_CORE_TEST}/test.adm
source ${OPENBUS_CORE_TEST}/runadmin.sh $mode localhost $bus2port --script=${OPENBUS_CORE_TEST}/test.adm
source runtests.sh $mode
source ${OPENBUS_CORE_TEST}/runadmin.sh $mode localhost $bus1port --undo-script=${OPENBUS_CORE_TEST}/test.adm
source ${OPENBUS_CORE_TEST}/runadmin.sh $mode localhost $bus2port --undo-script=${OPENBUS_CORE_TEST}/test.adm
cd ../interop
source ${OPENBUS_CORE_TEST}/runadmin.sh $mode localhost $bus1port --script=script.adm
source ${OPENBUS_CORE_TEST}/runadmin.sh $mode localhost $bus2port --script=script.adm
source runall.sh $mode
sleep 2 # wait for offers to expire
source ${OPENBUS_CORE_TEST}/runadmin.sh $mode localhost $bus1port --undo-script=script.adm
source ${OPENBUS_CORE_TEST}/runadmin.sh $mode localhost $bus2port --undo-script=script.adm
cd ../test
#!/bin/bash
mode=$1
busconsole="${OPENBUS_SDKLUA_HOME}/bin/busconsole"
if [[ "$mode" == "DEBUG" ]]; then
busconsole="$busconsole -d"
elif [[ "$mode" != "RELEASE" ]]; then
echo "Usage: $0 <RELEASE|DEBUG>"
exit 1
fi
cases="\
openbus/test/util/tickets \
openbus/test/util/database \
openbus/test/NoLoginIceptorCalls \
openbus/test/Concurrency \
openbus/test/MakeChainFor \
openbus/test/ChainExport \
openbus/test/LoginLogout \
openbus/test/assistant/Concurrency \
openbus/test/assistant/NoLoginIceptorCalls \
openbus/test/assistant/LoginLogout \
openbus/test/assistant/AssistantLoginLogout \
"
for case in $cases; do
echo -n "Test '${case}' ... "
$busconsole $case.lua ${@:2:${#@}} || exit $?
echo "OK"
done
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