Package org.olat.core.logging.activity

Source Code of org.olat.core.logging.activity.ReproduceCompilerFreakoutTestManually

package org.olat.core.logging.activity;

import javax.servlet.http.HttpSession;

import org.olat.basesecurity.ManagerFactory;
import org.olat.core.commons.persistence.DBFactory;
import org.olat.core.commons.persistence.DBModule;
import org.olat.core.id.Identity;
import org.olat.core.id.User;
import org.olat.core.test.OlatTestCase;
import org.olat.core.util.SessionInfo;
import org.olat.core.util.UserSession;
import org.olat.user.UserManager;
import org.springframework.mock.web.MockHttpSession;

/**
* Test to try to force a jvm bug with the UserActivityLoggerImpl
* <p>
* Run manually as it runs forever.
* <P>
* Initial Date:  28.07.2010 <br>
* @author Stefan
*/
public class ReproduceCompilerFreakoutTestManually extends OlatTestCase {

  public ReproduceCompilerFreakoutTestManually(String arg0) {
    super(arg0);
  }

  public void testReproceCompilerFreakout() throws Exception {
    UserActivityLoggerImpl ual = new UserActivityLoggerImpl();
    HttpSession session = new MockHttpSession();
    UserSession userSession = UserSession.getUserSession(session);
   
    assertTrue("isactivated", DBModule.isActivated());
   
    User user = UserManager.getInstance().createAndPersistUser("foo","bar","foo@bar.goo");
    Identity identity = ManagerFactory.getManager().createAndPersistIdentity("foo", user, "me", "foo", "bar");
    userSession.setSessionInfo(new SessionInfo("user", session));
    userSession.setIdentity(identity);
    ual.frameworkSetSession(userSession);
    System.out.println("********************************************************");
    System.out.println("Starting ReproduceCompilerFreakout Test... Runs Forever!");
    System.out.println("********************************************************");
    while(true) {
      ual.log(OlatLoggingAction.OLAT_LOGIN, getClass());
      DBFactory.getInstance().rollbackAndCloseSession();
//      Thread.sleep(1);
    }
  }
}
TOP

Related Classes of org.olat.core.logging.activity.ReproduceCompilerFreakoutTestManually

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.