mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed paths to testData for jps tests
This commit is contained in:
+3
-4
@@ -13,7 +13,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.jps.model.serialization.JpsProjectSerializationTest.SAMPLE_PROJECT_PATH;
|
||||
import static org.jetbrains.jps.model.serialization.JpsProjectSerializationTest.getFileInSampleProject;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -29,7 +28,7 @@ public class JpsArtifactSerializationTest extends JpsSerializationTestCase {
|
||||
|
||||
public void testSaveProject() {
|
||||
loadProject(SAMPLE_PROJECT_PATH);
|
||||
File[] artifactFiles = getFileInSampleProject(".idea/artifacts").listFiles();
|
||||
File[] artifactFiles = new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH + "/.idea/artifacts")).listFiles();
|
||||
assertNotNull(artifactFiles);
|
||||
for (File file : artifactFiles) {
|
||||
JpsArtifact artifact = getService().createReference(FileUtil.getNameWithoutExtension(file)).asExternal(myModel).resolve();
|
||||
@@ -38,12 +37,12 @@ public class JpsArtifactSerializationTest extends JpsSerializationTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private static void doTestSaveArtifact(JpsArtifact artifact, File expectedFile) {
|
||||
private void doTestSaveArtifact(JpsArtifact artifact, File expectedFile) {
|
||||
try {
|
||||
Element actual = new Element("component").setAttribute("name", "ArtifactManager");
|
||||
JpsArtifactSerializer.saveArtifact(artifact, actual);
|
||||
JpsMacroExpander
|
||||
expander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), getFileInSampleProject(""));
|
||||
expander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH)));
|
||||
Element expected = JpsLoaderBase.loadRootElement(expectedFile, expander);
|
||||
PlatformTestUtil.assertElementsEqual(expected, actual);
|
||||
}
|
||||
|
||||
+6
-4
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.jps.model.serialization;
|
||||
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import org.jdom.Element;
|
||||
@@ -87,7 +88,7 @@ public class JpsProjectSerializationTest extends JpsSerializationTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private static void doTestSaveLibrary(File libFile, String libName, JpsLibrary library) {
|
||||
private void doTestSaveLibrary(File libFile, String libName, JpsLibrary library) {
|
||||
try {
|
||||
Element actual = new Element("library");
|
||||
JpsLibraryTableSerializer.saveLibrary(library, actual, libName);
|
||||
@@ -102,7 +103,7 @@ public class JpsProjectSerializationTest extends JpsSerializationTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private static void doTestSaveModule(JpsModule module, final String moduleFilePath) {
|
||||
private void doTestSaveModule(JpsModule module, final String moduleFilePath) {
|
||||
try {
|
||||
Element actual = JDomSerializationUtil.createComponentElement("NewModuleRootManager");
|
||||
JpsModuleRootModelSerializer.saveRootModel(module, actual);
|
||||
@@ -116,11 +117,12 @@ public class JpsProjectSerializationTest extends JpsSerializationTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public static File getFileInSampleProject(String relativePath) {
|
||||
public File getFileInSampleProject(String relativePath) {
|
||||
return new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH + "/" + relativePath));
|
||||
}
|
||||
|
||||
public void _testLoadIdeaProject() {
|
||||
public void testLoadIdeaProject() {
|
||||
PathManagerEx.getTestDataPath(getClass());
|
||||
long start = System.currentTimeMillis();
|
||||
final JpsProject project = myProject;
|
||||
loadProject("");
|
||||
|
||||
+2
-2
@@ -46,8 +46,8 @@ public abstract class JpsSerializationTestCase extends JpsModelTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
protected static String getTestDataFileAbsolutePath(String relativePath) {
|
||||
return PathManagerEx.findFileUnderCommunityHome(relativePath).getAbsolutePath();
|
||||
protected String getTestDataFileAbsolutePath(String relativePath) {
|
||||
return PathManagerEx.findFileUnderProjectHome(relativePath, getClass()).getAbsolutePath();
|
||||
}
|
||||
|
||||
protected static Element loadModuleRootTag(File imlFile) {
|
||||
|
||||
Reference in New Issue
Block a user