JBoss Portal SVN: r10317 - in modules/common/trunk/common/src: test/java/org/jboss/portal/test/common/net/media and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-18 18:05:40 -0400 (Tue, 18 Mar 2008)
New Revision: 10317
Added:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMap.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMapImpl.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMapTestCase.java
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/media/MediaType.java
Log:
added media type map
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/media/MediaType.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/media/MediaType.java 2008-03-18 21:47:59 UTC (rev 10316)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/media/MediaType.java 2008-03-18 22:05:40 UTC (rev 10317)
@@ -110,7 +110,6 @@
}
return value;
}
-
public int hashCode()
{
if (hashCode == null)
Added: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMap.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMap.java (rev 0)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMap.java 2008-03-18 22:05:40 UTC (rev 10317)
@@ -0,0 +1,194 @@
+/******************************************************************************
+ * 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.test.common.net.media;
+
+import org.jboss.portal.common.net.media.MediaType;
+import org.jboss.portal.common.net.media.TypeDef;
+
+import java.util.Set;
+
+/**
+ * A map containing values associated with media types. The map has the capability to map wildcard subtypes
+ * (for instance text / *) or the wildcard type (* / *). In order to make the distinction between what the map
+ * declares and what it supports it is possible to query the map with resolution or not.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface MediaTypeMap<V>
+{
+
+ /**
+ * Returns true if the map declares the specified media type.
+ *
+ * @param mediaType the media type
+ * @return true if the map declares the media type
+ * @throws IllegalArgumentException if the argument is null
+ */
+ boolean contains(MediaType mediaType) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map declares the specified type. It is equivalent to check if the map
+ * contains a wildard subtype of a type.
+ *
+ * @param type the type
+ * @return true if the map declares the type
+ * @throws IllegalArgumentException if the argument is null
+ */
+ boolean contains(TypeDef type) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map declares the specified media type with a specified value.
+ *
+ * @param mediaType the media type
+ * @param value the value
+ * @return true if the map declares the media type and the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ boolean contains(MediaType mediaType, V value) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map declares the specified type with a specific value. It is equivalent to check if the map
+ * contains a wildard subtype of a type with a specific value.
+ *
+ * @param type the type
+ * @param value the value
+ * @return true if the map declares the media type and the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ boolean contains(TypeDef type, V value) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map declares the specified value for any media type or any type. It is equivalent to check
+ * if the map contains a wildcard type with a specific value.
+ *
+ * @param value the value
+ * @return true if the map declares the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ boolean contains(V value) throws IllegalArgumentException;
+
+ /**
+ * Returns the set of values declared for a given media type.
+ *
+ * @param mediaType the media type
+ * @return the values declared
+ * @throws IllegalArgumentException if any argument is null
+ */
+ Set<V> get(MediaType mediaType) throws IllegalArgumentException;
+
+ /**
+ * Returns the set of values declared for a given type.
+ *
+ * @param type the type
+ * @return the values declared
+ * @throws IllegalArgumentException if any argument is null
+ */
+ Set<V> get(TypeDef type) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map supports the specified media type.
+ *
+ * @param mediaType the media type
+ * @return true if the map supports the media type
+ * @throws IllegalArgumentException if the argument is null
+ */
+ boolean isSupported(MediaType mediaType) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map supports the specified type.
+ *
+ * @param type the type
+ * @return true if the map declares the type
+ * @throws IllegalArgumentException if the argument is null
+ */
+ boolean isSupported(TypeDef type) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map supports the specified media type with a specified value.
+ *
+ * @param mediaType the media type
+ * @param value the value
+ * @return true if the map supports the media type and the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ boolean isSupported(MediaType mediaType, V value) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map supports the specified type with a specific value.
+ *
+ * @param type the type
+ * @param value the value
+ * @return true if the map supports the media type and the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ boolean isSupported(TypeDef type, V value) throws IllegalArgumentException;
+
+ /**
+ * Returns true if the map supports the specified value for any media type or any type.
+ *
+ * @param value the value
+ * @return true if the map supports the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ boolean isSupported(V value) throws IllegalArgumentException;
+
+ /**
+ * Returns the set of values supported for a given media type.
+ *
+ * @param mediaType the media type
+ * @return the values supported
+ * @throws IllegalArgumentException if any argument is null
+ */
+ Set<V> resolve(MediaType mediaType) throws IllegalArgumentException;
+
+ /**
+ * Returns the set of values supported for a given type.
+ *
+ * @param type the type
+ * @return the values supported
+ * @throws IllegalArgumentException if any argument is null
+ */
+ Set<V> resolve(TypeDef type) throws IllegalArgumentException;
+
+ /**
+ * Returns the set of declared media types.
+ *
+ * @return the media types
+ */
+ Set<MediaType> getMediaTypes();
+
+ /**
+ * Returns the set of declared types.
+ *
+ * @return the types
+ */
+ Set<TypeDef> getTypes();
+
+ /**
+ * Returns the set of declared values.
+ *
+ * @return the values
+ */
+ Set<V> getValues();
+}
Added: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMapImpl.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMapImpl.java (rev 0)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMapImpl.java 2008-03-18 22:05:40 UTC (rev 10317)
@@ -0,0 +1,397 @@
+/******************************************************************************
+ * 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.test.common.net.media;
+
+import org.jboss.portal.common.net.media.MediaType;
+import org.jboss.portal.common.net.media.TypeDef;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MediaTypeMapImpl<V> implements MediaTypeMap<V>
+{
+
+ /** . */
+ private static final String ANY = "*";
+
+ /** . */
+ private static final String ANY_ANY = "*/*";
+
+ /** . */
+ private static final char SEPARATOR = '/';
+
+ /** . */
+ private final Map<MediaType, Set<V>> mediaTypeToValues = new HashMap<MediaType,Set<V>>();
+
+ /** . */
+ private final Map<TypeDef, Set<V>> typeToValues = new HashMap<TypeDef,Set<V>>();
+
+ /** . */
+ private final Map<MediaType, Set<V>> combinedMediaTypeToValues = new HashMap<MediaType,Set<V>>();
+
+ /** . */
+ private final Map<TypeDef, Set<V>> combinedTypeToValues = new HashMap<TypeDef,Set<V>>();
+
+ /** . */
+ private final Set<V> anyTypeValues = new HashSet<V>();
+
+ /**
+ * Adds a value to the map using a media type pattern.
+ *
+ * @param mediaTypePattern the media type pattern
+ * @param value the value
+ * @throws IllegalArgumentException if any argument is null or the media type pattern is not valid
+ */
+ public void put(String mediaTypePattern, V value) throws IllegalArgumentException
+ {
+ if (mediaTypePattern == null)
+ {
+ throw new IllegalArgumentException("No null media type pattern accepted");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+
+ if (ANY.equals(mediaTypePattern) || ANY_ANY.equals(mediaTypePattern))
+ {
+ put(value);
+ }
+ else
+ {
+ int index = mediaTypePattern.indexOf(SEPARATOR);
+
+ //
+ if (index == -1)
+ {
+ throw new IllegalArgumentException("Not a valid media type pattern value:" + mediaTypePattern);
+ }
+
+ //
+ String type = mediaTypePattern.substring(0, index);
+ String subtype = mediaTypePattern.substring(index + 1);
+
+ //
+ if (ANY.equals(subtype))
+ {
+ put(TypeDef.create(type), value);
+ }
+ else
+ {
+ put(MediaType.create(type, subtype), value);
+ }
+ }
+ }
+
+ /**
+ * Adds a value to the map.
+ *
+ * @param mediaType the media type
+ * @param value the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ public void put(MediaType mediaType, V value) throws IllegalArgumentException
+ {
+ if (mediaType == null)
+ {
+ throw new IllegalArgumentException("No null media type accepted");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+
+ //
+ Set<V> mediaTypeValues = mediaTypeToValues.get(mediaType);
+ if (mediaTypeValues == null)
+ {
+ mediaTypeValues = new HashSet<V>();
+ mediaTypeToValues.put(mediaType, mediaTypeValues);
+ }
+ mediaTypeValues.add(value);
+
+ //
+ Set<V> combinedMediaTypeValues = combinedMediaTypeToValues.get(mediaType);
+ if (combinedMediaTypeValues == null)
+ {
+ combinedMediaTypeValues = new HashSet<V>();
+ combinedMediaTypeToValues.put(mediaType, combinedMediaTypeValues);
+ }
+ combinedMediaTypeValues.add(value);
+
+ //
+ Set<V> combinedTypeValues = combinedTypeToValues.get(mediaType.getType());
+ if (combinedTypeValues != null)
+ {
+ combinedMediaTypeValues.addAll(combinedTypeValues);
+ }
+
+ //
+ combinedMediaTypeValues.addAll(anyTypeValues);
+ }
+
+ /**
+ * Adds a value to the map.
+ *
+ * @param type the type
+ * @param value the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ public void put(TypeDef type, V value) throws IllegalArgumentException
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+
+ //
+ Set<V> typeValues = typeToValues.get(type);
+ if (typeValues == null)
+ {
+ typeValues = new HashSet<V>();
+ typeToValues.put(type, typeValues);
+ }
+ typeValues.add(value);
+
+ //
+ Set<V> combinedTypeValues = combinedTypeToValues.get(type);
+ if (combinedTypeValues == null)
+ {
+ combinedTypeValues = new HashSet<V>();
+ combinedTypeToValues.put(type, combinedTypeValues);
+ }
+ combinedTypeValues.add(value);
+
+ //
+ for (Map.Entry<MediaType, Set<V>> entry : combinedMediaTypeToValues.entrySet())
+ {
+ if (entry.getKey().getType().equals(type))
+ {
+ entry.getValue().add(value);
+ }
+ }
+ }
+
+ /**
+ * Adds a value to the map.
+ *
+ * @param value the value
+ * @throws IllegalArgumentException if any argument is null
+ */
+ public void put(V value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+
+ //
+ anyTypeValues.add(value);
+
+ //
+ for (Set<V> combinedTypeValues : combinedTypeToValues.values())
+ {
+ combinedTypeValues.add(value);
+ }
+
+ //
+ for (Set<V> combinedMediaTypeValues : combinedMediaTypeToValues.values())
+ {
+ combinedMediaTypeValues.add(value);
+ }
+ }
+
+ public Set<V> resolve(MediaType mediaType)
+ {
+ if (mediaType == null)
+ {
+ throw new IllegalArgumentException("No null media type accepted");
+ }
+
+ //
+ Set<V> values = combinedMediaTypeToValues.get(mediaType);
+
+ //
+ if (values == null)
+ {
+ values = resolve(mediaType.getType());
+ }
+
+ //
+ return values;
+ }
+
+ public Set<V> resolve(TypeDef type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
+
+ //
+ Set<V> values = combinedTypeToValues.get(type);
+
+ //
+ if (values == null)
+ {
+ values = getValues();
+ }
+
+ //
+ return values;
+ }
+
+ public Set<V> get(MediaType mediaType)
+ {
+ if (mediaType == null)
+ {
+ throw new IllegalArgumentException("No null media type accepted");
+ }
+
+ //
+ Set<V> values = combinedMediaTypeToValues.get(mediaType);
+
+ //
+ if (values == null)
+ {
+ values = Collections.emptySet();
+ }
+
+ //
+ return values;
+ }
+
+ public Set<V> get(TypeDef type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No null type accepted");
+ }
+
+ //
+ Set<V> values = combinedTypeToValues.get(type);
+
+ //
+ if (values == null)
+ {
+ values = Collections.emptySet();
+ }
+
+ //
+ return values;
+ }
+
+ public Set<V> getValues()
+ {
+ return anyTypeValues;
+ }
+
+ public boolean isSupported(MediaType mediaType)
+ {
+ return resolve(mediaType).size() > 0;
+ }
+
+ public boolean isSupported(TypeDef type)
+ {
+ return resolve(type).size() > 0;
+ }
+
+ public boolean isSupported(MediaType mediaType, V value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+
+ //
+ return resolve(mediaType).contains(value);
+ }
+
+ public boolean isSupported(TypeDef type, V value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+
+ //
+ return resolve(type).contains(value);
+ }
+
+ public boolean isSupported(V value)
+ {
+ if (value == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+
+ //
+ return getValues().contains(value);
+ }
+
+ public boolean contains(MediaType mediaType)
+ {
+ return get(mediaType).size() > 0;
+ }
+
+ public boolean contains(TypeDef type)
+ {
+ return get(type).size() > 0;
+ }
+
+ public boolean contains(MediaType mediaType, V value)
+ {
+ return get(mediaType).contains(value);
+ }
+
+ public boolean contains(TypeDef type, V value)
+ {
+ return get(type).contains(value);
+ }
+
+ public boolean contains(V value)
+ {
+ return getValues().contains(value);
+ }
+
+ public Set<MediaType> getMediaTypes()
+ {
+ return combinedMediaTypeToValues.keySet();
+ }
+
+ public Set<TypeDef> getTypes()
+ {
+ return combinedTypeToValues.keySet();
+ }
+}
Added: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMapTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMapTestCase.java (rev 0)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/media/MediaTypeMapTestCase.java 2008-03-18 22:05:40 UTC (rev 10317)
@@ -0,0 +1,499 @@
+/******************************************************************************
+ * 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.test.common.net.media;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.net.media.MediaType;
+import org.jboss.portal.common.net.media.TypeDef;
+import org.jboss.portal.common.net.media.SubtypeDef;
+import org.jboss.portal.common.util.Tools;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MediaTypeMapTestCase extends TestCase
+{
+
+ private final String v1 = "v1";
+ private final String v2 = "v2";
+ private final String v3 = "v3";
+ private final String v4 = "v4";
+ private final String v5 = "v5";
+ private final String v6 = "v6";
+
+ private final MediaType TEXT_HTML = MediaType.TEXT_HTML;
+ private final TypeDef TEXT = TypeDef.TEXT;
+ private final MediaType TEXT_CSS = MediaType.TEXT_CSS;
+ private final MediaType TEXT_JAVASCRIPT = MediaType.TEXT_JAVASCRIPT;
+ private final MediaType IMAGE_PNG = MediaType.create(TypeDef.IMAGE, SubtypeDef.create("png"));
+ private final TypeDef IMAGE = TypeDef.IMAGE;
+
+ private final String[] values = {v1,v2,v3,v4,v5,v6};
+
+ private void testValidity(MediaTypeMap map, int index)
+ {
+ assertEquals(all[index], map.getValues());
+
+ //
+ assertEquals(get[index][0], map.get(TEXT_HTML));
+ assertEquals(get[index][1], map.get(TEXT));
+ assertEquals(get[index][2], map.get(TEXT_CSS));
+ assertEquals(get[index][3], map.get(TEXT_JAVASCRIPT));
+ assertEquals(get[index][4], map.get(IMAGE_PNG));
+ assertEquals(get[index][5], map.get(IMAGE));
+
+ //
+ assertEquals(resolve[index][0], map.resolve(TEXT_HTML));
+ assertEquals(resolve[index][1], map.resolve(TEXT));
+ assertEquals(resolve[index][2], map.resolve(TEXT_CSS));
+ assertEquals(resolve[index][3], map.resolve(TEXT_JAVASCRIPT));
+ assertEquals(resolve[index][4], map.resolve(IMAGE_PNG));
+ assertEquals(resolve[index][5], map.resolve(IMAGE));
+
+ for (Object value : values)
+ {
+ assertEquals("Expected " + value + " to be contained in the map", map.get(TEXT_HTML).contains(value), map.contains(TEXT_HTML, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.get(TEXT).contains(value), map.contains(TEXT, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.get(TEXT_CSS).contains(value), map.contains(TEXT_CSS, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.get(TEXT_JAVASCRIPT).contains(value), map.contains(TEXT_JAVASCRIPT, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.get(IMAGE_PNG).contains(value), map.contains(IMAGE_PNG, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.get(IMAGE).contains(value), map.contains(IMAGE, value));
+
+ //
+ assertEquals("Expected " + value + " to be contained in the map", map.resolve(TEXT_HTML).contains(value), map.isSupported(TEXT_HTML, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.resolve(TEXT).contains(value), map.isSupported(TEXT, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.resolve(TEXT_CSS).contains(value), map.isSupported(TEXT_CSS, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.resolve(TEXT_JAVASCRIPT).contains(value), map.isSupported(TEXT_JAVASCRIPT, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.resolve(IMAGE_PNG).contains(value), map.isSupported(IMAGE_PNG, value));
+ assertEquals("Expected " + value + " to be contained in the map", map.resolve(IMAGE).contains(value), map.isSupported(IMAGE, value));
+ }
+
+ assertEquals(mediaTypes[index], map.getMediaTypes());
+ assertEquals(types[index], map.getTypes());
+ }
+
+ //
+
+ private final Set all1 = Tools.toSet();
+ private final Set mediaTypes1 = Tools.toSet(TEXT_HTML);
+ private final Set types1 = Tools.toSet();
+ private final Set[] get1 = {
+ Tools.toSet(v1),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ };
+ private final Set[] resolve1 = {
+ Tools.toSet(v1),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet()
+ };
+
+ public void testPut1()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put(TEXT_HTML, v1);
+ testValidity(map, 0);
+ }
+
+ //
+
+ private final Set mediaTypes2 = Tools.toSet(TEXT_HTML);
+ private final Set types2 = Tools.toSet(TEXT);
+ private final Set all2 = Tools.toSet();
+ private final Set[] get2 = {
+ Tools.toSet(v1, v2),
+ Tools.toSet(v2),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ };
+ private final Set[] resolve2 = {
+ Tools.toSet(v1, v2),
+ Tools.toSet(v2),
+ Tools.toSet(v2),
+ Tools.toSet(v2),
+ Tools.toSet(),
+ Tools.toSet()
+ };
+
+ public void testPut2()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put(TEXT_HTML, v1);
+ map.put(TEXT, v2);
+ testValidity(map, 1);
+ }
+
+ //
+
+ private final Set mediaTypes3 = Tools.toSet(TEXT_HTML);
+
+ private final Set types3 = Tools.toSet(TEXT);
+
+ private final Set all3 = Tools.toSet(v3);
+
+ private final Set[] get3 = {
+ Tools.toSet(v1, v2, v3),
+ Tools.toSet(v2, v3),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ };
+
+ private final Set[] resolve3 = {
+ Tools.toSet(v1, v2, v3),
+ Tools.toSet(v2, v3),
+ Tools.toSet(v2, v3),
+ Tools.toSet(v2, v3),
+ Tools.toSet(v3),
+ Tools.toSet(v3)
+ };
+
+ public void testPut3()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put(TEXT_HTML, v1);
+ map.put(TEXT, v2);
+ map.put(v3);
+ testValidity(map, 2);
+ }
+
+ //
+
+ private final Set mediaTypes4 = Tools.toSet(TEXT_HTML, TEXT_CSS);
+
+ private final Set types4 = Tools.toSet(TEXT);
+
+ private final Set all4= Tools.toSet(v3);
+
+ private final Set[] get4 = {
+ Tools.toSet(v1, v2, v3),
+ Tools.toSet(v2, v3),
+ Tools.toSet(v2, v3, v4),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(v3)
+ };
+
+ private final Set[] resolve4 = {
+ Tools.toSet(v1, v2, v3),
+ Tools.toSet(v2, v3),
+ Tools.toSet(v2, v3, v4),
+ Tools.toSet(v2, v3),
+ Tools.toSet(v3),
+ Tools.toSet(v3)
+ };
+
+ public void testPut4()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put(TEXT_HTML, v1);
+ map.put(TEXT, v2);
+ map.put(v3);
+ map.put(TEXT_CSS, v4);
+ testValidity(map, 3);
+ }
+
+ //
+
+ private final Set mediaTypes5 = Tools.toSet(TEXT_HTML, TEXT_CSS);
+
+ private final Set types5 = Tools.toSet(TEXT);
+
+ private final Set all5 = Tools.toSet(v3);
+
+ private final Set[] get5 = {
+ Tools.toSet(v1, v2, v3, v5),
+ Tools.toSet(v2, v3, v5),
+ Tools.toSet(v2, v3, v4, v5),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ };
+
+ private final Set[] resolve5 = {
+ Tools.toSet(v1, v2, v3, v5),
+ Tools.toSet(v2, v3, v5),
+ Tools.toSet(v2, v3, v4, v5),
+ Tools.toSet(v2, v3, v5),
+ Tools.toSet(v3),
+ Tools.toSet(v3)
+ };
+
+ public void testPut5()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put(TEXT_HTML, v1);
+ map.put(TEXT, v2);
+ map.put(v3);
+ map.put(TEXT_CSS, v4);
+ map.put(TEXT, v5);
+ testValidity(map, 4);
+ }
+
+ //
+
+ private final Set mediaTypes6 = Tools.toSet(TEXT_HTML, TEXT_CSS);
+
+ private final Set types6 = Tools.toSet(TEXT);
+
+ private final Set all6 = Tools.toSet(v3, v6);
+
+ private final Set[] get6 = {
+ Tools.toSet(v1, v2, v3, v5, v6),
+ Tools.toSet(v2, v3, v5, v6),
+ Tools.toSet(v2, v3, v4, v5, v6),
+ Tools.toSet(),
+ Tools.toSet(),
+ Tools.toSet(),
+ };
+
+ private final Set[] resolve6 = {
+ Tools.toSet(v1, v2, v3, v5, v6),
+ Tools.toSet(v2, v3, v5, v6),
+ Tools.toSet(v2, v3, v4, v5, v6),
+ Tools.toSet(v2, v3, v5, v6),
+ Tools.toSet(v3, v6),
+ Tools.toSet(v3, v6)
+ };
+
+ public void testPut6()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put(TEXT_HTML, v1);
+ map.put(TEXT, v2);
+ map.put(v3);
+ map.put(TEXT_CSS, v4);
+ map.put(TEXT, v5);
+ map.put(v6);
+ testValidity(map, 5);
+ }
+
+ private Set[] types = {types1,types2,types3,types4,types5,types6};
+ private Set[] mediaTypes = {mediaTypes1,mediaTypes2,mediaTypes3,mediaTypes4,mediaTypes5,mediaTypes6};
+ private Set[] all = {all1,all2,all3,all4,all5,all6};
+ private Set[][] get = {get1,get2,get3,get4,get5,get6};
+ private Set[][] resolve = {resolve1,resolve2,resolve3,resolve4,resolve5,resolve6};
+
+ public void interfaceThrowsIAE()
+ {
+ try
+ {
+ new MediaTypeMapImpl().get((MediaType)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().get((TypeDef)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().resolve((MediaType)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().resolve((TypeDef)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().isSupported((MediaType)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().isSupported(TEXT, null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().isSupported(TEXT_HTML, null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().isSupported((TypeDef)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().isSupported((Object)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().contains((MediaType)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().contains(TEXT, null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().contains(TEXT_HTML, null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().contains((TypeDef)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ try
+ {
+ new MediaTypeMapImpl().contains((Object)null);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testAddUsingPattern1()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put("text/html", v1);
+ assertEquals(Tools.toSet(v1), map.get(MediaType.TEXT_HTML));
+ }
+
+ public void testAddUsingPattern2()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put("text/*", v1);
+ assertEquals(Tools.toSet(v1), map.get(TEXT));
+ }
+
+ public void testAddUsingPattern3()
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ map.put("*/*", v1);
+ assertEquals(Tools.toSet(v1), map.getValues());
+ }
+
+ private void testAddUsingPatternThrowsIAE(String pattern, String value)
+ {
+ MediaTypeMapImpl map = new MediaTypeMapImpl();
+ try
+ {
+ map.put(pattern, value);
+ fail() ;
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
+ }
+
+ public void testAddUsingPatternThrowsIAE4()
+ {
+ testAddUsingPatternThrowsIAE(null, v1);
+ }
+
+ public void testAddUsingPattern5()
+ {
+ testAddUsingPatternThrowsIAE(null, null);
+ }
+
+ public void testAddUsingPattern6()
+ {
+ testAddUsingPatternThrowsIAE("text/html", null);
+ }
+
+ public void testAddUsingPattern7()
+ {
+ testAddUsingPatternThrowsIAE("", v1);
+ }
+
+ public void testAddUsingPattern8()
+ {
+ testAddUsingPatternThrowsIAE("text", v1);
+ }
+
+ public void testAddUsingPattern9()
+ {
+ testAddUsingPatternThrowsIAE("foo/html", v1);
+ }
+
+ public void testAddUsingPattern10()
+ {
+ testAddUsingPatternThrowsIAE("text/", v1);
+ }
+
+ public void testAddUsingPattern11()
+ {
+ testAddUsingPatternThrowsIAE("/html", v1);
+ }
+}
16 years, 3 months
JBoss Portal SVN: r10316 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal: test/core and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-03-18 17:47:59 -0400 (Tue, 18 Mar 2008)
New Revision: 10316
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupAttribute.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/MarkupTestCase.java
Log:
- Fixed incorrect toString version for MarkupAttribute and added related test case.
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupAttribute.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupAttribute.java 2008-03-18 20:54:51 UTC (rev 10315)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/metadata/portlet/MarkupAttribute.java 2008-03-18 21:47:59 UTC (rev 10316)
@@ -96,33 +96,25 @@
public String getEncodedValue()
{
StringWriter tmp = new StringWriter(32);
- type.encode(getValue(), tmp);
+ encodeValueTo(null, tmp);
return tmp.toString();
}
public String getEncodedValue(String contextPath)
{
StringWriter writer = new StringWriter(64);
- return getEncodedValue(contextPath, writer);
+ encodeValueTo(contextPath, writer);
+ return writer.toString();
}
- String getEncodedValue(String contextPath, Writer writer)
+ private void encodeValueTo(String contextPath, Writer writer)
{
- if (type == Type.URI && value.startsWith("/"))
+ if (contextPath != null && type == Type.URI && value.startsWith("/"))
{
Type.URI.encode(contextPath, writer);
}
- try
- {
- writer.write(getEncodedValue());
- }
- catch (IOException e)
- {
- throw new UndeclaredIOException(e);
- }
-
- return writer.toString();
+ type.encode(getValue(), writer);
}
public Type getType()
@@ -145,7 +137,7 @@
writer.write(name);
writer.write("=\"");
- writer.write(getEncodedValue(urlPrefix, writer));
+ encodeValueTo(urlPrefix, writer);
writer.write('"');
}
catch (IOException e)
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/MarkupTestCase.java 2008-03-18 20:54:51 UTC (rev 10315)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/MarkupTestCase.java 2008-03-18 21:47:59 UTC (rev 10316)
@@ -93,4 +93,17 @@
MarkupAttribute attribute = new MarkupAttribute("name", "/-_.*ABCabc012# ", MarkupAttribute.Type.URI);
assertEquals("/-_.*ABCabc012%23+", attribute.getEncodedValue());
}
+
+ public void testToString()
+ {
+ MarkupElement element = new MarkupElement("elementname", "body", false,
+ new MarkupAttribute[]{new MarkupAttribute("attributename", "attributevalue", MarkupAttribute.Type.CDATA)});
+
+ assertEquals("<elementname attributename=\"attributevalue\">body</elementname>", element.toString().trim());
+
+ element = new MarkupElement("elementname", null, false,
+ new MarkupAttribute[]{new MarkupAttribute("attributename", "attributevalue", MarkupAttribute.Type.CDATA)});
+
+ assertEquals("<elementname attributename=\"attributevalue\"/>", element.toString().trim());
+ }
}
16 years, 3 months
JBoss Portal SVN: r10315 - modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-18 16:54:51 -0400 (Tue, 18 Mar 2008)
New Revision: 10315
Modified:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css
Log:
li fix
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css 2008-03-18 20:43:35 UTC (rev 10314)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/master.css 2008-03-18 20:54:51 UTC (rev 10315)
@@ -101,6 +101,10 @@
}
+ul li {
+ list-style-position:inside;
+}
+
.hidden {
display: none;
}
@@ -381,43 +385,4 @@
padding: 5px;
}
-/*-------------------------------------Admin*/
-
-.admin-table {
- width: 100%;
- margin: 15px 0 0 0;
-}
-
-.admin-table td.admin-app-header {
- background-color: #999999;
- padding: 2px;
- border-bottom: 1px solid #000;
-}
-
-.admin-table td.admin-filter-header {
- background-color: #cccccc;
-}
-
-.admin-table td.admin-container-header {
- background-color: #dddddd;
-}
-
-.admin-table td.admin-container-header h3,
-.admin-table td.admin-filter-header h3{
- color: #585858;
- font-weight: normal;
- border-bottom: 1px solid #999;
-}
-
-.admin-table tr.admin-cat-header td{
- border-bottom: 1px solid #cccccc;
- width: 25%;
-}
-
-.admin-table tr.admin-cat-header td{
- font-weight: bold
-}
-
-.admin-table tr.admin-failed{
- background-color: #f78181
-}
\ No newline at end of file
+/*-------------------------------------Debugger*/
16 years, 3 months
JBoss Portal SVN: r10314 - modules/portlet/branches.
by portal-commits@lists.jboss.org
Author: mmillson
Date: 2008-03-18 16:43:35 -0400 (Tue, 18 Mar 2008)
New Revision: 10314
Added:
modules/portlet/branches/JBP_PORTLET_1_0_1_JBPORTAL-1956/
Log:
Create JBPORTAL-1956 patch branch from JBP_PORTLET_1_0_1 tag
Copied: modules/portlet/branches/JBP_PORTLET_1_0_1_JBPORTAL-1956 (from rev 10313, modules/portlet/tags/JBP_PORTLET_1_0_1)
16 years, 3 months
JBoss Portal SVN: r10313 - in modules/portlet/trunk/portal/src/main: resources/simple-portal-war/css and 1 other directory.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-18 16:35:58 -0400 (Tue, 18 Mar 2008)
New Revision: 10313
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/admin.css
Log:
admin portlet - small fixes
Modified: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-03-18 20:15:05 UTC (rev 10312)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-03-18 20:35:58 UTC (rev 10313)
@@ -22,27 +22,23 @@
******************************************************************************/
package org.jboss.portal.portlet.portal.admin.ui;
-import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.portlet.container.managed.ManagedObject;
import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
import org.jboss.portal.portlet.container.managed.ManagedPortletFilter;
-import org.jboss.portal.portlet.container.managed.ManagedObject;
-import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.common.i18n.LocalizedString;
-import static org.jboss.unit.api.Assert.assertNotNull;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.portlet.PortletException;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletURL;
-import javax.portlet.PortletRequestDispatcher;
import java.io.IOException;
import java.io.PrintWriter;
-import java.util.Locale;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -120,19 +116,19 @@
//
writer.print("" +
- "" +
- "" +
- "<div class=\"admin-container full-width\">\n" +
- " <div class=\"admin-header\">\n" +
- " <div class=\"expand\">\n" +
- " <img src=\"/simple-portal/images/admin/expand.gif\" alt=\"\"/><a href=\"javascript:expandAll();\">Expand All</a>\n" +
- " </div>\n" +
- " <div class=\"collapse\">\n" +
- " <img src=\"/simple-portal/images/admin/contract.gif\" alt=\"\"/><a href=\"javascript:collapseAll();\">Collapse All</a>\n" +
- " </div>\n" +
- " </div>\n");
+ "" +
+ "" +
+ "<div class=\"admin-container full-width\">\n" +
+ " <div class=\"admin-header\">\n" +
+ " <div class=\"expand\">\n" +
+ " <img src=\"/simple-portal/images/admin/expand.gif\" alt=\"\"/><a href=\"javascript:expandAll();\">Expand All</a>\n" +
+ " </div>\n" +
+ " <div class=\"collapse\">\n" +
+ " <img src=\"/simple-portal/images/admin/contract.gif\" alt=\"\"/><a href=\"javascript:collapseAll();\">Collapse All</a>\n" +
+ " </div>\n" +
+ " </div>\n");
-
+
for (ManagedPortletApplication application : registry.getManagedPortletApplications())
{
PortletURL url = resp.createActionURL();
@@ -146,47 +142,51 @@
url.setParameter("lifecycle", "start");
String startURL = url.toString();
- String htmlId = application.getId().substring(1,application.getId().length());
+ String htmlId = application.getId().substring(1, application.getId().length());
-
-
writer.print("" +
"\n" +
" <div class=\"par-container\">\n" +
" <div class=\"par-header\">\n" +
" <div class=\"par-header-left\">\n" +
- " <a id=\"contract-"+ htmlId +"\" href=\"#\" onclick=\"collapse(this,'"+ htmlId +"');\">\n" +
+ " <a id=\"contract-" + htmlId + "\" href=\"javascript:return false;\" onclick=\"collapse(this,'" + htmlId + "');\">\n" +
" <img src=\"/simple-portal/images/admin/contract.gif\" alt=\"\" />\n" +
- " <h3 class=\"par\">"+ application.getId() +"</h3>\n" +
+ " <h3 class=\"par\">" + application.getId() + "</h3>\n" +
" </a>\n" +
- " <a id=\"expand-"+ htmlId +"\" href=\"#\" onclick=\"expand(this,'"+ htmlId +"');\">\n" +
+ " <a id=\"expand-" + htmlId + "\" href=\"#\" onclick=\"expand(this,'" + htmlId + "');return false;\">\n" +
" <img src=\"/simple-portal/images/admin/expand.gif\" alt=\"\" />\n" +
- " <h3 class=\"par\">"+ application.getId() +"</h3>\n" +
+ " <h3 class=\"par\">" + application.getId() + "</h3>\n" +
" </a>\n" +
" </div>\n" +
"\n" +
" <div class=\"par-header-right\">\n" +
" <span class=\"par-status\">");
- if (application.getStatus().toString().equals("STARTED")){
- writer.print("<img src=\"/simple-portal/images/admin/started-icon.gif\" alt=\"\"/>");
- }else{
- writer.print("<img src=\"/simple-portal/images/admin/stopped-icon.gif\" alt=\"\"/>");
- }
- writer.print("" +
+ if (application.getStatus().toString().equals("STARTED"))
+ {
+ writer.print("<img src=\"/simple-portal/images/admin/started-icon.gif\" alt=\"\"/>");
+ }
+ else
+ {
+ writer.print("<img src=\"/simple-portal/images/admin/stopped-icon.gif\" alt=\"\"/>");
+ }
+ writer.print("" +
"" + application.getStatus() + "</span>\n" +
"\n" +
" <div class=\"par-control\">\n" +
" <img src=\"/simple-portal/images/admin/start-stop-edge.gif\" alt=\"\"/>\n");
- if (application.getStatus().toString().equals("STARTED")){
- writer.print("<a class=\"stop\" href=\"" + stopURL + "\">Stop</a></td>\n");
- }else{
- writer.print("<a class=\"start\" href=\"" + startURL + "\">Start</a></td>\n");
- }
+ if (application.getStatus().toString().equals("STARTED"))
+ {
+ writer.print("<a class=\"stop\" href=\"" + stopURL + "\">Stop</a></td>\n");
+ }
+ else
+ {
+ writer.print("<a class=\"start\" href=\"" + startURL + "\">Start</a></td>\n");
+ }
- writer.print("" +
+ writer.print("" +
"" +
"" +
" </div>\n" +
@@ -219,7 +219,7 @@
//
//writer.print("<li>Filter " + filter.getId() + " " + filter.getStatus() + " <a href=\"" +
- // startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
+ // startURL + "\">Start</a> <a href=\"" + stopURL + "\">Stop</a></li>");
writer.print("" +
"" +
@@ -227,11 +227,14 @@
" <td class=\"par-row-left\"><img class=\"icon\" src=\"/simple-portal/images/admin/filter-icon.gif\" alt=\"\"/>" + filter.getId() + "</td>\n" +
" <td>" + filter.getStatus() + "</td>\n" +
" <td></td>\n");
- if (filter.getStatus().toString().equals("STARTED")){
- writer.print(" <td class=\"par-row-right\">Start | <a class=\"stop\" href=\"" + stopURL + "\">Stop</a></td>\n");
- }else{
- writer.print(" <td class=\"par-row-right\"><a class=\"start\" href=\"" + startURL + "\">Start</a> | Stop</td>\n");
- }
+ if (filter.getStatus().toString().equals("STARTED"))
+ {
+ writer.print(" <td class=\"par-row-right\">Start | <a class=\"stop\" href=\"" + stopURL + "\">Stop</a></td>\n");
+ }
+ else
+ {
+ writer.print(" <td class=\"par-row-right\"><a class=\"start\" href=\"" + startURL + "\">Start</a> | Stop</td>\n");
+ }
writer.print(" </tr>");
@@ -252,48 +255,62 @@
url.setParameter("lifecycle", "start");
startURL = url.toString();
-
+
LocalizedString description = null;
String descString = "";
- try{
+ try
+ {
MetaInfo metaInfo = container.getInfo().getMeta();
description = metaInfo.getMetaValue("description");
- }catch(Exception e){
+ }
+ catch (Exception e)
+ {
//e.printStackTrace();
}
- if (description != null){
- descString = description.getString(req.getLocale(),true);
+ if (description != null)
+ {
+ descString = description.getString(req.getLocale(), true);
}
writer.print("" +
"" +
" <tr class=\"par-container-row\">\n" +
" <td class=\"par-row-left\"><img class=\"icon\" src=\"/simple-portal/images/admin/portlet-icon.gif\" alt=\"\"/>" + container.getId() + "</td>\n" +
- " <td>" + container.getStatus() + "</td>\n" +
+ " <td>" + container.getStatus());
+ if (container.getStatus().toString().equals("FAILED"))
+ {
+ writer.print("<img class=\"failed\" src=\"/simple-portal/images/admin/warning-icon.gif\" alt=\"\"/>");
+ }
+
+
+ writer.print("</td>\n" +
" <td>" + descString + "</td>\n");
- if (container.getStatus().toString().equals("STARTED")){
- writer.print(" <td class=\"par-row-right\">Start | <a class=\"stop\" href=\"" + stopURL + "\">Stop</a></td>\n");
- }else{
- writer.print(" <td class=\"par-row-right\"><a class=\"start\" href=\"" + startURL + "\">Start</a> | Stop</td>\n");
- }
+ if (container.getStatus().toString().equals("STARTED"))
+ {
+ writer.print(" <td class=\"par-row-right\">Start | <a class=\"stop\" href=\"" + stopURL + "\">Stop</a></td>\n");
+ }
+ else
+ {
+ writer.print(" <td class=\"par-row-right\"><a class=\"start\" href=\"" + startURL + "\">Start</a> | Stop</td>\n");
+ }
writer.print(" </tr>");
}
- writer.print("</table>" +
- " </div>\n" +
- "");
+ writer.print("</table>" +
+ " </div>\n" +
+ "");
}
writer.print("</div>" +
" </div>\n" +
- " </div>\n" +
- " </div>\n" +
- "\n" +
- " </div>\n" +
- " <br class=\"clear\"/>\n" +
- "</div>");
+ " </div>\n" +
+ " </div>\n" +
+ "\n" +
+ " </div>\n" +
+ " <br class=\"clear\"/>\n" +
+ "</div>");
//
writer.close();
Modified: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/admin.css
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/admin.css 2008-03-18 20:15:05 UTC (rev 10312)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/admin.css 2008-03-18 20:35:58 UTC (rev 10313)
@@ -95,12 +95,14 @@
table.par-table {
margin: 0;
padding: 0;
- border-collapse: collapse;
+ /*border-collapse: collapse;*/
border-spacing: 0;
+ border: 1px solid #999;
}
table.par-table td {
padding: 0 0 0 3px;
+ width: 25%;
}
table.par-table tr.par-subhead {
@@ -120,6 +122,10 @@
margin: 0 3px 0 0;
}
+table.par-table td img.failed {
+ margin: 0 0 0 3px;
+}
+
table.par-table td.par-header-left {
padding: 0 0 0 15px;
}
16 years, 3 months
JBoss Portal SVN: r10312 - branches/JBoss_Portal_2_6_3_JBPORTAL-1956/build.
by portal-commits@lists.jboss.org
Author: mmillson
Date: 2008-03-18 16:15:05 -0400 (Tue, 18 Mar 2008)
New Revision: 10312
Modified:
branches/JBoss_Portal_2_6_3_JBPORTAL-1956/build/build-thirdparty.xml
Log:
Fix typo that exists in 2_6_3 tag source.
Modified: branches/JBoss_Portal_2_6_3_JBPORTAL-1956/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_2_6_3_JBPORTAL-1956/build/build-thirdparty.xml 2008-03-18 19:35:29 UTC (rev 10311)
+++ branches/JBoss_Portal_2_6_3_JBPORTAL-1956/build/build-thirdparty.xml 2008-03-18 20:15:05 UTC (rev 10312)
@@ -51,7 +51,7 @@
<componentref name="jboss-portal/modules/web" version="1.1.0"/>
<componentref name="jboss-portal/modules/test" version="1.0.1"/>
<componentref name="jboss-portal/modules/portlet" version="1.0.1"/>
- <componentref name="jboss-portal/modules/identity" version="1.0.1/>
+ <componentref name="jboss-portal/modules/identity" version="1.0.1"/>
<componentref name="antlr" version="2.7.6.ga"/>
<componentref name="apache-ant" version="1.6.5"/>
<componentref name="jackrabbit" version="1.1.1"/>
16 years, 3 months
JBoss Portal SVN: r10311 - branches.
by portal-commits@lists.jboss.org
Author: mmillson
Date: 2008-03-18 15:35:29 -0400 (Tue, 18 Mar 2008)
New Revision: 10311
Added:
branches/JBoss_Portal_2_6_3_JBPORTAL-1956/
Removed:
branches/JBoss_Portal_2_6_1_JBPORTAL-1956/
Log:
Fix typo. The branch is a copy of JBoss_Portal_2_6_3.
Copied: branches/JBoss_Portal_2_6_3_JBPORTAL-1956 (from rev 10310, branches/JBoss_Portal_2_6_1_JBPORTAL-1956)
16 years, 3 months
JBoss Portal SVN: r10310 - branches.
by portal-commits@lists.jboss.org
Author: mmillson
Date: 2008-03-18 15:31:49 -0400 (Tue, 18 Mar 2008)
New Revision: 10310
Added:
branches/JBoss_Portal_2_6_1_JBPORTAL-1956/
Log:
Create JBPORTAL-1942 patch branch from JBoss_Portal_2_6_3 tag
Copied: branches/JBoss_Portal_2_6_1_JBPORTAL-1956 (from rev 10309, tags/JBoss_Portal_2_6_3)
16 years, 3 months
JBoss Portal SVN: r10309 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portlet and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-18 12:44:37 -0400 (Tue, 18 Mar 2008)
New Revision: 10309
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossPortlet.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderRequest.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderResponse.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java
Log:
- Fixed the CMS
- Fixed the JBossPortlet and related Request/Response
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-03-18 14:57:23 UTC (rev 10308)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-03-18 16:44:37 UTC (rev 10309)
@@ -151,7 +151,13 @@
//
render.setAttribute(PortletInvocation.INVOCATION_SCOPE, "controller_context", controllerContext);
+
+ UserContext userContext = cf.createUserContext();
+ //
+ controllerContextTL.set(controllerContext);
+ userContextTL.set(userContext);
+
// Contextualize
render.setSecurityContext(cf.createSecurityContext());
render.setPortalContext(cf.createPortalContext());
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java 2008-03-18 14:57:23 UTC (rev 10308)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java 2008-03-18 16:44:37 UTC (rev 10309)
@@ -37,7 +37,6 @@
import org.jboss.portal.api.PortalRuntimeContext;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
-import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.core.aspects.controller.node.Navigation;
/**
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossPortlet.java 2008-03-18 14:57:23 UTC (rev 10308)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossPortlet.java 2008-03-18 16:44:37 UTC (rev 10309)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portlet;
-import org.jboss.logging.Logger;
import org.jboss.portal.format.util.EntityTable;
import javax.portlet.ActionRequest;
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderRequest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2008-03-18 14:57:23 UTC (rev 10308)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2008-03-18 16:44:37 UTC (rev 10309)
@@ -33,7 +33,6 @@
import org.jboss.portal.core.controller.portlet.ControllerUserContext;
import org.jboss.portal.core.controller.portlet.PortletInvocationFactory;
import org.jboss.portal.identity.User;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portlet.util.Parameters;
@@ -51,11 +50,11 @@
/** . */
private ControllerContext controllerContext;
- private RenderRequestImpl portletRequest;
+ private RenderRequest portletRequest;
private UserContext userContext;
- public JBossRenderRequest(RenderRequestImpl portletRequest)
+ public JBossRenderRequest(RenderRequest portletRequest)
{
super(portletRequest);
this.portletRequest = portletRequest;
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderResponse.java 2008-03-18 14:57:23 UTC (rev 10308)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossRenderResponse.java 2008-03-18 16:44:37 UTC (rev 10309)
@@ -39,9 +39,6 @@
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portal.core.aspects.controller.node.Navigation;
-import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -49,9 +46,9 @@
*/
public class JBossRenderResponse extends PortletResponseWrapper implements RenderResponse
{
- private RenderResponseImpl portletResponse;
+ private RenderResponse portletResponse;
- public JBossRenderResponse(RenderResponseImpl portletResponse, RenderInvocation invocation, PortletRequestImpl preq)
+ public JBossRenderResponse(RenderResponse portletResponse)
{
super(portletResponse);
this.portletResponse = portletResponse;
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java 2008-03-18 14:57:23 UTC (rev 10308)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/filter/JBossPortletFilter.java 2008-03-18 16:44:37 UTC (rev 10309)
@@ -24,6 +24,8 @@
import org.jboss.portlet.JBossActionRequest;
import org.jboss.portlet.JBossActionResponse;
+import org.jboss.portlet.JBossRenderRequest;
+import org.jboss.portlet.JBossRenderResponse;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
@@ -71,7 +73,10 @@
public void doFilter(RenderRequest request, RenderResponse response, FilterChain filterChain) throws IOException, PortletException
{
- filterChain.doFilter(request, response);
+ JBossRenderRequest renderRequest = new JBossRenderRequest(request);
+ JBossRenderResponse renderResponse = new JBossRenderResponse(response);
+
+ filterChain.doFilter(renderRequest, renderResponse);
}
public void doFilter(ResourceRequest resourceRequest, ResourceResponse resourceResponse, FilterChain filterChain) throws IOException, PortletException
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml 2008-03-18 14:57:23 UTC (rev 10308)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml 2008-03-18 16:44:37 UTC (rev 10309)
@@ -23,10 +23,24 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<portlet-app
- xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <filter>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <portlet-name>CMSPortlet</portlet-name>
+ <portlet-name>CMSAdminPortlet</portlet-name>
+ </filter-mapping>
+
<portlet>
<description>Content Management System Portlet</description>
<portlet-name>CMSPortlet</portlet-name>
16 years, 3 months
JBoss Portal SVN: r10308 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/info and 3 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-18 10:57:23 -0400 (Tue, 18 Mar 2008)
New Revision: 10308
Removed:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/SessionInfoSupport.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SessionInfoTest.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PortletInfoTest.java
modules/portlet/trunk/test/src/test/resources/info/test-info-war/WEB-INF/jboss-portlet.xml
modules/portlet/trunk/test/src/test/resources/info/test-info-war/WEB-INF/portlet.xml
Log:
- Removed CorePortletInfo and attached directly the different sub Info
- Session Info configured in jboss-portlet.xml was ignored
- CurrentUsersPortlet doesn't need to be a JBoss Portlet
- Added a warning for former portlet using the JBossPortlet extension to add the filter
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-03-18 14:57:23 UTC (rev 10308)
@@ -520,7 +520,6 @@
ContainerMetaInfo containerMeta = buildContainerMeta(portletMD);
ContainerSecurityInfo containerSecurity = buildContainerSecurityInfo(portletMD);
ContainerCacheInfo containerCache = buildContainerCache(portletMD);
- ContainerSessionInfo containerSession = buildContainerSession(portletMD);
//
Map<String, String> initParameters = Collections.emptyMap();
@@ -607,7 +606,6 @@
containerMeta,
containerSecurity,
containerCache,
- containerSession,
containerEvents,
containerNavigation,
filters,
@@ -628,7 +626,6 @@
containerMeta,
containerSecurity,
containerCache,
- containerSession,
portletMD.getPortletName(),
portletMD.getPortletClass(),
context.getApplicationName(),
@@ -753,11 +750,6 @@
return containerSecurity;
}
- private ContainerSessionInfo buildContainerSession(PortletMetaData portletMD)
- {
- return new ContainerSessionInfo(false);
- }
-
private ContainerCacheInfo buildContainerCache(PortletMetaData portletMD)
{
int expirationCache = portletMD.getExpirationCache();
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-18 14:57:23 UTC (rev 10308)
@@ -60,9 +60,6 @@
private final ContainerCacheInfo cache;
/** . */
- private final ContainerSessionInfo session;
-
- /** . */
private final ContainerEventingInfo events;
/** . */
@@ -98,7 +95,6 @@
ContainerMetaInfo meta,
ContainerSecurityInfo security,
ContainerCacheInfo cache,
- ContainerSessionInfo session,
String name,
String className,
String applicationName,
@@ -112,7 +108,6 @@
this.meta = meta;
this.security = security;
this.cache = cache;
- this.session = session;
this.events = new ContainerEventingInfo();
this.navigation = new ContainerNavigationInfo();
this.filterRefs = Collections.emptyList();
@@ -131,7 +126,6 @@
ContainerMetaInfo meta,
ContainerSecurityInfo security,
ContainerCacheInfo cache,
- ContainerSessionInfo session,
ContainerEventingInfo events,
ContainerNavigationInfo navigation,
List<String> filterRefs,
@@ -149,7 +143,6 @@
this.meta = meta;
this.security = security;
this.cache = cache;
- this.session = session;
this.events = events;
this.navigation = navigation;
this.filterRefs = filterRefs;
@@ -257,11 +250,6 @@
return cache;
}
- public ContainerSessionInfo getSession()
- {
- return session;
- }
-
public Boolean isRemotable()
{
return remotable;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-03-18 14:57:23 UTC (rev 10308)
@@ -83,14 +83,6 @@
CacheInfo getCache();
/**
- * Retrieves session-related information for the described portlet. If no information is available then it returns
- * the null value.
- *
- * @return the session related information
- */
- SessionInfo getSession();
-
- /**
* Determines whether the described portlet can be accessed remotely (such as via WSRP) or not. Clients of this
* method should be prepare to handle a <code>null</code> return value expressing the fact that the remotable status
* hasn't been explicitely set.
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-03-18 14:57:23 UTC (rev 10308)
@@ -38,7 +38,6 @@
private PreferencesInfoSupport preferencesSupport = new PreferencesInfoSupport();
private SecurityInfoSupport securitySupport = new SecurityInfoSupport();
private CacheInfoSupport cacheSupport = new CacheInfoSupport();
- private SessionInfoSupport sessionSupport = new SessionInfoSupport();
private MetaInfoSupport metaSupport = new MetaInfoSupport();
private EventingInfoSupport eventsSupport = new EventingInfoSupport();
private NavigationInfoSupport navigationSupport = new NavigationInfoSupport();
@@ -88,11 +87,6 @@
return cacheSupport;
}
- public SessionInfoSupport getSession()
- {
- return sessionSupport;
- }
-
public Boolean isRemotable()
{
return remotable;
Deleted: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/SessionInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/SessionInfoSupport.java 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/SessionInfoSupport.java 2008-03-18 14:57:23 UTC (rev 10308)
@@ -1,56 +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.support.info;
-
-import org.jboss.portal.portlet.info.SessionInfo;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class SessionInfoSupport implements SessionInfo
-{
-
- /** . */
- private Boolean distributed;
-
- public SessionInfoSupport(Boolean distributed)
- {
- this.distributed = distributed;
- }
-
- public SessionInfoSupport()
- {
- this(null);
- }
-
- public Boolean getDistributed()
- {
- return distributed;
- }
-
- public void setDistributed(Boolean distributed)
- {
- this.distributed = distributed;
- }
-}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PortletInfoTest.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PortletInfoTest.java 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/PortletInfoTest.java 2008-03-18 14:57:23 UTC (rev 10308)
@@ -52,7 +52,6 @@
assertNotNull(info.getMeta());
assertNotNull(info.getPreferences());
assertNotNull(info.getSecurity());
- assertNotNull(info.getSession());
container = registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("RemotablePortlet2");
info = container.getInfo();
Deleted: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SessionInfoTest.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SessionInfoTest.java 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/info/SessionInfoTest.java 2008-03-18 14:57:23 UTC (rev 10308)
@@ -1,60 +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.info;
-
-import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.info.SessionInfo;
-
-import static org.jboss.unit.api.Assert.*;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw Dawidowicz</a>
- * @version $Revision: 6720 $
- */
-public class SessionInfoTest extends AbstractInfoTest
-{
-
- public SessionInfoTest()
- {
- super("SessionInfoTest");
- }
-
- public void execute()
- {
- ManagedPortletContainer container = registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("DistributedPortlet1");
- PortletInfo info = container.getInfo();
- SessionInfo sessionInfo = info.getSession();
- assertNotNull(sessionInfo);
- Boolean distributed = sessionInfo.getDistributed();
- assertEquals(Boolean.TRUE, distributed);
-
-
- container = registry.getManagedPortletApplication("/test-info").getManagedPortletContainer("DistributedPortlet2");
- info = container.getInfo();
- sessionInfo = info.getSession();
- assertNotNull(sessionInfo);
- distributed = sessionInfo.getDistributed();
- assertEquals(Boolean.FALSE, distributed);
- }
-}
Modified: modules/portlet/trunk/test/src/test/resources/info/test-info-war/WEB-INF/jboss-portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/info/test-info-war/WEB-INF/jboss-portlet.xml 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/test/src/test/resources/info/test-info-war/WEB-INF/jboss-portlet.xml 2008-03-18 14:57:23 UTC (rev 10308)
@@ -34,13 +34,4 @@
<portlet-name>RemotablePortlet3</portlet-name>
<remotable>true</remotable>
</portlet>
-
- <portlet>
- <portlet-name>DistributedPortlet1</portlet-name>
- <distributed>true</distributed>
- </portlet>
- <portlet>
- <portlet-name>DistributedPortlet2</portlet-name>
- <distributed>false</distributed>
- </portlet>
</portlet-app>
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/test/resources/info/test-info-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/info/test-info-war/WEB-INF/portlet.xml 2008-03-18 14:53:32 UTC (rev 10307)
+++ modules/portlet/trunk/test/src/test/resources/info/test-info-war/WEB-INF/portlet.xml 2008-03-18 14:57:23 UTC (rev 10308)
@@ -186,34 +186,6 @@
</portlet>
<portlet>
- <portlet-name>DistributedPortlet1</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.info.universal.SimplePortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <portlet-info>
- <title>title</title>
- <short-title>short-title</short-title>
- <keywords>keywords</keywords>
- </portlet-info>
- </portlet>
-
- <portlet>
- <portlet-name>DistributedPortlet2</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.info.universal.SimplePortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <portlet-info>
- <title>title</title>
- <short-title>short-title</short-title>
- <keywords>keywords</keywords>
- </portlet-info>
- </portlet>
-
- <portlet>
<portlet-name>SecuredPortlet1</portlet-name>
<portlet-class>org.jboss.portal.test.portlet.info.universal.SimplePortlet</portlet-class>
<supports>
16 years, 3 months