package jetbrains.mps.baseLanguage.unitTest.runtime;

/*Generated by MPS */

import jetbrains.mps.smodel.runtime.ModuleRuntime;
import jetbrains.mps.baseLanguage.unitTest.runtime.plugin.EnvironmentAccessoryHandler;
import jetbrains.mps.components.ComponentHost;
import jetbrains.mps.baseLanguage.unitTest.platform.TestPlatform;

public class ModuleActivator implements ModuleRuntime.Activator {

  private EnvironmentAccessoryHandler myEnvironmentAccessoryHandler = new EnvironmentAccessoryHandler();
  private final ComponentHost myPlatform;

  public ModuleActivator(ComponentHost platform) {
    myPlatform = platform;
  }

  @Override
  public void activate() {
    JUnitTestDiscoveryParticipants.registerTestDiscoveryParticipants(TestPlatform.getInstance());
    TestPlatform.getInstance().addTestSessionLisnener(myEnvironmentAccessoryHandler);
  }

  @Override
  public void deactivate() {
    JUnitTestDiscoveryParticipants.unregisterTestDiscoveryParticipants(TestPlatform.getInstance());
    TestPlatform.getInstance().removeTestSessionLisnener(myEnvironmentAccessoryHandler);
  }
}
