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

[OPENBUS-2237] Após cadastrar uma categoria com ID vazio, ao reiniciar o...

[OPENBUS-2237] Após cadastrar uma categoria com ID vazio, ao reiniciar o barramento, ocorre uma falha e é interrompida a inicialização



git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/branches/02_00_00@144392 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 9e4a235d
......@@ -33,6 +33,7 @@ local log = require "openbus.util.logger"
local oo = require "openbus.util.oo"
local class = oo.class
local sysex = require "openbus.util.sysex"
local BAD_PARAM = sysex.BAD_PARAM
local idl = require "openbus.core.idl"
local assert = idl.serviceAssertion
......@@ -336,7 +337,7 @@ end
function Offer:subscribeObserver(observer)
if observer == nil then
sysex.BAD_PARAM{ completed = "COMPLETED_NO", minor = 0 }
BAD_PARAM{ completed = "COMPLETED_NO", minor = 0 }
end
local registry = self.registry
local offerid = self.id
......@@ -618,7 +619,7 @@ end
function OfferRegistry:subscribeObserver(observer, properties)
if observer == nil then
sysex.BAD_PARAM{ completed = "COMPLETED_NO", minor = 0 }
BAD_PARAM{ completed = "COMPLETED_NO", minor = 0 }
end
local login = self.access:getCallerChain().caller.id
local id = newid("time")
......@@ -860,6 +861,9 @@ function Category:removeAll()
end
function Category:registerEntity(id, name)
if id == "" then
BAD_PARAM{ completed = "COMPLETED_NO", minor = 0 }
end
local categoryId = self.id
local entities = self.entities
-- check if category already exists
......@@ -970,6 +974,9 @@ function EntityRegistry:__init(data)
end
function EntityRegistry:createEntityCategory(id, name)
if id == "" then
BAD_PARAM{ completed = "COMPLETED_NO", minor = 0 }
end
local categories = self.categories
-- check if category already exists
local category = categories[id]
......
......@@ -3,6 +3,9 @@ local pcall = _G.pcall
local io = require "io"
local giop = require "oil.corba.giop"
local sysex = giop.SystemExceptionIDs
local openbus = require "openbus"
local idl = require "openbus.core.idl"
local UnauthorizedOperation = idl.types.services.UnauthorizedOperation
......@@ -267,6 +270,16 @@ function Case.testGetEntity(self)
Check.assertEquals(1, #entSeq)
end
function Case.testCreateEmptyIds(self)
local entities = OpenBusContext:getEntityRegistry()
local ok, err = pcall(entities.createEntityCategory, entities, "", "")
Check.assertFalse(ok)
Check.assertEquals(sysex.BAD_PARAM, err._repid)
local ok, err = pcall(self.category.registerEntity, self.category, "", "")
Check.assertFalse(ok)
Check.assertEquals(sysex.BAD_PARAM, err._repid)
end
function Case.testCreateTwice(self)
local entities = OpenBusContext:getEntityRegistry()
local ok, err = pcall(entities.createEntityCategory, entities,
......
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