do not create empty jars

This commit is contained in:
Alexey Kudravtsev
2013-10-23 12:56:26 +04:00
parent 4730ae377f
commit 4f72b63490
2 changed files with 13 additions and 4 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ import com.intellij.testFramework.PsiTestUtil;
import com.intellij.util.PathsList;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.MavenImportingTestCase;
import org.jetbrains.idea.maven.importing.ArtifactsDownloadingTestCase;
import org.jetbrains.idea.maven.importing.MavenModuleImporter;
import java.io.File;
@@ -1123,7 +1124,10 @@ public class MavenClasspathsAndSearchScopesTest extends MavenImportingTestCase {
}
private void createRepositoryFile(String filePath) throws IOException {
createProjectSubFile("repo/" + filePath);
File f = new File(getProjectPath(), "repo/" + filePath);
f.getParentFile().mkdirs();
ArtifactsDownloadingTestCase.createEmptyJar(f.getParent(), f.getName());
setRepositoryPath(createProjectSubDir("repo").getPath());
}
@@ -18,6 +18,7 @@ package org.jetbrains.idea.maven.importing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.testFramework.PlatformTestUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.maven.MavenCustomRepositoryHelper;
import org.jetbrains.idea.maven.MavenImportingTestCase;
@@ -34,8 +35,12 @@ public abstract class ArtifactsDownloadingTestCase extends MavenImportingTestCas
}
protected void createDummyArtifact(String remoteRepo, String name) throws IOException {
FileUtil.writeToFile(new File(remoteRepo, name), PlatformTestUtil.EMPTY_JAR_BYTES);
createEmptyJar(remoteRepo, name);
}
FileUtil.writeToFile(new File(remoteRepo, name + ".sha1"), ("b04f3ee8f5e43fa3b162981b50bb72fe1acabb33 " + name).getBytes(CharsetToolkit.UTF8_CHARSET));
public static void createEmptyJar(@NotNull String dir, @NotNull String name) throws IOException {
FileUtil.writeToFile(new File(dir, name), PlatformTestUtil.EMPTY_JAR_BYTES);
FileUtil.writeToFile(new File(dir, name + ".sha1"), ("b04f3ee8f5e43fa3b162981b50bb72fe1acabb33 " + name).getBytes(CharsetToolkit.UTF8_CHARSET));
}
}