1   package com.sri.common.controller;
2   
3   import com.jcorporate.expresso.core.controller.Controller;
4   import com.jcorporate.expresso.core.controller.ControllerException;
5   import com.jcorporate.expresso.core.controller.ExpressoRequest;
6   import com.jcorporate.expresso.core.controller.ExpressoResponse;
7   import com.jcorporate.expresso.core.controller.Output;
8   import com.jcorporate.expresso.core.db.DBException;
9   
10  /***
11   * Test Suite
12   * @author Michael Rimov
13   * @version 1.0
14   */
15  public class TestModelStateHandler implements StateHandler {
16  
17      public int numberInvocations = 0;
18  
19      public Controller owner;
20  
21      public TestModelStateHandler(final Controller myOwner) {
22          owner = myOwner;
23          assert myOwner != null;
24      }
25  
26      /***
27       * Called to handle the request.
28       *
29       * @param request ControllerRequest The Function's ControllerRequest
30       *   object.
31       * @param response ControllerResponse The Function's ControllerResponse
32       *   object.
33       * @throws DBException upon underlying database exception error.
34       * @throws ControllerException upon underlying ControllerException error.
35       * @throws NonHandleableException if the state attempts a transition
36       *   that throws a NonHandleableException
37       */
38      public void handleRequest(final ExpressoRequest request,final  ExpressoResponse response) throws DBException,
39          ControllerException  {
40          numberInvocations++;
41          response.add( new Output("GeneratedRequest", Integer.toString(numberInvocations)));
42      }
43  }