blob: 38980651d6d68c336dc4f019c587227a33cb38ec [file] [log] [blame]
Tor Norbyec667c1f2014-05-28 17:06:51 -07001/*
2 * Copyright 2000-2013 JetBrains s.r.o.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.jetbrains.idea.devkit.testAssistant;
17
18import com.intellij.openapi.application.ApplicationManager;
19import com.intellij.openapi.vfs.LocalFileSystem;
20import com.intellij.openapi.vfs.VirtualFile;
21import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
22import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
23
24import java.io.IOException;
25
26/**
27 * User: zolotov
28 * Date: 9/23/13
29 */
30abstract public class TestDataPathTestCase extends JavaCodeInsightFixtureTestCase {
31 protected VirtualFile myContentRoot;
32 protected VirtualFile myContentRootSubdir;
33 protected VirtualFile myProjectSubdir;
34
35 public void setUp() throws Exception {
36 super.setUp();
37 myContentRoot = LocalFileSystem.getInstance().refreshAndFindFileByPath(myFixture.getTempDirPath());
38 ApplicationManager.getApplication().runWriteAction(new Runnable() {
39 @Override
40 public void run() {
41 try {
42 myProjectSubdir = myFixture.getProject().getBaseDir().createChildDirectory(this, "projectSubdir");
43 myContentRootSubdir = myContentRoot.createChildDirectory(this, "contentRootSubdir");
44 }
45 catch (IOException e) {
46 throw new RuntimeException(e);
47 }
48 }
49 });
50 }
51
52 @Override
53 protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) throws Exception {
54 moduleBuilder.addContentRoot(myFixture.getTempDirPath());
55 }
56}