Commit bd4f00ed authored by Hugo Roenick's avatar Hugo Roenick

[OPENBUS-2743] (Lua) Adequar testes de interoperabilidade para automatização

 - ajustando interop de sharedauth
 - atualizando scripts de teste


git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/sdk/lua/branches/02_00_01@161416 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 7477821d
#!/bin/bash
/bin/bash runtest.sh $1 protocol server
/bin/bash runtest.sh $1 simple server
/bin/bash runtest.sh $1 multiplexing server
/bin/bash runtest.sh $1 sharedauth server
/bin/bash runtest.sh $1 reloggedjoin server proxy
/bin/bash runtest.sh $1 chaining server proxy
/bin/bash runtest.sh $1 delegation messenger broadcaster forwarder
/bin/bash runtest.sh $1 protocol client server
/bin/bash runtest.sh $1 simple client server
/bin/bash runtest.sh $1 multiplexing client server
/bin/bash runtest.sh $1 sharedauth "sharing consuming"
/bin/bash runtest.sh $1 reloggedjoin client "server proxy"
/bin/bash runtest.sh $1 chaining client "server proxy"
/bin/bash runtest.sh $1 delegation client "messenger broadcaster forwarder"
......@@ -2,21 +2,18 @@
mode=$1
testcase=$2
services="server"
tasks=$3
services=$4
busconsole="${OPENBUS_SDKLUA_HOME}/bin/busconsole"
if [[ "$mode" == "DEBUG" ]]; then
busconsole="$busconsole -d"
elif [[ "$mode" != "RELEASE" ]]; then
echo "Usage: $0 <RELEASE|DEBUG> <test> [services...]"
echo "Usage: $0 <RELEASE|DEBUG> <tasks> <services>"
exit 1
fi
if [[ ${#@} > 2 ]]; then
services="${@:3:${#@}}"
fi
cd $testcase
pid=
for service in $services; do
......@@ -26,9 +23,12 @@ for service in $services; do
trap "kill $pid > /dev/null 2>&1" 0
done
echo -n "Executing test '$testcase' ... "
$busconsole client.lua $testcase
echo "OK"
for task in $tasks; do
echo -n "Executing task '$task' of test '$testcase' ... "
$busconsole $task.lua $testcase
echo "OK"
done
cd ../../test
echo -n "Test protocol with server of test '$testcase' ... "
$busconsole openbus/test/Protocol.lua
......
......@@ -9,10 +9,6 @@ settestcfg(...)
-- setup the ORB
local orb = openbus.initORB(orbcfg)
-- load interface definition
orb:loadidlfile("idl/hello.idl")
local iface = orb.types:lookup("tecgraf::openbus::interop::simple::Hello")
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
......@@ -27,20 +23,15 @@ local secret = OpenBusContext:decodeSharedAuth(waitfile(sharedauthfile))
-- login to the bus
conn:loginBySharedAuth(secret)
-- define service properties
local props = {{name="openbus.component.interface",value=iface.repID}}
-- find the offered service
log:TEST("retrieve hello service")
local OfferRegistry = OpenBusContext:getOfferRegistry()
for _, offer in ipairs(findoffers(OfferRegistry, props)) do
local entity = getprop(offer.properties, "openbus.offer.entity")
log:TEST("found service of ",entity,"!")
local hello = offer.service_ref:getFacetByName(iface.name):__narrow(iface)
local result = hello:sayHello()
assert(result == "Hello "..conn.login.entity.."!", result)
log:TEST("test successful for service of ",entity)
end
-- check identity
local langs = {
java = true,
cpp = true,
csharp = true,
lua = true,
}
local lang = string.match(conn.login.entity, "interop_sharedauth_(.+)_client")
assert(langs[lang] ~= nil)
-- logout from the bus
conn:logout()
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local ComponentContext = require "scs.core.ComponentContext"
local oil = require "oil"
require "openbus.test.util"
......@@ -11,43 +10,15 @@ settestcfg(...)
-- setup and start the ORB
local orb = openbus.initORB(orbcfg)
-- load interface definition
orb:loadidlfile("idl/hello.idl")
local iface = orb.types:lookup("tecgraf::openbus::interop::simple::Hello")
-- get bus context manager
local OpenBusContext = orb.OpenBusContext
-- create service implementation
local hello = {}
function hello:sayHello()
local entity = OpenBusContext:getCallerChain().caller.entity
log:TEST("got call from ",entity)
return "Hello "..entity.."!"
end
-- create service SCS component
local component = ComponentContext(orb, {
name = "Hello",
major_version = 1,
minor_version = 0,
patch_version = 0,
platform_spec = "Lua",
})
component:addFacet(iface.name, iface.repID, hello)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
conn:loginByCertificate(system, assert(openbus.readKeyFile(syskey)))
-- offer service
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent, properties)
log:TEST("hello service ready!")
conn:loginByPassword(user, password)
-- serialize shared authentication data
local secret = conn:startSharedAuth()
......@@ -55,3 +26,7 @@ local encoded = OpenBusContext:encodeSharedAuth(secret)
assert(oil.writeto(sharedauthfile, encoded, "wb"))
log:TEST("shared authentication data written to file!")
-- logout from the bus
conn:logout()
orb:shutdown()
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