Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
314d9a78
Commit
314d9a78
authored
Jan 08, 2021
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[http-resolver]: minor fixes
parent
43a8ce2f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
36 deletions
+38
-36
testsuite.yml
.github/workflows/testsuite.yml
+0
-4
test_uresolver.cc
extensions/HttpResolver/tests/test_uresolver.cc
+2
-1
test_ui.cc
extensions/tests/test_ui.cc
+14
-13
UInterface.h
include/UInterface.h
+1
-7
UInterface.cc
src/Core/UInterface.cc
+21
-9
testsuite.at
testsuite/testsuite.at
+0
-1
uniset2.files
uniset2.files
+0
-1
No files found.
.github/workflows/testsuite.yml
View file @
314d9a78
...
...
@@ -19,10 +19,6 @@ jobs:
libcomedi-devel libmariadb-devel libpqxx-devel librrd-devel libsqlite3-devel \
libxml2-devel libsigc++2-devel libpoco-devel libev-devel libomniORB-devel libmosquitto-devel \
xsltproc python-devel python-module-distribute libomniORB-names libomniORB-idl libomniORB-utils
-
name
:
prepare builder
run
:
|
useradd builder
su - builder
-
uses
:
actions/checkout@v2
-
name
:
configure
run
:
|
...
...
extensions/HttpResolver/tests/test_uresolver.cc
View file @
314d9a78
...
...
@@ -46,7 +46,8 @@ TEST_CASE("HttpResolver: resolve", "[httpresolver][ui]")
InitTest
();
REQUIRE_NOTHROW
(
ui
->
resolve
(
TestProc
,
Node1
)
);
REQUIRE_THROWS_AS
(
ui
->
resolve
(
DefaultObjectId
,
Node1
),
uniset
::
ResolveNameError
);
REQUIRE_NOTHROW
(
ui
->
resolve
(
"UNISET_PLC/UniObjects/TestProc"
)
);
REQUIRE_THROWS_AS
(
ui
->
resolve
(
DefaultObjectId
,
Node1
),
uniset
::
ResolveNameError
&
);
REQUIRE
(
ui
->
isExist
(
TestProc
,
Node1
)
);
}
// -----------------------------------------------------------------------------
...
...
extensions/tests/test_ui.cc
View file @
314d9a78
...
...
@@ -47,14 +47,14 @@ TEST_CASE("UInterface", "[UInterface]")
SECTION
(
"GET/SET"
)
{
REQUIRE_THROWS_AS
(
ui
->
getValue
(
DefaultObjectId
),
uniset
::
ORepFailed
);
REQUIRE_THROWS_AS
(
ui
->
getValue
(
DefaultObjectId
),
uniset
::
ORepFailed
&
);
REQUIRE_NOTHROW
(
ui
->
setValue
(
sid
,
1
)
);
REQUIRE
(
ui
->
getValue
(
sid
)
==
1
);
REQUIRE_NOTHROW
(
ui
->
setValue
(
sid
,
100
)
);
REQUIRE
(
ui
->
getValue
(
sid
)
==
100
);
// хоть это и дискретный датчик.. функция-то универсальная..
REQUIRE_THROWS_AS
(
ui
->
getValue
(
sid
,
DefaultObjectId
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
->
getValue
(
sid
,
100
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
->
getValue
(
sid
,
DefaultObjectId
),
uniset
::
Exception
&
);
REQUIRE_THROWS_AS
(
ui
->
getValue
(
sid
,
100
),
uniset
::
Exception
&
);
REQUIRE_NOTHROW
(
ui
->
setValue
(
aid
,
10
)
);
REQUIRE
(
ui
->
getValue
(
aid
)
==
10
);
...
...
@@ -67,16 +67,16 @@ TEST_CASE("UInterface", "[UInterface]")
REQUIRE_NOTHROW
(
ui
->
fastSetValue
(
si
,
20
,
DefaultObjectId
)
);
REQUIRE
(
ui
->
getValue
(
aid
)
==
20
);
REQUIRE_THROWS_AS
(
ui
->
getValue
(
aid
,
-
2
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
->
getValue
(
aid
,
-
2
),
uniset
::
Exception
&
);
si
.
id
=
sid
;
REQUIRE_NOTHROW
(
ui
->
setValue
(
si
,
15
,
DefaultObjectId
)
);
REQUIRE
(
ui
->
getValue
(
sid
)
==
15
);
si
.
node
=
-
2
;
REQUIRE_THROWS_AS
(
ui
->
setValue
(
si
,
20
,
DefaultObjectId
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
->
setValue
(
si
,
20
,
DefaultObjectId
),
uniset
::
Exception
&
);
REQUIRE_THROWS_AS
(
ui
->
getTimeChange
(
sid
,
DefaultObjectId
),
uniset
::
ORepFailed
);
REQUIRE_THROWS_AS
(
ui
->
getTimeChange
(
sid
,
DefaultObjectId
),
uniset
::
ORepFailed
&
);
REQUIRE_NOTHROW
(
ui
->
getTimeChange
(
sid
,
conf
->
getLocalNode
())
);
si
.
id
=
aid
;
...
...
@@ -96,8 +96,9 @@ TEST_CASE("UInterface", "[UInterface]")
SECTION
(
"resolve"
)
{
REQUIRE_NOTHROW
(
ui
->
resolve
(
sid
)
);
REQUIRE_THROWS_AS
(
ui
->
resolve
(
sid
,
10
),
uniset
::
ResolveNameError
);
REQUIRE_THROWS_AS
(
ui
->
resolve
(
sid
,
DefaultObjectId
),
uniset
::
ResolveNameError
);
REQUIRE_THROWS_AS
(
ui
->
resolve
(
sid
,
10
),
uniset
::
ResolveNameError
&
);
REQUIRE_THROWS_AS
(
ui
->
resolve
(
sid
,
DefaultObjectId
),
uniset
::
ResolveNameError
&
);
REQUIRE_NOTHROW
(
ui
->
resolve
(
"UNISET_PLC/Controllers/SharedMemory"
)
);
}
SECTION
(
"send"
)
...
...
@@ -163,17 +164,17 @@ TEST_CASE("UInterface", "[UInterface]")
SECTION
(
"ask"
)
{
REQUIRE_THROWS_AS
(
ui
->
askSensor
(
sid
,
UniversalIO
::
UIONotify
),
uniset
::
IOBadParam
);
REQUIRE_THROWS_AS
(
ui
->
askSensor
(
sid
,
UniversalIO
::
UIONotify
),
uniset
::
IOBadParam
&
);
REQUIRE_NOTHROW
(
ui
->
askSensor
(
sid
,
UniversalIO
::
UIONotify
,
testOID
)
);
REQUIRE_NOTHROW
(
ui
->
askSensor
(
aid
,
UniversalIO
::
UIONotify
,
testOID
)
);
REQUIRE_NOTHROW
(
ui
->
askSensor
(
aid
,
UniversalIO
::
UIODontNotify
,
testOID
)
);
REQUIRE_NOTHROW
(
ui
->
askSensor
(
sid
,
UniversalIO
::
UIODontNotify
,
testOID
)
);
REQUIRE_THROWS_AS
(
ui
->
askSensor
(
-
20
,
UniversalIO
::
UIONotify
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
->
askSensor
(
-
20
,
UniversalIO
::
UIONotify
),
uniset
::
Exception
&
);
REQUIRE_NOTHROW
(
ui
->
askRemoteSensor
(
sid
,
UniversalIO
::
UIONotify
,
conf
->
getLocalNode
(),
testOID
)
);
REQUIRE_NOTHROW
(
ui
->
askRemoteSensor
(
aid
,
UniversalIO
::
UIONotify
,
conf
->
getLocalNode
(),
testOID
)
);
REQUIRE_THROWS_AS
(
ui
->
askRemoteSensor
(
sid
,
UniversalIO
::
UIONotify
,
-
3
,
testOID
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
->
askRemoteSensor
(
sid
,
UniversalIO
::
UIONotify
,
-
3
,
testOID
),
uniset
::
Exception
&
);
uniset
::
IDList
lst
;
lst
.
add
(
aid
);
...
...
@@ -189,7 +190,7 @@ TEST_CASE("UInterface", "[UInterface]")
REQUIRE_NOTHROW
(
ui
->
askThreshold
(
aid
,
10
,
UniversalIO
::
UIONotify
,
90
,
100
,
false
,
testOID
)
);
REQUIRE_NOTHROW
(
ui
->
askThreshold
(
aid
,
11
,
UniversalIO
::
UIONotify
,
50
,
70
,
false
,
testOID
)
);
REQUIRE_NOTHROW
(
ui
->
askThreshold
(
aid
,
12
,
UniversalIO
::
UIONotify
,
20
,
40
,
false
,
testOID
)
);
REQUIRE_THROWS_AS
(
ui
->
askThreshold
(
aid
,
3
,
UniversalIO
::
UIONotify
,
50
,
20
,
false
,
testOID
),
IONotifyController_i
::
BadRange
);
REQUIRE_THROWS_AS
(
ui
->
askThreshold
(
aid
,
3
,
UniversalIO
::
UIONotify
,
50
,
20
,
false
,
testOID
),
IONotifyController_i
::
BadRange
&
);
IONotifyController_i
::
ThresholdsListSeq_var
slist
=
ui
->
getThresholdsList
(
aid
);
REQUIRE
(
slist
->
length
()
==
1
);
// количество датчиков с порогами = 1 (это aid)
...
...
@@ -212,7 +213,7 @@ TEST_CASE("UInterface", "[UInterface]")
REQUIRE
(
ti3
.
lowlimit
==
20
);
REQUIRE
(
ti3
.
hilimit
==
40
);
REQUIRE_THROWS_AS
(
ui
->
getThresholdInfo
(
sid
,
10
),
uniset
::
NameNotFound
);
REQUIRE_THROWS_AS
(
ui
->
getThresholdInfo
(
sid
,
10
),
uniset
::
NameNotFound
&
);
// проверяем thresholds который был сформирован из секции <thresholds>
ui
->
setValue
(
10
,
378
);
...
...
include/UInterface.h
View file @
314d9a78
...
...
@@ -167,13 +167,7 @@ namespace uniset
// throw(uniset::ORepFailed)
void
unregister
(
const
uniset
::
ObjectId
id
);
/*! получение ссылки на объект (по полному имени) */
inline
uniset
::
ObjectPtr
resolve
(
const
std
::
string
&
name
)
const
{
return
rep
.
resolve
(
name
);
}
// с поддержкой localIOR
uniset
::
ObjectPtr
resolve
(
const
std
::
string
&
name
)
const
;
uniset
::
ObjectPtr
resolve
(
const
uniset
::
ObjectId
id
)
const
;
// throw(uniset::ResolveNameError, uniset::TimeOut);
...
...
src/Core/UInterface.cc
View file @
314d9a78
...
...
@@ -922,7 +922,7 @@ namespace uniset
ostringstream
s
;
s
<<
uconf
<<
oind
->
getNodeName
(
node
);
string
nodeName
(
s
.
str
());
string
bname
(
nodeName
);
// сохраняем базовое название
const
string
bname
(
nodeName
);
// сохраняем базовое название
for
(
size_t
curNet
=
1
;
curNet
<=
uconf
->
getCountOfNet
();
curNet
++
)
{
...
...
@@ -1512,6 +1512,21 @@ namespace uniset
throw
uniset
::
TimeOut
(
set_err
(
"UI(apiRequest): Timeout"
,
id
,
node
));
}
// ------------------------------------------------------------------------------------------------------------
uniset
::
ObjectPtr
UInterface
::
resolve
(
const
std
::
string
&
name
)
const
{
if
(
uconf
->
isLocalIOR
()
)
{
if
(
CORBA
::
is_nil
(
orb
)
)
orb
=
uconf
->
getORB
();
const
string
sior
(
uconf
->
iorfile
->
getIOR
(
oind
->
getIdByName
(
name
))
);
if
(
!
sior
.
empty
()
)
return
orb
->
string_to_object
(
sior
.
c_str
());
}
return
rep
.
resolve
(
name
);
}
// ------------------------------------------------------------------------------------------------------------
uniset
::
ObjectPtr
UInterface
::
resolve
(
const
uniset
::
ObjectId
id
)
const
{
if
(
uconf
->
isLocalIOR
()
)
...
...
@@ -1519,14 +1534,14 @@ namespace uniset
if
(
CORBA
::
is_nil
(
orb
)
)
orb
=
uconf
->
getORB
();
string
sior
(
uconf
->
iorfile
->
getIOR
(
id
)
);
const
string
sior
(
uconf
->
iorfile
->
getIOR
(
id
)
);
if
(
!
sior
.
empty
()
)
return
orb
->
string_to_object
(
sior
.
c_str
());
}
return
rep
.
resolve
(
oind
->
getNameById
(
id
)
);
}
// ------------------------------------------------------------------------------------------------------------
uniset
::
ObjectPtr
UInterface
::
CacheOfResolve
::
resolve
(
const
uniset
::
ObjectId
id
,
const
uniset
::
ObjectId
node
)
const
{
try
...
...
@@ -1633,7 +1648,7 @@ namespace uniset
if
(
CORBA
::
is_nil
(
orb
)
)
orb
=
uconf
->
getORB
();
string
sior
(
uconf
->
iorfile
->
getIOR
(
id
)
);
const
string
sior
(
uconf
->
iorfile
->
getIOR
(
id
)
);
if
(
!
sior
.
empty
()
)
{
...
...
@@ -1685,13 +1700,10 @@ namespace uniset
if
(
id
==
uniset
::
DefaultObjectId
)
return
string
(
pre
+
" uniset::DefaultObjectId"
);
string
nm
(
oind
->
getNameById
(
node
)
);
if
(
nm
.
empty
()
)
nm
=
"UnknownName"
;
const
string
nm
=
oind
->
getNameById
(
id
);
ostringstream
s
;
s
<<
pre
<<
" ("
<<
id
<<
":"
<<
node
<<
")"
<<
nm
;
s
<<
pre
<<
" ("
<<
id
<<
":"
<<
node
<<
")"
<<
(
nm
.
empty
()
?
"UnknownName"
:
nm
)
;
return
s
.
str
();
}
// --------------------------------------------------------------------------------------------
...
...
testsuite/testsuite.at
View file @
314d9a78
...
...
@@ -14,4 +14,3 @@ m4_include(../extensions/LogicProcessor/tests/lproc-tests.at)
m4_include(../extensions/IOControl/tests/iocontrol-tests.at)
m4_include(../extensions/LogDB/tests/logdb-tests.at)
m4_include(../extensions/HttpResolver/tests/uresolver-tests.at)
m4_include(../extensions/LogicProcessor/tests/lproc-tests.at)
uniset2.files
View file @
314d9a78
...
...
@@ -550,7 +550,6 @@
./tests/umutex.cc
./tests/UniXmlTest/Makefile.am
./tests/UniXmlTest/XmlTest.cc
./tt.cc
./uniset-config.h
./Utilities/Admin/admin.cc
./Utilities/Admin/c.cc
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment