From portal-commits at lists.jboss.org Wed Mar 12 02:47:39 2008 Content-Type: multipart/mixed; boundary="===============2657505865523284754==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r10268 - in modules/common/trunk/common/src: test/java/org/jboss/portal/test/common and 1 other directory. Date: Wed, 12 Mar 2008 02:47:39 -0400 Message-ID: --===============2657505865523284754== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: chris.laprun(a)jboss.com Date: 2008-03-12 02:47:39 -0400 (Wed, 12 Mar 2008) New Revision: 10268 Removed: modules/common/trunk/common/src/main/java/org/jboss/portal/common/markup/ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/M= arkupTestCase.java Log: - Moved MarkupAttribute, MarkupElement and MarkupTestCase to core of JBoss = Portal. Deleted: modules/common/trunk/common/src/test/java/org/jboss/portal/test/co= mmon/MarkupTestCase.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/common/trunk/common/src/test/java/org/jboss/portal/test/common/= MarkupTestCase.java 2008-03-12 05:39:42 UTC (rev 10267) +++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/= MarkupTestCase.java 2008-03-12 06:47:39 UTC (rev 10268) @@ -1,115 +0,0 @@ -/*************************************************************************= ***** - * JBoss, a division of Red Hat = * - * Copyright 2006, 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.test.common; - -import junit.framework.TestCase; -import org.jboss.portal.common.markup.MarkupAttribute; -import org.jboss.portal.common.markup.MarkupElement; - -/** - * @author Julien Viet - * @version $Revision: 1.1 $ - */ -public class MarkupTestCase extends TestCase -{ - - public void testAttributeConstructor() - { - try - { - new MarkupAttribute(null, "value", MarkupAttribute.Type.CDATA); - fail("Was expecting an IAE"); - } - catch (IllegalArgumentException expected) - { - } - try - { - new MarkupAttribute("name", null, MarkupAttribute.Type.CDATA); - fail("Was expecting an IAE"); - } - catch (IllegalArgumentException expected) - { - } - try - { - new MarkupAttribute("name", "value", null); - fail("Was expecting an IAE"); - } - catch (IllegalArgumentException expected) - { - } - MarkupAttribute attribute =3D new MarkupAttribute("name", "value", M= arkupAttribute.Type.CDATA); - assertEquals("name", attribute.getName()); - assertEquals("value", attribute.getValue()); - assertEquals(MarkupAttribute.Type.CDATA, attribute.getType()); - } - - public void testElementContructor() - { - try - { - new MarkupElement(null, "body", false, new MarkupAttribute[0]); - fail("Was expecting an IAE"); - } - catch (IllegalArgumentException expected) - { - } - try - { - new MarkupElement("name", "body", false, null); - fail("Was expecting an IAE"); - } - catch (IllegalArgumentException expected) - { - } - try - { - new MarkupElement("name", "body", false, new MarkupAttribute[]{nu= ll}); - fail("Was expecting an IAE"); - } - catch (IllegalArgumentException expected) - { - } - MarkupElement element =3D new MarkupElement("elementname", "body", f= alse, new MarkupAttribute[]{new MarkupAttribute("attributename", "attribute= value", MarkupAttribute.Type.CDATA)}); - assertEquals("elementname", element.getName()); - assertEquals("body", element.getBodyContent()); - assertEquals(false, element.isNeverEmpty()); - assertEquals(1, element.getAttributeSize()); - MarkupAttribute attribute =3D element.getAttribute(0); - assertEquals("attributename", attribute.getName()); - assertEquals("attributevalue", attribute.getValue()); - assertEquals(MarkupAttribute.Type.CDATA, attribute.getType()); - attribute =3D element.getAttribute("attributename"); - assertEquals("attributename", attribute.getName()); - assertEquals("attributevalue", attribute.getValue()); - assertEquals(MarkupAttribute.Type.CDATA, attribute.getType()); - assertEquals(null, element.getAttribute("someotherattributename")); - } - - public void testAttributeURIEncoding() - { - MarkupAttribute attribute =3D new MarkupAttribute("name", "/-_.*ABCa= bc012# ", MarkupAttribute.Type.URI); - assertEquals("/-_.*ABCabc012%23+", attribute.getEncodedValue()); - } -} --===============2657505865523284754==--