Alex Giovi

+ Follow
since Sep 15, 2014
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alex Giovi

I created a web service with jax-rpc 1.1 for a QCM. The main class is defined as:
Class QCMUserResponse:    

Class QcmResponse:

This is an example of SoapUI request generated by the WSDL of this service:

When I try to test this service, I've got in my Java class an array of QCMUserResponse, this array contains the questionID value and an array of QcmResponse which always has one item: (in the case above, the last one with response id equal to 3), the others item that I passed as input argument are ignored.

Any ideas? Is it possible that jax-rpc doesn't support nested arrays?
6 years ago
I'm trying to upload a file with AngularJS and Spring controller. The Angular controller looks like this:

I also try this:

and the Spring controller looks like this:

My html Page looks like this:

I have 2 jars in web-inf/lib:commons-upload.jar and commons-io.jar I add this in my spring configuration file:

When I'm trying to upload a file, I get the error:

When I'm trying to upload a file using MultipartHttpServletRequest in my spring function instead of Multipart i get this error:

When i use HttpServletRequest request and i try to cast it i got a ClassCastException. Nothing change when i cancel enctype="multipart/form-data" from my form Tag.

My error is a server side error.
Any help will be much appreciated
8 years ago
First , i execute a bat file which append a date in txt file which is located under WEB-INF folder (the file is been modified with the date and modification time i want).
then i export my project as a War file , and i put it in a Ear file to be deployed after on a server.
The problem is in the war file before even the deploy of the application, after the creation of the war file, when i open it and check the txt file modification time , it's changed , so may be something is happend during the process of exportation, but i don't figure out what it is?
may be you're right , but all what i needed is the time of the creation of the war file (to be displayed after in my jsp file), this idea is simple and that's why i used it.
i use this to print the time of the deploy of my application in the main page when i run it on another computer.
In my java project I have inside the WEB-INF folder a text file which contains a date that I generate with a shell file.

In my project I use the last modified time of this file.

The problem is when I export the project and I open the archive file (Web application ARchive), the last modified time of this text file is changed with three hours in addition.

I checked ecplise options, and I don't see how can this happend.

Any help will be much appreciated.
Thanks, i resolved the problem.
9 years ago
I'm trying to test a method with this signature:

userinfo is a class which contains informations about the user and set in session scope when the user logged in.but when I try the test :

The problem is the userinfo class attribute is set in another method so when i try to access it in this method i got a NullPointerException , and with Autowiring the httpSession i got a new Session for each method i have to test.

What should i do with the session attribute, my method doesn't accept a session parameter , and for each test it create a WebApplicationContext with a new session.
9 years ago
great! it works
Many Thanks
9 years ago
Did you mean like this:

I already do this , but the problem is that Mockmvc.param attribute accept string so when i pass this as parameter(param("empstate", "Enums.EmplyeeState.PERMANENT"))
or without Apostrophe i have the same error(org.springframework.beans.TypeMismatchException)
9 years ago
I'm trying to test a Method with this signature:

the problem is that MockMvc param attributes accept only String parameters, is there a way to pass a HashMap , or an instance class object to the RequestBody as parameter? When i try to pass a hashMap as a string ,i get a MismatchException?

Any Help will be appreciated?
9 years ago
i'm trying to test this Method :

EmplyeeState is an enumeration , the values are saved in db as integer,this is my test Code:

I got this Errror:

I tried to pass the two variables as parameters ,passing only the EmployeeId as parameter but i still have the same error besides the param parameters must be both of type String. Any Idea?
9 years ago
Thanks for these informations.
I'll have a look at the documentation
9 years ago
Hi Dave,
thanks for the post , i'm a newbie in spring and unit testing, i thought @Mock will create a Reference instance to the original class,so i don't understand what's @InjeckMoks is used for?
so if you can explain a little bit what's the difference between them.
And it works:)

Now ,i updated my controller code, with a new line (to make it easy for me)


I know it's not a clear code , but i would like to have your opinion , if possible.
to execute LINE M in Mockito test method(Got a NPE in this line), do i have to Mock the others classes,Like what I do for the Repository interface
or is there any other method to include the execution of this line on code in Test ambiant
Also, i put a breakpoint in Read() method , and i started the appliaction in debug mode but it doesn't stop,is it
normal when using Mocking url?
Many thanks
9 years ago
In my spring webapp, I'm trying to test my controller:

My test Code looks like this:

When i execute the test i got this:

when i test the url in Chrome Browser i got this:


In my pom.xml file i added jackson-mapper-asl.jar and jackson-core-asl.jar I don't know why the response status is 200 but i did'nt got any data,so how the unit test pass?

Any help will be much appreciated
9 years ago
Thanks Dave,i added a mock to repository in test code but it doesn't work,
the problem that i still have the same error , and in debug mode,the compiler doesn't reach the getEmployeeList() method with url provided in mockMvc
i'll try seraching for solution
9 years ago