aspose file tools*
The moose likes Other Languages and the fly likes Test Engine in MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Test Engine in MVC" Watch "Test Engine in MVC" New topic
Author

Test Engine in MVC

Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

Hi there, I am building a test engine in MVC and want to add a functionality in which user session should not be killed i.e. suppose a person undergoing a test, suddenly faced a powercut, and when the power comes back , he or she should go back to the state at where they was interrupted by power-cut. The session should be resumed where he or she left the test. I am not asking for any code, just hints as I have no idea how to achieve this. Prometric test engine have this functionality already.


Back to Java , again.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Bobby,
First you need a way to identify the user is the same person. Presumably you already have a username/password.

You also probably want to make sure the person only has one session at a time so you'd want to invalidate the first session when a new one is created. One way to do this is to create a map of username to HttpSession so you can call invalidate. Another way is to have a filter or servlet check the database to see what the "current" session id is for the user.

Finally, you want to store the state of the test in something more durable than a session (database or file system is good.) That way you can re-load the new session with the current state when the user logs in again.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

thank you. I am using Microsoft c# .net and asp.net mvc. sorry , I forgot to mention this on my post. The answer you have provided me gave me some nice ideas though.

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
Bobby Sharma wrote:Hi there, I am building a test engine in MVC and want to add a functionality in which user session should not be killed i.e. suppose a person undergoing a test, suddenly faced a powercut, and when the power comes back , he or she should go back to the state at where they was interrupted by power-cut. The session should be resumed where he or she left the test. I am not asking for any code, just hints as I have no idea how to achieve this. Prometric test engine have this functionality already.


I used a Model class to represent a user/test combination. This class contains everything needed to identify the state of the test - answers to questions already done, whether or not test has been graded yet etc.

Also this Model class is serializable and each user/test combination has a unique ID which must be in text suitable for use as a file name.

The Model class object is serialized to disk after every significant action, keeping a copy in memory if possible.

If the user drops the connection and reconnects, the unique id can be used to recover the state he was in last.

Now you may think that serializing the object to disk frequently is slow, I can assure you that it is not compared to everything else going on.

MVC orientation will help in all aspects of creating a Test engine.

Bill

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Test Engine in MVC