cerberustesting / cerberus-core

The Open Source Test Automation Platform.
https://cerberus-testing.com
GNU General Public License v3.0
329 stars 101 forks source link

Standardize public servlets #1315

Open nicodeur opened 7 years ago

nicodeur commented 7 years ago

Hi,

When I call AddToExecutionQueue and I entered wrong argument (wrong campaign name, or wrong environment for exemple), I have only an error 500 on response, and a NullPointerException on log file :

StandardWrapperValve[AddToExecutionQueue]: Servlet.service() for servlet AddToExecutionQueue threw exception
java.lang.NullPointerException
        at org.cerberus.servlet.zzpublic.AddToExecutionQueue.getTestCasesToInsert(AddToExecutionQueue.java:243)
        at org.cerberus.servlet.zzpublic.AddToExecutionQueue.processRequest(AddToExecutionQueue.java:171)
        at org.cerberus.servlet.zzpublic.AddToExecutionQueue.doGet(AddToExecutionQueue.java:144)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
        at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
.......

It will be better to notify the user than campaign name is wrong, or environment is wrong etc.

On jenkins plugin, it will allow to display better errors messages when campaign is launch.

Regrads,

Nicolas

vertigo17 commented 7 years ago

Yes that servlet is a public servlet that is currently missing the following mandatory feature for any public servlet: -Proper help message when empty call is made. -Controls of those data before trigering the execution of the servlet. -Public Call log facilities in order to log all calls made in order to identify the external system that call those public API (this is to perform the impact analyses for version migration).

I propose to keep that issue to cover the cleaning of all the following API: (not sure all of them are really public)

abourdon commented 7 years ago

@nicodeur 500 error has just been fixed by the 125a82be0238ef22c1d6d5e2ff2106d45c5089e6 commit

nicodeur commented 7 years ago

@abourdon Hi, I just tested it, it works fine! Thanks.

bcivel commented 7 years ago

Reopen as we'll use that topic to clean other public servlet. I rename the issue

abourdon commented 7 years ago

Thanks to #1342, Cerberus now defines an API to write public servlets.

Let's take the opportunity of this issue to move all existing public servlets to this new API.

Regards, Aurélien