Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
253,100
boolean (@NotNull String testIdentifier) { try { return nastradamusClient.isClassInBucket(testIdentifier, (testClassName) -> matchesCurrentBucketViaHashing(testClassName)); } catch (Exception e) { // if fails, just fallback to consistent hashing return matchesCurrentBucketViaHashing(testIdentifier); } }
matchesBucketViaNastradamus
253,101
boolean (@NotNull String testIdentifier) { return TEST_RUNNERS_COUNT == 1 || MathUtil.nonNegativeAbs(testIdentifier.hashCode()) % TEST_RUNNERS_COUNT == TEST_RUNNER_INDEX; }
matchesCurrentBucketViaHashing
253,102
boolean (@NotNull String testIdentifier) { // just run aggregator "as usual", but send the data to Nastradamus if (IS_NASTRADAMUS_SHADOW_DATA_COLLECTION_ENABLED) { // do not return result until Nastradamus is "production-ready" matchesBucketViaNastradamus(testIdentifier); } if (IS_NASTRADAMUS_TEST_DISTRIBUTOR_ENABLED) ...
matchesCurrentBucket
253,103
void () { if (!(IS_NASTRADAMUS_TEST_DISTRIBUTOR_ENABLED || IS_NASTRADAMUS_SHADOW_DATA_COLLECTION_ENABLED)) return; try { var testRunRequest = nastradamusClient.collectTestRunResults(); nastradamusClient.sendTestRunResults(testRunRequest, IS_NASTRADAMUS_TEST_DISTRIBUTOR_ENABLED); } catch (Exception e) { System.err.print...
sendTestRunResultsToNastradamus
253,104
boolean (@NotNull String testIdentifier, int testRunnerCount, int testRunnerIndex) { var value = BUCKETS.get(testIdentifier); if (value != null) { var isMatchedBucket = value == testRunnerIndex; if (IS_VERBOSE_LOG_ENABLED) { System.out.printf( "Fair bucket match: test identifier `%s` (already sieved to buckets), runner...
matchesCurrentBucketFair
253,105
boolean () { return TEST_RUNNERS_COUNT > 1; }
shouldBucketTests
253,106
boolean (Class<?> testCaseClass, String moduleName, boolean checkForExclusion) { if ((testCaseClass.getModifiers() & Modifier.ABSTRACT) != 0) return false; if (checkForExclusion) { if (shouldExcludeTestClass(moduleName, testCaseClass)) return false; boolean isHardwareAgentRequired = getAnnotationInHierarchy(testCaseCla...
shouldAddTestCase
253,107
boolean (String moduleName, Class<?> testCaseClass) { if (!myForceLoadPerformanceTests && !shouldIncludePerformanceTestCase(testCaseClass.getSimpleName())) return true; String className = testCaseClass.getName(); return !myTestClassesFilter.matches(className, moduleName) || isBombed(testCaseClass) || testCaseClass.isAn...
shouldExcludeTestClass
253,108
boolean (Class<?> c) { return RUN_WITH_TEST_DISCOVERY && getAnnotationInHierarchy(c, ExcludeFromTestDiscovery.class) != null; }
isExcludeFromTestDiscovery
253,109
boolean (final AnnotatedElement element) { final Bombed bombedAnnotation = element.getAnnotation(Bombed.class); if (bombedAnnotation == null) return false; return !TestFrameworkUtil.bombExplodes(bombedAnnotation); }
isBombed
253,110
void (final String moduleName, final Collection<String> classNamesIterator) { for (String className : classNamesIterator) { try { Class<?> candidateClass = Class.forName(className, false, getClassLoader()); if (isClassTestCase(candidateClass, moduleName)) { myClassSet.add(candidateClass); } } catch (Throwable e) { Stri...
loadTestCases
253,111
ClassLoader () { return TestCaseLoader.class.getClassLoader(); }
getClassLoader
253,112
List<Throwable> () { return myClassLoadingErrors; }
getClassLoadingErrors
253,113
int (Class<?> aClass) { if (runFirst(aClass)) return 0; // `PlatformLiteFixture` is a very special test case, because it doesn't load all the XMLs with component/extension declarations // (that is, uses a mock application). Instead, it allows declaring them manually using its registerComponent/registerExtension // meth...
getRank
253,114
boolean (Class<?> testClass) { return getAnnotationInHierarchy(testClass, RunFirst.class) != null; }
runFirst
253,115
boolean (Class<?> aClass) { while (aClass != null) { if (PLATFORM_LITE_FIXTURE_NAME.equals(aClass.getName())) { return true; } else { aClass = aClass.getSuperclass(); } } return false; }
isPlatformLiteFixture
253,116
int () { return myClassSet.size(); }
getClassesCount
253,117
TestSorter () { String sorter = System.getProperty("intellij.build.test.sorter"); // use Nostradamus test sorter in case, if no other is specified if (sorter == null && IS_NASTRADAMUS_TEST_DISTRIBUTOR_ENABLED) { sorter = "com.intellij.nastradamus.NastradamusTestCaseSorter"; } if (sorter != null) { try { var testSorter ...
loadTestSorter
253,118
void () { myClassSet.clear(); myFirstTestClass = null; myLastTestClass = null; }
clearClasses
253,119
boolean () { return PERFORMANCE_TESTS_ONLY; }
isPerformanceTestsRun
253,120
boolean () { return INCLUDE_PERFORMANCE_TESTS; }
isIncludingPerformanceTestsRun
253,121
boolean (String className) { return isIncludingPerformanceTestsRun() || isPerformanceTestsRun() || !isPerformanceTest(null, className); }
shouldIncludePerformanceTestCase
253,122
boolean (String methodName, String className) { return TestFrameworkUtil.isPerformanceTest(methodName, className); }
isPerformanceTest
253,123
boolean (String className) { if (!INCLUDE_UNCONVENTIONALLY_NAMED_TESTS && !className.endsWith("Test")) { return false; } if ("_FirstInSuiteTest".equals(className) || "_LastInSuiteTest".equals(className)) { return false; } if (ourFilter == null) { ourFilter = calcTestClassFilter("tests/testGroups.properties"); TestClass...
isClassIncluded
253,124
void (String rootPackage, List<? extends Path> classesRoots) { long t = System.nanoTime(); for (Path classesRoot : classesRoots) { int count = getClassesCount(); ClassFinder classFinder = new ClassFinder(classesRoot, rootPackage, INCLUDE_UNCONVENTIONALLY_NAMED_TESTS); loadTestCases(classesRoot.getFileName().toString(),...
fillTestCases
253,125
JUnit4TestAdapterCache (JUnit4TestAdapterCache cache) { if (Retries.NUMBER > 0) { return new RetriesImpl.JUnit4TestAdapterCacheDelegate(cache); } else { return cache; } }
maybeEnable
253,126
TestResult (TestResult testResult) { if (Retries.NUMBER > 0) { testResult = new RetryingTestResult(testResult); } return testResult; }
maybeEnable
253,127
void (Failure failure, RunNotifier notifier) { var testDescription = failure.getDescription(); if (testDescription == Description.EMPTY || testDescription == Description.TEST_MECHANISM || !testDescription.isTest()) { return; } var testClass = testDescription.getTestClass(); if (testClass == null) { throw new IllegalSta...
retryTest
253,128
void (Test test, TestResult testResult) { if (test instanceof TestCase) { if ("warning".equals(((TestCase)test).getName())) { return; } var testResultDelegate = new TestResultDelegate(testResult); var failureExposingListener = new RetryListener(); testResultDelegate.addFirstListener(failureExposingListener); retryTest(...
retryTest
253,129
RunNotifier (TestResult result, JUnit4TestAdapter adapter) { return new RetryingRunNotifier(delegate.getNotifier(result, adapter)); }
getNotifier
253,130
void (Failure failure) { delegate.fireTestFailure(failure); if (!(failure.getException() instanceof AssumptionViolatedException)) { synchronized (this) { this.failure = failure; } } }
fireTestFailure
253,131
void (Description description) { delegate.fireTestFinished(description); if (failure != null && !Retries.shouldStop()) { retryTest(failure, delegate); } }
fireTestFinished
253,132
void (RunListener listener) { delegate.addListener(listener); }
addListener
253,133
void (RunListener listener) { delegate.removeListener(listener); }
removeListener
253,134
void (Description description) { delegate.fireTestRunStarted(description); }
fireTestRunStarted
253,135
void (Result result) { delegate.fireTestRunFinished(result); }
fireTestRunFinished
253,136
void (Failure failure) { delegate.fireTestAssumptionFailed(failure); }
fireTestAssumptionFailed
253,137
void (Description description) { delegate.fireTestIgnored(description); }
fireTestIgnored
253,138
void () { delegate.pleaseStop(); }
pleaseStop
253,139
void (RunListener listener) { delegate.addFirstListener(listener); }
addFirstListener
253,140
void (Test test) { synchronized (this) { failedTest = null; } super.startTest(test); }
startTest
253,141
void (Test test) { super.endTest(test); if (failedTest != null && !Retries.shouldStop()) { retryTest(failedTest, delegate); } }
endTest
253,142
void (Test test, Protectable p) { // delegate should not be called, otherwise test failures aren't propagated from it super.runProtected(test, p); }
runProtected
253,143
void (Test test) { delegate.startTest(test); }
startTest
253,144
void (Test test) { delegate.endTest(test); }
endTest
253,145
void (Test test, Throwable e) { throwable = e; }
addError
253,146
void (Test test, AssertionFailedError e) { throwable = e; }
addFailure
253,147
void (Test test) { Retries.testFinished(test, throwable == null); }
endTest
253,148
void (Test test) { }
startTest
253,149
List<Group> () { return myGroups; }
getGroups
253,150
Set<String> () { return myGroupNames; }
getGroupNames
253,151
boolean (String className, String moduleName) { return myGroups.stream() .filter(g -> myGroupNames.contains(g.name)) .anyMatch(g -> g.matches(className)) || myMatchUnlisted && !ContainerUtil.exists(myGroups, g -> g.matches(className)); }
matches
253,152
boolean (Set<String> groupNames) { return groupNames.isEmpty() || groupNames.contains(ALL_EXCLUDE_DEFINED); }
containsAllExcludeDefinedGroup
253,153
boolean (String className) { return !matchesAnyPattern(excluded, className) && matchesAnyPattern(included, className); }
matches
253,154
String () { return "GroupBasedTestClassFilter{names=" + myGroupNames + '}'; }
toString
253,155
boolean (Description description) { String className = description.getClassName(); String methodName = description.getMethodName(); return TestFrameworkUtil.isPerformanceTest(methodName, className); }
shouldRun
253,156
String () { return "Performance Tests Only"; }
describe
253,157
boolean (Description description) { return !PERFORMANCE_ONLY.shouldRun(description); }
shouldRun
253,158
String () { return "All Except Performance"; }
describe
253,159
boolean (Description description) { return !isBombed(description); }
shouldRun
253,160
String () { return "Not @Bombed"; }
describe
253,161
boolean (Description description) { Bombed bombed = description.getAnnotation(Bombed.class); return bombed != null && !TestFrameworkUtil.bombExplodes(bombed); }
isBombed
253,162
boolean (Description description) { return description.getAnnotation(IgnoreJUnit3.class) == null; }
shouldRun
253,163
String () { return "Not @IgnoreJUnit3"; }
describe
253,164
List<Throwable> () { return ourClassLoadingProblems; }
getLoadingClassProblems
253,165
List<Path> () { return TeamCityLogger.block("Collecting tests from ...", () -> { return doGetClassRoots(); }); }
getClassRoots
253,166
List<Path> () { String jarsToRunTestsFrom = System.getProperty("jar.dependencies.to.tests"); if (jarsToRunTestsFrom != null) { String[] jars = jarsToRunTestsFrom.split(";"); List<Path> classpath = Objects.requireNonNull(ExternalClasspathClassLoader.getRoots()); List<Path> testPaths = Arrays.stream(jars) .map(jarName ->...
doGetClassRoots
253,167
List<Path> (URL[] urls) { List<Path> classLoaderRoots = ContainerUtil.map(urls, url -> { try { return Paths.get(url.toURI()); } catch (URISyntaxException e) { throw new RuntimeException(e); } }); System.out.println("Collecting tests from " + classLoaderRoots); return classLoaderRoots; }
getClassRoots
253,168
int () { // counting test cases involves parallel directory scan now IdeaForkJoinWorkerThreadFactory.setupForkJoinCommonPool(true); int count = 0; for (Class<?> aClass : myTestCaseLoader.getClasses()) { Test test = getTest(aClass); if (test != null) count += test.countTestCases(); } return count; }
countTestCases
253,169
void (TestResult testResult, String message) { String processedTestsMessage = myRunTests <= 0 ? "None of tests was run" : myRunTests + " tests processed"; try { testResult.startTest(this); testResult.addError(this, new Throwable(processedTestsMessage + " before: " + message)); testResult.endTest(this); } catch (Excepti...
addErrorMessage
253,170
void (TestResult testResult) { final TestListener testListener = loadDiscoveryListener(); if (testListener != null) { testResult.addListener(testListener); } final OutOfProcessRetries.OutOfProcessRetryListener outOfProcessRetryListener = OutOfProcessRetries.getListenerForOutOfProcessRetry(); if (outOfProcessRetryListen...
run
253,171
TestListener () { // com.intellij.InternalTestDiscoveryListener final String discoveryListener = System.getProperty("test.discovery.listener"); if (discoveryListener != null) { try { return (TestListener)Class.forName(discoveryListener).newInstance(); } catch (Throwable e) { return null; } } return null; }
loadDiscoveryListener
253,172
boolean () { return !"true".equals(System.getProperty("intellij.build.test.ignoreFirstAndLastTests")); }
shouldAddFirstAndLastTests
253,173
void (final TestResult testResult, int totalTests, Class<?> testCaseClass) { myRunTests++; int errorCount = testResult.errorCount(); int count = errorCount + testResult.failureCount() - myIgnoredTests; if (count > MAX_FAILURE_TEST_COUNT && MAX_FAILURE_TEST_COUNT >= 0) { addErrorMessage(testResult, "Too many errors (" +...
runNextTest
253,174
Test (@NotNull final Class<?> testCaseClass) { try { if ((testCaseClass.getModifiers() & Modifier.PUBLIC) == 0) { return null; } Bombed classBomb = testCaseClass.getAnnotation(Bombed.class); if (classBomb != null && TestFrameworkUtil.bombExplodes(classBomb)) { return new ExplodedBomb(testCaseClass.getName(), classBomb)...
getTest
253,175
void (Test test) { if (!(test instanceof TestCase)) { doAddTest(test); } else { String name = ((TestCase)test).getName(); if ("warning".equals(name)) return; // Mute TestSuite's "no tests found" warning if (!isIncludingPerformanceTestsRun() && (isPerformanceTestsRun() ^ isPerformanceTest(name, testCaseClass.getSimpleNa...
addTest
253,176
void (Test test) { testsCount[0]++; super.addTest(test); }
doAddTest
253,177
Method (final TestCase testCase) { return safeFindMethod(testCase.getClass(), testCase.getName()); }
findTestMethod
253,178
JUnit4TestAdapter (@NotNull Class<?> testCaseClass) { return new JUnit4TestAdapter(testCaseClass, getJUnit4TestAdapterCache()); }
createJUnit4Adapter
253,179
JUnit4TestAdapterCache () { if (ourUnit4TestAdapterCache == null) { JUnit4TestAdapterCache cache; if ("junit5".equals(System.getProperty("intellij.build.test.runner"))) { try { cache = (JUnit4TestAdapterCache)Class.forName("com.intellij.tests.JUnit5TeamCityRunnerForTestAllSuite") .getMethod("createJUnit4TestAdapterCach...
getJUnit4TestAdapterCache
253,180
Method (Class<?> klass, String name) { return ReflectionUtil.getMethod(klass, name); }
safeFindMethod
253,181
void (String message) { TeamCityLogger.info(message); }
log
253,182
String () { return getClass().getSimpleName(); }
toString
253,183
File () { return new File(PathManager.getHomePath() + "/reports/report.txt"); }
reportFile
253,184
void (String message) { if (isUnderTC) { tcLog(message, null); } else { LOG.info(message); } }
info
253,185
void (String message) { warning(message, new Throwable()); }
warning
253,186
void (String message, @Nullable Throwable throwable) { if (isUnderTC) { tcLog(message, "WARNING"); } else { LOG.warn(message, throwable); } }
warning
253,187
void (String message) { error(message, new Throwable()); }
error
253,188
void (String message, @Nullable Throwable throwable) { if (isUnderTC) { tcLog(message, "ERROR"); } else { LOG.error(message, throwable); } }
error
253,189
void (String message, String level) { if (message.isEmpty()) return; try { while (message.charAt(0) == '\n') message = message.substring(1); if (level != null) message = level + ": " + message; if (!message.endsWith("\n")) message += "\n"; FileUtil.appendToFile(reportFile(), message); } catch (IOException e) { LOG.erro...
tcLog
253,190
String (@NotNull String s) { StringBuilder sb = new StringBuilder(s.length()); for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); char escape = switch (ch) { case '\n' -> 'n'; case '\r' -> 'r'; case '\'', '|', '[', ']' -> ch; default -> 0; }; if (escape != 0) { sb.append('|').append(escape); } else if (ch < ...
escapeTeamcityServiceMessage
253,191
Date (Bombed bombed) { final Calendar instance = Calendar.getInstance(); instance.set(Calendar.YEAR, bombed.year()); instance.set(Calendar.MONTH, bombed.month()); instance.set(Calendar.DAY_OF_MONTH, bombed.day()); instance.set(Calendar.HOUR_OF_DAY, bombed.time()); instance.set(Calendar.MINUTE, 0); return instance.getTi...
raidDate
253,192
boolean (@NotNull Bombed bombedAnnotation) { Date now = new Date(); return now.after(raidDate(bombedAnnotation)); }
bombExplodes
253,193
boolean (@NotNull Class<?> testCaseClass) { if (!SKIP_SLOW && !SKIP_HEADLESS) { return true; } for (Class<?> clazz = testCaseClass; clazz != null; clazz = clazz.getSuperclass()) { if (SKIP_HEADLESS && clazz.getAnnotation(SkipInHeadlessEnvironment.class) != null) { System.out.println("Class '" + testCaseClass.getName() ...
canRunTest
253,194
boolean (@NotNull Class<?> aClass, boolean allowAbstract) { int modifiers = aClass.getModifiers(); if (!allowAbstract && (modifiers & Modifier.ABSTRACT) != 0) return false; if ((modifiers & Modifier.PUBLIC) == 0) return false; if (aClass.getAnnotation(RunWith.class) != null) return true; for (Method method : aClass.get...
isJUnit4TestClass
253,195
boolean (@NotNull Class<?> aClass, boolean allowAbstract) { int modifiers = aClass.getModifiers(); if (!allowAbstract && (modifiers & Modifier.ABSTRACT) != 0) return false; if ((modifiers & Modifier.PUBLIC) == 0) return false; if (aClass.getAnnotation(ExtendWith.class) != null) return true; for (Method method : aClass....
isJUnit5TestClass
253,196
boolean (@Nullable String testName, @Nullable String className) { return containsWord(testName, className, "performance"); }
isPerformanceTest
253,197
boolean (@Nullable String testName, @Nullable String className) { return isPerformanceTest(testName, className) || containsWord(testName, className, "stress") || containsWord(testName, className, "slow"); }
isStressTest
253,198
boolean (@Nullable String testName, @Nullable String className, @NotNull String word) { return testName != null && StringUtil.containsIgnoreCase(testName, word) || className != null && StringUtil.containsIgnoreCase(className, word); }
containsWord
253,199
void (Class<?> clazz) { assert SelfSeedingTestCase.class.isAssignableFrom(clazz) : "To make tests balancing work properly on the TeamCity, the test class should implement " + SelfSeedingTestCase.class.getName(); }
assertParentOf