Search in sources :

Example 1 with IdeaTestFixtureFactory

use of com.intellij.testFramework.fixtures.IdeaTestFixtureFactory in project intellij-community by JetBrains.

the class HighlightingTestBase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    final IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
    myTestFixture = createFixture(factory);
    myTestFixture.setTestDataPath(getTestDataBasePath() + getTestDataPath());
    Class<? extends LocalInspectionTool>[] inspectionClasses = new DefaultInspectionProvider().getInspectionClasses();
    if (getName().contains("Inspection")) {
        inspectionClasses = ArrayUtil.mergeArrays(inspectionClasses, ApplicationLoader.getInspectionClasses());
    }
    myTestFixture.setUp();
    myTestFixture.enableInspections(inspectionClasses);
    new WriteAction() {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            ResourceUtil.copyFiles(HighlightingTestBase.this);
            init();
        }
    }.execute().throwException();
}
Also used : IdeaTestFixtureFactory(com.intellij.testFramework.fixtures.IdeaTestFixtureFactory) WriteAction(com.intellij.openapi.application.WriteAction) NotNull(org.jetbrains.annotations.NotNull) Result(com.intellij.openapi.application.Result)

Example 2 with IdeaTestFixtureFactory

use of com.intellij.testFramework.fixtures.IdeaTestFixtureFactory in project ideavim by JetBrains.

the class VimTestCase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    final IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
    final LightProjectDescriptor projectDescriptor = LightProjectDescriptor.EMPTY_PROJECT_DESCRIPTOR;
    final TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder(projectDescriptor);
    final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
    myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture, new LightTempDirTestFixtureImpl(true));
    myFixture.setUp();
    myFixture.setTestDataPath(getTestDataPath());
    KeyHandler.getInstance().fullReset(myFixture.getEditor());
    Options.getInstance().resetAllOptions();
    VimPlugin.getKey().resetKeyMappings();
}
Also used : IdeaProjectTestFixture(com.intellij.testFramework.fixtures.IdeaProjectTestFixture) IdeaTestFixtureFactory(com.intellij.testFramework.fixtures.IdeaTestFixtureFactory) LightTempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl) LightProjectDescriptor(com.intellij.testFramework.LightProjectDescriptor)

Example 3 with IdeaTestFixtureFactory

use of com.intellij.testFramework.fixtures.IdeaTestFixtureFactory in project intellij-community by JetBrains.

the class TestBase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    final IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
    final IdeaProjectTestFixture fixture = factory.createLightFixtureBuilder().getFixture();
    myFixture = factory.createCodeInsightFixture(fixture);
    myFixture.setTestDataPath(getTestDataPath());
    myFixture.setUp();
}
Also used : IdeaProjectTestFixture(com.intellij.testFramework.fixtures.IdeaProjectTestFixture) IdeaTestFixtureFactory(com.intellij.testFramework.fixtures.IdeaTestFixtureFactory)

Example 4 with IdeaTestFixtureFactory

use of com.intellij.testFramework.fixtures.IdeaTestFixtureFactory in project intellij-community by JetBrains.

the class SvnTestCase method setUp.

