r2485 - in trunk: topia-persistence/src/main/java/org/nuiton/topia/framework topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/events
Author: athimel Date: 2012-05-15 18:27:19 +0200 (Tue, 15 May 2012) New Revision: 2485 Url: http://nuiton.org/repositories/revision/topia/2485 Log: There is no event propagation on hierarchy Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/events/VetoableEventTest.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2012-05-15 14:47:30 UTC (rev 2484) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2012-05-15 16:27:19 UTC (rev 2485) @@ -936,7 +936,7 @@ Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener) { if (listener == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } entityListeners.add(entityClass, listener); } @@ -949,42 +949,42 @@ Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable) { if (vetoable == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } entityVetoables.add(entityClass, vetoable); } public void addTopiaTransactionListener(TopiaTransactionListener listener) { if (listener == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } transactionListeners.add(listener); } public void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) { if (vetoable== null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } transactionVetoables.add(vetoable); } public void addPropertyChangeListener(PropertyChangeListener listener) { if (listener == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } propertyChangeListeners.add(listener); } public void addTopiaContextListener(TopiaContextListener listener) { if (listener == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } topiaContextListeners.add(listener); } public void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) { if (vetoable == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } entitiesVetoables.add(vetoable); } @@ -999,7 +999,7 @@ Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener) { if (listener == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } entityListeners.remove(entityClass, listener); } @@ -1012,42 +1012,42 @@ Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable) { if (vetoable == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } entityVetoables.remove(entityClass, vetoable); } public void removeTopiaTransactionListener(TopiaTransactionListener listener) { if (listener == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } transactionListeners.remove(listener); } public void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) { if (vetoable == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } transactionVetoables.remove(vetoable); } public void removePropertyChangeListener(PropertyChangeListener listener) { if (listener == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } propertyChangeListeners.remove(listener); } public void removeTopiaContextListener(TopiaContextListener listener) { if (listener == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } topiaContextListeners.remove(listener); } public void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) { if (vetoable == null) { - throw new NullPointerException("listener can not be null."); + throw new NullPointerException("Listener can not be null."); } entitiesVetoables.remove(vetoable); } Modified: trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/events/VetoableEventTest.java =================================================================== --- trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/events/VetoableEventTest.java 2012-05-15 14:47:30 UTC (rev 2484) +++ trunk/topia-persistence-tck/src/main/java/org/nuiton/topia/tck/it/events/VetoableEventTest.java 2012-05-15 16:27:19 UTC (rev 2485) @@ -196,23 +196,20 @@ } /** - * Test the vetoable events firing on a any entity + * Test the vetoable events isolation between two brother contexts * * @throws org.nuiton.topia.TopiaException if any exception while manipulating db */ @Test - public void testVetoableHierarchy() throws TopiaException { - log.debug("START TEST : testVetoableHierarchy"); + public void testVetoableIsolation() throws TopiaException { + log.debug("START TEST : testVetoableIsolation"); - VetoableCounter counterRoot = new VetoableCounter(); VetoableCounter counterChild1 = new VetoableCounter(); VetoableCounter counterChild2 = new VetoableCounter(); - TopiaContext rootContext = db.getRootCtxt(); TopiaContext childContext1 = db.beginTransaction(); TopiaContext childContext2 = db.beginTransaction(); - rootContext.addTopiaEntityVetoable(Personne.class, counterRoot); childContext1.addTopiaEntityVetoable(Personne.class, counterChild1); childContext2.addTopiaEntityVetoable(Personne.class, counterChild2); @@ -223,11 +220,6 @@ Personne personne1 = dao1.create(Personne.PROPERTY_NAME, "Bob Marley"); childContext1.commitTransaction(); -// Assert.assertEquals(1, counterRoot.createCount); // FIXME AThimel 15/05/2012 Am I expecting the propagation in thr wrong direction ? - Assert.assertEquals(0, counterRoot.loadCount); - Assert.assertEquals(0, counterRoot.updateCount); - Assert.assertEquals(0, counterRoot.deleteCount); - Assert.assertEquals(1, counterChild1.createCount); Assert.assertEquals(0, counterChild1.loadCount); Assert.assertEquals(0, counterChild1.updateCount); @@ -246,11 +238,6 @@ Personne personne2 = dao2.create(Personne.PROPERTY_NAME, "Bob Moran"); childContext2.commitTransaction(); -// Assert.assertEquals(2, counterRoot.createCount); // FIXME AThimel 15/05/2012 Am I expecting the propagation in thr wrong direction ? - Assert.assertEquals(0, counterRoot.loadCount); - Assert.assertEquals(0, counterRoot.updateCount); - Assert.assertEquals(0, counterRoot.deleteCount); - Assert.assertEquals(1, counterChild1.createCount); Assert.assertEquals(0, counterChild1.loadCount); Assert.assertEquals(0, counterChild1.updateCount); @@ -261,6 +248,19 @@ Assert.assertEquals(0, counterChild2.updateCount); Assert.assertEquals(0, counterChild2.deleteCount); + dao2.delete(personne2); + childContext2.commitTransaction(); + + Assert.assertEquals(1, counterChild1.createCount); + Assert.assertEquals(0, counterChild1.loadCount); + Assert.assertEquals(0, counterChild1.updateCount); + Assert.assertEquals(0, counterChild1.deleteCount); + + Assert.assertEquals(1, counterChild2.createCount); + Assert.assertEquals(0, counterChild2.loadCount); + Assert.assertEquals(0, counterChild2.updateCount); + Assert.assertEquals(1, counterChild2.deleteCount); + } } \ No newline at end of file
participants (1)
-
athimelï¼ users.nuiton.org