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
/bin/bash runtest.sh $1 protocol server /bin/bash runtest.sh $1 protocol client server
/bin/bash runtest.sh $1 simple server /bin/bash runtest.sh $1 simple client server
/bin/bash runtest.sh $1 multiplexing server /bin/bash runtest.sh $1 multiplexing client server
/bin/bash runtest.sh $1 sharedauth server /bin/bash runtest.sh $1 sharedauth "sharing consuming"
/bin/bash runtest.sh $1 reloggedjoin server proxy /bin/bash runtest.sh $1 reloggedjoin client "server proxy"
/bin/bash runtest.sh $1 chaining server proxy /bin/bash runtest.sh $1 chaining client "server proxy"
/bin/bash runtest.sh $1 delegation messenger broadcaster forwarder /bin/bash runtest.sh $1 delegation client "messenger broadcaster forwarder"
...@@ -2,21 +2,18 @@ ...@@ -2,21 +2,18 @@
mode=$1 mode=$1
testcase=$2 testcase=$2
services="server" tasks=$3
services=$4
busconsole="${OPENBUS_SDKLUA_HOME}/bin/busconsole" busconsole="${OPENBUS_SDKLUA_HOME}/bin/busconsole"
if [[ "$mode" == "DEBUG" ]]; then if [[ "$mode" == "DEBUG" ]]; then
busconsole="$busconsole -d" busconsole="$busconsole -d"
elif [[ "$mode" != "RELEASE" ]]; then elif [[ "$mode" != "RELEASE" ]]; then
echo "Usage: $0 <RELEASE|DEBUG> <test> [services...]" echo "Usage: $0 <RELEASE|DEBUG> <tasks> <services>"
exit 1 exit 1
fi fi
if [[ ${#@} > 2 ]]; then
services="${@:3:${#@}}"
fi
cd $testcase cd $testcase
pid= pid=
for service in $services; do for service in $services; do
...@@ -26,9 +23,12 @@ for service in $services; do ...@@ -26,9 +23,12 @@ for service in $services; do
trap "kill $pid > /dev/null 2>&1" 0 trap "kill $pid > /dev/null 2>&1" 0
done done
echo -n "Executing test '$testcase' ... " for task in $tasks; do
$busconsole client.lua $testcase echo -n "Executing task '$task' of test '$testcase' ... "
echo "OK" $busconsole $task.lua $testcase
echo "OK"
done
cd ../../test cd ../../test
echo -n "Test protocol with server of test '$testcase' ... " echo -n "Test protocol with server of test '$testcase' ... "
$busconsole openbus/test/Protocol.lua $busconsole openbus/test/Protocol.lua
......
...@@ -9,10 +9,6 @@ settestcfg(...) ...@@ -9,10 +9,6 @@ settestcfg(...)
-- setup the ORB -- setup the ORB
local orb = openbus.initORB(orbcfg) 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 -- get bus context manager
local OpenBusContext = orb.OpenBusContext local OpenBusContext = orb.OpenBusContext
...@@ -27,20 +23,15 @@ local secret = OpenBusContext:decodeSharedAuth(waitfile(sharedauthfile)) ...@@ -27,20 +23,15 @@ local secret = OpenBusContext:decodeSharedAuth(waitfile(sharedauthfile))
-- login to the bus -- login to the bus
conn:loginBySharedAuth(secret) conn:loginBySharedAuth(secret)
-- define service properties -- check identity
local props = {{name="openbus.component.interface",value=iface.repID}} local langs = {
java = true,
-- find the offered service cpp = true,
log:TEST("retrieve hello service") csharp = true,
local OfferRegistry = OpenBusContext:getOfferRegistry() lua = true,
for _, offer in ipairs(findoffers(OfferRegistry, props)) do }
local entity = getprop(offer.properties, "openbus.offer.entity") local lang = string.match(conn.login.entity, "interop_sharedauth_(.+)_client")
log:TEST("found service of ",entity,"!") assert(langs[lang] ~= nil)
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
-- logout from the bus -- logout from the bus
conn:logout() conn:logout()
......
local openbus = require "openbus" local openbus = require "openbus"
local log = require "openbus.util.logger" local log = require "openbus.util.logger"
local ComponentContext = require "scs.core.ComponentContext"
local oil = require "oil" local oil = require "oil"
require "openbus.test.util" require "openbus.test.util"
...@@ -11,43 +10,15 @@ settestcfg(...) ...@@ -11,43 +10,15 @@ settestcfg(...)
-- setup and start the ORB -- setup and start the ORB
local orb = openbus.initORB(orbcfg) 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 -- get bus context manager
local OpenBusContext = orb.OpenBusContext 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 -- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport) local conn = OpenBusContext:createConnection(bushost, busport)
OpenBusContext:setDefaultConnection(conn) OpenBusContext:setDefaultConnection(conn)
-- login to the bus -- login to the bus
conn:loginByCertificate(system, assert(openbus.readKeyFile(syskey))) conn:loginByPassword(user, password)
-- offer service
local OfferRegistry = OpenBusContext:getOfferRegistry()
OfferRegistry:registerService(component.IComponent, properties)
log:TEST("hello service ready!")
-- serialize shared authentication data -- serialize shared authentication data
local secret = conn:startSharedAuth() local secret = conn:startSharedAuth()
...@@ -55,3 +26,7 @@ local encoded = OpenBusContext:encodeSharedAuth(secret) ...@@ -55,3 +26,7 @@ local encoded = OpenBusContext:encodeSharedAuth(secret)
assert(oil.writeto(sharedauthfile, encoded, "wb")) assert(oil.writeto(sharedauthfile, encoded, "wb"))
log:TEST("shared authentication data written to file!") 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