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

[OPENBUS-2184] Adaptação do código para ser compatível também com Lua 5.2

- Correção para permitir carregar arquivos binários (certificados) corretamente no Windows (leitura como texto suprime o \r seguido de \n).

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/branches/02_00_00@147772 ae0415b3-e90b-0410-900d-d0be9363c56b
parent b0917b81
......@@ -799,7 +799,7 @@ handlers["add-certificate"] = function(cmd)
end
local certificate = cmd.params.certificate
local f = io.open(certificate)
local f = io.open(certificate, "rb")
if not f then
print("[ERRO] Não foi possível localizar arquivo de certificado")
return false
......
......@@ -81,7 +81,7 @@ end
function NoPermissionCase.testRegisterCertificateNoPermission(self)
local certificates = OpenBusContext:getCertificateRegistry()
local file = io.open(certificate)
local file = assert(io.open(certificate, "rb"))
local cert = file:read("*a")
file:close()
local ok, err = pcall(certificates.registerCertificate, certificates, "random",
......@@ -142,7 +142,7 @@ end
function InvalidParamCase.testRegisterInvalidCertificate(self)
local certs = self.certs
local file = io.open(certificate)
local file = assert(io.open(certificate, "rb"))
local read = file:read("*a")
read = "\n--CORRUPTED!--\n" .. read
local ok, err = pcall(certs.registerCertificate, certs, "unknown", read)
......@@ -186,7 +186,7 @@ end
function CRCase.testRegisterRemoveCertificate(self)
local certs = self.certs
local file = io.open(certificate)
local file = assert(io.open(certificate, "rb"))
local read = file:read("*a")
file:close()
certs:registerCertificate("test-1", read)
......@@ -195,7 +195,7 @@ end
function CRCase.testRegisterGetRemoveCertificate(self)
local certs = self.certs
local file = io.open(certificate)
local file = assert(io.open(certificate, "rb"))
local read = file:read("*a")
file:close()
certs:registerCertificate("test-2", read)
......@@ -206,7 +206,7 @@ end
function CRCase.testRegisterCertificateTwice(self)
local certs = self.certs
local file = io.open(certificate)
local file = assert(io.open(certificate, "rb"))
local read = file:read("*a")
file:close()
certs:registerCertificate("test-3", read)
......@@ -227,7 +227,7 @@ function CRCase.testGetListWithManyEntitiesWithCertificate(self)
prevcount = index
end
-- register some new certificates
local file = io.open(certificate)
local file = assert(io.open(certificate, "rb"))
local read = file:read("*a")
file:close()
local count = 3
......
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