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/MarkupTestCase.java
Log:
- Moved MarkupAttribute, MarkupElement and MarkupTestCase to core of JBoss Portal.
Deleted:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/MarkupTestCase.java
===================================================================
---
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 <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @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 = new MarkupAttribute("name",
"value", MarkupAttribute.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[]{null});
- fail("Was expecting an IAE");
- }
- catch (IllegalArgumentException expected)
- {
- }
- MarkupElement element = new MarkupElement("elementname",
"body", false, new MarkupAttribute[]{new
MarkupAttribute("attributename", "attributevalue",
MarkupAttribute.Type.CDATA)});
- assertEquals("elementname", element.getName());
- assertEquals("body", element.getBodyContent());
- assertEquals(false, element.isNeverEmpty());
- assertEquals(1, element.getAttributeSize());
- MarkupAttribute attribute = element.getAttribute(0);
- assertEquals("attributename", attribute.getName());
- assertEquals("attributevalue", attribute.getValue());
- assertEquals(MarkupAttribute.Type.CDATA, attribute.getType());
- attribute = 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 = new MarkupAttribute("name",
"/-_.*ABCabc012# ", MarkupAttribute.Type.URI);
- assertEquals("/-_.*ABCabc012%23+", attribute.getEncodedValue());
- }
-}