Update of /var/cvs/tests/bridge/org/mmbase/bridge In directory james.mmbase.org:/tmp/cvs-serv10245
Modified Files: ProcessorTest.java Log Message: commented in the failing cases again. I know how to fix them now. See also: http://cvs.mmbase.org/viewcvs/tests/bridge/org/mmbase/bridge Index: ProcessorTest.java =================================================================== RCS file: /var/cvs/tests/bridge/org/mmbase/bridge/ProcessorTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- ProcessorTest.java 26 Jan 2009 16:00:05 -0000 1.5 +++ ProcessorTest.java 30 Apr 2009 14:16:08 -0000 1.6 @@ -13,6 +13,7 @@ import org.mmbase.tests.*; import org.mmbase.datatypes.processors.*; import junit.framework.*; +import org.mmbase.bridge.util.*; import org.mmbase.util.DynamicDate; import org.mmbase.util.logging.Logger; @@ -20,9 +21,10 @@ /** + * Testing wether the processors of datatypes behave as expected. * * @author Michiel Meeuwissen - * @version $Id: ProcessorTest.java,v 1.5 2009/01/26 16:00:05 michiel Exp $ + * @version $Id: ProcessorTest.java,v 1.6 2009/04/30 14:16:08 michiel Exp $ * @since MMBase-1.9.1 */ public class ProcessorTest extends BridgeTest { @@ -32,6 +34,7 @@ super(name); } + protected Node testCommitProcessorIsChanged1(Cloud c) { NodeManager nm = c.getNodeManager("mustbechanged"); Node n = nm.createNode(); @@ -49,19 +52,19 @@ Node n = c.getNode(nn); try { n.commit(); - throw new AssertionFailedError("Should have thrown exception"); + fail("Should have thrown exception"); } catch(RuntimeException ru) { // ok } } - public void testCommitProcessorIsChanged() { Cloud c = getCloud(); int nn = testCommitProcessorIsChanged1(c).getNumber(); testCommitProcessorIsChanged2(c, nn); testCommitProcessorIsChanged3(c, nn); } + public void testCommitProcessorIsChangedTransaction() { Cloud c = getCloud(); Transaction t = c.getTransaction("aa"); @@ -74,9 +77,9 @@ t = c.getTransaction("cc"); testCommitProcessorIsChanged3(t, nn); t.commit(); - } + protected Node testAge(Cloud c) { NodeManager nm = c.getNodeManager("datatypes"); Node n = nm.createNode(); @@ -85,39 +88,44 @@ n = c.getNode(n.getNumber()); assertEquals(DynamicDate.eval("2008-01-01"), n.getDateValue("birthdate")); n.setIntValue("age", 10); - /* - assertEquals(10, n.getIntValue("age")); /// TODO TODO FAILS FAILS + assertEquals(10, n.getIntValue("age")); n.commit(); assertEquals(10, n.getIntValue("age")); - */ return n; } public void testAge() { + try { org.mmbase.cache.CacheManager.getInstance().disable(".*"); testAge(getCloud()); org.mmbase.cache.CacheManager.getInstance().readConfiguration(); + } catch (NoClassDefFoundError ncdfe) { + log.service("Probably using RMMCI, cannot disable caches then. " + ncdfe.getMessage()); + } } - public void testAgeTransaction() { + try { org.mmbase.cache.CacheManager.getInstance().disable(".*"); Transaction t = getCloud().getTransaction("bla"); Node n = testAge(t); t.commit(); assertEquals(10, getCloud().getNode(n.getNumber()).getIntValue("age")); org.mmbase.cache.CacheManager.getInstance().readConfiguration(); + } catch (NoClassDefFoundError ncdfe) { + log.service("Probably using RMMCI, cannot disable caches then. " + ncdfe.getMessage()); } + } - protected int testCommitCount(Cloud c) { + // Creates an commits a node, and checks if that increased the commit count + protected void testCommitCount(Cloud c) { + if (c.getCloudContext().getUri().equals(ContextProvider.DEFAULT_CLOUD_CONTEXT_NAME)) { // only test on local NodeManager nm = c.getNodeManager("datatypes"); int ccbefore = CountCommitProcessor.count; Node n = nm.createNode(); n.commit(); - if (c.getCloudContext().getUri().equals(ContextProvider.DEFAULT_CLOUD_CONTEXT_NAME)) { assertEquals(ccbefore + 1, CountCommitProcessor.count); } - return n.getNumber(); } public void testCommitCount() { @@ -129,11 +137,11 @@ Transaction t = getCloud().getTransaction("commitcount"); testCommitCount(t); t.commit(); - if (getCloudContext().getUri().equals(ContextProvider.DEFAULT_CLOUD_CONTEXT_NAME)) { - // there is no point in calling a commit processor twice - assertEquals(ccbefore + 1, CountCommitProcessor.count); + if (getCloudContext().getUri().equals(ContextProvider.DEFAULT_CLOUD_CONTEXT_NAME)) { // only test on local + assertEquals(ccbefore + 1, CountCommitProcessor.count); // there is no point in calling a commit processor twice } } + static int nn = 0; public void testCommitCountTransaction2() { Transaction t = getCloud().getTransaction("commitcount2"); @@ -144,13 +152,13 @@ t.commit(); // but only the transaction. nn = n.getNumber(); - if (getCloudContext().getUri().equals(ContextProvider.DEFAULT_CLOUD_CONTEXT_NAME)) { + if (getCloudContext().getUri().equals(ContextProvider.DEFAULT_CLOUD_CONTEXT_NAME)) { // only test on local // commit processor must have been called. - // TODO TODY FAILS FAILS - //assertEquals(ccbefore + 1, CountCommitProcessor.count); + assertEquals(ccbefore + 1, CountCommitProcessor.count); // FAILS } } + protected void testCommitCountOnChange(Cloud c, int nn) { int ccbefore = CountCommitProcessor.count; int changedbefore = CountCommitProcessor.changed; @@ -165,7 +173,8 @@ int ccbefore = CountCommitProcessor.count; int changedbefore = CountCommitProcessor.changed; Node n = c.getNode(nn); - n.setStringValue("string", "foobar"); + n.setStringValue("string", "foobar" + ccbefore); + assertTrue("Node is changed, but it reports that it isn't. Values" + new NodeMap(n) + " changed fields " + n.getChanged(), n.isChanged()); n.commit(); if (getCloudContext().getUri().equals(ContextProvider.DEFAULT_CLOUD_CONTEXT_NAME)) { assertEquals(ccbefore + 1, CountCommitProcessor.count); @@ -180,11 +189,9 @@ public void testCommitCountOnChangeTransaction() { testCommitCountOnChange(getCloud().getTransaction("commitcount3"), nn); - // testCommitCountOnChange2(getCloud().getTransaction("commitcount4"), nn); // TODO TODO - // FAILS FAILS + testCommitCountOnChange2(getCloud().getTransaction("commitcount4"), nn); } - } _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs