Re: [Apache Bloodhound] #746: Parent/child relations are inverted in ticket validation
#746: Parent/child relations are inverted in ticket validation +--- Reporter: rjollos| Owner: rjollos Type: defect | Status: closed Priority: major | Milestone: Release 8 Component: relations |Version: Resolution: fixed | Keywords: +--- Description changed by rjollos: Old description: To reproduce: * Create ticket A. * Create ticket B and add a //B is a child of A// relation. * Attempt to close ticket B with resolution //fixed//. The following warning results: {{{#!html div id=warning class=alert fade in button type=button class=close data- dismiss=alert×/button span class=label label-warningWarning/span Cannot resolve this ticket because it has open child tickets. /div }}} New description: To reproduce: * Create ticket A. * Create ticket B and add a //B is a child of A// relation. * Attempt to close ticket B with resolution //fixed//. The following warning results: {{{#!html div id=warning class=alert fade in button type=button class=close data- dismiss=alert×/button span class=label label-warningWarning/span Cannot resolve this ticket because it has open child tickets. /div }}} For reference, the behavior in question is contained in `TicketRelationsSpecifics._check_open_children`, which was initially implemented in [1501152] for #588. -- -- Ticket URL: https://issues.apache.org/bloodhound/ticket/746#comment:2 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
Re: [Apache Bloodhound] #775: Can't create multiple is a parent of relations
#775: Can't create multiple is a parent of relations + Reporter: rjollos| Owner: rjollos Type: defect | Status: accepted Priority: major | Milestone: Release 8 Component: relations |Version: Resolution: | Keywords: validation + Comment (by astaric): When the validator was written, parent relation was somewhat special. Two relations were not isparentof and ischildof, but parent and children (inverse of what are they now). This was consistent with the layout at the time (name on the relation on left, followed by all relations of the type). When relation types were changed, validator was not. It is checking whether there are existing relations with the same source and type, where it should be checking if there are existing relations with same type and destination. (source can point to many resources, but only one resource should point to destination with this type) If you have not started working on this, I can. -- Ticket URL: https://issues.apache.org/bloodhound/ticket/775#comment:3 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
svn commit: r1574802 - in /bloodhound/trunk/bloodhound_relations/bhrelations: tests/api.py validation.py
Author: rjollos Date: Thu Mar 6 08:47:29 2014 New Revision: 1574802 URL: http://svn.apache.org/r1574802 Log: 0.8dev: It was not possible to create multiple //is a parent of// relations. Refs #775. Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py bloodhound/trunk/bloodhound_relations/bhrelations/validation.py Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py?rev=1574802r1=1574801r2=1574802view=diff == --- bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py (original) +++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py Thu Mar 6 08:47:29 2014 @@ -224,13 +224,13 @@ class ApiTestCase(BaseRelationsTestCase) parent2 = self._insert_and_load_ticket(A3) #act relations_system = self.relations_system -relations_system.add(child, parent1, parent) +relations_system.add(parent1, child, 'parent') self.assertRaises( ValidationError, relations_system.add, -child, parent2, -parent) +child, +'parent') def test_can_not_add_more_than_one_parents_via_children(self): #arrange @@ -239,12 +239,12 @@ class ApiTestCase(BaseRelationsTestCase) parent2 = self._insert_and_load_ticket(A3) #act relations_system = self.relations_system -relations_system.add(parent1, child, children) +relations_system.add(child, parent1, children) self.assertRaises( ValidationError, relations_system.add, -parent2, child, +parent2, children) def test_ticket_can_be_resolved(self): @@ -254,13 +254,13 @@ class ApiTestCase(BaseRelationsTestCase) parent2 = self._insert_and_load_ticket(A3) #act relations_system = self.relations_system -relations_system.add(parent1, child, children) -self.assertRaises( -ValidationError, -relations_system.add, -parent2, -child, -children) +relations_system.add(child, parent1, children) + +self.req.args['action'] = 'resolve' +warnings = \ +TicketRelationsSpecifics(self.env).validate_ticket(self.req, child) + +self.assertEqual(0, len(list(warnings))) def test_can_save_and_load_relation_time(self): #arrange @@ -397,53 +397,53 @@ class ApiTestCase(BaseRelationsTestCase) def test_cannot_create_other_relations_between_descendants(self): t1, t2, t3, t4, t5 = map(self._insert_and_load_ticket, 12345) -self.relations_system.add(t4, t2, parent) #t1 - t2 -self.relations_system.add(t3, t2, parent) # / \ -self.relations_system.add(t2, t1, parent) # t3t4 +self.relations_system.add(t2, t4, parent) #t1 - t2 +self.relations_system.add(t2, t3, parent) # / \ +self.relations_system.add(t1, t2, parent) # t3t4 self.assertRaises( ValidationError, -self.relations_system.add, t1, t2, dependent +self.relations_system.add, t2, t1, dependent ) self.assertRaises( ValidationError, -self.relations_system.add, t2, t1, dependent +self.relations_system.add, t1, t2, dependent ) self.assertRaises( ValidationError, -self.relations_system.add, t1, t4, dependent +self.relations_system.add, t4, t1, dependent ) self.assertRaises( ValidationError, -self.relations_system.add, t3, t1, dependent +self.relations_system.add, t1, t3, dependent ) try: -self.relations_system.add(t1, t5, dependent) -self.relations_system.add(t3, t4, dependent) +self.relations_system.add(t5, t1,dependent) +self.relations_system.add(t4, t3, dependent) except ValidationError: self.fail(Could not add valid relation.) def test_cannot_add_parent_if_this_would_cause_invalid_relations(self): t1, t2, t3, t4, t5 = map(self._insert_and_load_ticket, 12345) -self.relations_system.add(t4, t2, parent) #t1 - t2 -self.relations_system.add(t3, t2, parent) # / \ -self.relations_system.add(t2, t1, parent) # t3t4t5 -self.relations_system.add(t2, t5, dependent) +self.relations_system.add(t2, t4, parent) #t1 - t2 +self.relations_system.add(t2, t3, parent) # / \ +self.relations_system.add(t1, t2, parent) # t3t4t5 +self.relations_system.add(t5, t2, dependent)
Re: [Apache Bloodhound] #775: Can't create multiple is a parent of relations
#775: Can't create multiple is a parent of relations + Reporter: rjollos| Owner: rjollos Type: defect | Status: accepted Priority: major | Milestone: Release 8 Component: relations |Version: Resolution: | Keywords: validation + Comment (by rjollos): (In [1574802]) 0.8dev: It was not possible to create multiple //is a parent of// relations. Refs #775. -- Ticket URL: https://issues.apache.org/bloodhound/ticket/775#comment:5 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
Re: [Apache Bloodhound] #775: Can't create multiple is a parent of relations
#775: Can't create multiple is a parent of relations + Reporter: rjollos| Owner: rjollos Type: defect | Status: accepted Priority: major | Milestone: Release 8 Component: relations |Version: Resolution: | Keywords: validation + Comment (by rjollos): The unit tests are passing now, but given the number of changes that needed to be made and in light of comment:3, we should probably review all of the unit tests to be sure there aren't any false positives. Please feel free to go ahead with that if you are inclined, otherwise I will pick it up tomorrow. Thanks for your help! -- Ticket URL: https://issues.apache.org/bloodhound/ticket/775#comment:6 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
svn commit: r1574841 - in /bloodhound/trunk/bloodhound_relations/bhrelations/tests: api.py base.py notification.py search.py web_ui.py
Author: astaric Date: Thu Mar 6 11:12:21 2014 New Revision: 1574841 URL: http://svn.apache.org/r1574841 Log: Refactor bhrelations tests. Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py bloodhound/trunk/bloodhound_relations/bhrelations/tests/base.py bloodhound/trunk/bloodhound_relations/bhrelations/tests/notification.py bloodhound/trunk/bloodhound_relations/bhrelations/tests/search.py bloodhound/trunk/bloodhound_relations/bhrelations/tests/web_ui.py Modified: bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py?rev=1574841r1=1574840r2=1574841view=diff == --- bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py (original) +++ bloodhound/trunk/bloodhound_relations/bhrelations/tests/api.py Thu Mar 6 11:12:21 2014 @@ -18,10 +18,13 @@ # under the License. from datetime import datetime import unittest + from bhrelations.api import TicketRelationsSpecifics from bhrelations.tests.mocks import TestRelationChangingListener from bhrelations.validation import ValidationError -from bhrelations.tests.base import BaseRelationsTestCase +from bhrelations.tests.base import BaseRelationsTestCase, PARENT, CHILD, \ +DEPENDS_ON, DEPENDENCY_OF, BLOCKS, BLOCKED_BY, REFERS_TO, DUPLICATE_OF, \ +MULTIPRODUCT_REL from multiproduct.env import ProductEnvironment from trac.ticket.model import Ticket from trac.core import TracError @@ -32,146 +35,124 @@ class ApiTestCase(BaseRelationsTestCase) def test_can_add_two_ways_relations(self): #arrange ticket = self._insert_and_load_ticket(A1) -dependent = self._insert_and_load_ticket(A2) +ticket2 = self._insert_and_load_ticket(A2) #act -relations_system = self.relations_system -relations_system.add( -ticket, dependent, dependent) -#assert -relations = relations_system.get_relations(ticket) -self.assertEqual(dependent, relations[0][type]) -self.assertEqual(unicode(dependent.id), relations[0][destination].id) +self.add_relation(ticket, DEPENDENCY_OF, ticket2) +#assert +relations = self.get_relations(ticket) +self.assertEqual(DEPENDENCY_OF, relations[0][type]) +self.assertEqual(unicode(ticket2.id), relations[0][destination].id) -relations = relations_system.get_relations(dependent) -self.assertEqual(dependson, relations[0][type]) +relations = self.get_relations(ticket2) +self.assertEqual(DEPENDS_ON, relations[0][type]) self.assertEqual(unicode(ticket.id), relations[0][destination].id) def test_can_add_single_way_relations(self): #arrange ticket = self._insert_and_load_ticket(A1) -referred = self._insert_and_load_ticket(A2) +ticket2 = self._insert_and_load_ticket(A2) #act -relations_system = self.relations_system -relations_system.add(ticket, referred, refersto) +self.add_relation(ticket, REFERS_TO, ticket2) #assert -relations = relations_system.get_relations(ticket) -self.assertEqual(refersto, relations[0][type]) -self.assertEqual(unicode(referred.id), relations[0][destination].id) +relations = self.get_relations(ticket) +self.assertEqual(1, len(relations)) +self.assertEqual(REFERS_TO, relations[0][type]) +self.assertEqual(unicode(ticket2.id), relations[0][destination].id) -relations = relations_system.get_relations(referred) -self.assertEqual(0, len(relations)) +self.assertEqual(0, len(self.get_relations(ticket2))) def test_can_add_multiple_relations(self): #arrange ticket = self._insert_and_load_ticket(A1) -dependent1 = self._insert_and_load_ticket(A2) -dependent2 = self._insert_and_load_ticket(A3) +ticket2 = self._insert_and_load_ticket(A2) +ticket3 = self._insert_and_load_ticket(A3) #act -relations_system = self.relations_system -relations_system.add( -ticket, dependent1, dependent) -relations_system.add( -ticket, dependent2, dependent) +self.add_relation(ticket, DEPENDS_ON, ticket2) +self.add_relation(ticket, DEPENDS_ON, ticket3) #assert -relations = relations_system.get_relations(ticket) -self.assertEqual(2, len(relations)) +self.assertEqual(2, len(self.get_relations(ticket))) +self.assertEqual(1, len(self.get_relations(ticket2))) +self.assertEqual(1, len(self.get_relations(ticket3))) def test_will_not_create_more_than_one_identical_relations(self): #arrange ticket = self._insert_and_load_ticket(A1) -dependent1 = self._insert_and_load_ticket(A2) +ticket2 =
Re: [Apache Bloodhound] #775: Can't create multiple is a parent of relations
#775: Can't create multiple is a parent of relations + Reporter: rjollos| Owner: rjollos Type: defect | Status: accepted Priority: major | Milestone: Release 8 Component: relations |Version: Resolution: | Keywords: validation + Comment (by astaric): In r1574841 I refactored tests a bit, to make syntax for adding relations clearer. All relations in tests are now added using add_relation(ticket1, rel_type, ticket2), meaning ticket1 is rel_type of ticket2. I checked that all relations are now used correctly (no more inverted relations). -- Ticket URL: https://issues.apache.org/bloodhound/ticket/775#comment:7 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
[Apache Bloodhound] New user registration: dominik
New user registration for user dominik -- Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker