use of org.jetbrains.idea.maven.MavenCustomRepositoryHelper in project intellij-community by JetBrains.
the class InvalidProjectImportingTest method testDoNotReportResolvedPlugins.
public void testDoNotReportResolvedPlugins() throws Exception {
MavenCustomRepositoryHelper helper = new MavenCustomRepositoryHelper(myDir, "plugins");
setRepositoryPath(helper.getTestDataPath("plugins"));
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <plugins>" + " <plugin>" + " <groupId>org.apache.maven.plugins</groupId>" + " <artifactId>maven-compiler-plugin</artifactId>" + " <version>2.0.2</version>" + " </plugin>" + " </plugins>" + "</build>");
assertProblems(getRootProjects().get(0));
}
use of org.jetbrains.idea.maven.MavenCustomRepositoryHelper in project intellij-community by JetBrains.
the class MiscImportingTest method testMavenExtensionsAreLoadedAndAfterProjectsReadIsCalled.
public void testMavenExtensionsAreLoadedAndAfterProjectsReadIsCalled() throws Exception {
try {
MavenCustomRepositoryHelper helper = new MavenCustomRepositoryHelper(myDir, "plugins");
setRepositoryPath(helper.getTestDataPath("plugins"));
getMavenGeneralSettings().setWorkOffline(true);
importProjectWithMaven3("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "" + "<build>" + " <extensions>" + " <extension>" + " <groupId>intellij.test</groupId>" + " <artifactId>maven-extension</artifactId>" + " <version>1.0</version>" + " </extension>" + " </extensions>" + "</build>");
List<MavenProject> projects = myProjectsTree.getProjects();
assertEquals(1, projects.size());
MavenProject mavenProject = projects.get(0);
assertEquals("Name for test:project generated by MyMavenExtension.", mavenProject.getFinalName());
PlatformTestUtil.assertPathsEqual(myProjectPom.getPath(), mavenProject.getProperties().getProperty("workspace-info"));
} finally {
// do not lock files by maven process
MavenServerManager.getInstance().shutdown(true);
}
}
use of org.jetbrains.idea.maven.MavenCustomRepositoryHelper in project intellij-community by JetBrains.
the class MiscImportingTest method testTakingProxySettingsIntoAccount.
public void testTakingProxySettingsIntoAccount() throws Exception {
MavenCustomRepositoryHelper helper = new MavenCustomRepositoryHelper(myDir, "local1");
setRepositoryPath(helper.getTestDataPath("local1"));
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.0</version>" + " </dependency>" + "</dependencies>");
removeFromLocalRepository("junit");
// force resolving
scheduleResolveAll();
resolveDependenciesAndImport();
File jarFile = new File(getRepositoryFile(), "junit/junit/4.0/junit-4.0.jar");
assertTrue(jarFile.exists());
myProjectsManager.listenForExternalChanges();
// valid password is 'fg3W9' (see http://www.jetbrains.net/confluence/display/JBINT/HTTP+Proxy+with+authorization)
updateSettingsXml("<proxies>" + " <proxy>" + " <id>my</id>" + " <active>true</active>" + " <protocol>http</protocol>" + " <host>proxy-auth-test.labs.intellij.net</host>" + " <port>3128</port>" + " <username>user1</username>" + " <password>invalid</password>" + " </proxy>" + "</proxies>");
removeFromLocalRepository("junit");
assertFalse(jarFile.exists());
try {
// force resolving
scheduleResolveAll();
resolveDependenciesAndImport();
} finally {
// LightweightHttpWagon does not clear settings if they were not set before a proxy was configured.
System.clearProperty("http.proxyHost");
System.clearProperty("http.proxyPort");
}
assertFalse(jarFile.exists());
restoreSettingsFile();
// force resolving
scheduleResolveAll();
resolveDependenciesAndImport();
assertTrue(jarFile.exists());
}
use of org.jetbrains.idea.maven.MavenCustomRepositoryHelper in project intellij-community by JetBrains.
the class MavenIndicesStressTest method test2.
public void test2() throws Exception {
MavenCustomRepositoryHelper helper;
helper = new MavenCustomRepositoryHelper(myDir, "plugins", "local1", "local2");
helper.copy("plugins", "local1");
helper.copy("local2", "local1");
setRepositoryPath(helper.getTestDataPath("local1"));
final MavenIndexerWrapper indexer = MavenServerManager.getInstance().createIndexer();
File indicesDir = new File(myDir, "indices");
MavenIndices indices = new MavenIndices(indexer, indicesDir, this);
MavenIndex index = indices.add("id", getRepositoryPath(), MavenIndex.Kind.LOCAL);
//index.addArtifact(new MavenId("group1", "artifact1", "1"));
fail();
indices.close();
MavenIndices indices1 = new MavenIndices(indexer, indicesDir, this);
MavenIndices indices2 = new MavenIndices(indexer, indicesDir, this);
AtomicInteger finishedCount = new AtomicInteger(0);
Thread t1 = createThread(indices1.getIndices().get(0), finishedCount);
Thread t2 = createThread(indices2.getIndices().get(0), finishedCount);
t1.start();
t2.start();
do {
t1.join(100);
t2.join(100);
} while (finishedCount.get() < 2);
t1.join(100);
t2.join(100);
indices.close();
indices1.close();
indices2.close();
t1.join();
t2.join();
}
use of org.jetbrains.idea.maven.MavenCustomRepositoryHelper in project intellij-community by JetBrains.
the class MavenIndicesTestFixture method setUp.
public void setUp() throws Exception {
myRepositoryHelper = new MavenCustomRepositoryHelper(myDir.toFile(), ArrayUtil.append(myExtraRepoDirs, myLocalRepoDir));
for (String each : myExtraRepoDirs) {
addToRepository(each);
}
MavenProjectsManager.getInstance(myProject).getGeneralSettings().setLocalRepository(myRepositoryHelper.getTestDataPath(myLocalRepoDir));
getIndicesManager().setTestIndexDir(myDir.resolve("MavenIndices"));
myIndicesManager = MavenProjectIndicesManager.getInstance(myProject);
myIndicesManager.doInit();
}
Aggregations