@Before
  public void setUp() throws Exception {
    MockHttpSession session =
        new MockHttpSession(servletContext) {
          @Override
          public String getId() {
            return "TEST$SESSION";
          }
        };
    MockHttpServletRequest request = new MockHttpServletRequest(servletContext);
    request.setSession(session);
    MockHttpServletResponse response = new MockHttpServletResponse();

    Configuration cfg = new ConfigurationImpl();
    cfg.setGraniteConfig("/WEB-INF/granite/granite-config-spring.xml");
    cfg.setFlexServicesConfig("/WEB-INF/flex/services-config-spring.xml");
    servletContext.setAttribute(ServletGraniteConfig.GRANITE_CONFIG_CONFIGURATION_KEY, cfg);
    GraniteConfig graniteConfig = ServletGraniteConfig.loadConfig(servletContext);
    ServicesConfig servicesConfig = ServletServicesConfig.loadConfig(servletContext);
    HttpGraniteContext.createThreadIntance(
        graniteConfig, servicesConfig, servletContext, request, response);

    springServiceFactory = new SpringServiceFactory();
    springServiceFactory.configure(new XMap("properties"));
    springServiceFactory.setApplicationContext(applicationContext);
  }