Author: julien(a)jboss.com
Date: 2008-02-27 19:25:00 -0500 (Wed, 27 Feb 2008)
New Revision: 10148
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/Properties.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/PropertiesTestCase.java
Modified:
modules/portlet/trunk/portlet/src/test/resources/local-jboss-unit.xml
Log:
remove obsolete Properties class
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/Properties.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/Properties.java 2008-02-28
00:18:59 UTC (rev 10147)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/Properties.java 2008-02-28
00:25:00 UTC (rev 10148)
@@ -1,173 +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.portlet;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A set of multi valued properties produced by a response.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class Properties
-{
-
- private Map<String, ArrayList<String>> content;
-
- public Properties()
- {
- }
-
- /**
- * @param name the property name
- * @param value the property value
- * @throws IllegalArgumentException if name or value is null
- */
- public void addProperty(String name, String value)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
- if (value == null)
- {
- throw new IllegalArgumentException("Value cannot be null");
- }
- if (content == null)
- {
- content = new HashMap<String, ArrayList<String>>();
- }
-
- //
- ArrayList<String> values = content.get(name);
- if (values == null)
- {
- values = new ArrayList<String>();
- content.put(name, values);
- }
-
- //
- values.add(value);
- }
-
- /**
- * @param name the property name
- * @param value the property value
- * @throws IllegalArgumentException if name or value is null
- */
- public void setProperty(String name, String value)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
- if (value == null)
- {
- throw new IllegalArgumentException("Value cannot be null");
- }
- if (content == null)
- {
- content = new HashMap<String, ArrayList<String>>();
- }
-
- //
- ArrayList<String> values = content.get(name);
- if (values == null)
- {
- values = new ArrayList<String>();
- content.put(name, values);
- }
- else
- {
- values.clear();
- }
-
- //
- values.add(value);
- }
-
- /** Clear the properties. */
- public void clear()
- {
- if (content != null)
- {
- content.clear();
- }
- }
-
- public String getProperty(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
- if (content == null)
- {
- return null;
- }
-
- //
- ArrayList<String> values = content.get(name);
- if (values == null)
- {
- return null;
- }
- else
- {
- return values.get(0);
- }
- }
-
- /**
- * @param name the property name
- * @return the list of properties for the specified name or null if it does not exist
- * @throws IllegalArgumentException if name is null
- */
- public List<String> getProperties(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
- if (content == null)
- {
- return null;
- }
- return content.get(name);
- }
-
- public Set<String> getPropertyNames()
- {
- if (content == null)
- {
- return Collections.emptySet();
- }
- return content.keySet();
- }
-}
Deleted:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/PropertiesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/PropertiesTestCase.java 2008-02-28
00:18:59 UTC (rev 10147)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/PropertiesTestCase.java 2008-02-28
00:25:00 UTC (rev 10148)
@@ -1,119 +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.portlet;
-
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.Properties;
-import org.jboss.unit.api.pojo.annotations.Test;
-
-import static org.jboss.unit.api.Assert.*;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PropertiesTestCase
-{
-
- public PropertiesTestCase()
- {
- }
-
- @Test
- public void testA()
- {
- Properties props = new Properties();
- props.setProperty("name1", "value1");
-
- props.addProperty("name2", "value2");
-
- props.setProperty("name3", "value3-1");
- props.addProperty("name3", "value3-2");
-
- props.addProperty("name4", "value4-1");
- props.addProperty("name4", "value4-2");
-
- props.setProperty("name5", "value5-1");
- props.setProperty("name5", "value5-2");
-
- props.addProperty("name6", "value6-1");
- props.setProperty("name6", "value6-2");
-
- assertEquals("value1", props.getProperty("name1"));
- assertEquals(1, props.getProperties("name1").size());
- assertEquals("value1", props.getProperties("name1").get(0));
-
- assertEquals("value2", props.getProperty("name2"));
- assertEquals(1, props.getProperties("name2").size());
- assertEquals("value2", props.getProperties("name2").get(0));
-
- assertEquals("value3-1", props.getProperty("name3"));
- assertEquals(2, props.getProperties("name3").size());
- assertEquals("value3-1", props.getProperties("name3").get(0));
- assertEquals("value3-2", props.getProperties("name3").get(1));
-
- assertEquals("value4-1", props.getProperty("name4"));
- assertEquals(2, props.getProperties("name4").size());
- assertEquals("value4-1", props.getProperties("name4").get(0));
- assertEquals("value4-2", props.getProperties("name4").get(1));
-
- assertEquals(1, props.getProperties("name5").size());
- assertEquals("value5-2", props.getProperties("name5").get(0));
-
- assertEquals("value6-2", props.getProperty("name6"));
- assertEquals(1, props.getProperties("name6").size());
- assertEquals("value6-2", props.getProperties("name6").get(0));
-
- assertEquals(null, props.getProperties("not here"));
- assertNull(props.getProperty("not here"));
- assertEquals(Tools.toSet(new Object[]{"name1", "name2",
"name3", "name4", "name5", "name6"}),
props.getPropertyNames());
-
- try
- {
- props.setProperty(null, "not null");
- fail("Expected IllegalArgumentException");
- }
- catch (IllegalArgumentException e)
- {
- }
-
- try
- {
- props.setProperty("not null", null);
- fail("Expected IllegalArgumentException");
- }
- catch (IllegalArgumentException e)
- {
- }
-
- try
- {
- props.setProperty(null, null);
- fail("Expected IllegalArgumentException");
- }
- catch (IllegalArgumentException e)
- {
- }
- }
-
-}
Modified: modules/portlet/trunk/portlet/src/test/resources/local-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/portlet/src/test/resources/local-jboss-unit.xml 2008-02-28
00:18:59 UTC (rev 10147)
+++ modules/portlet/trunk/portlet/src/test/resources/local-jboss-unit.xml 2008-02-28
00:25:00 UTC (rev 10148)
@@ -29,9 +29,6 @@
<class
name="org.jboss.portal.test.portlet.ParametersTestCase"/>
</test>
<test>
- <class
name="org.jboss.portal.test.portlet.PropertiesTestCase"/>
- </test>
- <test>
<class
name="org.jboss.portal.test.portlet.ContentBufferTestCase"/>
</test>
<test>