Commit 88e54c4e authored by Renato Figueiro Maia's avatar Renato Figueiro Maia
Browse files

[OPENBUS-2089] Relaxar o critério das propriedades reservadas

- Ajuste dos testes.



git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/trunk@135143 ae0415b3-e90b-0410-900d-d0be9363c56b
parent eaa89c05
......@@ -68,6 +68,23 @@ local ComponentId = {
platform_spec = "none",
}
local ReservedProperties = {
["openbus.offer.id"] = true,
["openbus.offer.login"] = true,
["openbus.offer.entity"] = true,
["openbus.offer.timestamp"] = true,
["openbus.offer.year"] = true,
["openbus.offer.month"] = true,
["openbus.offer.day"] = true,
["openbus.offer.hour"] = true,
["openbus.offer.minute"] = true,
["openbus.offer.second"] = true,
["openbus.component.name"] = true,
["openbus.component.version.major"] = true,
["openbus.component.version.minor"] = true,
["openbus.component.version.patch"] = true,
}
-- Funes auxiliares ---------------------------------------------------------
local function assertCondOrTimeout(condition,timeout)
if timeout == nil then timeout = 2 end
......@@ -309,10 +326,14 @@ function InvalidParamCase.testRegisterInvalidProperties(self)
local orb = self.conn.orb
local context = createPingComponent(orb)
local comp = context.IComponent
local props = { {name="openbus.myname", value="ping"}, }
local ok, err = pcall(self.offers.registerService, self.offers, comp, props)
Check.assertTrue(not ok)
Check.assertEquals(offertypes.InvalidProperties, err._repid)
for reservedname in pairs(ReservedProperties) do
local props = { {name=reservedname, value="blah"}, }
local ok, err = pcall(self.offers.registerService, self.offers, comp, props)
Check.assertTrue(not ok)
Check.assertEquals(offertypes.InvalidProperties, err._repid)
Check.assertTrue(isContained(props, err.properties))
Check.assertTrue(isContained(err.properties, props))
end
end
function InvalidParamCase.testRegisterUnauthorizedFacets(self)
......@@ -460,15 +481,15 @@ function ServiceOfferCase.testSetProperties(self)
end
function ServiceOfferCase.testInvalidProperties(self)
local invalidProps = {
{ name="openbus.reserved.name", value="should fail"},
}
local ok, err = pcall(self.serviceOffer.setProperties, self.serviceOffer,
invalidProps)
Check.assertTrue(not ok)
Check.assertEquals(offertypes.InvalidProperties, err._repid)
Check.assertTrue(isContained(invalidProps, err.properties))
Check.assertTrue(isContained(err.properties, invalidProps))
for reservedname in pairs(ReservedProperties) do
local invalidProps = {{ name=reservedname, value="blah"}}
local ok, err = pcall(self.serviceOffer.setProperties, self.serviceOffer,
invalidProps)
Check.assertTrue(not ok)
Check.assertEquals(offertypes.InvalidProperties, err._repid)
Check.assertTrue(isContained(invalidProps, err.properties))
Check.assertTrue(isContained(err.properties, invalidProps))
end
end
function ServiceOfferCase.testRemoveProperties(self)
......
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