Example #1
0
  @BeforeMethod
  protected void setUp(final Method testMethod) throws Exception {
    // setting hg executable
    String exec = System.getenv(HG_EXECUTABLE_PATH);
    if (exec != null) {
      myClientBinaryPath = new File(exec);
    }
    if (exec == null || !myClientBinaryPath.exists()) {
      final File pluginRoot = new File(PluginPathManager.getPluginHomePath(HgVcs.VCS_NAME));
      myClientBinaryPath = new File(pluginRoot, "testData/bin");
    }
    HgVcs.setTestHgExecutablePath(myClientBinaryPath.getPath());

    myMainRepo = initRepositories();
    myProjectDir = new File(myMainRepo.getDirFixture().getTempDirPath());

    UIUtil.invokeAndWaitIfNeeded(
        new Runnable() {
          @Override
          public void run() {
            try {
              initProject(myProjectDir, testMethod.getName());
              activateVCS(HgVcs.VCS_NAME);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    myChangeListManager = new HgTestChangeListManager(myProject);
    myTraceClient = true;
    doActionSilently(VcsConfiguration.StandardConfirmation.ADD);
    doActionSilently(VcsConfiguration.StandardConfirmation.REMOVE);
  }
  public void testIdeadev14081() throws Exception {
    // NOTE: That doesn't really reproduce the bug as it's dependent on a particular instrumentation
    // sequence used during form preview
    // (the nested form is instrumented with a new AsmCodeGenerator instance directly in the middle
    // of instrumentation of the current form)
    final String testDataPath =
        PluginPathManager.getPluginHomePath("ui-designer")
            + File.separatorChar
            + "testData"
            + File.separatorChar
            + File.separatorChar
            + "formEmbedding"
            + File.separatorChar
            + "Ideadev14081"
            + File.separatorChar;
    AsmCodeGenerator embeddedClassGenerator =
        initCodeGenerator("Embedded.form", "Embedded", testDataPath);
    byte[] embeddedPatchedData = getVerifiedPatchedData(embeddedClassGenerator);
    myClassFinder.addClassDefinition("Embedded", embeddedPatchedData);
    myNestedFormLoader.registerNestedForm("Embedded.form", testDataPath + "Embedded.form");
    AsmCodeGenerator mainClassGenerator = initCodeGenerator("Main.form", "Main", testDataPath);
    byte[] mainPatchedData = getVerifiedPatchedData(mainClassGenerator);

    /*
    FileOutputStream fos = new FileOutputStream("C:\\yole\\FormPreview27447\\MainPatched.class");
    fos.write(mainPatchedData);
    fos.close();
    */

    myClassFinder.addClassDefinition("Main", mainPatchedData);
    final Class mainClass = myClassFinder.getLoader().loadClass("Main");
    Object instance = mainClass.newInstance();
    assert instance != null : mainClass;
  }
 @Before
 public void setUp() throws Exception {
   super.setUp();
   // PlatformTestCase.initPlatformLangPrefix();
   File pluginRoot = new File(PluginPathManager.getPluginHomePath("svn4idea"));
   if (!pluginRoot.isDirectory()) {
     // try standalone mode
     Class aClass = Svn17TestCase.class;
     String rootPath =
         PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
     pluginRoot = new File(rootPath).getParentFile().getParentFile().getParentFile();
   }
   myWorkingCopyRoot = new File(pluginRoot, "testData/move2unv");
 }
  protected void setUp() throws Exception {
    super.setUp();
    myTempDir = FileUtil.createTempDirectory("GitRepositoryReaderTest", null);

    File pluginRoot = new File(PluginPathManager.getPluginHomePath("git4idea"));
    File dataDir = new File(new File(pluginRoot, "testData"), "repo");

    FileUtil.copyDir(dataDir, myTempDir);
    myGitDir = new File(myTempDir, ".git");
    FileUtil.rename(new File(myTempDir, "dot_git"), myGitDir);
    assertTrue(myGitDir.exists());
    myRepositoryReader = new GitRepositoryReader(myGitDir);

    myLocalBranches = readBranches(true);
    myRemoteBranches = readBranches(false);
  }
        @Override
        public void configureModule(
            @NotNull Module module,
            @NotNull ModifiableRootModel model,
            @NotNull ContentEntry contentEntry) {
          super.configureModule(module, model, contentEntry);

          String libPath = PluginPathManager.getPluginHomePath("osmorc") + "/lib";
          PsiTestUtil.addLibrary(
              module, model, "osgi.core", libPath, "org.apache.felix.framework-4.2.1.jar");
          PsiTestUtil.addLibrary(module, model, "plexus", libPath, "plexus-utils-3.0.10.jar");

          String annotationsPath = PathManager.getJarPathForClass(NotNull.class);
          assertNotNull(annotationsPath);
          File annotations = new File(annotationsPath);
          PsiTestUtil.addLibrary(
              module, model, "annotations", annotations.getParent(), annotations.getName());

          FacetManager.getInstance(module).addFacet(OsmorcFacetType.getInstance(), "OSGi", null);
        }
 private AsmCodeGenerator initCodeGenerator(final String formFileName, final String className)
     throws Exception {
   final String testDataPath = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/";
   return initCodeGenerator(formFileName, className, testDataPath);
 }
 public static String getAbsoluteTestDataPath() {
   return FileUtil.toSystemIndependentName(PluginPathManager.getPluginHomePath("groovy"))
       + "/testdata/";
 }
 @Override
 protected String getBasePath() {
   return PluginPathManager.getPluginHomePathRelative("devkit")
       + "/testData/inspections/statefulEp";
 }
 @NotNull
 @Override
 protected String getTestDataPath() {
   return PluginPathManager.getPluginHomePath("javaFX") + "/testData/completion/";
 }
 @Override
 protected String getBasePath() {
   return PluginPathManager.getPluginHomePathRelative("devkit")
       + "/testData/navigation/descriptionType";
 }
 @NotNull
 @Override
 protected String getTestDataPath() {
   return PluginPathManager.getPluginHomePath("properties") + "/testData";
 }