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
Łukasz Nowak
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):
...
@@ -66,7 +66,7 @@ class SoftwareInstance(Item):
return
result_dict
return
result_dict
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'check
Disc
onnected'
)
'check
C
onnected'
)
def
checkDisconnected
(
self
,
graph
,
root
):
def
checkDisconnected
(
self
,
graph
,
root
):
size
=
len
(
graph
)
size
=
len
(
graph
)
visited
=
set
()
visited
=
set
()
...
@@ -83,3 +83,4 @@ class SoftwareInstance(Item):
...
@@ -83,3 +83,4 @@ class SoftwareInstance(Item):
# anyway wrong in Software Instance trees
# anyway wrong in Software Instance trees
if
size
!=
len
(
visited
)
+
1
:
if
size
!=
len
(
visited
)
+
1
:
raise
DisconnectedSoftwareTree
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() +
...
@@ -153,7 +153,7 @@ graph[software_instance.getUid()] = software_instance.getPredecessorUidList() +
\n
\n
# check if all elements are still connected\n
# check if all elements are still connected\n
script.log(graph, root_software_instance.getUid())\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
\n
software_instance.edit(\n
software_instance.edit(\n
predecessor_list=predecessor_list,\n
predecessor_list=predecessor_list,\n
...
...
master/bt5/vifib_base/bt/revision
View file @
7f011348
247
248
\ No newline at end of file
\ No newline at end of file
master/product/Vifib/tests/testVifibSlapWebService.py
View file @
7f011348
...
@@ -8206,31 +8206,31 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -8206,31 +8206,31 @@ class TestVifibSlapWebService(testVifibMixin):
def
_test_si_tree
(
self
):
def
_test_si_tree
(
self
):
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
software_instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
)
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
):
def
test_si_tree_simple_connected
(
self
):
"""Graph of one element is connected
"""Graph of one element is connected
A
A
"""
"""
self
.
_test_si_tree
()
self
.
_test_si_tree
()
graph
=
{
'A'
:
[]}
graph
=
{
'A'
:
[]}
root
=
'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
):
def
test_si_tree_simple_list_connected
(
self
):
"""Graph of list is connected
"""Graph of list is connected
B->C->A
B->C->A
"""
"""
self
.
_test_si_tree
()
self
.
_test_si_tree
()
graph
=
{
'A'
:
[],
'B'
:
[
'C'
],
'C'
:
[
'A'
]}
graph
=
{
'A'
:
[],
'B'
:
[
'C'
],
'C'
:
[
'A'
]}
root
=
'B'
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
):
def
test_si_tree_complex_connected
(
self
):
"""Tree is connected
"""Tree is connected
B --> A
B --> A
\
-> C --> D
\
-> C --> D
\
-> E --> F
\
-> E --> F
...
@@ -8245,11 +8245,11 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -8245,11 +8245,11 @@ class TestVifibSlapWebService(testVifibMixin):
'F'
:
[],
'F'
:
[],
}
}
root
=
'B'
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
):
def
test_si_tree_simple_list_disconnected
(
self
):
"""Two lists are disconnected
"""Two lists are disconnected
A->B
A->B
C
C
"""
"""
...
@@ -8257,23 +8257,24 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -8257,23 +8257,24 @@ class TestVifibSlapWebService(testVifibMixin):
graph
=
{
'A'
:
[
'B'
],
'B'
:
[],
'C'
:
[]}
graph
=
{
'A'
:
[
'B'
],
'B'
:
[],
'C'
:
[]}
root
=
'A'
root
=
'A'
from
erp5.document.SoftwareInstance
import
DisconnectedSoftwareTree
from
erp5.document.SoftwareInstance
import
DisconnectedSoftwareTree
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
check
Disc
onnected
,
graph
,
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
check
C
onnected
,
graph
,
root
)
root
)
# For now limitation of implementation gives false positive
# For now limitation of implementation gives false positive
@
expectedFailure
@
expectedFailure
def
test_si_tree_cyclic_connected
(
self
):
def
test_si_tree_cyclic_connected
(
self
):
"""Cyclic is connected
"""Cyclic is connected
A<->B
A<->B
"""
"""
self
.
_test_si_tree
()
self
.
_test_si_tree
()
graph
=
{
'A'
:
[
'B'
],
'B'
:
[
'A'
]}
graph
=
{
'A'
:
[
'B'
],
'B'
:
[
'A'
]}
root
=
'B'
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
):
def
test_si_tree_cyclic_disconnected
(
self
):
"""Two trees, where one is cyclic are disconnected
"""Two trees, where one is cyclic are disconnected
B --> A
B --> A
\
-> H
\
-> H
C --> D --> G
C --> D --> G
...
@@ -8292,7 +8293,7 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -8292,7 +8293,7 @@ class TestVifibSlapWebService(testVifibMixin):
}
}
root
=
'B'
root
=
'B'
from
erp5.document.SoftwareInstance
import
DisconnectedSoftwareTree
from
erp5.document.SoftwareInstance
import
DisconnectedSoftwareTree
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
check
Disc
onnected
,
graph
,
self
.
assertRaises
(
DisconnectedSoftwareTree
,
self
.
check
C
onnected
,
graph
,
root
)
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