From portal-commits at lists.jboss.org Sun Jul 6 16:05:46 2008 Content-Type: multipart/mixed; boundary="===============5238812129576723725==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r11304 - modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model. Date: Sun, 06 Jul 2008 16:05:39 -0400 Message-ID: --===============5238812129576723725== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2008-07-06 16:05:38 -0400 (Sun, 06 Jul 2008) New Revision: 11304 Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/p= resentation/test/model/RemoveChildRecursiveTestCase.java Log: recursive removal test case Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/port= al/presentation/test/model/RemoveChildRecursiveTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/= presentation/test/model/RemoveChildRecursiveTestCase.java = (rev 0) +++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/= presentation/test/model/RemoveChildRecursiveTestCase.java 2008-07-06 20:05:= 38 UTC (rev 11304) @@ -0,0 +1,79 @@ +/*************************************************************************= ***** + * JBoss, a division of Red Hat = * + * Copyright 2008, Red Hat Middleware, LLC, and individual = * + * contributors as indicated by the @authors tag. See the = * + * copyright.txt in the distribution for a full listing of = * + * individual contributors. = * + * = * + * This is free software; you can redistribute it and/or modify it = * + * under the terms of the GNU Lesser General Public License as = * + * published by the Free Software Foundation; either version 2.1 of = * + * the License, or (at your option) any later version. = * + * = * + * This software is distributed in the hope that it will be useful, = * + * but WITHOUT ANY WARRANTY; without even the implied warranty of = * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU = * + * Lesser General Public License for more details. = * + * = * + * You should have received a copy of the GNU Lesser General Public = * + * License along with this software; if not, write to the Free = * + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA = * + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. = * + *************************************************************************= *****/ +package org.jboss.portal.presentation.test.model; + +import org.jboss.portal.presentation.model.ObjectTraversalType; +import org.jboss.portal.presentation.model.ViewPort; +import org.jboss.portal.presentation.model.ViewPortScope; + +/** + * @author Julien Viet + * @version $Revision: 630 $ + */ +public class RemoveChildRecursiveTestCase extends TraversalModelTestCase +{ + + public void testRemoveChild() + { + test(3, null); + } + + protected void test(ObjectTraversalType[] before, ObjectTraversalType[]= after, Object handback) + { + NodeDef rootDef =3D NodeDef.create(context); + NodeDef fooDef =3D rootDef.addChild("foo"); + NodeDef barDef =3D fooDef.addChild("bar"); + NodeDef juuDef =3D barDef.addChild("juu"); + + // + fooDef.setTraversal(before[0]); + barDef.setTraversal(before[1]); + juuDef.setTraversal(before[2]); + + // + rootDef.populate(mockModel); + + // + ViewPortScope scope =3D new CustomScope(mockModel, model, rootDef); + UIObjectTree context =3D new UIObjectTree(); + ViewPort viewPort =3D model.createViewPort(context, scope); + + // + viewPort.refresh(); + rootDef.assertEquals(context.getNode(model.getRootId())); + + // + mockModel.destroy(mockModel.getRoot().getChild("foo").getChild("bar"= )); + fooDef.removeChild("bar"); + + // + fooDef.setTraversal(after[0]); + barDef.setTraversal(after[1]); + juuDef.setTraversal(after[2]); + + // + viewPort.refresh(); + rootDef.assertEquals(context.getNode(model.getRootId())); + context.assertConsistency(model.getRootId()); + } +} \ No newline at end of file --===============5238812129576723725==--