@Before
public void setUp() throws Exception {
    System.out.println("Native client for status: " + isUseNativeAcceleration());
    String property = System.getProperty("svn.test.data.directory");
    if (!StringUtil.isEmpty(property)) {
        myTestDataDir = property;
    }
    UIUtil.invokeAndWaitIfNeeded((Runnable) () -> {
        try {
            final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
            myTempDirFixture = fixtureFactory.createTempDirTestFixture();
            myTempDirFixture.setUp();
            myRepoRoot = new File(myTempDirFixture.getTempDirPath(), "svnroot");
            assert myRepoRoot.mkdir() || myRepoRoot.isDirectory() : myRepoRoot;
            myPluginRoot = new File(PluginPathManager.getPluginHomePath("svn4idea"));
            if (!myPluginRoot.isDirectory()) {
                Class aClass = SvnTestCase.class;
                String rootPath = PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
                myPluginRoot = new File(rootPath).getParentFile().getParentFile().getParentFile();
            }
            File svnBinDir = new File(myPluginRoot, getTestDataDir() + "/svn/bin");
            File svnExecutable = null;
            if (SystemInfo.isWindows) {
                svnExecutable = new File(svnBinDir, "windows/svn.exe");
            } else if (SystemInfo.isLinux) {
                svnExecutable = new File(svnBinDir, "linux/svn");
            } else if (SystemInfo.isMac) {
                svnExecutable = new File(svnBinDir, "mac/svn");
            }
            assertTrue("No Subversion executable was found: " + svnExecutable + ", " + SystemInfo.OS_NAME, svnExecutable != null && svnExecutable.canExecute());
            myClientBinaryPath = svnExecutable.getParentFile();
            myRunner = SystemInfo.isMac ? createClientRunner(Collections.singletonMap("DYLD_LIBRARY_PATH", myClientBinaryPath.getPath())) : createClientRunner();
            ZipUtil.extract(new File(myPluginRoot, getTestDataDir() + "/svn/newrepo.zip"), myRepoRoot, null);
            myWcRoot = new File(myTempDirFixture.getTempDirPath(), myWcRootName);
            assert myWcRoot.mkdir() || myWcRoot.isDirectory() : myWcRoot;
            myRepoUrl = (SystemInfo.isWindows ? "file:///" : "file://") + FileUtil.toSystemIndependentName(myRepoRoot.getPath());
            verify(runSvn("co", myRepoUrl, myWcRoot.getPath()));
            initProject(myWcRoot, SvnTestCase.this.getTestName());
            activateVCS(SvnVcs.VCS_NAME);
            myGate = new MockChangeListManagerGate(ChangeListManager.getInstance(myProject));
            ((StartupManagerImpl) StartupManager.getInstance(myProject)).runPostStartupActivities();
            refreshSvnMappingsSynchronously();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    });
    // there should be kind-a waiting for after change list manager finds all changes and runs inner refresh of copies in the above method
    if (myInitChangeListManager) {
        ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
        VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
        changeListManager.ensureUpToDate(false);
    }
}
Also used : MockChangeListManagerGate(com.intellij.testFramework.vcs.MockChangeListManagerGate) IdeaTestFixtureFactory(com.intellij.testFramework.fixtures.IdeaTestFixtureFactory) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File) VcsException(com.intellij.openapi.vcs.VcsException) IOException(java.io.IOException) Before(org.junit.Before)

Example 5 with IdeaTestFixtureFactory

use of com.intellij.testFramework.fixtures.IdeaTestFixtureFactory in project intellij-community by JetBrains.

the class RestFixtureTestCase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
    TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder(getProjectDescriptor());
    final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
    myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture, new LightTempDirTestFixtureImpl(true));
    myFixture.setUp();
    myFixture.setTestDataPath(getTestDataPath());
}
Also used : IdeaProjectTestFixture(com.intellij.testFramework.fixtures.IdeaProjectTestFixture) IdeaTestFixtureFactory(com.intellij.testFramework.fixtures.IdeaTestFixtureFactory) LightTempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl)

Aggregations

IdeaTestFixtureFactory (com.intellij.testFramework.fixtures.IdeaTestFixtureFactory)5 IdeaProjectTestFixture (com.intellij.testFramework.fixtures.IdeaProjectTestFixture)3 LightTempDirTestFixtureImpl (com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl)2 Result (com.intellij.openapi.application.Result)1 WriteAction (com.intellij.openapi.application.WriteAction)1 VcsException (com.intellij.openapi.vcs.VcsException)1 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 LightProjectDescriptor (com.intellij.testFramework.LightProjectDescriptor)1 MockChangeListManagerGate (com.intellij.testFramework.vcs.MockChangeListManagerGate)1 File (java.io.File)1 IOException (java.io.IOException)1 NotNull (org.jetbrains.annotations.NotNull)1 Before (org.junit.Before)1