Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos.core
Commits
7f011348
Commit
7f011348
authored
Aug 12, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename to checkConnected
Even more -- return True in case if all was ok.
parent
771aa3d7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
15 deletions
+17
-15
master/bt5/vifib_base/DocumentTemplateItem/SoftwareInstance.py
...r/bt5/vifib_base/DocumentTemplateItem/SoftwareInstance.py
+2
-1
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestSoftwareInstance.xml
...flow/scripts/SoftwareInstance_requestSoftwareInstance.xml
+1
-1
master/bt5/vifib_base/bt/revision
master/bt5/vifib_base/bt/revision
+1
-1
master/product/Vifib/tests/testVifibSlapWebService.py
master/product/Vifib/tests/testVifibSlapWebService.py
+13
-12
No files found.
master/bt5/vifib_base/DocumentTemplateItem/SoftwareInstance.py
View file @
7f011348
...
...
@@ -66,7 +66,7 @@ class SoftwareInstance(Item):
return
result_dict
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'check
Disc
onnected'
)
'check
C
onnected'
)
def
checkDisconnected
(
self
,
graph
,
root
):
size
=
len
(
graph
)
visited
=
set
()
...
...
@@ -83,3 +83,4 @@ class SoftwareInstance(Item):
# anyway wrong in Software Instance trees
if
size
!=
len
(
visited
)
+
1
:
raise
DisconnectedSoftwareTree
return
True
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestSoftwareInstance.xml
View file @
7f011348
...
...
@@ -153,7 +153,7 @@ graph[software_instance.getUid()] = software_instance.getPredecessorUidList() +
\n
# check if all elements are still connected\n
script.log(graph, root_software_instance.getUid())\n
software_instance.check
Disc
onnected(graph, root_software_instance.getUid())\n
software_instance.check
C
onnected(graph, root_software_instance.getUid())\n
\n
software_instance.edit(\n
predecessor_list=predecessor_list,\n
...
...
master/bt5/vifib_base/bt/revision
View file @
7f011348
247
\ No newline at end of file
248
\ No newline at end of file
master/product/Vifib/tests/testVifibSlapWebService.py
View file @
7f011348
...
...
@@ -8206,31 +8206,31 @@ class TestVifibSlapWebService(testVifibMixin):
def
_test_si_tree
(
self
):
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
)
self
.
check
Disconnected
=
software_instance
.
checkDisc
onnected
self
.
check
Connected
=
software_instance
.
checkC
onnected
def
test_si_tree_simple_connected
(
self
):
"""Graph of one element is connected
A
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[]}
root
=
'A'
self
.
assertEqual
(
None
,
self
.
checkDisc
onnected
(
graph
,
root
))
self
.
assertEqual
(
True
,
self
.
checkC
onnected
(
graph
,
root
))
def
test_si_tree_simple_list_connected
(
self
):
"""Graph of list is connected
B->C->A
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[],
'B'
:
[
'C'
],
'C'
:
[
'A'
]}
root
=
'B'
self
.
assertEqual
(
None
,
self
.
checkDisc
onnected
(
graph
,
root
))
self
.
assertEqual
(
True
,
self
.
checkC
onnected
(
graph
,
root
))
def
test_si_tree_complex_connected
(
self
):
"""Tree is connected
B --> A
\
-> C --> D
\
-> E --> F
...
...
@@ -8245,11 +8245,11 @@ class TestVifibSlapWebService(testVifibMixin):
'F'
:
[],
}
root
=
'B'
self
.
assertEqual
(
None
,
self
.
checkDisc
onnected
(
graph
,
root
))
self
.
assertEqual
(
True
,
self
.
checkC
onnected
(
graph
,
root
))
def
test_si_tree_simple_list_disconnected
(
self
):
"""Two lists are disconnected
A->B
C
"""
...
...
@@ -8257,23 +8257,24 @@ class TestVifibSlapWebService(testVifibMixin):
graph
=
{
'A'
:
[
'B'
],
'B'
:
[],
'C'
:
[]}
root
=
'A'
from
erp5.document.SoftwareInstance
import
DisconnectedSoftwareTree
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
check
Disc
onnected
,
graph
,
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
check
C
onnected
,
graph
,
root
)
# For now limitation of implementation gives false positive
@
expectedFailure
def
test_si_tree_cyclic_connected
(
self
):
"""Cyclic is connected
A<->B
"""
self
.
_test_si_tree
()
graph
=
{
'A'
:
[
'B'
],
'B'
:
[
'A'
]}
root
=
'B'
self
.
assertEqual
(
None
,
self
.
checkDisc
onnected
(
graph
,
root
))
self
.
assertEqual
(
True
,
self
.
checkC
onnected
(
graph
,
root
))
def
test_si_tree_cyclic_disconnected
(
self
):
"""Two trees, where one is cyclic are disconnected
B --> A
\
-> H
C --> D --> G
...
...
@@ -8292,7 +8293,7 @@ class TestVifibSlapWebService(testVifibMixin):
}
root
=
'B'
from
erp5.document.SoftwareInstance
import
DisconnectedSoftwareTree
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
check
Disc
onnected
,
graph
,
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
check
C
onnected
,
graph
,
root
)
########################################
...
...
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