Commit c759b0cd authored by Renato Figueiro Maia's avatar Renato Figueiro Maia
Browse files

[OPENBUS-2577] Método findServices retorna conjunto errado de ofertas

- Adição de teste automático para exercitar o bug encontrado.
- Uso de GOTO de Lua 5.2 na correção do bug.

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/branches/02_00_00@156904 ae0415b3-e90b-0410-900d-d0be9363c56b
parent c1a7aa4e
......@@ -90,14 +90,13 @@ function PropertyIndex:find(properties)
-- select the objects from the minimum set that are also present
-- in the other sets (i.e. satisfy all other properties)
for object in pairs(min) do
local exclude
for index = 1, count-1 do
exclude = (sets[index][object]==nil)
if exclude then break end
end
if not exclude then
found[#found+1] = object
if sets[index][object]==nil then
goto continue
end
end
found[#found+1] = object
::continue::
end
end
return found
......
......@@ -219,6 +219,14 @@ local function isOfferRegSubscription(observer, properties)
end
end
local function getProperty(list, name)
for _, prop in ipairs(list) do
if prop.name == name then
return prop.value
end
end
end
local OffersFixture = cached.class({}, IdentityFixture)
......@@ -667,13 +675,6 @@ return OpenBusFixture{
checks.assert(#found, checks.equal(1))
checks.assert(found[1], isServiceOfferDesc(comp, login, props2))
local function getProperty(list, name)
for _, prop in ipairs(list) do
if prop.name == name then
return prop.value
end
end
end
found = offers:findServices(SomeOfferProps)
checks.assert(#found, checks.equal(3))
for _, offer in ipairs(found) do
......@@ -702,6 +703,30 @@ return OpenBusFixture{
minor = 0,
})
end,
JIRA_OPENBUS_2577 = function (fixture, openbus)
local conn = fixture.system or openbus.context:getCurrentConnection()
local login = conn.login
local offers = fixture.offers
local comp = fixture.component
local offer1 = offers:registerService(comp.IComponent, {
{name="prop1", value="value1"},
{name="prop2", value="YYYYYY"},
{name="prop3", value="XXXXXX"},
})
local offer2 = offers:registerService(comp.IComponent, {
{name="prop1", value="ZZZZZZ"},
{name="prop2", value="value2"},
{name="prop3", value="XXXXXX"},
})
-- search first service offer
local props = {
{name="prop1", value="value1"},
{name="prop3", value="XXXXXX"},
{name="prop2", value="value2"},
}
local found = offers:findServices(props)
checks.assert(#found, checks.equal(0))
end,
},
},
AsClient = OffersFixture{
......
Supports Markdown
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