Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
19,300
String () { String sourcesDir = System.getProperty("maven.sources.dir", PluginPathManager.getPluginHomePath("maven")); return FileUtil.toSystemIndependentName(sourcesDir + "/src/test/data"); }
getOriginalTestDataPath
19,301
String (String relativePath) { String path = getTestData(relativePath).getPath(); return FileUtil.toSystemIndependentName(path); }
getTestDataPath
19,302
File (String relativePath) { return new File(myWorkingData, relativePath); }
getTestData
19,303
void (String relativePath) { FileUtil.delete(new File(getTestDataPath(relativePath))); }
delete
19,304
void () { assertEquals("org.apache.maven.plugins", p.getGroupId()); assertEquals("maven-compiler-plugin", p.getArtifactId()); assertEquals("2.0.2", p.getVersion()); }
testLoadingPluginInfo
19,305
void () { assertEquals("compiler", p.getGoalPrefix()); List<String> qualifiedGoals = new ArrayList<>(); List<String> displayNames = new ArrayList<>(); List<String> goals = new ArrayList<>(); for (MavenPluginInfo.Mojo m : p.getMojos()) { goals.add(m.getGoal()); qualifiedGoals.add(m.getQualifiedGoal()); displayNames.add(m.getDisplayName()); } assertOrderedElementsAreEqual(goals, "compile", "testCompile"); assertOrderedElementsAreEqual(qualifiedGoals, "org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile", "org.apache.maven.plugins:maven-compiler-plugin:2.0.2:testCompile"); assertOrderedElementsAreEqual(displayNames, "compiler:compile", "compiler:testCompile"); }
testGoals
19,306
void () { myFixture.configureByText("pom.xml", """ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>simpleMaven</groupId> <artifactId>simpleMaven</artifactId> <version>1.0</version> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <compilerReuseStrategy><caret></compilerReuseStrategy> </configuration> </plugin> </plugins> </build> </project> """); myFixture.completeBasic(); UsefulTestCase.assertSameElements(new ArrayList<String>(Arrays.asList("reuseCreated", "reuseSame", "alwaysNew")), myFixture.getLookupElementStrings()); }
testCompletion
19,307
void () { myFixture.configureByText("pom.xml", """ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>simpleMaven</groupId> <artifactId>simpleMaven</artifactId> <version>1.0</version> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changelog-plugin</artifactId> <configuration> <goal><caret></goal> </configuration> </plugin> </plugins> </build> </project> """); myFixture.completeBasic(); assertContainsElements(myFixture.getLookupElementStrings(), "clean", "compile", "package"); }
testCompletion
19,308
void () { myFixture.configureByText("pom.xml", """ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>simpleMaven</groupId> <artifactId>simpleMaven</artifactId> <version>1.0</version> <packaging>jar</packaging> <build> <plugins> <plugin> <groupId>org.codehaus.groovy.maven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.0</version> <executions> <execution> <id>groovy-magic</id> <phase>package</phase> <goals> <goal>execute</goal> </goals> <configuration> <source> String<caret> </source> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant-nodeps</artifactId> <version>1.8.0</version> </dependency> </dependencies> </plugin> </plugins> </build> </project> """); myFixture.completeBasic(); List<String> lookups = myFixture.getLookupElementStrings(); assert lookups.containsAll(new ArrayList<String>(Arrays.asList("String", "StringBuffer", "StringBuilder"))); }
testCompletion
19,309
void () { myFixture.configureByText("pom.xml", """ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>simpleMaven</groupId> <artifactId>simpleMaven</artifactId> <version>1.0</version> <packaging>jar</packaging> <build> <plugins> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.3</version> <configuration> <!-- http://groovy.codehaus.org/The+groovydoc+Ant+task --> <source> String<caret> </source> </configuration> </plugin> </plugins> </build> </project> """); myFixture.completeBasic(); List<String> lookups = myFixture.getLookupElementStrings(); assert lookups.containsAll(new ArrayList<String>(Arrays.asList("String", "StringBuffer", "StringBuilder"))); }
testCompletion2
19,310
void () { myFixture.configureByText("pom.xml", """ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>simpleMaven</groupId> <artifactId>simpleMaven</artifactId> <version>1.0</version> <packaging>jar</packaging> <build> <plugins> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>groovy-maven-plugin</artifactId> <version>1.3</version> <configuration> <!-- http://groovy.codehaus.org/The+groovydoc+Ant+task --> <source> String<caret> </source> </configuration> </plugin> </plugins> </build> </project> """); myFixture.completeBasic(); List<String> lookups = myFixture.getLookupElementStrings(); assert lookups.containsAll(new ArrayList<String>(Arrays.asList("String", "StringBuffer", "StringBuilder"))); }
testCompletion3
19,311
void () { myFixture.configureByText("pom.xml", """ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>simpleMaven</groupId> <artifactId>simpleMaven</artifactId> <version>1.0</version> <packaging>jar</packaging> <build> <plugins> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.3</version> <configuration> <!-- http://groovy.codehaus.org/The+groovydoc+Ant+task --> <source> println project<caret> </source> </configuration> </plugin> </plugins> </build> </project> """); PsiElement element = myFixture.getElementAtCaret(); assert element instanceof GrVariable; assert ((GrVariable)element).getDeclaredType().getPresentableText().equals("MavenProject"); }
testInjectionVariables
19,312
void () { myFixture.configureByText("pom.xml", """ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>simpleMaven</groupId> <artifactId>simpleMaven</artifactId> <version>1.0</version> <packaging>jar</packaging> <build> <plugins> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.3</version> <configuration> <!-- http://groovy.codehaus.org/The+groovydoc+Ant+task --> <source> import java.lang.String; class SomeClass { public static String buildHi() { return "Hi 2!" } } println SomeClass.buildHi() </source> </configuration> </plugin> </plugins> </build> </project> """); myFixture.checkHighlighting(true, false, true); }
testHighlighting
19,313
void (IOException e) { throw new RuntimeException(e); }
onReadError
19,314
void () { fail("syntax error"); }
onSyntaxError
19,315
void () { var in = List.of(1, 2, 3, 4, 5); var out = new ArrayList<Integer>(); ParallelRunner.runSequentially(in, out::add); assertEquals(in, out); }
testSequential
19,316
void () { Exception rethrown = null; var text = "should be rethrown"; var in = List.of(1, 2, 3, 4, 5); try { ParallelRunner.<Integer, Exception>runSequentiallyRethrow(in, it -> { throw new Exception(text); }); } catch (Exception e) { rethrown = e; } assertNotNull(rethrown); assertEquals(text, rethrown.getMessage()); }
testSequentialRethrow
19,317
void () { var text = "should be rethrown"; var in = List.of(1, 2, 3, 4, 5); ParallelRunner.runSequentiallyRethrow(in, it -> { throw new IOException(text); }); }
testSequentialSneakyRethrow
19,318
void () { var in = Set.of(1, 2, 3, 4, 5); var out = new ConcurrentHashMap<Integer, Integer>(); ParallelRunner.runInParallel(in, it -> out.put(it, it)); assertEquals(in, out.keySet()); }
testParallel
19,319
void () { Exception rethrown = null; var text = "should be rethrown"; var in = List.of(1, 2, 3, 4, 5); try { ParallelRunner.runInParallel(in, it -> { throw new RuntimeException(text); }); } catch (RuntimeException e) { rethrown = e; } assertNotNull(rethrown); assertEquals(text, rethrown.getMessage()); }
testParallelRethrowRuntimeException
19,320
void () { Exception rethrown = null; var text = "should be rethrown"; var in = List.of(1, 2, 3, 4, 5); try { ParallelRunner.<Integer, MyTestException>runInParallelRethrow(in, it -> { throw new MyTestException(text); }); } catch (MyTestException e) { rethrown = e; } assertNotNull(rethrown); assertEquals(text, rethrown.getMessage()); }
testParallelRethrow
19,321
void () { var text = "should be rethrown"; var in = List.of(1, 2, 3, 4, 5); ParallelRunner.runInParallelRethrow(in, it -> { throw new IOException(text); }); }
testParallelSneakyThrow
19,322
String () { return message; }
getMessage
19,323
void () { assertClassSearchResults("TestCas", "TestCase(junit.framework) junit:junit:4.0 junit:junit:3.8.2 junit:junit:3.8.1", "TestCaseClassLoader(junit.runner) junit:junit:3.8.2 junit:junit:3.8.1"); assertClassSearchResults("TESTcase", "TestCase(junit.framework) junit:junit:4.0 junit:junit:3.8.2 junit:junit:3.8.1", "TestCaseClassLoader(junit.runner) junit:junit:3.8.2 junit:junit:3.8.1"); assertClassSearchResults("After", "After(org.junit) junit:junit:4.0", "AfterClass(org.junit) junit:junit:4.0"); assertClassSearchResults("After ", "After(org.junit) junit:junit:4.0"); assertClassSearchResults("*After", "After(org.junit) junit:junit:4.0", "AfterClass(org.junit) junit:junit:4.0", "BeforeAndAfterRunner(org.junit.internal.runners) junit:junit:4.0", "InvokedAfterMatcher(org.jmock.core.matcher) jmock:jmock:1.2.0 jmock:jmock:1.1.0 jmock:jmock:1.0.0"); // do not include package hits assertClassSearchResults("JUnit", "JUnit4TestAdapter(junit.framework) junit:junit:4.0", "JUnit4TestAdapterCache(junit.framework) junit:junit:4.0", "JUnit4TestCaseFacade(junit.framework) junit:junit:4.0", "JUnitCore(org.junit.runner) junit:junit:4.0"); assertClassSearchResults("org.junit.After", "After(org.junit) junit:junit:4.0", "AfterClass(org.junit) junit:junit:4.0"); assertClassSearchResults("org.After", "After(org.junit) junit:junit:4.0", "AfterClass(org.junit) junit:junit:4.0"); assertClassSearchResults("junit.After", "After(org.junit) junit:junit:4.0", "AfterClass(org.junit) junit:junit:4.0"); assertClassSearchResults("or.jun.After", "After(org.junit) junit:junit:4.0", "AfterClass(org.junit) junit:junit:4.0"); // do not include other packages assertClassSearchResults("junit.framework.Test ", "Test(junit.framework) junit:junit:4.0 junit:junit:3.8.2 junit:junit:3.8.1"); assertClassSearchResults("!@][#$%)(^&*()_"); // shouldn't throw }
testClassSearch
19,324
void () { if (ignore()) return; assertArtifactSearchResults(""); assertArtifactSearchResults("j:j", Stream.concat(Arrays.stream(JMOCK_VERSIONS), Arrays.stream(JUNIT_VERSIONS)).toArray(String[]::new)); assertArtifactSearchResults("junit", JUNIT_VERSIONS); assertArtifactSearchResults("junit 3.", JUNIT_VERSIONS); assertArtifactSearchResults("uni 3."); assertArtifactSearchResults("juni juni 3."); assertArtifactSearchResults("junit foo", JUNIT_VERSIONS); assertArtifactSearchResults("juni:juni:3.", JUNIT_VERSIONS); assertArtifactSearchResults("junit:", JUNIT_VERSIONS); assertArtifactSearchResults("junit:junit", JUNIT_VERSIONS); assertArtifactSearchResults("junit:junit:3.", JUNIT_VERSIONS); assertArtifactSearchResults("junit:junit:4.0", JUNIT_VERSIONS); }
testArtifactSearch
19,325
void () { if (ignore()) return; assertArtifactSearchResults("commons", COMMONS_IO_VERSIONS); assertArtifactSearchResults("commons-", COMMONS_IO_VERSIONS); assertArtifactSearchResults("commons-io", COMMONS_IO_VERSIONS); }
testArtifactSearchDash
19,326
void (String pattern, String... expected) { assertOrderedElementsAreEqual(getClassSearchResults(pattern), expected); }
assertClassSearchResults
19,327
List<String> (String pattern) { List<String> actualArtifacts = new ArrayList<>(); for (MavenClassSearchResult eachResult : new MavenClassSearcher().search(myProject, pattern, 100)) { StringBuilder s = new StringBuilder(eachResult.getClassName() + "(" + eachResult.getPackageName() + ")"); for (MavenDependencyCompletionItem eachVersion : eachResult.getSearchResults().getItems()) { if (s.length() > 0) s.append(" "); s.append(eachVersion.getGroupId()).append(":").append(eachVersion.getArtifactId()).append(":").append(eachVersion.getVersion()); } actualArtifacts.add(s.toString()); } return actualArtifacts; }
getClassSearchResults
19,328
void (String pattern, String... expected) { List<String> actual = new ArrayList<>(); StringBuilder s; for (MavenArtifactSearchResult eachResult : new MavenArtifactSearcher().search(myProject, pattern, 100)) { for (MavenDependencyCompletionItem eachVersion : eachResult.getSearchResults().getItems()) { s = new StringBuilder(); s.append(eachVersion.getGroupId()).append(":").append(eachVersion.getArtifactId()).append(":").append(eachVersion.getVersion()); actual.add(s.toString()); } } assertUnorderedElementsAreEqual(actual, expected); }
assertArtifactSearchResults
19,329
void () { MavenRepositoryInfo localRepo = new MavenRepositoryInfo(LOCAL_REPOSITORY_ID, "/home/user/.m2/repository", IndexKind.LOCAL); localDiff = MavenIndices.getLocalDiff(localRepo, myContext, null); Assert.assertNotNull(localDiff.newIndices); Assert.assertEquals(localRepo.getUrl(), localDiff.newIndices.getRepositoryPathOrUrl()); Assert.assertNull(localDiff.oldIndices); localDiff = MavenIndices.getLocalDiff(localRepo, myContext, localDiff.newIndices); Assert.assertNotNull(localDiff.newIndices); Assert.assertEquals(localRepo.getUrl(), localDiff.newIndices.getRepositoryPathOrUrl()); Assert.assertNull(localDiff.oldIndices); }
testGetLocalInitAndNoDiff
19,330
void () { MavenRepositoryInfo localRepo = new MavenRepositoryInfo(LOCAL_REPOSITORY_ID, "/home/user/.m2/repository", IndexKind.LOCAL); localDiff = MavenIndices.getLocalDiff(localRepo, myContext, null); Assert.assertNotNull(localDiff.newIndices); Assert.assertEquals(localRepo.getUrl(), localDiff.newIndices.getRepositoryPathOrUrl()); Assert.assertNull(localDiff.oldIndices); localRepo = new MavenRepositoryInfo(LOCAL_REPOSITORY_ID, "/home/user/.m3/repository", IndexKind.LOCAL); MavenIndex currentLocalIndex = localDiff.newIndices; localDiff = MavenIndices.getLocalDiff(localRepo, myContext, currentLocalIndex); Assert.assertNotNull(localDiff.newIndices); Assert.assertEquals(localRepo.getUrl(), localDiff.newIndices.getRepositoryPathOrUrl()); Assert.assertSame(currentLocalIndex, localDiff.oldIndices); }
testGetLocalInitAndDiff
19,331
void () { MavenRepositoryInfo localRepo = new MavenRepositoryInfo(LOCAL_REPOSITORY_ID, "/home/user/.m4/repository", IndexKind.LOCAL); localDiff = MavenIndices.getLocalDiff(localRepo, myContext, null); Assert.assertNotNull(localDiff.newIndices); Assert.assertEquals(localRepo.getUrl(), localDiff.newIndices.getRepositoryPathOrUrl()); Assert.assertNull(localDiff.oldIndices); }
testGetLocalCreateNew
19,332
void () { MavenRepositoryInfo remoteRepo = new MavenRepositoryInfo("central", "https://repo.maven.apache.org/maven2", IndexKind.LOCAL); Map<String, Set<String>> remoteRepositoryIdsByUrl = Map.of(remoteRepo.getUrl(), Collections.singleton(remoteRepo.getId())); remoteDiff = MavenIndices.getRemoteDiff(remoteRepositoryIdsByUrl, Collections.emptyList(), myContext); Assert.assertEquals(1, remoteDiff.newIndices.size()); Assert.assertEquals(remoteRepo.getUrl(), remoteDiff.newIndices.get(0).getRepositoryPathOrUrl()); Assert.assertTrue(remoteDiff.oldIndices.isEmpty()); remoteDiff = MavenIndices.getRemoteDiff(remoteRepositoryIdsByUrl, remoteDiff.newIndices, myContext); Assert.assertEquals(1, remoteDiff.newIndices.size()); Assert.assertEquals(remoteRepo.getUrl(), remoteDiff.newIndices.get(0).getRepositoryPathOrUrl()); Assert.assertTrue(remoteDiff.oldIndices.isEmpty()); }
testGetRemoteInitAndNoDiff
19,333
void () { MavenRepositoryInfo remoteRepo = new MavenRepositoryInfo("central", "https://repo.maven.apache.org/maven2", IndexKind.LOCAL); Map<String, Set<String>> remoteRepositoryIdsByUrl = Map.of(remoteRepo.getUrl(), Collections.singleton(remoteRepo.getId())); remoteDiff = MavenIndices.getRemoteDiff(remoteRepositoryIdsByUrl, Collections.emptyList(), myContext); Assert.assertEquals(1, remoteDiff.newIndices.size()); Assert.assertEquals(remoteRepo.getUrl(), remoteDiff.newIndices.get(0).getRepositoryPathOrUrl()); Assert.assertTrue(remoteDiff.oldIndices.isEmpty()); remoteRepo = new MavenRepositoryInfo("snapshot", "https://repo.maven.apache.org/snapshot", IndexKind.REMOTE); remoteRepositoryIdsByUrl = Map.of(remoteRepo.getUrl(), Collections.singleton(remoteRepo.getId())); remoteDiff = MavenIndices.getRemoteDiff(remoteRepositoryIdsByUrl, remoteDiff.newIndices, myContext); Assert.assertEquals(1, remoteDiff.newIndices.size()); Assert.assertEquals(remoteRepo.getUrl(), remoteDiff.newIndices.get(0).getRepositoryPathOrUrl()); Assert.assertEquals(1, remoteDiff.oldIndices.size()); Assert.assertTrue(remoteDiff.oldIndices.get(0).getRepositoryPathOrUrl().contains("maven2")); }
testGetRemoteInitAndDiff
19,334
void () { MavenRepositoryInfo remoteRepo = new MavenRepositoryInfo("milestone", "https://repo.maven.apache.org/milestone", IndexKind.REMOTE); Map<String, Set<String>> remoteRepositoryIdsByUrl = Map.of(remoteRepo.getUrl(), Collections.singleton(remoteRepo.getUrl())); remoteDiff = MavenIndices.getRemoteDiff(remoteRepositoryIdsByUrl, Collections.emptyList(), myContext); Assert.assertEquals(1, remoteDiff.newIndices.size()); Assert.assertEquals(remoteRepo.getUrl(), remoteDiff.newIndices.get(0).getRepositoryPathOrUrl()); Assert.assertTrue(remoteDiff.oldIndices.isEmpty()); }
testGetRemoteCreateNew
19,335
void () { myFixture.addFileToProject("Indices/Index10/index.properties", """ #Sun Oct 31 18:51:24 MSK 2021 dataDirName=data0 kind=REMOTE id=central pathOrUrl=https://repo.maven.apache.org/maven2 version=5""").getVirtualFile(); MavenRepositoryInfo remoteRepo = new MavenRepositoryInfo("central", "https://repo.maven.apache.org/maven2", IndexKind.REMOTE); Map<String, Set<String>> remoteRepositoryIdsByUrl = Map.of(remoteRepo.getUrl(), Collections.singleton(remoteRepo.getId())); remoteDiff = MavenIndices.getRemoteDiff(remoteRepositoryIdsByUrl, Collections.emptyList(), myContext); Assert.assertEquals(1, remoteDiff.newIndices.size()); Assert.assertEquals(remoteRepo.getUrl(), remoteDiff.newIndices.get(0).getRepositoryPathOrUrl()); Assert.assertTrue(remoteDiff.oldIndices.isEmpty()); }
testGetRemoteDiffWithDuplicates
19,336
void () { MavenRemoteRepository remote1 = new MavenRemoteRepository("id1", "name", "http://foo/bar", null, null, null); MavenRemoteRepository remote2 = new MavenRemoteRepository("id2", "name", " http://foo\\bar\\\\ ", null, null, null); MavenRemoteRepository remote3 = new MavenRemoteRepository("id3", "name", "http://foo\\bar\\baz", null, null, null); MavenRemoteRepository remote4 = new MavenRemoteRepository("id4", "name", "http://foo/bar", null, null, null); MavenRemoteRepository remote5 = new MavenRemoteRepository("id4", "name", "http://foo/baz", null, null, null); assertEquals(1, MavenIndexUtils.groupRemoteRepositoriesByUrl(Collections.singleton(remote1)).size()); assertEquals(1, MavenIndexUtils.groupRemoteRepositoriesByUrl(asList(remote1, remote2)).size()); assertEquals(2, MavenIndexUtils.groupRemoteRepositoriesByUrl(asList(remote1, remote2, remote3)).size()); assertEquals(2, MavenIndexUtils.groupRemoteRepositoriesByUrl(asList(remote1, remote2, remote3, remote4)).size()); assertEquals(3, MavenIndexUtils.groupRemoteRepositoriesByUrl(asList(remote1, remote2, remote3, remote4, remote5)).size()); }
testGroupRemoteRepositoriesByUrl
19,337
void () { assertArchetypeExists("org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE"); }
testDefaultArchetypes
19,338
void () { MavenArchetype mavenArchetype = new MavenArchetype("myGroup", "myArtifact", "666", null, null); MavenIndicesManager.addArchetype(mavenArchetype); assertArchetypeExists("myGroup:myArtifact:666"); }
testAddingArchetypes
19,339
void (Set<File> added, Set<File> failedToAdd) { addedFiles.addAll(added); failedToAddFiles.addAll(failedToAdd); latch.countDown(); }
indexUpdated
19,340
void (String archetypeId) { Set<MavenArchetype> achetypes = myIndicesFixture.getArchetypeManager().getArchetypes(); List<String> actualNames = new ArrayList<>(); for (MavenArchetype each : achetypes) { actualNames.add(each.groupId + ":" + each.artifactId); } MavenId id = new MavenId(archetypeId); assertTrue(actualNames.toString(), actualNames.contains(id.getGroupId() + ":" + id.getArtifactId())); }
assertArchetypeExists
19,341
void () { MavenSystemIndicesManager.getInstance().setTestIndicesDir(myDir.resolve("MavenIndices")); getIndicesManager().scheduleUpdateIndicesList(null); getIndicesManager().waitForBackgroundTasksInTests(); UIUtil.dispatchAllInvocationEvents(); }
setUpAfterImport
19,342
void () { MavenServerManager.getInstance().shutdown(true); Disposer.dispose(getIndicesManager()); }
tearDown
19,343
MavenIndicesManager () { return MavenIndicesManager.getInstance(myProject); }
getIndicesManager
19,344
MavenArchetypeManager () { return MavenArchetypeManager.getInstance(myProject); }
getArchetypeManager
19,345
MavenCustomRepositoryHelper () { return myRepositoryHelper; }
getRepositoryHelper
19,346
boolean (@NotNull String category, @NotNull String message, Throwable t) { fail(message + t); return false; }
processWarn
19,347
TestCaseBuilder (String... lines) { return new TestCaseBuilder().withLines(lines); }
testCase
19,348
TestCaseBuilder (String... lines) { List<String> joinedAndSplitted = List.of(StringUtil.join(lines, "\n").split("\n")); myLines.addAll(joinedAndSplitted); return this; }
withLines
19,349
TestCaseBuilder (MavenLoggedEventParser... parsers) { ContainerUtil.addAll(myParsers, parsers); return this; }
withParsers
19,350
TestCaseBuilder (String message) { myExpectedEvents.add(event(message, StartEventMatcher::new)); myExpectedEvents.add(event(message, FinishSuccessEventMatcher::new)); return this; }
expectSucceed
19,351
TestCaseBuilder (String message, Function<String, Matcher<BuildEvent>> creator) { myExpectedEvents.add(event(message, creator)); return this; }
expect
19,352
TestCaseBuilder (String message, Matcher<BuildEvent> matcher) { myExpectedEvents.add(Pair.create(message, matcher)); return this; }
expect
19,353
void () { check(false); }
check
19,354
void (boolean checkFinishEvent) { Iterator<BuildEvent> events = collect().iterator(); Iterator<Pair<String, Matcher<BuildEvent>>> expectedEvents = myExpectedEvents.iterator(); while (events.hasNext()) { if (!expectedEvents.hasNext()) { BuildEvent next = events.next(); if (next instanceof FinishBuildEvent && !checkFinishEvent) { continue; } if(next instanceof OutputBuildEvent && mySkipOutput) { continue; } fail("Event: " + next.getMessage() + " was not expected here"); } BuildEvent next = events.next(); if(next instanceof StartBuildEventImpl && !checkFinishEvent){ continue; } if(next instanceof OutputBuildEvent && mySkipOutput) { continue; } Pair<String, Matcher<BuildEvent>> matcher = expectedEvents.next(); assertThat(next, matcher.second); } if (expectedEvents.hasNext()) { fail("Didn't receive expected event: " + expectedEvents.next().first); } }
check
19,355
String () { List<BuildEvent> events = collect(); Map<Object, Integer> levelMap = new HashMap<>(); Map<Object, String> result = new LinkedHashMap<>(); for (BuildEvent event : events) { if (event instanceof FinishEvent) { Integer value = levelMap.get(event.getId()); if (value == null) { fail("Finish event for non-registered start event" + event); } } if (event instanceof FinishEvent && ((FinishEvent)event).getResult() instanceof FailureResult) { result.computeIfPresent(event.getId(), (id, s) -> "error:" + s); } else { int level; if (event.getId() instanceof ExternalSystemTaskId) { level = 0; } else { Integer integer = levelMap.get(event.getParentId()); if (integer == null) { fail("Parent id not registered!" + event); } level = integer + 1; } assertFalse("cannot calculate event level, possible bad parent id", level < 0); if(event instanceof OutputBuildEvent && mySkipOutput){ continue; } result.put(event.getId(), event.getMessage()); levelMap.put(event.getId(), level); } } StringBuilder builder = new StringBuilder(); for (Map.Entry<Object, String> entry : result.entrySet()) { Integer indent = levelMap.get(entry.getKey()); builder.append(StringUtil.repeatSymbol(' ', indent == null ? 0 : indent.intValue())).append(entry.getValue()); if(!entry.getValue().endsWith("\n")) { builder.append("\n"); } } return builder.toString(); }
runAndFormatToString
19,356
List<BuildEvent> () { MavenRunConfiguration configuration = (MavenRunConfiguration)new MavenRunConfigurationType.MavenRunConfigurationFactory(MavenRunConfigurationType.getInstance()) .createTemplateConfiguration(getProject()); CollectConsumer collectConsumer = new CollectConsumer(); MavenLogOutputParser parser = new MavenLogOutputParser(configuration, myTaskId, myParsers); collectConsumer.accept(new StartBuildEventImpl( new DefaultBuildDescriptor(myTaskId, "Maven Run", System.getProperty("user.dir"), System.currentTimeMillis()), "Maven Run")); StubBuildOutputReader reader = new StubBuildOutputReader(myLines); String line; while ((line = reader.readLine()) != null) { parser.parse(line, reader, collectConsumer); } parser.finish(collectConsumer); return collectConsumer.myReceivedEvents; }
collect
19,357
TestCaseBuilder () { mySkipOutput = true; return this; }
withSkippedOutput
19,358
void (BuildEvent buildEvent) { myReceivedEvents.add(buildEvent); }
accept
19,359
boolean (Object item) { return item instanceof FinishEvent && ((FinishEvent)item).getMessage().equals(myMessage) && ((FinishEvent)item).getResult() instanceof SuccessResult; }
matches
19,360
void (@NotNull Description description) { description.appendText("Expected successful FinishEvent " + myMessage); }
describeTo
19,361
boolean (Object item) { return item instanceof StartEvent && ((StartEvent)item).getMessage().equals(myMessage); }
matches
19,362
void (@NotNull Description description) { description.appendText("Expected StartEvent " + myMessage); }
describeTo
19,363
boolean (Object item) { return item instanceof MessageEvent && StringUtil.equalsTrimWhitespaces(myMessage, ((MessageEvent)item).getDescription()) && ((MessageEvent)item).getKind() == WARNING; }
matches
19,364
void (@NotNull Description description) { description.appendText("Expected WarningEvent " + myMessage); }
describeTo
19,365
boolean (Object item) { return item instanceof FileMessageEvent && ((FileMessageEvent)item).getMessage().equals(myMessage) && FileUtil.filesEqual(new File(myFileName), ((FileMessageEvent)item).getFilePosition().getFile()) && ((FileMessageEvent)item).getFilePosition().getStartLine() == myLine && ((FileMessageEvent)item).getFilePosition().getStartColumn() == myColumn; }
matches
19,366
void (@NotNull Description description) { description.appendText("Expected \n" + new FileMessageEventImpl("EXECUTE_TASK:0", ERROR, "Error", myMessage, myMessage, new FilePosition(new File(myFileName), myLine,myColumn))); }
describeTo
19,367
Object () { throw new UnsupportedOperationException(); }
getParentEventId
19,368
String () { myPosition++; return getCurrentLine(); }
readLine
19,369
void () { }
pushBack
19,370
void (int numberOfLines) { throw new UnsupportedOperationException(); }
pushBack
19,371
String () { if (myPosition >= myLines.size() || myPosition < 0) { return null; } return myLines.get(myPosition); }
getCurrentLine
19,372
void () { MavenLogEntryReader.MavenLogEntry entry = new MavenLogEntryReader.MavenLogEntry("[ERROR] error line"); assertEquals(LogMessageType.ERROR, entry.myType); assertEquals("error line", entry.myLine); entry = new MavenLogEntryReader.MavenLogEntry("[INFO] info line"); assertEquals(LogMessageType.INFO, entry.myType); assertEquals("info line", entry.myLine); entry = new MavenLogEntryReader.MavenLogEntry("[WARNING] warning line"); assertEquals(LogMessageType.WARNING, entry.myType); assertEquals("warning line", entry.myLine); entry = new MavenLogEntryReader.MavenLogEntry("line"); assertNull(entry.myType); assertEquals("line", entry.myLine); }
testParser
19,373
void () { MavenLogEntryReader.MavenLogEntry entry = new MavenLogEntryReader.MavenLogEntry("Progress 1\r Progress 2\r Progress 3\r[INFO] Done"); assertEquals(LogMessageType.INFO, entry.myType); assertEquals("Done", entry.myLine); }
testRemoveProgressFromOutput
19,374
void () { testCase(""" [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The POM for some.maven:artifact:jar:1.2 is missing, no dependency information available """) .withParsers(new WarningNotifier()) .expect("The POM for some.maven:artifact:jar:1.2 is missing, no dependency information available", WarningEventMatcher::new) .withSkippedOutput() .check(); }
testWarningNotify
19,375
void () { testCase(""" [INFO] --------------------------------[ jar ]--------------------------------- [WARNING]\s [WARNING] Some problems were encountered while building the effective model for org.jb:m1-pom:jar:1 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 30, column 21 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 23, column 21 [WARNING]\s [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING]\s [WARNING] For this reason, future Maven versions might no longer support building such malformed projects""") .withParsers(new WarningNotifier()) .expect(""" Some problems were encountered while building the effective model for org.jb:m1-pom:jar:1 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 30, column 21 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 23, column 21 It is highly recommended to fix these problems because they threaten the stability of your build. For this reason, future Maven versions might no longer support building such malformed projects""", WarningEventMatcher::new) .withSkippedOutput() .check(); }
testWarningConcatenate
19,376
void () { String expectedFileName = FileUtil.toSystemDependentName("C:/path/to/MyFile.java"); String expectedMessage = "';' expected"; testCase(""" [INFO] ------------------------------------------------------------- [ERROR] /C:/path/to/MyFile.java:[13,21] ';' expected [INFO] 1 error""") .withParsers(new JavaBuildErrorNotification()) .expect(expectedMessage, new FileEventMatcher(expectedMessage, expectedFileName, 12, 20)) .withSkippedOutput() .check(); }
testParseJavaError
19,377
void () { String expectedFileName = FileUtil.toSystemDependentName("C:\\path\\to\\MyFile.kt"); String expectedMessage = "Data class primary constructor must have only property (val / var) parameters"; testCase(""" [INFO] --- kotlin-maven-plugin:1.3.21:compile (compile) @ test-11 --- [ERROR] C:\\path\\to\\MyFile.kt: (3, 16) Data class primary constructor must have only property (val / var) parameters [INFO] ------------------------------------------------------------------------""") .withParsers(new KotlinBuildErrorNotification()) .expect(expectedMessage, new FileEventMatcher(expectedMessage, expectedFileName, 2, 15)) .withSkippedOutput() .check(); }
testParseKotlinError
19,378
void () { String expectedFileName = FileUtil.toSystemDependentName("C:\\path\\to\\MyFile.java"); String expectedMessage = "Line matches the illegal pattern 'System\\.(out|err).*?$'. [RegexpSinglelineJava]"; testCase(""" [INFO] Starting audit... [ERROR] C:\\path\\to\\MyFile.java:9: Line matches the illegal pattern 'System\\.(out|err).*?$'. [RegexpSinglelineJava] Audit done.""") .withParsers(new JavaBuildErrorNotification()) .expect(expectedMessage, new FileEventMatcher(expectedMessage, expectedFileName, 8, 0)) .withSkippedOutput() .check(); }
testParseJavaCheckstyle
19,379
List<String> (String line) { if (!line.endsWith("\n")) { line += '\n'; } Filter.Result result = myFilter.applyFilter(line, line.length()); if (result == null) return Collections.emptyList(); List<String> res = new ArrayList<>(); for (Filter.ResultItem item : result.getResultItems()) { res.add(line.substring(item.getHighlightStartOffset(), item.getHighlightEndOffset())); } return res; }
passLine
19,380
void () { myFixture.addClass(""" public class CccTest { public void testTtt() {} public void testTtt2() {} }"""); String tempDirPath = myFixture.getTempDirPath(); assertEquals(passLine("[INFO] Scanning for projects..."), Collections.emptyList()); assertEquals(passLine("[INFO] Surefire report directory: " + tempDirPath), Collections.singletonList(tempDirPath)); assertEquals(passLine("[ERROR] Please refer to " + tempDirPath + " for the individual test results."), Collections.singletonList( tempDirPath)); }
testSurefire2_14
19,381
void () {}
testTtt
19,382
void () {}
testTtt2
19,383
void () { myFixture.addFileToProject(".mvn/maven.config", "-o -U -N -T3 -q -X -e -C -c -ff -fae -fn" + " -s user-settings.xml -gs global-settings.xml"); MavenConfig config = MavenConfigParser.parse(myFixture.getTempDirPath()); Assert.assertTrue(config.hasOption(MavenConfigSettings.OFFLINE)); Assert.assertTrue(config.hasOption(MavenConfigSettings.UPDATE_SNAPSHOTS)); Assert.assertTrue(config.hasOption(MavenConfigSettings.NON_RECURSIVE)); Assert.assertTrue(config.hasOption(MavenConfigSettings.QUIET)); Assert.assertTrue(config.hasOption(MavenConfigSettings.ERRORS)); Assert.assertTrue(config.hasOption(MavenConfigSettings.DEBUG)); Assert.assertTrue(config.hasOption(MavenConfigSettings.CHECKSUM_WARNING_POLICY)); Assert.assertTrue(config.hasOption(MavenConfigSettings.CHECKSUM_FAILURE_POLICY)); Assert.assertTrue(config.hasOption(MavenConfigSettings.FAIL_AT_END)); Assert.assertTrue(config.hasOption(MavenConfigSettings.FAIL_FAST)); Assert.assertTrue(config.hasOption(MavenConfigSettings.FAIL_NEVER)); Assert.assertEquals("3", config.getOptionValue(MavenConfigSettings.THREADS)); Assert.assertEquals("user-settings.xml", config.getOptionValue(MavenConfigSettings.ALTERNATE_USER_SETTINGS)); Assert.assertEquals("global-settings.xml", config.getOptionValue(MavenConfigSettings.ALTERNATE_GLOBAL_SETTINGS)); }
testParseShortNames
19,384
void () { myFixture.addFileToProject(".mvn/maven.config", "--offline --update-snapshots --non-recursive --quiet --debug --errors --strict-checksums " + "--lax-checksums --fail-fast --fail-at-end --fail-never --threads 3 " + "--settings user-settings.xml --global-settings global-settings.xml"); MavenConfig config = MavenConfigParser.parse(myFixture.getTempDirPath()); Assert.assertTrue(config.hasOption(MavenConfigSettings.OFFLINE)); Assert.assertTrue(config.hasOption(MavenConfigSettings.UPDATE_SNAPSHOTS)); Assert.assertTrue(config.hasOption(MavenConfigSettings.NON_RECURSIVE)); Assert.assertTrue(config.hasOption(MavenConfigSettings.QUIET)); Assert.assertTrue(config.hasOption(MavenConfigSettings.ERRORS)); Assert.assertTrue(config.hasOption(MavenConfigSettings.DEBUG)); Assert.assertTrue(config.hasOption(MavenConfigSettings.CHECKSUM_WARNING_POLICY)); Assert.assertTrue(config.hasOption(MavenConfigSettings.CHECKSUM_FAILURE_POLICY)); Assert.assertTrue(config.hasOption(MavenConfigSettings.FAIL_AT_END)); Assert.assertTrue(config.hasOption(MavenConfigSettings.FAIL_FAST)); Assert.assertTrue(config.hasOption(MavenConfigSettings.FAIL_NEVER)); Assert.assertEquals("3", config.getOptionValue(MavenConfigSettings.THREADS)); Assert.assertEquals("user-settings.xml", config.getOptionValue(MavenConfigSettings.ALTERNATE_USER_SETTINGS)); Assert.assertEquals("global-settings.xml", config.getOptionValue(MavenConfigSettings.ALTERNATE_GLOBAL_SETTINGS)); }
testParseLongNames
19,385
void () { myFixture.addFileToProject(".mvn/maven.config", "-unknown -ZZ --badprop"); MavenConfig config = MavenConfigParser.parse(myFixture.getTempDirPath()); Assert.assertTrue(config.isEmpty()); }
testUnknownNames
19,386
void () { MavenRunnerSettings runnerSettings = new MavenRunnerSettings(); runnerSettings.setVmOptions("-Xmx400m"); String vmOptions = MavenExternalParameters.getRunVmOptions(runnerSettings, myProject, getProjectPath()); assertEquals("-Xmx400m", vmOptions); }
testGetRunVmOptionsSettings
19,387
void () { MavenRunConfiguration.MavenSettings s = new MavenRunConfiguration.MavenSettings(myProject); s.myRunnerParameters.setWorkingDirPath("some path"); s.myRunnerParameters.setGoals(Arrays.asList("clean", "validate")); s.myRunnerParameters.setProfilesMap(ImmutableMap.<String, Boolean>builder() .put("prof1", true) .put("prof2", true) .put("prof3", false) .put("aaa", true) .put("tomcat (local)", false) .put("tomcat (local) ", true).build()); s.myGeneralSettings = new MavenGeneralSettings(myProject); s.myGeneralSettings.setChecksumPolicy(MavenExecutionOptions.ChecksumPolicy.WARN); s.myGeneralSettings.setFailureBehavior(MavenExecutionOptions.FailureMode.AT_END); s.myGeneralSettings.setOutputLevel(MavenExecutionOptions.LoggingLevel.FATAL); s.myGeneralSettings.setThreads("1.5C"); s.myRunnerSettings = new MavenRunnerSettings(); s.myRunnerSettings.setMavenProperties(ImmutableMap.of("a", "1", "b", "2", "c", "3")); Element xml = XmlSerializer.serialize(s); MavenRunConfiguration.MavenSettings loaded = XmlSerializer.deserialize(xml, MavenRunConfiguration.MavenSettings.class); assertEquals(s.myRunnerParameters.getWorkingDirPath(), loaded.myRunnerParameters.getWorkingDirPath()); assertEquals(s.myRunnerParameters.getGoals(), loaded.myRunnerParameters.getGoals()); assertEquals(s.myRunnerParameters.getProfilesMap(), loaded.myRunnerParameters.getProfilesMap()); assertOrderedEquals(s.myRunnerParameters.getProfilesMap().keySet(), loaded.myRunnerParameters.getProfilesMap().keySet()); // Compare ordering of profiles. assertEquals(s.myGeneralSettings, loaded.myGeneralSettings); assertEquals(s.myRunnerSettings, loaded.myRunnerSettings); }
testSaveLoadRunnerParameters
19,388
void (JavaParameters parameters, MavenConfigSettings mavenConfigSettings) { Assert.assertFalse(parameters.getProgramParametersList().hasParameter(mavenConfigSettings.getLongKey())); Assert.assertFalse(parameters.getProgramParametersList().hasParameter(mavenConfigSettings.getKey())); }
notContainMavenKey
19,389
void (JavaParameters parameters, MavenConfigSettings mavenConfigSettings) { Assert.assertTrue(parameters.getProgramParametersList().hasParameter(mavenConfigSettings.getLongKey()) || parameters.getProgramParametersList().hasParameter(mavenConfigSettings.getKey())); }
containMavenKey
19,390
void () { VirtualFile m = createModulePom("m", """ <groupId>test</groupId> <artifactId>m</artifactId> <version>1</version> <dependencies> <dependency> <groupId>test</groupId> <artifactId>dep</artifactId> <version>1</version> </dependency> </dependencies> """); VirtualFile dep = createModulePom("dep", """ <groupId>test</groupId> <artifactId>dep</artifactId> <version>1</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.0</version> </dependency> </dependencies> """); importProjects(m, dep); assertModules("m", "dep"); assertModuleModuleDeps("m", "dep"); setupJdkForModules("m", "dep"); createOutputDirectories(); Module module = getModule("m"); VirtualFile[] jdkRoots = ModuleRootManager.getInstance(module).getSdk().getRootProvider().getFiles(OrderRootType.CLASSES); VirtualFile[] junitRoots = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject).getLibraryByName("Maven: junit:junit:4.0") .getFiles(OrderRootType.CLASSES); assertOrderedEquals(OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots(), ArrayUtil.mergeArrays(jdkRoots, junitRoots)); }
testDoNotIncludeTargetDirectoriesOfModuleDependenciesToLibraryClassesRoots
19,391
void () { VirtualFile m1 = createModulePom("m1", """ <groupId>test</groupId> <artifactId>m1</artifactId> <version>1</version> <dependencies> <dependency> <groupId>test</groupId> <artifactId>m2</artifactId> <version>1</version> </dependency> </dependencies> """); VirtualFile m2 = createModulePom("m2", """ <groupId>test</groupId> <artifactId>m2</artifactId> <version>1</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.0</version> <scope>provided</scope> </dependency> </dependencies> """); importProjects(m1, m2); assertModules("m1", "m2"); Module m1m = ModuleManager.getInstance(myProject).findModuleByName("m1"); List<OrderEntry> modules1 = new ArrayList<>(); ModuleRootManager.getInstance(m1m).orderEntries().withoutSdk().withoutModuleSourceEntries().forEach( new CommonProcessors.CollectProcessor<>(modules1)); GlobalSearchScope scope1 = LibraryScopeCache.getInstance(myProject).getLibraryScope(modules1); assertSearchScope(scope1, getProjectPath() + "/m1/src/main/java", getProjectPath() + "/m1/src/test/java", getProjectPath() + "/m2/src/main/java", getProjectPath() + "/m2/src/test/java" ); String libraryPath = getRepositoryPath() + "/junit/junit/4.0/junit-4.0.jar"; String librarySrcPath = getRepositoryPath() + "/junit/junit/4.0/junit-4.0-sources.jar"; Module m2m = ModuleManager.getInstance(myProject).findModuleByName("m2"); List<OrderEntry> modules2 = new ArrayList<>(); ModuleRootManager.getInstance(m2m).orderEntries().withoutSdk().withoutModuleSourceEntries().forEach( new CommonProcessors.CollectProcessor<>(modules2)); GlobalSearchScope scope2 = LibraryScopeCache.getInstance(myProject).getLibraryScope(modules2); List<String> expectedPaths = new ArrayList<>(List.of(getProjectPath() + "/m2/src/main/java", getProjectPath() + "/m2/src/test/java", libraryPath)); if (new File(librarySrcPath).exists()) { expectedPaths.add(librarySrcPath); } assertSearchScope(scope2, ArrayUtilRt.toStringArray(expectedPaths)); }
testLibraryScopeForTwoDependentModules
19,392
void (List<Module> modules) { assertEquals(6, modules.size()); ProjectFileIndex index = ProjectFileIndex.getInstance(myProject); VirtualFile m3JavaDir = VfsUtil.findFileByIoFile(new File(getProjectPath(), "m3/src/main/java"), true); assertNotNull(m3JavaDir); // Should be: m1 -> m3, m2 -> m3, m3 -> source, and m4 -> m3 List<OrderEntry> orderEntries = index.getOrderEntriesForFile(m3JavaDir); assertEquals(4, orderEntries.size()); List<Module> ownerModules = orderEntriesToOwnerModules(orderEntries); List<Module> depModules = orderEntriesToDepModules(orderEntries); assertOrderedElementsAreEqual(ownerModules, Arrays.asList(modules.get(0), modules.get(1), modules.get(2), modules.get(3))); assertOrderedElementsAreEqual(depModules, Arrays.asList(modules.get(2), modules.get(2), null, modules.get(2))); // m3 -> source OrderEntry m3E2 = orderEntries.get(2); assertInstanceOf(m3E2, ModuleSourceOrderEntry.class); VirtualFile m6javaDir = VfsUtil.findFileByIoFile(new File(getProjectPath(), "m6/src/main/java"), true); assertNotNull(m6javaDir); // Should be m1 -> m6, m2 -> m6, m5 -> m6, m6 -> source List<OrderEntry> m6OrderEntries = index.getOrderEntriesForFile(m6javaDir); assertEquals(4, m6OrderEntries.size()); List<Module> m6OwnerModules = orderEntriesToOwnerModules(m6OrderEntries); List<Module> m6DepModules = orderEntriesToDepModules(m6OrderEntries); assertOrderedElementsAreEqual(m6OwnerModules, Arrays.asList(modules.get(0), modules.get(1), modules.get(4), modules.get(5))); assertOrderedElementsAreEqual(m6DepModules, Arrays.asList(modules.get(5), modules.get(5), modules.get(5), null)); // m6 -> source OrderEntry m6E3 = m6OrderEntries.get(3); assertInstanceOf(m6E3, ModuleSourceOrderEntry.class); VirtualFile jmockDir = VfsUtil.findFileByIoFile(new File(getRepositoryPath(), "jmock/jmock/1.0/jmock-1.0.jar"), true); assertNotNull(jmockDir); VirtualFile jmockJar = JarFileSystem.getInstance().getJarRootForLocalFile(jmockDir); assertNotNull(jmockJar); // m2 -> jmock, m3 -> jmock List<OrderEntry> jmockOrderEntries = index.getOrderEntriesForFile(jmockJar); assertEquals(2, jmockOrderEntries.size()); OrderEntry jmockE0 = jmockOrderEntries.get(0); assertEquals(modules.get(1), jmockE0.getOwnerModule()); assertInstanceOf(jmockE0, LibraryOrderEntry.class); OrderEntry jmockE1 = jmockOrderEntries.get(1); assertEquals(modules.get(2), jmockE1.getOwnerModule()); assertInstanceOf(jmockE1, LibraryOrderEntry.class); }
checkDirIndexTestModulesWithCompileOrRuntimeScope
19,393
List<Module> (List<OrderEntry> orderEntries) { return ContainerUtil.map(orderEntries, orderEntry -> orderEntry.getOwnerModule()); }
orderEntriesToOwnerModules
19,394
List<Module> (List<OrderEntry> orderEntries) { return ContainerUtil.map(orderEntries, orderEntry -> (orderEntry instanceof ModuleOrderEntry) ? ((ModuleOrderEntry)orderEntry).getModule() : null); }
orderEntriesToDepModules
19,395
void (String... modules) { for (String each : modules) { assertModuleSearchScope(each, getProjectPath() + "/" + each + "/src/main/java", getProjectPath() + "/" + each + "/src/test/java"); } }
assertModuleScopes
19,396
void (String moduleName, String... paths) { assertSearchScope(moduleName, Scope.MODULE, null, paths); }
assertModuleSearchScope
19,397
void (String moduleName, String... paths) { assertCompileProductionSearchScope(moduleName, paths); assertRuntimeProductionSearchScope(moduleName, paths); }
assertAllProductionSearchScope
19,398
void (String moduleName, String... paths) { assertCompileTestsSearchScope(moduleName, paths); assertRuntimeTestsSearchScope(moduleName, paths); }
assertAllTestsSearchScope
19,399
void (String moduleName, String... paths) { assertSearchScope(moduleName, Scope.COMPILE, Type.PRODUCTION, paths); }
assertCompileProductionSearchScope