Commit 5ad5ded7 authored by Renato Figueiro Maia's avatar Renato Figueiro Maia

[OPENBUS-2535] Adicionar suporte SSL no núcleo do barramento

- Renomando parâmetro de configuração de habilita o uso de SSL no núcleo do barramento.
- Adaptando as implementações de assistente para permitir conexão por referência.
- Ajuste nos testes para que funcionem com suporte SSL.

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/sdk/lua/trunk@159736 ae0415b3-e90b-0410-900d-d0be9363c56b
parent a7ca0cde
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
require "openbus.test.util"
......@@ -17,7 +18,9 @@ local iface = orb.types:lookup("tecgraf::openbus::interop::chaining::HelloProxy"
local OpenBusContext = orb.OpenBusContext
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local sysex = require "openbus.util.sysex"
local ComponentContext = require "scs.core.ComponentContext"
......@@ -72,7 +73,9 @@ local component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, hello)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local sysex = require "openbus.util.sysex"
local ComponentContext = require "scs.core.ComponentContext"
......@@ -48,7 +49,9 @@ local component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, hello)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
local table = require "loop.table"
......@@ -50,7 +51,9 @@ local component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, Broadcaster)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
require "openbus.test.util"
......@@ -17,7 +18,9 @@ local iface = orb.types:lookup("tecgraf::openbus::interop::delegation::Messenger
local OpenBusContext = orb.OpenBusContext
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
local table = require "loop.table"
local Timer = require "cothread.Timer"
......@@ -72,7 +73,9 @@ component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, Forwarder)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
local table = require "loop.table"
......@@ -47,7 +48,9 @@ local component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, Messenger)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local table = require "loop.table"
require "openbus.test.util"
......@@ -21,12 +22,14 @@ local OpenBusContext = orb.OpenBusContext
properties[#properties+1] =
{name="openbus.component.interface",value=iface.repID}
busref = assert(util.readfrom(busref, "r"))
bus2ref = assert(util.readfrom(bus2ref, "r"))
for _, businfo in ipairs{
{host=bushost, port=busport, offers=3},
{host=bus2host, port=bus2port, offers=1},
{ref=orb:newproxy(busref, nil, "::scs::core::IComponent"), offers=3},
{ref=orb:newproxy(bus2ref, nil, "::scs::core::IComponent"), offers=1},
} do
-- connect to the bus
local conn = OpenBusContext:createConnection(businfo.host, businfo.port)
local conn = OpenBusContext:connectByReference(businfo.ref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
require "openbus.test.util"
-- setup and start the ORBs
-- customize test configuration for this case
settestcfg(...)
-- setup and start the ORBs
local orb1 = openbus.initORB(orbcfg)
settestcfg(...)
local orb2 = openbus.initORB(orbcfg)
-- load interface definition
......@@ -43,10 +45,16 @@ component1:addFacet(iface.name, iface.repID, hello)
component2:addFacet(iface.name, iface.repID, hello)
-- connect to the buses
local conn1AtBus1WithOrb1 = OpenBusContext1:createConnection(bushost, busport)
local conn2AtBus1WithOrb1 = OpenBusContext1:createConnection(bushost, busport)
local connAtBus2WithOrb1 = OpenBusContext1:createConnection(bus2host, bus2port)
local connAtBus1WithOrb2 = OpenBusContext2:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
bus2ref = assert(util.readfrom(bus2ref, "r"))
local bus1 = orb1:newproxy(busref, nil, "::scs::core::IComponent")
local conn1AtBus1WithOrb1 = OpenBusContext1:connectByReference(bus1)
local conn2AtBus1WithOrb1 = OpenBusContext1:connectByReference(bus1)
local connAtBus2WithOrb1 = OpenBusContext1:connectByReference(
orb1:newproxy(bus2ref, nil, "::scs::core::IComponent"))
local connAtBus1WithOrb2 = OpenBusContext2:connectByReference(
orb2:newproxy(busref, nil, "::scs::core::IComponent"))
-- set incoming connections
function OpenBusContext1:onCallDispatch(busid, login, objkey, operation, ...)
......
......@@ -2,6 +2,7 @@ local openbus = require "openbus"
local idl = require "openbus.core.idl"
local log = require "openbus.util.logger"
local except = require "openbus.util.except"
local util = require "openbus.util.server"
require "openbus.test.util"
......@@ -20,7 +21,9 @@ local iface = orb.types:lookup("tecgraf::openbus::interop::protocol::Server")
local OpenBusContext = orb.OpenBusContext
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
-- create service implementation
......@@ -64,7 +65,9 @@ component._facets[iface.name] = {
component[iface.name] = servant
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
require "openbus.test.util"
......@@ -17,7 +18,9 @@ local iface = orb.types:lookup("tecgraf::openbus::interop::simple::Hello")
local OpenBusContext = orb.OpenBusContext
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
local table = require "loop.table"
......@@ -61,7 +62,9 @@ local component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, hello)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
local table = require "loop.table"
......@@ -42,7 +43,9 @@ local component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, hello)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
require "openbus.test.util"
......@@ -17,7 +18,9 @@ local iface = orb.types:lookup("tecgraf::openbus::interop::simple::Hello")
local OpenBusContext = orb.OpenBusContext
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- read shared authentication data
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
local oil = require "oil"
......@@ -37,7 +38,9 @@ local component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, hello)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
require "openbus.test.util"
......@@ -17,7 +18,9 @@ local iface = orb.types:lookup("tecgraf::openbus::interop::simple::Hello")
local OpenBusContext = orb.OpenBusContext
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
local openbus = require "openbus"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local ComponentContext = require "scs.core.ComponentContext"
require "openbus.test.util"
......@@ -36,7 +37,9 @@ local component = ComponentContext(orb, {
component:addFacet(iface.name, iface.repID, hello)
-- connect to the bus
local conn = OpenBusContext:createConnection(bushost, busport)
busref = assert(util.readfrom(busref, "r"))
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
OpenBusContext:setDefaultConnection(conn)
-- login to the bus
......
......@@ -1114,6 +1114,8 @@ argcheck.convertclass(Connection, {
})
local ContextOperations = {
createConnection = { "string", "number|string", "nil|table" },
connectByAddress = { "string", "number|string", "nil|table" },
connectByReference = { "table", "nil|table" },
setDefaultConnection = { "nil|table" },
getDefaultConnection = {},
setCurrentConnection = { "nil|table" },
......
......@@ -128,11 +128,11 @@ function Assistant:__init()
local conn = createConnection{
interval = interval,
orb = self.orb,
busref = self.busref,
bushost = self.bushost,
busport = self.busport,
accesskey = self.accesskey,
nolegacy = self.nolegacy,
legacydelegate = self.legacydelegate,
observer = self.observer ~= nil and Observer{observer=self.observer} or nil,
}
if self.orb == nil then self.orb = conn.orb end
......
......@@ -326,7 +326,12 @@ local Assistant = class{ interval = 5 }
function Assistant:__init()
if self.orb == nil then self.orb = initORB() end
local OpenBusContext = assert(self.orb.OpenBusContext, "invalid ORB")
local conn = OpenBusContext:createConnection(self.bushost, self.busport, self)
local conn
if self.busref ~= nil then
conn = OpenBusContext:connectByReference(self.busref, self)
else
conn = OpenBusContext:connectByAddress(self.bushost, self.busport, self)
end
--if OpenBusContext:getDefaultConnection() == nil then
-- OpenBusContext:setDefaultConnection(conn)
--end
......@@ -502,8 +507,9 @@ argcheck.convertclass(Assistant, {
})
argcheck.convertmodule(module, {
create = {
bushost = "string",
busport = "number|string",
busref = "nil|table",
bushost = "nil|string",
busport = "nil|number|string",
},
newSearchProps = { "string", "string" },
getProperty = { "table", "string" },
......
......@@ -6,19 +6,23 @@ local openbus = require "openbus"
local libidl = require "openbus.idl"
local idl = require "openbus.core.idl"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local sysex = giop.SystemExceptionIDs
bushost, busport, verbose = ...
require "openbus.test.configs"
require "openbus.test.util"
setorbcfg(...)
busref = assert(util.readfrom(busref, "r"))
syskey = assert(openbus.readKeyFile(syskey))
local connprops = { accesskey = openbus.newKey() }
local orb = openbus.initORB()
local orb = openbus.initORB(orbcfg)
local OpenBusContext = orb.OpenBusContext
assert(OpenBusContext.orb == orb)
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
do log:TEST("Encode illegal argument")
local illegalchains = {
......@@ -101,9 +105,9 @@ do log:TEST("Decode malformed chain")
end
do log:TEST("Encode and decode chains")
local conn1 = OpenBusContext:createConnection(bushost, busport, connprops)
local conn1 = OpenBusContext:connectByReference(busref, connprops)
conn1:loginByPassword(user, password, domain)
local conn2 = OpenBusContext:createConnection(bushost, busport, connprops)
local conn2 = OpenBusContext:connectByReference(busref, connprops)
conn2:loginByCertificate(system, syskey)
assert(conn1.busid == conn2.busid)
local busid = conn1.busid
......
......@@ -16,20 +16,25 @@ local libidl = require "openbus.idl"
local idl = require "openbus.core.idl"
local msg = require "openbus.util.messages"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local sysex = giop.SystemExceptionIDs
bushost, busport, verbose = ...
require "openbus.test.configs"
require "openbus.test.util"
setorbcfg(...)
busref = assert(util.readfrom(busref, "r"))
local smalltime = .1
local connprops = { accesskey = openbus.newKey() }
-- login as admin and provide additional functionality for the test
local invalidate, shutdown do
local orb = openbus.initORB()
local orb = openbus.initORB(orbcfg)
local OpenBusContext = orb.OpenBusContext
local conn = OpenBusContext:createConnection(bushost, busport)
local busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
conn:loginByPassword(admin, admpsw, domain)
OpenBusContext:setDefaultConnection(conn)
function invalidate(loginId)
......@@ -41,13 +46,14 @@ local invalidate, shutdown do
end
end
local orb = openbus.initORB()
local orb = openbus.initORB(orbcfg)
local OpenBusContext = orb.OpenBusContext
assert(OpenBusContext.orb == orb)
local busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
do log:TEST("Two threads logging in")
local conn = OpenBusContext:createConnection(bushost, busport, connprops)
local conn = OpenBusContext:connectByReference(busref, connprops)
local failures = 0
local threads = 2
local function trylogin()
......@@ -73,7 +79,7 @@ do log:TEST("Two threads logging in")
end
do log:TEST("Two threads getting invalid login")
local conn = OpenBusContext:createConnection(bushost, busport, connprops)
local conn = OpenBusContext:connectByReference(busref, connprops)
conn:loginByPassword(user, password, domain)
OpenBusContext:setDefaultConnection(conn)
local OfferRegistry = OpenBusContext:getOfferRegistry()
......@@ -126,7 +132,7 @@ do log:TEST("Two threads getting invalid login")
end
do log:TEST("Two threads getting invalid login while other relogs")
local conn = OpenBusContext:createConnection(bushost, busport, connprops)
local conn = OpenBusContext:connectByReference(busref, connprops)
conn:loginByPassword(user, password, domain)
OpenBusContext:setDefaultConnection(conn)
local OfferRegistry = OpenBusContext:getOfferRegistry()
......@@ -174,7 +180,7 @@ do log:TEST("Two threads getting invalid login while other relogs")
end
do log:TEST("Two threads getting invalid login and trying to relog")
local conn = OpenBusContext:createConnection(bushost, busport, connprops)
local conn = OpenBusContext:connectByReference(busref, connprops)
conn:loginByPassword(user, password, domain)
OpenBusContext:setDefaultConnection(conn)
local OfferRegistry = OpenBusContext:getOfferRegistry()
......
......@@ -5,26 +5,30 @@ local giop = require "oil.corba.giop"
local openbus = require "openbus"
local idl = require "openbus.core.idl"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local sysex = giop.SystemExceptionIDs
bushost, busport, verbose = ...
require "openbus.test.configs"
require "openbus.test.util"
setorbcfg(...)
busref = assert(util.readfrom(busref, "r"))
syskey = assert(openbus.readKeyFile(syskey))
local connprops = { accesskey = openbus.newKey() }
local orb = openbus.initORB()
local orb = openbus.initORB(orbcfg)
local OpenBusContext = orb.OpenBusContext
assert(OpenBusContext.orb == orb)
busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local FakeEntity = "FakeEntity"
for _, count in ipairs{0, 1, 10, 100} do
log:TEST("Import chain with "..count.." originators from token")
local conn = OpenBusContext:createConnection(bushost, busport, connprops)
local conn = OpenBusContext:connectByReference(busref, connprops)
conn:loginByPassword(user, password, domain)
local busid = conn.busid
local login = conn.login.id
......@@ -71,7 +75,7 @@ for _, count in ipairs{0, 1, 10, 100} do
end
do log:TEST("Fail to import chain from token of unknown domain")
local conn = OpenBusContext:createConnection(bushost, busport, connprops)
local conn = OpenBusContext:connectByReference(busref, connprops)
conn:loginByPassword(user, password, domain)
OpenBusContext:setDefaultConnection(conn)
......@@ -86,7 +90,7 @@ do log:TEST("Fail to import chain from token of unknown domain")
end
do log:TEST("Fail to import chain from invalid token")
local conn = OpenBusContext:createConnection(bushost, busport, connprops)
local conn = OpenBusContext:connectByReference(busref, connprops)
conn:loginByPassword(user, password, domain)
OpenBusContext:setDefaultConnection(conn)
......
......@@ -16,9 +16,14 @@ local libidl = require "openbus.idl"
local idl = require "openbus.core.idl"
local msg = require "openbus.util.messages"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
require "openbus.test.configs"
require "openbus.test.util"
setorbcfg(...)
busref = assert(util.readfrom(busref, "r"))
bus2ref = assert(util.readfrom(bus2ref, "r"))
syskey = assert(openbus.readKeyFile(syskey))
local thread = coroutine.running()
......@@ -28,7 +33,7 @@ local sleep = cothread.delay
local sysex = giop.SystemExceptionIDs
local entity = nil -- defined later
local orb = openbus.initORB()
local orb = openbus.initORB(orbcfg)
local OpenBusContext = orb.OpenBusContext
assert(OpenBusContext.orb == orb)
local conns = {}
......@@ -122,55 +127,67 @@ local function assertlogoff(conn, invalid)
return conn
end
log:TEST(true, "ConnectionManager::createConnection")
log:TEST(true, "ConnectionManager::connectByAddress")
do log:TEST "connect with invalid host"
for _, invalid in ipairs{true,false,123,{},error,thread,userdata} do
local badtype = type(invalid)
local ex = catcherr(OpenBusContext.createConnection, OpenBusContext, invalid, busport)
assert(ex:match("bad argument #2 to 'createConnection' %(expected string, got "..badtype.."%)$"))
local ex = catcherr(OpenBusContext.connectByAddress, OpenBusContext, invalid, busport)
assert(ex:match("bad argument #2 to 'connectByAddress' %(expected string, got "..badtype.."%)$"))
end
end
do log:TEST "connect with invalid port"
for _, invalid in ipairs{true,false,{},error,thread,userdata} do
local badtype = type(invalid)
local ex = catcherr(OpenBusContext.createConnection, OpenBusContext, bushost, invalid)
assert(ex:match("bad argument #3 to 'createConnection' %(expected number|string, got "..badtype.."%)$"))
local ex = catcherr(OpenBusContext.connectByAddress, OpenBusContext, bushost, invalid)
assert(ex:match("bad argument #3 to 'connectByAddress' %(expected number|string, got "..badtype.."%)$"))
end
end
do log:TEST "connect with invalid properties"
for _, invalid in ipairs{true,false,123,"nolegacy",error,thread,userdata} do
local badtype = type(invalid)
local ex = catcherr(OpenBusContext.createConnection, OpenBusContext, bushost, busport, invalid)
assert(ex:match("bad argument #4 to 'createConnection' %(expected nil|table, got "..badtype.."%)$"))
local ex = catcherr(OpenBusContext.connectByAddress, OpenBusContext, bushost, busport, invalid)
assert(ex:match("bad argument #4 to 'connectByAddress' %(expected nil|table, got "..badtype.."%)$"))
end
end
do log:TEST "connect to unavailable host"
local conn = OpenBusContext:createConnection("unavailable", busport)
local conn = OpenBusContext:connectByAddress("unavailable", busport)
for op, params in pairs(loginways) do
local ex = catcherr(conn[op], conn, params())
assert(ex._repid == sysex.TRANSIENT)
assert(ex.completed == "COMPLETED_NO")
if orbcfg.options.security == "required" then
assert(ex._repid == sysex.NO_PERMISSION)
assert(ex.completed == "COMPLETED_NO")
else
assert(ex._repid == sysex.TRANSIENT)
assert(ex.completed == "COMPLETED_NO")
end
end
end
do log:TEST "connect to unavailable port"
local conn = OpenBusContext:createConnection(bushost, 0)
local conn = OpenBusContext:connectByAddress(bushost, 0)
for op, params in pairs(loginways) do
local ex = catcherr(conn[op], conn, params())
assert(ex._repid == sysex.TRANSIENT)
assert(ex.completed == "COMPLETED_NO")
if orbcfg.options.security == "required" then
assert(ex._repid == sysex.NO_PERMISSION)
assert(ex.completed == "COMPLETED_NO")
else
assert(ex._repid == sysex.TRANSIENT)
assert(ex.completed == "COMPLETED_NO")
end
end
end
do log:TEST "connect to bus"
local bus = orb:newproxy(busref, nil, "::scs::core::IComponent")
local bus2 = orb:newproxy(bus2ref, nil, "::scs::core::IComponent")
for i = 1, 2 do
conns[i] = assertlogoff(OpenBusContext:createConnection(bushost, busport))
conns[i] = assertlogoff(OpenBusContext:connectByReference(bus))
end
otherBusConn = OpenBusContext:createConnection(bus2host, bus2port)
otherBusConn = OpenBusContext:connectByReference(bus2)
end
-- create a valid key to be used as a wrong key in the tests below.
......@@ -179,9 +196,10 @@ end
local WrongKey = openbus.newKey()
-- login as admin and provide additional functionality for the test
local invalidate, shutdown, leasetime do
local orb = openbus.initORB()
local orb = openbus.initORB(orbcfg)
local OpenBusContext = orb.OpenBusContext
local conn = OpenBusContext:createConnection(bushost, busport)
local busref = orb:newproxy(busref, nil, "::scs::core::IComponent")
local conn = OpenBusContext:connectByReference(busref)
conn:loginByPassword(admin, admpsw, domain)
OpenBusContext:setDefaultConnection(conn)
busid = conn.busid
......
......@@ -5,26 +5,30 @@ local giop = require "oil.corba.giop"
local openbus = require "openbus"
local idl = require "openbus.core.idl"
local log = require "openbus.util.logger"
local util = require "openbus.util.server"
local sysex = giop.SystemExceptionIDs
bushost, busport, verbose = ...
require "openbus.test.configs"
require "openbus.test.util"
setorbcfg(...)
busref = assert(util.readfrom(busref, "r"))
syskey = assert(openbus.readKeyFile(syskey))
local connprops = { accesskey = openbus.newKey() }