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
b245e46f
Commit
b245e46f
authored
Oct 04, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(tests): добавил тесты для UIInterface совместно с SharedMemory
(проверка удалённых вызовов). Исправил некоторые части кода.
parent
5a26585e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
36 additions
and
21 deletions
+36
-21
Makefile.am
extensions/tests/Makefile.am
+1
-1
tests_with_sm.cc
extensions/tests/tests_with_sm.cc
+12
-0
tests_with_sm.sh
extensions/tests/tests_with_sm.sh
+1
-1
tests_with_sm.xml
extensions/tests/tests_with_sm.xml
+4
-4
IONotifyController.h
include/IONotifyController.h
+1
-1
ObjectRepository.h
include/ObjectRepository.h
+1
-1
UInterface.h
include/UInterface.h
+2
-2
UniSetTypes.h
include/UniSetTypes.h
+4
-4
UInterface.cc
src/Interfaces/UInterface.cc
+4
-4
ObjectRepository.cc
src/ObjectRepository/ObjectRepository.cc
+1
-1
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+2
-2
IONotifyController.cc
src/Processes/IONotifyController.cc
+3
-0
No files found.
extensions/tests/Makefile.am
View file @
b245e46f
...
...
@@ -10,7 +10,7 @@ tests_with_conf_SOURCES = tests_with_conf.cc
tests_with_conf_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
$(top_builddir)
/extensions/lib/libUniSet2Extensions.la
tests_with_conf_CPPFLAGS
=
-I
$(top_builddir)
/include
-I
$(top_builddir)
/extensions/include
-I
$(includedir)
/Catch
tests_with_sm_SOURCES
=
tests_with_sm.cc
tests_with_sm_SOURCES
=
tests_with_sm.cc
ui.cc
tests_with_sm_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
$(top_builddir)
/extensions/lib/libUniSet2Extensions.la
\
$(top_builddir)
/extensions/SharedMemory/libUniSet2SharedMemory.la
$(SIGC_LIBS)
$(COMCPP_LIBS)
tests_with_sm_CPPFLAGS
=
-I
$(top_builddir)
/include
-I
$(top_builddir)
/extensions/include
-I
$(includedir)
/Catch
\
...
...
extensions/tests/tests_with_sm.cc
View file @
b245e46f
...
...
@@ -4,6 +4,7 @@
#include <string>
#include "Debug.h"
#include "UniSetActivator.h"
#include "PassiveTimer.h"
#include "SharedMemory.h"
#include "Extensions.h"
// --------------------------------------------------------------------------
...
...
@@ -47,6 +48,17 @@ int main(int argc, char* argv[] )
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
->
broadcast
(
sm
.
transport_msg
()
);
act
->
run
(
true
);
int
tout
=
6000
;
PassiveTimer
pt
(
tout
);
while
(
!
pt
.
checkTime
()
&&
!
act
->
exist
()
)
msleep
(
100
);
if
(
!
act
->
exist
()
)
{
cerr
<<
"(tests_with_sm): SharedMemory not exist! (timeout="
<<
tout
<<
")"
<<
endl
;
return
1
;
}
int
ret
=
session
.
run
();
...
...
extensions/tests/tests_with_sm.sh
View file @
b245e46f
#!/bin/sh
# '--' - нужен для отделения аоргументов catch, от наших..
uniset-start.sh
-f
./tests_with_sm
$*
--
--confile
tests_with_sm.xml
uniset-start.sh
-f
./tests_with_sm
$*
--
--confile
tests_with_sm.xml
--e-startup-pause
10
--ulog-levels
warn,crit
--dlog-levels
warn,crit
extensions/tests/tests_with_sm.xml
View file @
b245e46f
...
...
@@ -4,7 +4,7 @@
<!-- Общие(стартовые) параметры по UniSet -->
<UniSet>
<NameService
host=
"localhost"
port=
"2809"
/>
<LocalNode
name=
"
LocalhostNode
"
/>
<LocalNode
name=
"
localhost
"
/>
<RootSection
name=
"UNISET_PLC"
/>
<CountOfNet
name=
"1"
/>
<RepeatCount
name=
"3"
/>
...
...
@@ -171,7 +171,7 @@
textname - текстовое имя датчика
-->
<nodes
port=
"2809"
unet_broadcast_ip=
"192.168.1.255"
unet_broadcast_ip2=
"192.168.122.255"
>
<item
id=
"3000"
dbserver=
"DBServer1"
infserver=
"InfoServer"
ip=
"127.0.0.1"
name=
"
LocalhostNode
"
textname=
"Локальный узел"
unet_ignore=
"0"
unet_port=
"2048"
>
<item
id=
"3000"
dbserver=
"DBServer1"
infserver=
"InfoServer"
ip=
"127.0.0.1"
name=
"
localhost
"
textname=
"Локальный узел"
unet_ignore=
"0"
unet_port=
"2048"
>
<iocards>
<item
card=
"1"
name=
"DI32"
/>
<item
card=
"2"
name=
"DO32"
/>
...
...
@@ -179,8 +179,8 @@
</iocards>
</item>
<item
id=
"3001"
infserver=
"InfoServer"
ip=
"127.0.0.1"
name=
"LocalhostNode1"
textname=
"Локальный узел"
unet_ignore=
"0"
unet_port=
"2049"
/>
<item
id=
"3002"
ip=
"192.168.56.10"
name=
"
N
ode1"
textname=
"Node1"
unet_ignore=
"0"
unet_ip=
"192.168.56.255"
unet_port=
"3001"
unet_respond_id=
"Input1_S"
unet_respond_invert=
"1"
/>
<item
id=
"3003"
ip=
"192.168.56.11"
name=
"
N
ode2"
textname=
"Node2"
unet_ignore=
"0"
unet_ip=
"192.168.56.255"
unet_port=
"3002"
/>
<item
id=
"3002"
ip=
"192.168.56.10"
name=
"
n
ode1"
textname=
"Node1"
unet_ignore=
"0"
unet_ip=
"192.168.56.255"
unet_port=
"3001"
unet_respond_id=
"Input1_S"
unet_respond_invert=
"1"
/>
<item
id=
"3003"
ip=
"192.168.56.11"
name=
"
n
ode2"
textname=
"Node2"
unet_ignore=
"0"
unet_ip=
"192.168.56.255"
unet_port=
"3002"
/>
</nodes>
<!-- ************************ Датчики ********************** -->
<sensors
name=
"Sensors"
>
...
...
include/IONotifyController.h
View file @
b245e46f
...
...
@@ -255,7 +255,7 @@ class IONotifyController:
struct
ThresholdsListInfo
{
ThresholdsListInfo
(){}
ThresholdsListInfo
(
IOController_i
::
SensorInfo
&
si
,
ThresholdExtList
&&
list
,
ThresholdsListInfo
(
const
IOController_i
::
SensorInfo
&
si
,
ThresholdExtList
&&
list
,
UniversalIO
::
IOType
t
=
UniversalIO
::
AI
)
:
si
(
si
),
type
(
t
),
list
(
std
::
move
(
list
)
){}
...
...
include/ObjectRepository.h
View file @
b245e46f
...
...
@@ -71,7 +71,7 @@
UniSetTypes
::
ObjectPtr
resolve
(
const
std
::
string
&
name
,
const
std
::
string
&
NSName
=
"NameService"
)
const
throw
(
UniSetTypes
::
ORepFailed
,
UniSetTypes
::
NameNotFound
);
/*! Проверка существования и доступности объекта */
bool
isExist
(
const
UniSetTypes
::
ObjectPtr
oref
)
const
;
bool
isExist
(
const
UniSetTypes
::
ObjectPtr
&
oref
)
const
;
/*! Проверка существования и доступности объекта */
bool
isExist
(
const
std
::
string
&
fullName
)
const
;
...
...
include/UInterface.h
View file @
b245e46f
...
...
@@ -86,7 +86,7 @@ class UInterface
void
fastSetValue
(
const
IOController_i
::
SensorInfo
&
si
,
long
value
,
UniSetTypes
::
ObjectId
supplier
);
//! Получение состояния для списка указанных датчиков
IOController_i
::
SensorInfoSeq_var
getSensorSeq
(
UniSetTypes
::
IDList
&
lst
);
IOController_i
::
SensorInfoSeq_var
getSensorSeq
(
const
UniSetTypes
::
IDList
&
lst
);
/*! Изменения состояния списка входов/выходов
\return Возвращает список не найденных идентификаторов */
...
...
@@ -103,7 +103,7 @@ class UInterface
UniSetTypes
::
ObjectId
backid
=
UniSetTypes
::
DefaultObjectId
)
const
throw
(
UI_THROW_EXCEPTIONS
);
//! Заказ по списку
UniSetTypes
::
IDSeq_var
askSensorsSeq
(
UniSetTypes
::
IDList
&
lst
,
UniversalIO
::
UIOCommand
cmd
,
UniSetTypes
::
IDSeq_var
askSensorsSeq
(
const
UniSetTypes
::
IDList
&
lst
,
UniversalIO
::
UIOCommand
cmd
,
UniSetTypes
::
ObjectId
backid
=
UniSetTypes
::
DefaultObjectId
);
// ------------------------------------------------------
...
...
include/UniSetTypes.h
View file @
b245e46f
...
...
@@ -105,17 +105,17 @@ namespace UniSetTypes
void
add
(
ObjectId
id
);
void
del
(
ObjectId
id
);
inline
int
size
(){
return
lst
.
size
();
}
inline
bool
empty
(){
return
lst
.
empty
();
}
inline
int
size
()
const
{
return
lst
.
size
();
}
inline
bool
empty
()
const
{
return
lst
.
empty
();
}
std
::
list
<
ObjectId
>
getList
();
// за освобождение выделеной памяти
// отвечает вызывающий!
IDSeq
*
getIDSeq
();
IDSeq
*
getIDSeq
()
const
;
//
ObjectId
getFirst
();
ObjectId
getFirst
()
const
;
ObjectId
node
;
// узел, на котором находятся датчики
private
:
...
...
src/Interfaces/UInterface.cc
View file @
b245e46f
...
...
@@ -1141,7 +1141,7 @@ bool UInterface::isExist( const UniSetTypes::ObjectId id ) const
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
//
uwarn << "UI(isExist): " << ex << endl;
//
uwarn << "UI(isExist): " << ex << endl;
}
catch
(...){}
return
false
;
...
...
@@ -1594,7 +1594,7 @@ IOController_i::CalibrateInfo UInterface::getCalibrateInfo( const IOController_i
throw
UniSetTypes
::
TimeOut
(
set_err
(
"UI(getCalibrateInfo): Timeout"
,
si
.
id
,
si
.
node
));
}
// --------------------------------------------------------------------------------------------
IOController_i
::
SensorInfoSeq_var
UInterface
::
getSensorSeq
(
UniSetTypes
::
IDList
&
lst
)
IOController_i
::
SensorInfoSeq_var
UInterface
::
getSensorSeq
(
const
UniSetTypes
::
IDList
&
lst
)
{
if
(
lst
.
empty
()
)
return
IOController_i
::
SensorInfoSeq_var
();
...
...
@@ -1622,7 +1622,7 @@ IOController_i::SensorInfoSeq_var UInterface::getSensorSeq( UniSetTypes::IDList&
IOController_i_var
iom
=
IOController_i
::
_narrow
(
oref
);
UniSetTypes
::
IDSeq_var
seq
=
lst
.
getIDSeq
(
);
UniSetTypes
::
IDSeq_var
seq
(
lst
.
getIDSeq
()
);
return
iom
->
getSensorSeq
(
seq
);
}
catch
(
CORBA
::
TRANSIENT
){}
...
...
@@ -1748,7 +1748,7 @@ IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, UniSetTyp
throw
UniSetTypes
::
TimeOut
(
set_err
(
"UI(setOutputSeq): Timeout"
,
lst
[
0
].
si
.
id
,
lst
[
0
].
si
.
node
));
}
// --------------------------------------------------------------------------------------------
UniSetTypes
::
IDSeq_var
UInterface
::
askSensorsSeq
(
UniSetTypes
::
IDList
&
lst
,
UniSetTypes
::
IDSeq_var
UInterface
::
askSensorsSeq
(
const
UniSetTypes
::
IDList
&
lst
,
UniversalIO
::
UIOCommand
cmd
,
UniSetTypes
::
ObjectId
backid
)
{
if
(
lst
.
empty
()
)
...
...
src/ObjectRepository/ObjectRepository.cc
View file @
b245e46f
...
...
@@ -398,7 +398,7 @@ bool ObjectRepository::isExist( const string& fullName ) const
// --------------------------------------------------------------------------
bool
ObjectRepository
::
isExist
(
const
ObjectPtr
oref
)
const
bool
ObjectRepository
::
isExist
(
const
ObjectPtr
&
oref
)
const
{
try
{
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
b245e46f
...
...
@@ -141,7 +141,7 @@ std::list<UniSetTypes::ObjectId> UniSetTypes::IDList::getList()
return
lst
;
}
UniSetTypes
::
ObjectId
UniSetTypes
::
IDList
::
getFirst
()
UniSetTypes
::
ObjectId
UniSetTypes
::
IDList
::
getFirst
()
const
{
if
(
lst
.
empty
()
)
return
UniSetTypes
::
DefaultObjectId
;
...
...
@@ -151,7 +151,7 @@ UniSetTypes::ObjectId UniSetTypes::IDList::getFirst()
// за освобождение выделеной памяти
// отвечает вызывающий!
IDSeq
*
UniSetTypes
::
IDList
::
getIDSeq
()
IDSeq
*
UniSetTypes
::
IDList
::
getIDSeq
()
const
{
IDSeq
*
seq
=
new
IDSeq
();
seq
->
length
(
lst
.
size
());
...
...
src/Processes/IONotifyController.cc
View file @
b245e46f
...
...
@@ -861,6 +861,9 @@ IONotifyController_i::ThresholdInfo IONotifyController::getThresholdInfo( UniSet
for
(
auto
it2
=
it
->
second
.
list
.
begin
();
it2
!=
it
->
second
.
list
.
end
();
++
it2
)
{
/*! \warning На самом деле список разрешает иметь много порогов с одинаковым ID, для разных "заказчиков".
Но здесь мы возвращаем первый встретившийся..
*/
if
(
it2
->
id
==
tid
)
return
IONotifyController_i
::
ThresholdInfo
(
*
it2
);
}
...
...
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