Author: ppitonak(a)redhat.com
Date: 2011-01-19 05:00:54 -0500 (Wed, 19 Jan 2011)
New Revision: 21073
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionItemBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuGroupBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuItemBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabPanelBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToggleControlBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelBean.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinner.java
Log:
* refactoring because panels were moved to CDK
* Attributes refactored since pn.faces-config.xml doesn't exist anymore
* refactoring of spinner test
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -45,6 +45,7 @@
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
+import javax.faces.FacesException;
import javax.faces.bean.ManagedBean;
import javax.faces.component.UIComponent;
import javax.faces.component.behavior.BehaviorBase;
@@ -103,6 +104,8 @@
Attribute newAttr = new Attribute(a);
attributes.put(newAttr.getName(), newAttr);
}
+ } else if (!loadFromClass &&
!richfacesAttributes.containsKey(componentClass)) {
+ throw new FacesException("Componnent " + componentClass.getName() +
" is not included in faces-config.xml.");
} else {
logger.debug("retrieving attributes of " + componentClass.getName()
+ " from class descriptor");
loadAttributesFromClass(componentClass);
@@ -631,68 +634,65 @@
private void loadRichFacesComponents() {
richfacesAttributes = new HashMap<Class<?>,
List<Attribute>>();
- final String[] files = {"META-INF/faces-config.xml",
"META-INF/pn.faces-config.xml"};
+ try {
+ ClassLoader cl = UIStatus.class.getClassLoader();
+ Enumeration<URL> fileUrls =
cl.getResources("META-INF/faces-config.xml");
+ URL configFile = null;
- for (String file : files) {
- try {
- ClassLoader cl = UIStatus.class.getClassLoader();
- Enumeration<URL> fileUrls = cl.getResources(file);
- URL configFile = null;
-
- while (fileUrls.hasMoreElements()) {
- URL url = fileUrls.nextElement();
- if (url.getPath().contains("richfaces-components-ui")) {
- configFile = url;
- }
+ while (fileUrls.hasMoreElements()) {
+ URL url = fileUrls.nextElement();
+ if (url.getPath().contains("richfaces-components-ui")) {
+ configFile = url;
}
+ }
- JAXBContext context = JAXBContext.newInstance(FacesConfigHolder.class);
- FacesConfigHolder facesConfigHolder = (FacesConfigHolder)
context.createUnmarshaller().unmarshal(configFile);
- List<Component> components = facesConfigHolder.getComponents();
- List<Behavior> behaviors = facesConfigHolder.getBehaviors();
+ JAXBContext context = JAXBContext.newInstance(FacesConfigHolder.class);
+ FacesConfigHolder facesConfigHolder = (FacesConfigHolder)
context.createUnmarshaller().unmarshal(configFile);
+ List<Component> components = facesConfigHolder.getComponents();
+ List<Behavior> behaviors = facesConfigHolder.getBehaviors();
- for (Component c : components) {
- if (c.getAttributes() == null) {
- continue;
- }
+ for (Component c : components) {
+ if (c.getAttributes() == null) {
+ continue;
+ }
- // remove hidden attributes
- Iterator<Attribute> i = c.getAttributes().iterator();
- while (i.hasNext()) {
- Attribute a = i.next();
- if (a.isHidden() || "id".equals(a.getName()) ||
"binding".equals(a.getName())) {
- i.remove();
- }
+ // remove hidden attributes
+ Iterator<Attribute> i = c.getAttributes().iterator();
+ while (i.hasNext()) {
+ Attribute a = i.next();
+ if (a.isHidden() || "id".equals(a.getName()) ||
"binding".equals(a.getName())) {
+ i.remove();
}
+ }
- richfacesAttributes.put(c.getComponentClass(), c.getAttributes());
- logger.info("attributes for component " +
c.getComponentClass().getName() + " loaded");
+ richfacesAttributes.put(c.getComponentClass(), c.getAttributes());
+ logger.info("attributes for component " +
c.getComponentClass().getName() + " loaded");
+ }
+
+ for (Behavior b : behaviors) {
+ if (b.getAttributes() == null) {
+ continue;
}
- for (Behavior b : behaviors) {
- if (b.getAttributes() == null) {
- continue;
+ // remove hidden attributes
+ Iterator<Attribute> i = b.getAttributes().iterator();
+ while (i.hasNext()) {
+ Attribute a = i.next();
+ if (a.isHidden() || "id".equals(a.getName()) ||
"binding".equals(a.getName())) {
+ i.remove();
}
-
- // remove hidden attributes
- Iterator<Attribute> i = b.getAttributes().iterator();
- while (i.hasNext()) {
- Attribute a = i.next();
- if (a.isHidden() || "id".equals(a.getName()) ||
"binding".equals(a.getName())) {
- i.remove();
- }
- }
-
- richfacesAttributes.put(b.getBehaviorClass(), b.getAttributes());
- logger.info("attributes for behavior " +
b.getBehaviorClass().getName() + " loaded");
}
- } catch (IOException ex) {
- logger.error("Input/output error.", ex);
- } catch (JAXBException ex) {
- logger.error("XML reading error.", ex);
+ richfacesAttributes.put(b.getBehaviorClass(), b.getAttributes());
+ logger.info("attributes for behavior " +
b.getBehaviorClass().getName() + " loaded");
}
+
+ } catch (IOException ex) {
+ logger.error("Input/output error.", ex);
+ } catch (JAXBException ex) {
+ logger.error("XML reading error.", ex);
}
+
}
@XmlRootElement(name = "faces-config", namespace =
"http://java.sun.com/xml/ns/javaee")
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionItemBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionItemBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichAccordionItemBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -27,8 +27,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
-import org.richfaces.component.AbstractAccordionItem;
-
+import org.richfaces.component.UIAccordionItem;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,7 +54,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes =
Attributes.getComponentAttributesFromFacesConfig(AbstractAccordionItem.class,
getClass());
+ attributes =
Attributes.getComponentAttributesFromFacesConfig(UIAccordionItem.class, getClass());
attributes.setAttribute("header", "Item 1");
attributes.setAttribute("name", "item1");
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -53,7 +53,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getComponentAttributesFromClass(UICollapsiblePanel.class,
getClass());
+ attributes =
Attributes.getComponentAttributesFromFacesConfig(UICollapsiblePanel.class, getClass());
attributes.setAttribute("rendered", true);
attributes.setAttribute("header", "collapsible panel
header");
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -27,7 +27,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
-import org.richfaces.component.html.HtmlPanelMenu;
+import org.richfaces.component.UIPanelMenu;
import org.richfaces.event.ItemChangeEvent;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
@@ -56,7 +56,7 @@
logger.debug("initializing bean " + getClass().getName());
// loading from Class to work around RF-10161
- attributes = Attributes.getComponentAttributesFromClass(HtmlPanelMenu.class,
getClass());
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UIPanelMenu.class,
getClass());
attributes.setAttribute("rendered", true);
attributes.setAttribute("style", "width: 200px;");
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuGroupBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuGroupBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuGroupBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -27,7 +27,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
-import org.richfaces.component.html.HtmlPanelMenuGroup;
+import org.richfaces.component.UIPanelMenuGroup;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,15 +53,15 @@
public void init() {
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
-
- attributes = Attributes.getComponentAttributesFromClass(HtmlPanelMenuGroup.class,
getClass());
-
+
+ attributes =
Attributes.getComponentAttributesFromFacesConfig(UIPanelMenuGroup.class, getClass());
+
attributes.setAttribute("rendered", true);
-
+
// already defined in source directly
attributes.remove("name");
attributes.remove("label");
-
+
// attributes should be hidden
attributes.remove("panelMenu");
attributes.remove("parentItem");
@@ -77,7 +77,7 @@
public void setAttributes(Attributes attributes) {
this.attributes = attributes;
}
-
+
public void changeExpandListener(Object event) {
// TODO ajax or server expansion doesn't work yet
throw new UnsupportedOperationException("needs to be implemented in
Metamer");
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuItemBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuItemBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelMenuItemBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -27,7 +27,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
-import org.richfaces.component.html.HtmlPanelMenuItem;
+import org.richfaces.component.UIPanelMenuItem;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,15 +53,15 @@
public void init() {
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
-
- attributes = Attributes.getComponentAttributesFromClass(HtmlPanelMenuItem.class,
getClass());
-
+
+ attributes =
Attributes.getComponentAttributesFromFacesConfig(UIPanelMenuItem.class, getClass());
+
attributes.setAttribute("rendered", true);
-
+
// already defined in source directly
attributes.remove("name");
attributes.remove("label");
-
+
// attributes should be hidden
attributes.remove("panelMenu");
attributes.remove("parentItem");
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabPanelBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabPanelBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTabPanelBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -53,7 +53,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getComponentAttributesFromClass(UITabPanel.class,
getClass());
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UITabPanel.class,
getClass());
attributes.setAttribute("activeItem", "tab1");
attributes.setAttribute("rendered", true);
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToggleControlBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToggleControlBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichToggleControlBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelBean.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelBean.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinner.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinner.java 2011-01-19
09:51:32 UTC (rev 21072)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/TestRichSpinner.java 2011-01-19
10:00:54 UTC (rev 21073)
@@ -464,8 +464,7 @@
@Test
public void testRendered() {
- JQueryLocator renderedInput =
pjq("input[type=radio][name$=renderedInput][value=false]");
- selenium.click(renderedInput);
+
selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
selenium.waitForPageToLoad();
assertFalse(selenium.isElementPresent(spinner), "Spinner should not be
rendered when rendered=false.");