You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2020/07/01 14:11:37 UTC
[myfaces] branch master updated: refactored
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/master by this push:
new 45a0c49 refactored
45a0c49 is described below
commit 45a0c497212279349243b63d6693a6aa78605ead
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Wed Jul 1 16:11:27 2020 +0200
refactored
---
.../mock/lifecycle/ApplyRequestValuesExecutor.java | 2 +
.../mock/lifecycle/DefaultRestoreViewSupport.java | 10 +--
.../mock/lifecycle/InvokeApplicationExecutor.java | 3 +
.../myfaces/test/mock/lifecycle/MockLifecycle.java | 36 +++-------
.../test/mock/lifecycle/MockLifecycleFactory.java | 14 +---
.../myfaces/test/mock/lifecycle/PhaseExecutor.java | 2 -
.../test/mock/lifecycle/PhaseListenerManager.java | 10 +--
.../mock/lifecycle/ProcessValidationsExecutor.java | 2 +
.../mock/lifecycle/RenderResponseExecutor.java | 2 +
.../test/mock/lifecycle/RestoreViewExecutor.java | 84 +++++-----------------
.../mock/lifecycle/UpdateModelValuesExecutor.java | 2 +
.../test/mock/resource/MockResourceHandler.java | 18 ++---
.../test/mock/resource/MockResourceLoader.java | 2 +-
.../mock/resource/MockSimpleResourceHandler.java | 18 ++---
.../myfaces/test/mock/visit/FullVisitContext.java | 15 ----
.../myfaces/test/mock/visit/MockVisitCallback.java | 1 +
.../myfaces/test/mock/visit/MockVisitContext.java | 6 +-
.../test/mock/visit/PartialVisitContext.java | 5 +-
.../org/apache/myfaces/test/util/Jsf11Utils.java | 30 --------
.../org/apache/myfaces/test/util/Jsf12Utils.java | 39 ----------
20 files changed, 64 insertions(+), 237 deletions(-)
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/ApplyRequestValuesExecutor.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/ApplyRequestValuesExecutor.java
index ae803ea..0ad76cc 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/ApplyRequestValuesExecutor.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/ApplyRequestValuesExecutor.java
@@ -32,12 +32,14 @@ import javax.faces.event.PhaseId;
*/
class ApplyRequestValuesExecutor implements PhaseExecutor
{
+ @Override
public boolean execute(FacesContext facesContext)
{
facesContext.getViewRoot().processDecodes(facesContext);
return false;
}
+ @Override
public PhaseId getPhase()
{
return PhaseId.APPLY_REQUEST_VALUES;
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/DefaultRestoreViewSupport.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/DefaultRestoreViewSupport.java
index 8b5c509..cf92c0e 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/DefaultRestoreViewSupport.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/DefaultRestoreViewSupport.java
@@ -43,6 +43,7 @@ public class DefaultRestoreViewSupport implements RestoreViewSupport
private static final Logger log = Logger.getLogger(DefaultRestoreViewSupport.class.getName());
+ @Override
public void processComponentBinding(FacesContext facesContext,
UIComponent component)
{
@@ -58,14 +59,13 @@ public class DefaultRestoreViewSupport implements RestoreViewSupport
}
}
+ @Override
public String calculateViewId(FacesContext facesContext)
{
- //Assert.notNull(facesContext);
ExternalContext externalContext = facesContext.getExternalContext();
Map requestMap = externalContext.getRequestMap();
- String viewId = (String) requestMap
- .get(JAVAX_SERVLET_INCLUDE_PATH_INFO);
+ String viewId = (String) requestMap.get(JAVAX_SERVLET_INCLUDE_PATH_INFO);
if (viewId != null)
{
if (log.isLoggable(Level.FINEST))
@@ -87,8 +87,7 @@ public class DefaultRestoreViewSupport implements RestoreViewSupport
if (viewId == null)
{
- viewId = (String) requestMap
- .get(JAVAX_SERVLET_INCLUDE_SERVLET_PATH);
+ viewId = (String) requestMap.get(JAVAX_SERVLET_INCLUDE_SERVLET_PATH);
if (viewId != null && log.isLoggable(Level.FINEST))
{
log.log(Level.FINEST, "Calculated viewId '" + viewId
@@ -115,6 +114,7 @@ public class DefaultRestoreViewSupport implements RestoreViewSupport
return viewId;
}
+ @Override
public boolean isPostback(FacesContext facesContext)
{
return true;
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/InvokeApplicationExecutor.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/InvokeApplicationExecutor.java
index d0d7cfd..c1ed060 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/InvokeApplicationExecutor.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/InvokeApplicationExecutor.java
@@ -32,12 +32,15 @@ import javax.faces.event.PhaseId;
*/
class InvokeApplicationExecutor implements PhaseExecutor
{
+
+ @Override
public boolean execute(FacesContext facesContext)
{
facesContext.getViewRoot().processApplication(facesContext);
return false;
}
+ @Override
public PhaseId getPhase()
{
return PhaseId.INVOKE_APPLICATION;
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/MockLifecycle.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/MockLifecycle.java
index de199c8..8a32fc0 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/MockLifecycle.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/MockLifecycle.java
@@ -61,20 +61,16 @@ public class MockLifecycle extends Lifecycle
// ------------------------------------------------------- Lifecycle Methods
- /** {@inheritDoc} */
+ @Override
public void addPhaseListener(PhaseListener listener)
{
-
phaseListenerList.add(listener);
-
}
- /** {@inheritDoc} */
+ @Override
public void execute(FacesContext context) throws FacesException
{
-
- PhaseListenerManager phaseListenerMgr = new PhaseListenerManager(this,
- context, getPhaseListeners());
+ PhaseListenerManager phaseListenerMgr = new PhaseListenerManager(this,context, getPhaseListeners());
for (int executorIndex = 0; executorIndex < lifecycleExecutors.length; executorIndex++)
{
if (executePhase(context, lifecycleExecutors[executorIndex],
@@ -126,27 +122,21 @@ public class MockLifecycle extends Lifecycle
return skipFurtherProcessing;
}
- /** {@inheritDoc} */
+ @Override
public PhaseListener[] getPhaseListeners()
{
-
- return (PhaseListener[]) phaseListenerList
- .toArray(new PhaseListener[phaseListenerList.size()]);
-
+ return (PhaseListener[]) phaseListenerList.toArray(new PhaseListener[phaseListenerList.size()]);
}
- /** {@inheritDoc} */
+ @Override
public void removePhaseListener(PhaseListener listener)
{
-
phaseListenerList.remove(listener);
-
}
- /** {@inheritDoc} */
+ @Override
public void render(FacesContext context) throws FacesException
{
-
// if the response is complete we should not be invoking the phase listeners
if (isResponseComplete(context, renderExecutor.getPhase(), true))
{
@@ -158,8 +148,7 @@ public class MockLifecycle extends Lifecycle
try
{
- phaseListenerMgr.informPhaseListenersBefore(renderExecutor
- .getPhase());
+ phaseListenerMgr.informPhaseListenersBefore(renderExecutor.getPhase());
// also possible that one of the listeners completed the response
if (isResponseComplete(context, renderExecutor.getPhase(), true))
{
@@ -170,14 +159,12 @@ public class MockLifecycle extends Lifecycle
}
finally
{
- phaseListenerMgr.informPhaseListenersAfter(renderExecutor
- .getPhase());
+ phaseListenerMgr.informPhaseListenersAfter(renderExecutor.getPhase());
}
}
- private boolean isResponseComplete(FacesContext facesContext,
- PhaseId phase, boolean before)
+ private boolean isResponseComplete(FacesContext facesContext, PhaseId phase, boolean before)
{
boolean flag = false;
if (facesContext.getResponseComplete())
@@ -187,8 +174,7 @@ public class MockLifecycle extends Lifecycle
return flag;
}
- private boolean shouldRenderResponse(FacesContext facesContext,
- PhaseId phase, boolean before)
+ private boolean shouldRenderResponse(FacesContext facesContext, PhaseId phase, boolean before)
{
boolean flag = false;
if (facesContext.getRenderResponse())
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/MockLifecycleFactory.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/MockLifecycleFactory.java
index 24ca920..b26c4fe 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/MockLifecycleFactory.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/MockLifecycleFactory.java
@@ -43,10 +43,8 @@ public class MockLifecycleFactory extends LifecycleFactory
*/
public MockLifecycleFactory()
{
-
lifecycles = new HashMap();
lifecycles.put(LifecycleFactory.DEFAULT_LIFECYCLE, new MockLifecycle());
-
}
// ----------------------------------------------------- Mock Object Methods
@@ -60,28 +58,22 @@ public class MockLifecycleFactory extends LifecycleFactory
// ------------------------------------------------ LifecycleFactory Methods
- /** {@inheritDoc} */
+ @Override
public void addLifecycle(String lifecycleId, Lifecycle lifecycle)
{
-
lifecycles.put(lifecycleId, lifecycle);
-
}
- /** {@inheritDoc} */
+ @Override
public Lifecycle getLifecycle(String lifecycleId)
{
-
return (Lifecycle) lifecycles.get(lifecycleId);
-
}
- /** {@inheritDoc} */
+ @Override
public Iterator getLifecycleIds()
{
-
return lifecycles.keySet().iterator();
-
}
}
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/PhaseExecutor.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/PhaseExecutor.java
index 54b7402..366a6a4 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/PhaseExecutor.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/PhaseExecutor.java
@@ -27,11 +27,9 @@ import javax.faces.event.PhaseId;
*
* @author Nikolay Petrov
* @since 1.0.0
- *
*/
interface PhaseExecutor
{
-
/**
* Executes a phase of the JavaServer(tm) Faces lifecycle, like UpdateModelValues.
* The <code>execute</code> method is called by the lifecylce implementation's private
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/PhaseListenerManager.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/PhaseListenerManager.java
index 30bab5a..5974316 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/PhaseListenerManager.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/PhaseListenerManager.java
@@ -80,8 +80,7 @@ class PhaseListenerManager
{
try
{
- phaseListener.beforePhase(new PhaseEvent(facesContext,
- phaseId, lifecycle));
+ phaseListener.beforePhase(new PhaseEvent(facesContext, phaseId, lifecycle));
beforePhaseSuccess[i] = true;
}
catch (Exception e)
@@ -97,9 +96,7 @@ class PhaseListenerManager
void informPhaseListenersAfter(PhaseId phaseId)
{
- //boolean[] beforePhaseSuccess = listenerSuccessMap.get(phaseId);
- boolean[] beforePhaseSuccess = (boolean[]) listenerSuccessMap
- .get(phaseId);
+ boolean[] beforePhaseSuccess = (boolean[]) listenerSuccessMap.get(phaseId);
for (int i = phaseListeners.length - 1; i >= 0; i--)
{
@@ -109,8 +106,7 @@ class PhaseListenerManager
{
try
{
- phaseListener.afterPhase(new PhaseEvent(facesContext,
- phaseId, lifecycle));
+ phaseListener.afterPhase(new PhaseEvent(facesContext, phaseId, lifecycle));
}
catch (Exception e)
{
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/ProcessValidationsExecutor.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/ProcessValidationsExecutor.java
index 8f5ab67..3ca125b 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/ProcessValidationsExecutor.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/ProcessValidationsExecutor.java
@@ -30,12 +30,14 @@ import javax.faces.event.PhaseId;
*/
class ProcessValidationsExecutor implements PhaseExecutor
{
+ @Override
public boolean execute(FacesContext facesContext)
{
facesContext.getViewRoot().processValidators(facesContext);
return false;
}
+ @Override
public PhaseId getPhase()
{
return PhaseId.PROCESS_VALIDATIONS;
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/RenderResponseExecutor.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/RenderResponseExecutor.java
index 6d6ed33..ea109a4 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/RenderResponseExecutor.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/RenderResponseExecutor.java
@@ -37,6 +37,7 @@ import javax.faces.event.PhaseId;
*/
class RenderResponseExecutor implements PhaseExecutor
{
+ @Override
public boolean execute(FacesContext facesContext)
{
Application application = facesContext.getApplication();
@@ -53,6 +54,7 @@ class RenderResponseExecutor implements PhaseExecutor
return false;
}
+ @Override
public PhaseId getPhase()
{
return PhaseId.RENDER_RESPONSE;
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/RestoreViewExecutor.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/RestoreViewExecutor.java
index d188cd2..ab15d85 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/RestoreViewExecutor.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/RestoreViewExecutor.java
@@ -21,15 +21,13 @@ package org.apache.myfaces.test.mock.lifecycle;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.apache.myfaces.test.util.Jsf11Utils;
-import org.apache.myfaces.test.util.Jsf12Utils;
import org.apache.myfaces.test.util.JsfVersion;
import javax.faces.FacesException;
import javax.faces.application.Application;
+import javax.faces.application.ViewExpiredException;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
@@ -43,10 +41,11 @@ import javax.faces.event.PhaseId;
*/
class RestoreViewExecutor implements PhaseExecutor
{
-
private static final Logger log = Logger.getLogger(RestoreViewExecutor.class.getName());
+
private RestoreViewSupport _restoreViewSupport;
+ @Override
public boolean execute(FacesContext facesContext)
{
if (facesContext == null)
@@ -59,7 +58,7 @@ class RestoreViewExecutor implements PhaseExecutor
ViewHandler viewHandler = application.getViewHandler();
if (JsfVersion.supports12())
{
- Jsf12Utils.initView(facesContext, viewHandler);
+ viewHandler.initView(facesContext);
}
else
{
@@ -77,8 +76,7 @@ class RestoreViewExecutor implements PhaseExecutor
log.log(Level.FINEST, "View already exists in the FacesContext");
}
- viewRoot.setLocale(facesContext.getExternalContext()
- .getRequestLocale());
+ viewRoot.setLocale(facesContext.getExternalContext().getRequestLocale());
restoreViewSupport.processComponentBinding(facesContext, viewRoot);
return false;
}
@@ -96,14 +94,16 @@ class RestoreViewExecutor implements PhaseExecutor
viewRoot = viewHandler.restoreView(facesContext, viewId);
if (viewRoot == null)
{
- if (JsfVersion.supports12())
- {
- Jsf12Utils.throwViewExpiredException(viewId);
- }
- else
- {
- Jsf11Utils.throwViewExpiredException(viewId);
- }
+ if (JsfVersion.supports12())
+ {
+ throw new ViewExpiredException(
+ "The expected view was not returned for the view identifier: " + viewId, viewId);
+ }
+ else
+ {
+ throw new RuntimeException(
+ "The expected view was not returned for the view identifier: " + viewId);
+ }
}
restoreViewSupport.processComponentBinding(facesContext, viewRoot);
}
@@ -132,66 +132,14 @@ class RestoreViewExecutor implements PhaseExecutor
return _restoreViewSupport;
}
- /**
- * @param restoreViewSupport
- * the restoreViewSupport to set
- */
public void setRestoreViewSupport(RestoreViewSupport restoreViewSupport)
{
_restoreViewSupport = restoreViewSupport;
}
+ @Override
public PhaseId getPhase()
{
return PhaseId.RESTORE_VIEW;
}
-
- /**
- * TODO place that stuff into the default view handler implementation.
- */
- private static String deriveViewId(FacesContext facesContext)
- {
- ExternalContext externalContext = facesContext.getExternalContext();
-
- // if (PortletUtil.isPortletRequest(facesContext))
- // {
- // PortletRequest request = (PortletRequest) externalContext.getRequest();
- // return request.getParameter(MyFacesGenericPortlet.VIEW_ID);
- // }
- //
- String viewId = externalContext.getRequestPathInfo(); // getPathInfo
- if (viewId == null)
- {
- // No extra path info found, so it is propably extension mapping
- viewId = externalContext.getRequestServletPath(); // getServletPath
- // DebugUtils.assertError(viewId != null, log,
- // "RequestServletPath is null, cannot determine viewId of current page.");
- if (viewId == null)
- {
- return null;
- }
-
- // TODO: JSF Spec 2.2.1 - what do they mean by "if the default
- // ViewHandler implementation is used..." ?
- String defaultSuffix = externalContext
- .getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
- String suffix = defaultSuffix != null ? defaultSuffix
- : ViewHandler.DEFAULT_SUFFIX;
- // DebugUtils.assertError(suffix.charAt(0) == '.', log, "Default suffix must start with a dot!");
-
- int dot = viewId.lastIndexOf('.');
- if (dot == -1)
- {
- log.log(Level.SEVERE, "Assumed extension mapping, but there is no extension in "
- + viewId);
- viewId = null;
- }
- else
- {
- viewId = viewId.substring(0, dot) + suffix;
- }
- }
-
- return viewId;
- }
}
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/UpdateModelValuesExecutor.java b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/UpdateModelValuesExecutor.java
index f1e7832..71114ab 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/UpdateModelValuesExecutor.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/lifecycle/UpdateModelValuesExecutor.java
@@ -32,12 +32,14 @@ import javax.faces.event.PhaseId;
*/
class UpdateModelValuesExecutor implements PhaseExecutor
{
+ @Override
public boolean execute(FacesContext facesContext)
{
facesContext.getViewRoot().processUpdates(facesContext);
return false;
}
+ @Override
public PhaseId getPhase()
{
return PhaseId.UPDATE_MODEL_VALUES;
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java b/test/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java
index 608c299..e740426 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceHandler.java
@@ -117,16 +117,14 @@ public class MockResourceHandler extends ResourceHandler
.getExternalContext().getMimeType(resourceName);
}
- for (MockResourceLoader loader : getResourceHandlerSupport()
- .getResourceLoaders())
+ for (MockResourceLoader loader : getResourceHandlerSupport().getResourceLoaders())
{
MockResourceMeta resourceMeta = deriveResourceMeta(loader,
resourceName, libraryName);
if (resourceMeta != null)
{
- resource = new MockResource(resourceMeta, loader,
- getResourceHandlerSupport(), contentType);
+ resource = new MockResource(resourceMeta, loader, getResourceHandlerSupport(), contentType);
break;
}
}
@@ -355,16 +353,8 @@ public class MockResourceHandler extends ResourceHandler
{
try
{
- ClassLoader cl = AccessController
- .doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
- {
- public ClassLoader run()
- throws PrivilegedActionException
- {
- return Thread.currentThread()
- .getContextClassLoader();
- }
- });
+ ClassLoader cl = AccessController.doPrivileged(
+ (PrivilegedExceptionAction<ClassLoader>) () -> Thread.currentThread().getContextClassLoader());
return cl;
}
catch (PrivilegedActionException pae)
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceLoader.java b/test/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceLoader.java
index fa578ef..3ef77c7 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceLoader.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/resource/MockResourceLoader.java
@@ -83,7 +83,7 @@ public abstract class MockResourceLoader
public class VersionComparator implements Comparator<String>
{
-
+ @Override
public int compare(String s1, String s2)
{
int n1 = 0;
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/resource/MockSimpleResourceHandler.java b/test/src/main/java/org/apache/myfaces/test/mock/resource/MockSimpleResourceHandler.java
index c7fb896..d27f76e 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/resource/MockSimpleResourceHandler.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/resource/MockSimpleResourceHandler.java
@@ -217,8 +217,7 @@ public class MockSimpleResourceHandler extends ResourceHandler
if (null != bundleName)
{
- Locale locale = context.getApplication().getViewHandler()
- .calculateLocale(context);
+ Locale locale = context.getApplication().getViewHandler().calculateLocale(context);
ResourceBundle bundle = ResourceBundle.getBundle(bundleName,
locale, getContextClassLoader());
@@ -227,8 +226,7 @@ public class MockSimpleResourceHandler extends ResourceHandler
{
try
{
- localePrefix = bundle
- .getString(ResourceHandler.LOCALE_PREFIX);
+ localePrefix = bundle.getString(ResourceHandler.LOCALE_PREFIX);
}
catch (MissingResourceException e)
{
@@ -252,16 +250,8 @@ public class MockSimpleResourceHandler extends ResourceHandler
{
try
{
- ClassLoader cl = AccessController
- .doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
- {
- public ClassLoader run()
- throws PrivilegedActionException
- {
- return Thread.currentThread()
- .getContextClassLoader();
- }
- });
+ ClassLoader cl = AccessController.doPrivileged(
+ (PrivilegedExceptionAction<ClassLoader>) () -> Thread.currentThread().getContextClassLoader());
return cl;
}
catch (PrivilegedActionException pae)
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/visit/FullVisitContext.java b/test/src/main/java/org/apache/myfaces/test/mock/visit/FullVisitContext.java
index 721e4b7..af3772f 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/visit/FullVisitContext.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/visit/FullVisitContext.java
@@ -81,18 +81,12 @@ public class FullVisitContext extends VisitContext
_hints = Collections.unmodifiableSet(hintsEnumSet);
}
- /**
- * @see VisitContext#getFacesContext VisitContext.getFacesContext()
- */
@Override
public FacesContext getFacesContext()
{
return _facesContext;
}
- /**
- * @see VisitContext#getIdsToVisit VisitContext.getIdsToVisit()
- */
@Override
public Collection<String> getIdsToVisit()
{
@@ -100,9 +94,6 @@ public class FullVisitContext extends VisitContext
return ALL_IDS;
}
- /**
- * @see VisitContext#getSubtreeIdsToVisit VisitContext.getSubtreeIdsToVisit()
- */
@Override
public Collection<String> getSubtreeIdsToVisit(UIComponent component)
{
@@ -117,18 +108,12 @@ public class FullVisitContext extends VisitContext
return ALL_IDS;
}
- /**
- * @see VisitContext#getHints VisitContext.getHints
- */
@Override
public Set<VisitHint> getHints()
{
return _hints;
}
- /**
- * @see VisitContext#invokeVisitCallback VisitContext.invokeVisitCallback()
- */
@Override
public VisitResult invokeVisitCallback(UIComponent component,
VisitCallback callback)
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java b/test/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java
index 052e38a..e4d63ee 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitCallback.java
@@ -34,6 +34,7 @@ import javax.faces.component.visit.VisitResult;
public class MockVisitCallback implements VisitCallback
{
+ @Override
public VisitResult visit(VisitContext context, UIComponent target)
{
return VisitResult.ACCEPT;
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java b/test/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java
index 7e5b43c..70e4397 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/visit/MockVisitContext.java
@@ -90,16 +90,14 @@ public class MockVisitContext extends VisitContext
// Make sure component is a NamingContainer
if (!(component instanceof NamingContainer))
{
- throw new IllegalArgumentException(
- "Component is not a NamingContainer: " + component);
+ throw new IllegalArgumentException("Component is not a NamingContainer: " + component);
}
return ALL_IDS;
}
@Override
- public VisitResult invokeVisitCallback(UIComponent component,
- VisitCallback callback)
+ public VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback)
{
return callback.visit(this, component);
}
diff --git a/test/src/main/java/org/apache/myfaces/test/mock/visit/PartialVisitContext.java b/test/src/main/java/org/apache/myfaces/test/mock/visit/PartialVisitContext.java
index 25aa30b..47a6a6e 100644
--- a/test/src/main/java/org/apache/myfaces/test/mock/visit/PartialVisitContext.java
+++ b/test/src/main/java/org/apache/myfaces/test/mock/visit/PartialVisitContext.java
@@ -83,8 +83,9 @@ public class PartialVisitContext extends VisitContext
_facesContext = facesContext;
// Copy the client ids into a HashSet to allow for quick lookups.
- Set<String> clientIdSet = (clientIds == null) ? new HashSet<String>()
- : new HashSet<String>(clientIds);
+ Set<String> clientIdSet = clientIds == null
+ ? new HashSet<>()
+ : new HashSet<>(clientIds);
// Initialize our various collections
// We maintain 4 collections:
diff --git a/test/src/main/java/org/apache/myfaces/test/util/Jsf11Utils.java b/test/src/main/java/org/apache/myfaces/test/util/Jsf11Utils.java
deleted file mode 100644
index cb3c6ff..0000000
--- a/test/src/main/java/org/apache/myfaces/test/util/Jsf11Utils.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.myfaces.test.util;
-
-public class Jsf11Utils
-{
-
- public static void throwViewExpiredException(String viewId)
- {
- throw new RuntimeException(
- "The expected view was not returned for the view identifier: " + viewId);
- }
-}
diff --git a/test/src/main/java/org/apache/myfaces/test/util/Jsf12Utils.java b/test/src/main/java/org/apache/myfaces/test/util/Jsf12Utils.java
deleted file mode 100644
index 17d1803..0000000
--- a/test/src/main/java/org/apache/myfaces/test/util/Jsf12Utils.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.myfaces.test.util;
-
-import javax.faces.application.ViewExpiredException;
-import javax.faces.application.ViewHandler;
-import javax.faces.context.FacesContext;
-
-public class Jsf12Utils
-{
-
- public static void initView(FacesContext facesContext, ViewHandler viewHandler)
- {
- viewHandler.initView(facesContext);
- }
-
- public static void throwViewExpiredException(String viewId)
- {
- throw new ViewExpiredException(
- "The expected view was not returned for the view identifier: " + viewId, viewId);
- }
-}