You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/03 23:18:39 UTC
svn commit: r673811 [4/5] - in /myfaces/core/trunk_1.2.x:
api/src/main/java-templates/javax/faces/component/
api/src/main/java/javax/faces/ api/src/main/java/javax/faces/application/
api/src/main/java/javax/faces/component/ api/src/main/java/javax/face...
Modified: myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/ValueBindingImplCactus.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/ValueBindingImplCactus.java?rev=673811&r1=673810&r2=673811&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/ValueBindingImplCactus.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/ValueBindingImplCactus.java Thu Jul 3 14:18:36 2008
@@ -32,204 +32,204 @@
import org.apache.cactus.ServletTestCase;
public class ValueBindingImplCactus extends ServletTestCase {
- private FacesContext facesContext;
- private UIViewRoot viewRoot;
- private Application application;
-
- protected void setUp() throws Exception {
- super.setUp();
- FacesContextFactory facesContextFactory = (FacesContextFactory) FactoryFinder
- .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
- LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
- .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
- Lifecycle lifecycle = lifecycleFactory
- .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
- facesContext = facesContextFactory.getFacesContext(this.config
- .getServletContext(), request, response, lifecycle);
- assertNotNull(facesContext);
- application = facesContext.getApplication();
- ViewHandler viewHandler = application.getViewHandler();
- String viewId = "/index.jsp";
- viewRoot = viewHandler.createView(facesContext, viewId);
- viewRoot.setViewId(viewId);
- facesContext.setViewRoot(viewRoot);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.getExpressionString()'
- */
- public void testGetExpressionString() {
-
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.getType(FacesContext)'
- */
- public void testGetType() {
-
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.getValue(FacesContext)'
- */
- public void testGetValue() {
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.isReadOnly(FacesContext)'
- */
- public void testIsReadOnly() {
-
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.setValue(FacesContext, Object)'
- */
- public void testSetValueSimpleMap() {
- facesContext.getExternalContext().getRequestMap().put("foo", new HashMap());
- ValueBinding binding = application.createValueBinding("#{foo['baz']}");
- Integer value = new Integer(14);
- binding.setValue(facesContext, value);
- assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
- }
-
- public void testSetValueSimpleBeanInRequestMapNoInitialValue() {
- Map map = new HashMap();
- DummyBean bean = new DummyBean(map);
- facesContext.getExternalContext().getRequestMap().put("bean", bean);
- ValueBinding binding = application.createValueBinding("#{bean.map['baz']}");
- Integer value = new Integer(14);
- binding.setValue(facesContext, value);
- assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
- }
-
- public void testSetValueSimpleBeanInRequestMapWithInitialValue() {
- Map map = new HashMap();
- String initialValue = "hello world";
- map.put("baz", initialValue);
- DummyBean bean = new DummyBean(map);
- facesContext.getExternalContext().getRequestMap().put("bean", bean);
- ValueBinding binding = application.createValueBinding("#{bean.map['baz']}");
- assertEquals(initialValue, binding.getValue(facesContext));
- Integer value = new Integer(14);
- binding.setValue(facesContext, value);
- assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
- }
-
- public void testSetValueSimpleBeanInRequestMapWithConverter() {
- Map map = new HashMap();
- DummyBean bean = new DummyBean(map);
- facesContext.getExternalContext().getRequestMap().put("bean", bean);
- ValueBinding binding = application.createValueBinding("#{bean.map['baz']}");
- binding.setValue(facesContext, new Integer(14));
- assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
- }
-
- public void testSetValueSimpleBeanInSessionMap() {
- DummyBean bean = new DummyBean(new HashMap());
- facesContext.getExternalContext().getSessionMap().put("bean", bean);
- ValueBinding binding = application.createValueBinding("#{bean.map['baz']}");
- Integer value = new Integer(14);
- binding.setValue(facesContext, value);
- assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
- }
-
- public void setSetIntegerPrimitive() {
- DummyBean bean = new DummyBean(new HashMap());
- facesContext.getExternalContext().getSessionMap().put("bean", bean);
- ValueBinding binding = application.createValueBinding("#{bean.integerPrimitive}");
- Integer value = new Integer(14);
- binding.setValue(facesContext, value);
- assertEquals(14, bean.getIntegerPrimitive());
- }
-
- public void testUnaryNot() {
- facesContext.getExternalContext().getRequestMap().put("trueBean", Boolean.TRUE);
- ValueBinding binding;
-
- // First test #{trueBean} is working well
- binding = application.createValueBinding("#{trueBean}");
- assertTrue( ((Boolean)binding.getValue(facesContext)).booleanValue() );
-
- // Then test #{! trueBean} is false
- binding = application.createValueBinding("#{! trueBean}");
- assertFalse( ((Boolean)binding.getValue(facesContext)).booleanValue() );
- }
-
- public void testNotEmpty() {
- facesContext.getExternalContext().getRequestMap().put("dummyString", "dummy");
- ValueBinding binding;
-
- binding = application.createValueBinding("#{! empty dummyString}");
- assertTrue( ((Boolean)binding.getValue(facesContext)).booleanValue() );
-
- binding = application.createValueBinding("#{! empty undefString}");
- assertFalse( ((Boolean)binding.getValue(facesContext)).booleanValue() );
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.ValueBindingImpl(Application,
- * String)'
- */
- public void testValueBindingImplApplicationString() {
-
- }
-
- /*
- * Test method for 'org.apache.myfaces.el.ValueBindingImpl.toString()'
- */
- public void testToString() {
-
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.ValueBindingImpl()'
- */
- public void testValueBindingImpl() {
-
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.saveState(FacesContext)'
- */
- public void testSaveState() {
-
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.restoreState(FacesContext,
- * Object)'
- */
- public void testRestoreState() {
-
- }
-
- /*
- * Test method for 'org.apache.myfaces.el.ValueBindingImpl.isTransient()'
- */
- public void testIsTransient() {
-
- }
-
- /*
- * Test method for
- * 'org.apache.myfaces.el.ValueBindingImpl.setTransient(boolean)'
- */
- public void testSetTransient() {
+ private FacesContext facesContext;
+ private UIViewRoot viewRoot;
+ private Application application;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ FacesContextFactory facesContextFactory = (FacesContextFactory) FactoryFinder
+ .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+ LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
+ .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ Lifecycle lifecycle = lifecycleFactory
+ .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+ facesContext = facesContextFactory.getFacesContext(this.config
+ .getServletContext(), request, response, lifecycle);
+ assertNotNull(facesContext);
+ application = facesContext.getApplication();
+ ViewHandler viewHandler = application.getViewHandler();
+ String viewId = "/index.jsp";
+ viewRoot = viewHandler.createView(facesContext, viewId);
+ viewRoot.setViewId(viewId);
+ facesContext.setViewRoot(viewRoot);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.getExpressionString()'
+ */
+ public void testGetExpressionString() {
+
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.getType(FacesContext)'
+ */
+ public void testGetType() {
+
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.getValue(FacesContext)'
+ */
+ public void testGetValue() {
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.isReadOnly(FacesContext)'
+ */
+ public void testIsReadOnly() {
+
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.setValue(FacesContext, Object)'
+ */
+ public void testSetValueSimpleMap() {
+ facesContext.getExternalContext().getRequestMap().put("foo", new HashMap());
+ ValueBinding binding = application.createValueBinding("#{foo['baz']}");
+ Integer value = new Integer(14);
+ binding.setValue(facesContext, value);
+ assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
+ }
+
+ public void testSetValueSimpleBeanInRequestMapNoInitialValue() {
+ Map map = new HashMap();
+ DummyBean bean = new DummyBean(map);
+ facesContext.getExternalContext().getRequestMap().put("bean", bean);
+ ValueBinding binding = application.createValueBinding("#{bean.map['baz']}");
+ Integer value = new Integer(14);
+ binding.setValue(facesContext, value);
+ assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
+ }
+
+ public void testSetValueSimpleBeanInRequestMapWithInitialValue() {
+ Map map = new HashMap();
+ String initialValue = "hello world";
+ map.put("baz", initialValue);
+ DummyBean bean = new DummyBean(map);
+ facesContext.getExternalContext().getRequestMap().put("bean", bean);
+ ValueBinding binding = application.createValueBinding("#{bean.map['baz']}");
+ assertEquals(initialValue, binding.getValue(facesContext));
+ Integer value = new Integer(14);
+ binding.setValue(facesContext, value);
+ assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
+ }
+
+ public void testSetValueSimpleBeanInRequestMapWithConverter() {
+ Map map = new HashMap();
+ DummyBean bean = new DummyBean(map);
+ facesContext.getExternalContext().getRequestMap().put("bean", bean);
+ ValueBinding binding = application.createValueBinding("#{bean.map['baz']}");
+ binding.setValue(facesContext, new Integer(14));
+ assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
+ }
+
+ public void testSetValueSimpleBeanInSessionMap() {
+ DummyBean bean = new DummyBean(new HashMap());
+ facesContext.getExternalContext().getSessionMap().put("bean", bean);
+ ValueBinding binding = application.createValueBinding("#{bean.map['baz']}");
+ Integer value = new Integer(14);
+ binding.setValue(facesContext, value);
+ assertEquals(14, ((Integer)binding.getValue(facesContext)).intValue());
+ }
+
+ public void setSetIntegerPrimitive() {
+ DummyBean bean = new DummyBean(new HashMap());
+ facesContext.getExternalContext().getSessionMap().put("bean", bean);
+ ValueBinding binding = application.createValueBinding("#{bean.integerPrimitive}");
+ Integer value = new Integer(14);
+ binding.setValue(facesContext, value);
+ assertEquals(14, bean.getIntegerPrimitive());
+ }
+
+ public void testUnaryNot() {
+ facesContext.getExternalContext().getRequestMap().put("trueBean", Boolean.TRUE);
+ ValueBinding binding;
+
+ // First test #{trueBean} is working well
+ binding = application.createValueBinding("#{trueBean}");
+ assertTrue( ((Boolean)binding.getValue(facesContext)).booleanValue() );
+
+ // Then test #{! trueBean} is false
+ binding = application.createValueBinding("#{! trueBean}");
+ assertFalse( ((Boolean)binding.getValue(facesContext)).booleanValue() );
+ }
+
+ public void testNotEmpty() {
+ facesContext.getExternalContext().getRequestMap().put("dummyString", "dummy");
+ ValueBinding binding;
+
+ binding = application.createValueBinding("#{! empty dummyString}");
+ assertTrue( ((Boolean)binding.getValue(facesContext)).booleanValue() );
+
+ binding = application.createValueBinding("#{! empty undefString}");
+ assertFalse( ((Boolean)binding.getValue(facesContext)).booleanValue() );
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.ValueBindingImpl(Application,
+ * String)'
+ */
+ public void testValueBindingImplApplicationString() {
+
+ }
+
+ /*
+ * Test method for 'org.apache.myfaces.el.ValueBindingImpl.toString()'
+ */
+ public void testToString() {
+
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.ValueBindingImpl()'
+ */
+ public void testValueBindingImpl() {
+
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.saveState(FacesContext)'
+ */
+ public void testSaveState() {
+
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.restoreState(FacesContext,
+ * Object)'
+ */
+ public void testRestoreState() {
+
+ }
+
+ /*
+ * Test method for 'org.apache.myfaces.el.ValueBindingImpl.isTransient()'
+ */
+ public void testIsTransient() {
+
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.myfaces.el.ValueBindingImpl.setTransient(boolean)'
+ */
+ public void testSetTransient() {
- }
+ }
}
Modified: myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/BulkOrder.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/BulkOrder.java?rev=673811&r1=673810&r2=673811&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/BulkOrder.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/BulkOrder.java Thu Jul 3 14:18:36 2008
@@ -21,8 +21,8 @@
public class BulkOrder implements Order {
- public String toString() {
- return "I am a Bulk Order";
- }
-
+ public String toString() {
+ return "I am a Bulk Order";
+ }
+
}
\ No newline at end of file
Modified: myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/GuiceResolverTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/GuiceResolverTestCase.java?rev=673811&r1=673810&r2=673811&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/GuiceResolverTestCase.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/GuiceResolverTestCase.java Thu Jul 3 14:18:36 2008
@@ -32,41 +32,41 @@
public class GuiceResolverTestCase extends AbstractJsfTestCase {
- public GuiceResolverTestCase(String name) {
- super(name);
- }
+ public GuiceResolverTestCase(String name) {
+ super(name);
+ }
- @Override
- protected void setUp() throws Exception {
-
- super.setUp();
-
- // simulate a ServletContextListener
- Injector injector = Guice.createInjector(new ShoppingModule());
- servletContext.setAttribute(GuiceResolver.KEY, injector);
-
- // simulate Myfaces starting up
- RuntimeConfig rc = RuntimeConfig.getCurrentInstance(externalContext);
- ManagedBean bean = new ManagedBean();
- bean.setBeanClass(ShoppingCart.class.getName());
- bean.setScope("request");
- rc.addManagedBean("shoppingCart", bean);
-
- }
+ @Override
+ protected void setUp() throws Exception {
+
+ super.setUp();
+
+ // simulate a ServletContextListener
+ Injector injector = Guice.createInjector(new ShoppingModule());
+ servletContext.setAttribute(GuiceResolver.KEY, injector);
+
+ // simulate Myfaces starting up
+ RuntimeConfig rc = RuntimeConfig.getCurrentInstance(externalContext);
+ ManagedBean bean = new ManagedBean();
+ bean.setBeanClass(ShoppingCart.class.getName());
+ bean.setScope("request");
+ rc.addManagedBean("shoppingCart", bean);
+
+ }
- public void testResolve() {
-
- ELResolver resolver = new GuiceResolver();
-
- ShoppingCart cart = (ShoppingCart) resolver.getValue(facesContext.getELContext(), ((Object)null), ((Object)"shoppingCart"));
-
- assertNotNull(cart);
-
- assertEquals(new BulkOrder().toString(), cart.getOrder().toString());
-
- cart = (ShoppingCart) resolver.getValue(facesContext.getELContext(), ((Object)null), ((Object)"XXXshoppingCart"));
-
- assertNull(cart);
- }
-
+ public void testResolve() {
+
+ ELResolver resolver = new GuiceResolver();
+
+ ShoppingCart cart = (ShoppingCart) resolver.getValue(facesContext.getELContext(), ((Object)null), ((Object)"shoppingCart"));
+
+ assertNotNull(cart);
+
+ assertEquals(new BulkOrder().toString(), cart.getOrder().toString());
+
+ cart = (ShoppingCart) resolver.getValue(facesContext.getELContext(), ((Object)null), ((Object)"XXXshoppingCart"));
+
+ assertNull(cart);
+ }
+
}
Modified: myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/Order.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/Order.java?rev=673811&r1=673810&r2=673811&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/Order.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/Order.java Thu Jul 3 14:18:36 2008
@@ -20,5 +20,5 @@
package org.apache.myfaces.el.unified.resolver;
public interface Order {
-
+
}
Modified: myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/ShoppingCart.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/ShoppingCart.java?rev=673811&r1=673810&r2=673811&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/ShoppingCart.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/ShoppingCart.java Thu Jul 3 14:18:36 2008
@@ -23,15 +23,15 @@
public class ShoppingCart {
- private Order order;
-
- @Inject
- public ShoppingCart(Order order) {
- this.order = order;
- }
-
- public Order getOrder() {
- return order;
- }
-
+ private Order order;
+
+ @Inject
+ public ShoppingCart(Order order) {
+ this.order = order;
+ }
+
+ public Order getOrder() {
+ return order;
+ }
+
}
Modified: myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/ShoppingModule.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/ShoppingModule.java?rev=673811&r1=673810&r2=673811&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/ShoppingModule.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/el/unified/resolver/ShoppingModule.java Thu Jul 3 14:18:36 2008
@@ -24,10 +24,10 @@
public class ShoppingModule implements Module {
- public void configure(Binder binder) {
+ public void configure(Binder binder) {
- binder.bind(Order.class).to(BulkOrder.class);
-
- }
+ binder.bind(Order.class).to(BulkOrder.class);
+
+ }
}
\ No newline at end of file
Modified: myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/lifecycle/InstrumentingPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/lifecycle/InstrumentingPhaseListener.java?rev=673811&r1=673810&r2=673811&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/lifecycle/InstrumentingPhaseListener.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/test/java/org/apache/myfaces/lifecycle/InstrumentingPhaseListener.java Thu Jul 3 14:18:36 2008
@@ -24,95 +24,95 @@
import javax.faces.event.PhaseListener;
public class InstrumentingPhaseListener implements PhaseListener {
- private static final long serialVersionUID = -3222250142846233648L;
- private PhaseId listenPhaseId = null;
- private PhaseId eventPhaseId = null;
- private boolean before = true;
- private boolean after = true;
- private boolean render = false;
- private boolean complete = false;
- private List afterPhases = new ArrayList();
- private List beforePhases = new ArrayList();
-
- public InstrumentingPhaseListener() {
- }
-
- public InstrumentingPhaseListener(PhaseId interestingPhaseId) {
- this.listenPhaseId = interestingPhaseId;
- }
-
- public void afterPhase(PhaseEvent event) {
- afterPhases.add(event.getPhaseId());
- if(null != eventPhaseId && event.getPhaseId().equals(eventPhaseId)) {
- if(after && render) {
- event.getFacesContext().renderResponse();
- } else if(after && complete) {
- event.getFacesContext().responseComplete();
- }
- }
- }
-
- public void beforePhase(PhaseEvent event) {
- beforePhases.add(event.getPhaseId());
- if(null != eventPhaseId && event.getPhaseId().equals(eventPhaseId)) {
- if(before && render) {
- event.getFacesContext().renderResponse();
- } else if(before && complete) {
- event.getFacesContext().responseComplete();
- }
- }
- }
-
- public boolean isBefore() {
- return before;
- }
-
- public void setBefore(boolean before) {
- this.before = before;
- }
-
- public boolean isAfter() {
- return after;
- }
-
- public void setAfter(boolean after) {
- this.after = after;
- }
-
- public boolean isComplete() {
- return complete;
- }
-
- public void setComplete(boolean complete) {
- this.complete = complete;
- }
-
- public boolean isRender() {
- return render;
- }
-
- public void setRender(boolean render) {
- this.render = render;
- }
-
- public PhaseId getPhaseId() {
- if(null == listenPhaseId) {
- return PhaseId.ANY_PHASE;
- }
- return listenPhaseId;
- }
-
- public void setEventPhaseId(PhaseId phaseId) {
- this.eventPhaseId = phaseId;
- }
-
- public List getAfterPhases() {
- return afterPhases;
- }
-
- public List getBeforePhases() {
- return beforePhases;
- }
+ private static final long serialVersionUID = -3222250142846233648L;
+ private PhaseId listenPhaseId = null;
+ private PhaseId eventPhaseId = null;
+ private boolean before = true;
+ private boolean after = true;
+ private boolean render = false;
+ private boolean complete = false;
+ private List afterPhases = new ArrayList();
+ private List beforePhases = new ArrayList();
+
+ public InstrumentingPhaseListener() {
+ }
+
+ public InstrumentingPhaseListener(PhaseId interestingPhaseId) {
+ this.listenPhaseId = interestingPhaseId;
+ }
+
+ public void afterPhase(PhaseEvent event) {
+ afterPhases.add(event.getPhaseId());
+ if(null != eventPhaseId && event.getPhaseId().equals(eventPhaseId)) {
+ if(after && render) {
+ event.getFacesContext().renderResponse();
+ } else if(after && complete) {
+ event.getFacesContext().responseComplete();
+ }
+ }
+ }
+
+ public void beforePhase(PhaseEvent event) {
+ beforePhases.add(event.getPhaseId());
+ if(null != eventPhaseId && event.getPhaseId().equals(eventPhaseId)) {
+ if(before && render) {
+ event.getFacesContext().renderResponse();
+ } else if(before && complete) {
+ event.getFacesContext().responseComplete();
+ }
+ }
+ }
+
+ public boolean isBefore() {
+ return before;
+ }
+
+ public void setBefore(boolean before) {
+ this.before = before;
+ }
+
+ public boolean isAfter() {
+ return after;
+ }
+
+ public void setAfter(boolean after) {
+ this.after = after;
+ }
+
+ public boolean isComplete() {
+ return complete;
+ }
+
+ public void setComplete(boolean complete) {
+ this.complete = complete;
+ }
+
+ public boolean isRender() {
+ return render;
+ }
+
+ public void setRender(boolean render) {
+ this.render = render;
+ }
+
+ public PhaseId getPhaseId() {
+ if(null == listenPhaseId) {
+ return PhaseId.ANY_PHASE;
+ }
+ return listenPhaseId;
+ }
+
+ public void setEventPhaseId(PhaseId phaseId) {
+ this.eventPhaseId = phaseId;
+ }
+
+ public List getAfterPhases() {
+ return afterPhases;
+ }
+
+ public List getBeforePhases() {
+ return beforePhases;
+ }
-
+
}