Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
16,000
void (int number) { if ( number > yylength() ) zzScanError(ZZ_PUSHBACK_2BIG); zzMarkedPos -= number; }
yypushback
16,001
boolean (Language language) { return language != null && language.is(ShLanguage.INSTANCE); }
isApplicable
16,002
boolean (@NotNull String command, @NotNull Project project, @Nullable String workingDirectory, @NotNull Executor executor) { ShRunner shRunner = ApplicationManager.getApplication().getService(ShRunner.class); if (shRunner != null && shRunner.isAvailable(project)) { shRunner.run(project, command, workingDirectory, "RunMarkdown", true); } /*try { runInTerminal(command, workingDirectory, project); } catch (ExecutionException e) { e.printStackTrace(); }*/ return true; }
run
16,003
String () { return ShBundle.message("sh.markdown.runner.title"); }
title
16,004
GeneralCommandLine (Project project, String workingDirectory, String command) { PtyCommandLine commandLine = new PtyCommandLine(); commandLine.withConsoleMode(false); commandLine.withInitialColumns(120); commandLine.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE); commandLine.setWorkDirectory(workingDirectory); commandLine.withExePath(ShConfigurationType.getDefaultShell(project)); commandLine.withParameters("-c"); commandLine.withParameters(command); return commandLine; }
createCommandLineForScript
16,005
String () { return PluginPathManager.getPluginHomePath("sh") + "/copyright/testData/copyright/"; }
getTestDataPath
16,006
UpdateCopyright (Project project, Module module, VirtualFile file, FileType base, CopyrightProfile options) { return new ShUpdatePsiFileCopyright(project, module, file, options); }
createInstance
16,007
boolean () { return getFile() instanceof ShFile; }
accept
16,008
void () { PsiFile file = getFile(); PsiElement first = file.getFirstChild(); if (first instanceof PsiComment && ((PsiComment)first).getTokenType() == ShTypes.SHEBANG) first = getNextSibling(first); PsiElement next = first; while (next instanceof PsiComment || ((next instanceof ASTNode) && ((ASTNode)next).getElementType() == ShTypes.LINEFEED)) { next = getNextSibling(next); } if (first != null) { checkComments(first, next, true); } else { checkComments(null, null, true); } }
scanFile
16,009
boolean (@NotNull PsiElement element) { PsiFile psiFile = element.getContainingFile(); return psiFile instanceof PyFile; }
isRunningProhibitedForElement
16,010
boolean (@NotNull PsiFile file) { return file instanceof PyFile; }
isRunningProhibitedForFile
16,011
String () { TerminalProjectOptionsProvider terminalProjectOptionsProvider = TerminalProjectOptionsProvider.getInstance(myProject); return terminalProjectOptionsProvider.getShellPath(); }
getDefaultShell
16,012
void (@NotNull Project project, @NotNull String command, @NotNull String workingDirectory, @NotNull @NlsContexts.TabTitle String title, boolean activateToolWindow) { TerminalToolWindowManager terminalToolWindowManager = TerminalToolWindowManager.getInstance(project); ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(TerminalToolWindowFactory.TOOL_WINDOW_ID); if (window == null) { return; } ContentManager contentManager = window.getContentManager(); Pair<Content, TerminalWidget> pair = getSuitableProcess(contentManager, workingDirectory); if (pair == null) { terminalToolWindowManager.createShellWidget(workingDirectory, title, activateToolWindow, activateToolWindow) .sendCommandToExecute(command); return; } if (activateToolWindow) { window.activate(null); } pair.first.setDisplayName(title); contentManager.setSelectedContent(pair.first); pair.second.sendCommandToExecute(command); }
run
16,013
boolean (@NotNull Project project) { ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(TerminalToolWindowFactory.TOOL_WINDOW_ID); return window != null && window.isAvailable(); }
isAvailable
16,014
String () { // A decoded result of calling `WebPGetDecoderVersion()`; we don't want to load the native library just to get this constant. return "1.3.2"; }
getDecoderVersion
16,015
String () { return getDecoderVersion(); }
getEncoderVersion
16,016
boolean () { if (!sJniLibLoadAttempted) { try { loadNativeLibrary(); } catch (UnsatisfiedLinkError e) { Logger.getInstance(WebpNativeLibHelper.class).warn(e); } } return sJniLibLoaded; }
loadNativeLibraryIfNeeded
16,017
boolean (ImageTypeSpecifier type) { return canWriteImage(type); }
canEncodeImage
16,018
boolean (ImageTypeSpecifier type) { SampleModel sm = type.getSampleModel(); ColorModel cm = type.getColorModel(); return (sm.getNumBands() >= 2 && sm.getNumBands() <= 4 || cm instanceof IndexColorModel) && sm.getSampleSize(0) <= 8 && sm.getWidth() <= 65535 && sm.getHeight() <= 65535 && (cm == null || cm.getComponentSize()[0] <= 8) && WebpNativeLibHelper.loadNativeLibraryIfNeeded(); }
canWriteImage
16,019
String (Locale locale) { return "WebP Image Encoder"; }
getDescription
16,020
IIOMetadata (ImageWriteParam param) { return new WebpMetadata(); }
getDefaultStreamMetadata
16,021
IIOMetadata (ImageTypeSpecifier imageType, ImageWriteParam param) { return new WebpMetadata(); }
getDefaultImageMetadata
16,022
IIOMetadata (IIOMetadata inData, ImageWriteParam param) { return null; }
convertStreamMetadata
16,023
IIOMetadata (IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param) { return null; }
convertImageMetadata
16,024
void (Object output) { super.setOutput(output); if (output != null) { if (!(output instanceof ImageOutputStream)) { throw new IllegalArgumentException("output is not an ImageOutputStream"); } this.stream = (ImageOutputStream)output; this.stream.setByteOrder(ByteOrder.LITTLE_ENDIAN); } else { this.stream = null; } }
setOutput
16,025
Raster (@NotNull IIOImage image) { boolean rasterOnly = image.hasRaster(); if (rasterOnly) { return image.getRaster(); } else { RenderedImage renderedImage = image.getRenderedImage(); if (renderedImage instanceof BufferedImage bufferedImage) { // Convert indexed to RGB if (renderedImage.getColorModel() instanceof IndexColorModel) { //noinspection UndesirableClassUsage BufferedImage rgb = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = rgb.createGraphics(); graphics.drawImage(bufferedImage, 0, 0, null); graphics.dispose(); return rgb.getRaster(); } return bufferedImage.getRaster(); } else if (renderedImage.getNumXTiles() == 1 && renderedImage.getNumYTiles() == 1) { Raster raster = renderedImage.getTile(renderedImage.getMinTileX(), renderedImage.getMinTileY()); if (raster.getWidth() != renderedImage.getWidth() || raster.getHeight() != renderedImage.getHeight()) { raster = raster.createChild(raster.getMinX(), raster.getMinY(), renderedImage.getWidth(), renderedImage.getHeight(), raster.getMinX(), raster.getMinY(), null); } return raster; } else { return renderedImage.getData(); } } }
getRaster
16,026
boolean (byte[] a1, int offset, int len, byte[] a2) { for (int i = 0; i < len; i++) { if (a1[offset + i] != a2[i]) { return false; } } return true; }
arrayEquals
16,027
String (Locale locale) { return "Webp Image Decoder"; }
getDescription
16,028
void () { myInputBytes = null; }
dispose
16,029
void (Object input, boolean seekForwardOnly, boolean ignoreMetadata) { super.setInput(input, seekForwardOnly, ignoreMetadata); myInputBytes = null; myError = 0; }
setInput
16,030
int (boolean allowSearch) { return myInputBytes == null ? 0 : 1; }
getNumImages
16,031
LauncherDiscoveryRequest (String[] suiteClassNames, String[] packageNameRef, String param) { if (suiteClassNames.length == 0) { return null; } LauncherDiscoveryRequestBuilder builder = LauncherDiscoveryRequestBuilder.request(); if (suiteClassNames.length == 1 && suiteClassNames[0].charAt(0) == '@') { // all tests in the package specified try (BufferedReader reader = new BufferedReader(new FileReader(suiteClassNames[0].substring(1)))) { final String packageName = reader.readLine(); if (packageName == null) return null; String tags = reader.readLine(); String filters = reader.readLine(); String line; List<DiscoverySelector> selectors = new ArrayList<>(); while ((line = reader.readLine()) != null) { DiscoverySelector selector = createSelector(line, null); if (selector != null) { selectors.add(selector); } } if (hasBrokenSelector(selectors)) { builder.filters(createMethodFilter(new ArrayList<>(selectors))); for (int i = 0; i < selectors.size(); i++) { DiscoverySelector selector = selectors.get(i); if (selector instanceof MethodSelector) { selectors.set(i, createClassSelector(((MethodSelector)selector).getClassName())); } } } packageNameRef[0] = packageName.isEmpty() ? "<default package>" : packageName; if (selectors.isEmpty()) { builder.selectors(DiscoverySelectors.selectPackage(packageName)); } else { builder.selectors(selectors); if (!packageName.isEmpty()) { builder.filters(PackageNameFilter.includePackageNames(packageName)); } } if (filters != null && !filters.isEmpty()) { String[] classNames = filters.split("\\|\\|"); for (String className : classNames) { if (!className.contains("*")) { try { Class.forName(className, false, JUnit5TestRunnerUtil.class.getClassLoader()); } catch (ClassNotFoundException e) { System.err.println(MessageFormat.format(ResourceBundle.getBundle("messages.RuntimeBundle").getString("junit.class.not.found"), className)); } } } builder.filters(ClassNameFilter.includeClassNamePatterns(classNames)); } if (tags != null && !tags.isEmpty()) { builder.filters(TagFilter.includeTags(tags.split(" "))); } return builder.filters(ClassNameFilter.excludeClassNamePatterns("com\\.intellij\\.rt.*", "com\\.intellij\\.junit3.*")).build(); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } else { DiscoverySelector selector = createSelector(suiteClassNames[0], packageNameRef); if (selector instanceof MethodSelector && !loadMethodByReflection((MethodSelector)selector)) { DiscoverySelector classSelector = createClassSelector(((MethodSelector)selector).getClassName()); DiscoverySelector methodSelector = classSelector instanceof NestedClassSelector ? DiscoverySelectors.selectMethod(((NestedClassSelector)classSelector).getNestedClassName(), ((MethodSelector)selector).getMethodName()) : selector; builder.filters(createMethodFilter(Collections.singletonList(methodSelector))); selector = classSelector; } if (selector instanceof MethodSelector && param != null) { DiscoverySelector methodSelectIteration = createMethodSelectIteration(selector, param); if (methodSelectIteration != null) { return builder.selectors(methodSelectIteration).build(); } } assert selector != null : "selector by class name is never null"; return builder.selectors(selector).build(); } return null; }
buildRequest
16,032
boolean (MethodSelector selector) { try { Class<?> aClass = Class.forName(selector.getClassName()); return ReflectionSupport.findMethod(aClass, selector.getMethodName(), selector.getMethodParameterTypes()).isPresent(); } catch (ClassNotFoundException e) { return false; } }
loadMethodByReflection
16,033
boolean (List<DiscoverySelector> selectors) { for (DiscoverySelector selector : selectors) { if (selector instanceof MethodSelector && !loadMethodByReflection((MethodSelector)selector)) { return true; } } return false; }
hasBrokenSelector
16,034
PostDiscoveryFilter (List<DiscoverySelector> selectors) { return new PostDiscoveryFilter() { @Override public FilterResult apply(TestDescriptor descriptor) { return FilterResult.includedIf(shouldRun(descriptor), () -> descriptor.getDisplayName() + " matches", () -> descriptor.getDisplayName() + " doesn't match"); } private boolean shouldRun(TestDescriptor descriptor) { TestSource source = descriptor.getSource().orElse(null); if (source instanceof MethodSource) { for (DiscoverySelector selector : selectors) { if (selector instanceof MethodSelector && ((MethodSelector)selector).getMethodName().equals(((MethodSource)source).getMethodName()) && (((MethodSelector)selector).getClassName().equals(((MethodSource)source).getClassName()) || inNestedClass((MethodSource)source, createClassSelector(((MethodSelector)selector).getClassName())))) { return true; } } for (DiscoverySelector selector : selectors) { if (selector instanceof ClassSelector && ((ClassSelector)selector).getClassName().equals(((MethodSource)source).getClassName()) || inNestedClass((MethodSource)source, selector)) { return true; } } return false; } return true; } private boolean inNestedClass(MethodSource source, DiscoverySelector selector) { return selector instanceof NestedClassSelector && ((NestedClassSelector)selector).getNestedClassName().equals(source.getClassName()); } }; }
createMethodFilter
16,035
FilterResult (TestDescriptor descriptor) { return FilterResult.includedIf(shouldRun(descriptor), () -> descriptor.getDisplayName() + " matches", () -> descriptor.getDisplayName() + " doesn't match"); }
apply
16,036
boolean (TestDescriptor descriptor) { TestSource source = descriptor.getSource().orElse(null); if (source instanceof MethodSource) { for (DiscoverySelector selector : selectors) { if (selector instanceof MethodSelector && ((MethodSelector)selector).getMethodName().equals(((MethodSource)source).getMethodName()) && (((MethodSelector)selector).getClassName().equals(((MethodSource)source).getClassName()) || inNestedClass((MethodSource)source, createClassSelector(((MethodSelector)selector).getClassName())))) { return true; } } for (DiscoverySelector selector : selectors) { if (selector instanceof ClassSelector && ((ClassSelector)selector).getClassName().equals(((MethodSource)source).getClassName()) || inNestedClass((MethodSource)source, selector)) { return true; } } return false; } return true; }
shouldRun
16,037
boolean (MethodSource source, DiscoverySelector selector) { return selector instanceof NestedClassSelector && ((NestedClassSelector)selector).getNestedClassName().equals(source.getClassName()); }
inNestedClass
16,038
DiscoverySelector (String line, String[] packageNameRef) { if (line.startsWith("\u001B")) { String uniqueId = line.substring("\u001B".length()); return DiscoverySelectors.selectUniqueId(uniqueId); } else if (line.startsWith("\u002B")) { String directory = line.substring("\u002B".length()); List<ClasspathRootSelector> selectors = DiscoverySelectors.selectClasspathRoots(Collections.singleton(Paths.get(directory))); if (selectors.isEmpty()) { return null; } else { return selectors.iterator().next(); } } else if (line.contains(",")) { MethodSelector selector = DiscoverySelectors.selectMethod(line.replaceFirst(",", "#")); if (packageNameRef != null) { packageNameRef[0] = selector.getClassName(); } return selector; } else { if (packageNameRef != null) { packageNameRef[0] = line; } return createClassSelector(line); } }
createSelector
16,039
DiscoverySelector (String line) { int nestedClassIdx = line.lastIndexOf("$"); if (nestedClassIdx > 0) { AtomicReference<DiscoverySelector> nestedClassSelector = new AtomicReference<>(); ReflectionSupport.tryToLoadClass(line).ifFailure(__ -> { nestedClassSelector.set(getNestedSelector(line, nestedClassIdx)); }); if (nestedClassSelector.get() != null) return nestedClassSelector.get(); } return DiscoverySelectors.selectClass(line); }
createClassSelector
16,040
DiscoverySelector (DiscoverySelector methodSelector, String param) { Integer index = null; if (param != null) { Matcher matcher = VALUE_SOURCE_PATTERN.matcher(param); if (matcher.find()) { String group = matcher.group(1); try { index = Integer.parseInt(group); } catch (NumberFormatException ignored) { } } } if (index != null) { try { return DiscoverySelectors.selectIteration(methodSelector, index); } catch (NoSuchMethodError e) { return null; } } return null; }
createMethodSelectIteration
16,041
NestedClassSelector (String line, int nestedClassIdx) { String enclosingClass = line.substring(0, nestedClassIdx); String nestedClassName = line.substring(nestedClassIdx + 1); DiscoverySelector enclosingClassSelector = createClassSelector(enclosingClass); Class<?> klass = enclosingClassSelector instanceof NestedClassSelector ? ((NestedClassSelector)enclosingClassSelector).getNestedClass() : ((ClassSelector)enclosingClassSelector).getJavaClass(); Class<?> superclass = klass.getSuperclass(); while (superclass != null) { for (Class<?> nested : superclass.getDeclaredClasses()) { if (nested.getSimpleName().equals(nestedClassName)) { List<Class<?>> enclosingClasses; if (enclosingClassSelector instanceof NestedClassSelector) { enclosingClasses = new ArrayList<>(((NestedClassSelector)enclosingClassSelector).getEnclosingClasses()); enclosingClasses.add(klass); } else { enclosingClasses = Collections.singletonList(klass); } return DiscoverySelectors.selectNestedClass(enclosingClasses, nested); } } superclass = superclass.getSuperclass(); } return null; }
getNestedSelector
16,042
void (ArrayList<String> listeners, int count) { myListeners = listeners; do { JUnit5TestExecutionListener currentListener = new JUnit5TestExecutionListener(); myExecutionListeners.add(currentListener); if (count > 2) { currentListener.initializeIdSuffix(count); } } while (--count > 0); myLauncher = LauncherFactory.create(); }
createListeners
16,043
int (String[] args, String programParam, int count, boolean sendTree) { try { JUnit5TestExecutionListener listener = myExecutionListeners.get(0); listener.initializeIdSuffix(!sendTree); final String[] packageNameRef = new String[1]; final LauncherDiscoveryRequest discoveryRequest = JUnit5TestRunnerUtil.buildRequest(args, packageNameRef, programParam); List<TestExecutionListener> listeners = new ArrayList<>(); listeners.add(listener); for (String listenerClassName : myListeners) { final IDEAJUnitListener junitListener = (IDEAJUnitListener)Class.forName(listenerClassName).newInstance(); listeners.add(new MyCustomListenerWrapper(junitListener)); } if (sendTree) { for (JUnit5TestExecutionListener executionListener : myExecutionListeners) { executionListener.setRootName(packageNameRef[0]); executionListener.setSendTree(); } } myLauncher.execute(discoveryRequest, listeners.toArray(new TestExecutionListener[0])); return listener.wasSuccessful() ? 0 : -1; } catch (Exception e) { System.err.println("Internal Error occurred."); e.printStackTrace(System.err); return -2; } finally { if (count > 0) myExecutionListeners.remove(0); } }
startRunnerWithArgs
16,044
TestIdentifier (String[] args, String name) { final LauncherDiscoveryRequest discoveryRequest = JUnit5TestRunnerUtil.buildRequest(args, new String[1], ""); myForkedTestPlan = LauncherFactory.create().discover(discoveryRequest); final Set<TestIdentifier> roots = myForkedTestPlan.getRoots(); if (roots.isEmpty()) return null; List<TestIdentifier> nonEmptyRoots = roots.stream() .filter(identifier -> !myForkedTestPlan.getChildren(identifier).isEmpty()) .collect(Collectors.toList()); if (nonEmptyRoots.isEmpty()) return null; return nonEmptyRoots.size() == 1 ? nonEmptyRoots.get(0) : FAKE_ROOT; }
getTestToStart
16,045
List<TestIdentifier> (TestIdentifier description) { if (description == FAKE_ROOT) { return myForkedTestPlan.getRoots() .stream() .flatMap(root -> myForkedTestPlan.getChildren(root).stream()) .collect(Collectors.toList()); } return new ArrayList<>(myForkedTestPlan.getChildren(description)); }
getChildTests
16,046
String (TestIdentifier child) { if (!myForkedTestPlan.getParent(child).isPresent()) { //if fork mode is "repeat", then the only child is the corresponding class child = myForkedTestPlan.getChildren(child).iterator().next(); } final TestIdentifier testIdentifier = child; final String className = JUnit5TestExecutionListener.getClassName(testIdentifier); final String methodSignature = JUnit5TestExecutionListener.getMethodSignature(testIdentifier); if (methodSignature != null) { return className + "," + methodSignature; } return className != null ? className : testIdentifier.getDisplayName(); }
getStartDescription
16,047
String (TestIdentifier child) { return child.toString(); }
getTestClassName
16,048
void (TestIdentifier testIdentifier) { if (testIdentifier.isTest()) { final String className = JUnit5TestExecutionListener.getClassName(testIdentifier); final String methodName = JUnit5TestExecutionListener.getMethodName(testIdentifier); myJunitListener.testStarted(className, methodName); } }
executionStarted
16,049
void (TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { if (testIdentifier.isTest()) { final String className = JUnit5TestExecutionListener.getClassName(testIdentifier); final String methodName = JUnit5TestExecutionListener.getMethodName(testIdentifier); if (myJunitListener instanceof IDEAJUnitListenerEx) { ((IDEAJUnitListenerEx)myJunitListener).testFinished(className, methodName, testExecutionResult.getStatus() == TestExecutionResult.Status.SUCCESSFUL); } else { myJunitListener.testFinished(className, methodName); } } }
executionFinished
16,050
boolean () { return mySuccessful; }
wasSuccessful
16,051
void (boolean forked) { if (forked && myIdSuffix.isEmpty()) { myIdSuffix = String.valueOf(System.currentTimeMillis()); } }
initializeIdSuffix
16,052
void (int i) { myIdSuffix = i + "th"; }
initializeIdSuffix
16,053
void (TestIdentifier testIdentifier, ReportEntry entry) { StringBuilder builder = new StringBuilder(); builder.append("timestamp = ").append(entry.getTimestamp()); entry.getKeyValuePairs().forEach((key, value) -> builder.append(", ").append(key).append(" = ").append(value)); builder.append("\n"); myPrintStream.println("##teamcity[testStdOut" + idAndName(testIdentifier) + " out = '" + escapeName(builder.toString()) + "']"); }
reportingEntryPublished
16,054
void (TestPlan testPlan) { myTestPlan = testPlan; if (mySendTree) { for (TestIdentifier root : myTestPlan.getRoots()) { assert root.isContainer(); for (TestIdentifier testIdentifier : myTestPlan.getChildren(root)) { String legacyReportingName = testIdentifier.getLegacyReportingName(); if (legacyReportingName != null && legacyReportingName.equals(myRootName)) setPresentableName(testIdentifier.getDisplayName()); sendTreeUnderRoot(testIdentifier, new HashSet<>()); } } myPrintStream.println("##teamcity[treeEnded]"); } if (myRootName != null) { int lastPointIdx = myRootName.lastIndexOf('.'); String name = myRootName; String comment = null; if (lastPointIdx >= 0) { name = myRootName.substring(lastPointIdx + 1); comment = myRootName.substring(0, lastPointIdx); } String messageName = (myPresentableName == null || myPresentableName.isEmpty()) ? escapeName(name) : myPresentableName; myPrintStream.println("##teamcity[rootName name = '" + messageName + (comment != null ? ("' comment = '" + escapeName(comment)) : "") + "'" + " location = 'java:suite://" + escapeName(myRootName) + "']"); } }
testPlanExecutionStarted
16,055
void (TestIdentifier root, HashSet<TestIdentifier> visited) { String idAndName = idAndName(root); if (root.isContainer()) { boolean skipContainer = shouldSkipContainer(root); if (!skipContainer) myPrintStream.println("##teamcity[suiteTreeStarted" + idAndName + " " + getLocationHint(root) + "]"); for (TestIdentifier childIdentifier : myTestPlan.getChildren(root)) { if (visited.add(childIdentifier)) { sendTreeUnderRoot(childIdentifier, visited); } else { System.err.println("Identifier '" + getId(childIdentifier) + "' is reused"); } } if (!skipContainer) myPrintStream.println("##teamcity[suiteTreeEnded" + idAndName + "]"); } else if (root.isTest()) { myPrintStream.println("##teamcity[suiteTreeNode " + idAndName + " " + getLocationHint(root) + "]"); } }
sendTreeUnderRoot
16,056
void (TestIdentifier testIdentifier, String reason) { executionStarted (testIdentifier); executionFinished(testIdentifier, TestExecutionResult.Status.ABORTED, null, reason); }
executionSkipped
16,057
void (TestIdentifier testIdentifier) { if (testIdentifier.isTest()) { testStarted(testIdentifier); myCurrentTestStart = System.nanoTime(); } else if (!shouldSkipContainer(testIdentifier)) { myFinishCount = 0; myPrintStream.println("##teamcity[testSuiteStarted" + idAndName(testIdentifier) + getLocationHint(testIdentifier) + "]"); } }
executionStarted
16,058
void (TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { TestExecutionResult.Status status = testExecutionResult.getStatus(); Throwable throwableOptional = testExecutionResult.getThrowable().orElse(null); executionFinished(testIdentifier, status, throwableOptional, null); mySuccessful &= TestExecutionResult.Status.SUCCESSFUL == testExecutionResult.getStatus(); }
executionFinished
16,059
void (TestIdentifier testIdentifier, TestExecutionResult.Status status, Throwable throwableOptional, String reason) { if (testIdentifier.isTest()) { long duration = getDuration(); if (status == TestExecutionResult.Status.FAILED) { testFailure(testIdentifier, MapSerializerUtil.TEST_FAILED, throwableOptional, duration, reason, true); } else if (status == TestExecutionResult.Status.ABORTED) { testFailure(testIdentifier, MapSerializerUtil.TEST_IGNORED, throwableOptional, duration, reason, true); } testFinished(testIdentifier, duration); myFinishCount++; } else if (!shouldSkipContainer(testIdentifier) || status == TestExecutionResult.Status.FAILED){ String messageName = null; if (status == TestExecutionResult.Status.FAILED) { messageName = MapSerializerUtil.TEST_FAILED; } else if (status == TestExecutionResult.Status.ABORTED) { messageName = MapSerializerUtil.TEST_IGNORED; } if (messageName != null) { Set<TestIdentifier> descendants = myTestPlan != null ? myTestPlan.getDescendants(testIdentifier) : Collections.emptySet(); if (status == TestExecutionResult.Status.FAILED) { String parentId = getParentId(testIdentifier); String nameAndId = " name='" + CLASS_CONFIGURATION + "' nodeId='" + escapeName(getId(testIdentifier)) + "' parentNodeId='" + escapeName(parentId) + "' "; myPrintStream.println("##teamcity[testStarted " + nameAndId + " ]"); testFailure(CLASS_CONFIGURATION, getId(testIdentifier), parentId, messageName, throwableOptional, 0, reason, true); myPrintStream.println("##teamcity[testFinished" + nameAndId + "]"); } else if (descendants.isEmpty()) { testFailure(testIdentifier, MapSerializerUtil.TEST_IGNORED, throwableOptional, 0, reason, true); } if (!descendants.isEmpty() && myFinishCount == 0) { for (TestIdentifier childIdentifier : descendants) { testStarted(childIdentifier); Throwable throwable = status == TestExecutionResult.Status.ABORTED ? throwableOptional : null; testFailure(childIdentifier, MapSerializerUtil.TEST_IGNORED, throwable, 0, reason, status == TestExecutionResult.Status.ABORTED); testFinished(childIdentifier, 0); } myFinishCount = 0; } } myPrintStream.println("##teamcity[testSuiteFinished" + idAndName(testIdentifier) + "]"); } }
executionFinished
16,060
boolean (TestIdentifier testIdentifier) { UniqueId id = UniqueId.parse(testIdentifier.getUniqueId()); List<UniqueId.Segment> segments = id.getSegments(); if (segments.isEmpty()) return false; UniqueId.Segment lastSegment = segments.get(segments.size() - 1); return lastSegment.getType().equals("engine") || myRootName != null && myRootName.equals(lastSegment.getValue()); }
shouldSkipContainer
16,061
long () { return (System.nanoTime() - myCurrentTestStart) / 1_000_000; }
getDuration
16,062
void (TestIdentifier testIdentifier) { myPrintStream.println("##teamcity[testStarted" + idAndName(testIdentifier) + " " + getLocationHint(testIdentifier) + "]"); }
testStarted
16,063
void (TestIdentifier testIdentifier, long duration) { myPrintStream.println("##teamcity[testFinished" + idAndName(testIdentifier) + (duration > 0 ? " duration='" + duration + "'" : "") + "]"); }
testFinished
16,064
void (TestIdentifier testIdentifier, String messageName, Throwable ex, long duration, String reason, boolean includeThrowable) { testFailure(testIdentifier.getDisplayName(), getId(testIdentifier), getParentId(testIdentifier), messageName, ex, duration, reason, includeThrowable); }
testFailure
16,065
void (String methodName, String id, String parentId, String messageName, Throwable ex, long duration, String reason, boolean includeThrowable) { Map<String, String> attrs = new LinkedHashMap<>(); attrs.put("name", methodName); attrs.put("id", id); attrs.put("nodeId", id); attrs.put("parentNodeId", parentId); if (duration > 0) { attrs.put("duration", Long.toString(duration)); } if (reason != null) { attrs.put("message", reason); } try { if (ex != null) { ComparisonFailureData failureData = null; if (ex instanceof MultipleFailuresError && ((MultipleFailuresError)ex).hasFailures()) { for (Throwable assertionError : ((MultipleFailuresError)ex).getFailures()) { testFailure(methodName, id, parentId, messageName, assertionError, duration, reason, true); } } else if (ex instanceof AssertionFailedError && !(ex instanceof FileComparisonData) && ((AssertionFailedError)ex).isActualDefined() && ((AssertionFailedError)ex).isExpectedDefined()) { ValueWrapper actual = ((AssertionFailedError)ex).getActual(); ValueWrapper expected = ((AssertionFailedError)ex).getExpected(); failureData = new ComparisonFailureData(expected.getStringRepresentation(), actual.getStringRepresentation()); } else { //try to detect failure with junit 4 if present in the classpath try { failureData = ExpectedPatterns.createExceptionNotification(ex); } catch (Throwable ignore) {} } if (includeThrowable || failureData == null) { ComparisonFailureData.registerSMAttributes(failureData, getTrace(ex), ex.getMessage(), attrs, ex, "Comparison Failure: ", "expected: <"); } else { ComparisonFailureData.registerSMAttributes(failureData, "", ex.getMessage(), attrs, ex, "Comparison Failure: ", "expected: <"); } } } finally { myPrintStream.println(MapSerializerUtil.asString(messageName, attrs)); } }
testFailure
16,066
String (Throwable ex) { StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); ex.printStackTrace(writer); return stringWriter.toString(); }
getTrace
16,067
void (String rootName) { myRootName = rootName; }
setRootName
16,068
void (String presentableName) { myPresentableName = presentableName; }
setPresentableName
16,069
String (TestIdentifier identifier) { return identifier.getUniqueId() + myIdSuffix; }
getId
16,070
String (TestIdentifier testIdentifier) { return " id='" + escapeName(getId(testIdentifier)) + "' name='" + escapeName(testIdentifier.getDisplayName()) + "' nodeId='" + escapeName(getId(testIdentifier)) + "' parentNodeId='" + escapeName(getParentId(testIdentifier)) + "'"; }
idAndName
16,071
String (TestIdentifier testIdentifier) { Optional<TestIdentifier> parent = myTestPlan.getParent(testIdentifier); return parent .map(identifier -> shouldSkipContainer(identifier) ? getParentId(identifier) : identifier.getUniqueId() + myIdSuffix) .orElse("0"); }
getParentId
16,072
String (TestIdentifier root) { return getLocationHint(root, myTestPlan.getParent(root).orElse(null)); }
getLocationHint
16,073
String (TestIdentifier root, TestIdentifier rootParent) { return root.getSource() .map(testSource -> getLocationHintValue(testSource, rootParent != null ? rootParent.getSource().orElse(null) : null)) .filter(maybeLocationHintValue -> !NO_LOCATION_HINT_VALUE.equals(maybeLocationHintValue)) .map(locationHintValue -> "locationHint='" + locationHintValue + "'" + getMetaInfo(root)) .orElse(NO_LOCATION_HINT); }
getLocationHint
16,074
String (TestIdentifier root) { return root.getSource() .map(testSource -> { if (testSource instanceof MethodSource) { //noinspection SpellCheckingInspection return " metainfo='" + ((MethodSource)testSource).getMethodParameterTypes() + "'"; } if (testSource instanceof ClassSource) { //noinspection SpellCheckingInspection return ((ClassSource)testSource).getPosition() .map(position -> " metainfo='" + position.getLine() + ":" + position.getColumn() + "'") .orElse(NO_LOCATION_HINT); } return NO_LOCATION_HINT; }) .orElse(NO_LOCATION_HINT); }
getMetaInfo
16,075
String (TestSource testSource, TestSource parentSource) { if (testSource instanceof CompositeTestSource) { CompositeTestSource compositeTestSource = ((CompositeTestSource)testSource); for (TestSource sourceFromComposite : compositeTestSource.getSources()) { String locationHintValue = getLocationHintValue(sourceFromComposite, parentSource); if (!NO_LOCATION_HINT_VALUE.equals(locationHintValue)) { return locationHintValue; } } return NO_LOCATION_HINT_VALUE; } if (testSource instanceof FileSource) { FileSource fileSource = (FileSource)testSource; File file = fileSource.getFile(); String line = fileSource.getPosition() .map(position -> ":" + position.getLine()) .orElse(""); return "file://" + file.getAbsolutePath() + line; } if (testSource instanceof MethodSource) { MethodSource methodSource = (MethodSource)testSource; return javaLocation(methodSource.getClassName(), methodSource.getMethodName(), true); } if (testSource instanceof ClassSource) { String className = ((ClassSource)testSource).getClassName(); return javaLocation(className, null, false); } if (parentSource != null) { return getLocationHintValue(parentSource,null); } return NO_LOCATION_HINT_VALUE; }
getLocationHintValue
16,076
String (String className, String maybeMethodName, boolean isTest) { String type = isTest ? "test" : "suite"; String methodName = maybeMethodName == null ? "" : "/" + maybeMethodName; String location = escapeName(className + methodName); return "java:" + type + "://" + location; }
javaLocation
16,077
String (String str) { return MapSerializerUtil.escapeStr(str, MapSerializerUtil.STD_ESCAPER); }
escapeName
16,078
String (TestIdentifier description) { return description.getSource().map(source -> { if (source instanceof MethodSource) { return ((MethodSource)source).getClassName(); } if (source instanceof ClassSource) { return ((ClassSource)source).getClassName(); } return null; }).orElse(null); }
getClassName
16,079
String (TestIdentifier testIdentifier) { return testIdentifier.getSource().map((source) -> { if (source instanceof MethodSource) { return ((MethodSource)source).getMethodName(); } return null; }).orElse(null); }
getMethodName
16,080
String (TestIdentifier testIdentifier) { return testIdentifier.getSource().map((source) -> { if (source instanceof MethodSource) { String parameterTypes = ((MethodSource)source).getMethodParameterTypes(); return ((MethodSource)source).getMethodName() + (parameterTypes != null ? "(" + parameterTypes + ")" : ""); } return null; }).orElse(null); }
getMethodSignature
16,081
String () { return PluginPathManager.getPluginHomePath("rareJavaRefactorings") + "/testData/removemiddleman/"; }
getTestDataPath
16,082
void (final String conflict) { doTest(() -> { PsiClass aClass = myFixture.findClass("Test"); final PsiField field = aClass.findFieldByName("myField", false); final Set<PsiMethod> methods = DelegationUtils.getDelegatingMethodsForField(field); List<MemberInfo> infos = new ArrayList<>(); for (PsiMethod method : methods) { final MemberInfo info = new MemberInfo(method); info.setChecked(true); info.setToAbstract(true); infos.add(info); } try { RemoveMiddlemanProcessor processor = new RemoveMiddlemanProcessor(field, infos); processor.run(); if (conflict != null) TestCase.fail("Conflict expected"); } catch (BaseRefactoringProcessor.ConflictsInTestsException e) { if (conflict == null) throw e; TestCase.assertEquals(conflict, e.getMessage()); } }); }
doTest
16,083
void () { doTest((String)null); }
testNoGetter
16,084
void () { doTest("foo() will be deleted. Hierarchy will be broken"); }
testSiblings
16,085
void () { doTest("foo() will be deleted. Hierarchy will be broken"); }
testInterface
16,086
void () { doTest("foo() will be deleted. Hierarchy will be broken"); }
testPresentGetter
16,087
void () { doTest("foo() will be deleted. Hierarchy will be broken"); }
testInterfaceDelegation
16,088
String () { return PluginPathManager.getPluginHomePath("rareJavaRefactorings") + "/testData/wrapReturnValue/"; }
getTestDataPath
16,089
void () { doTest(false); }
testSimple
16,090
void () { doTest(false); }
testGenerics
16,091
void () { doTest(true, "Existing class does not have getter for selected field"); }
testInconsistentWrapper
16,092
void () { doTest(true); }
testWrapper
16,093
void () { doTest(true); }
testStrip
16,094
void () { doTest(true, "Existing class does not have appropriate constructor"); }
testNoConstructor
16,095
void () { doTest(false, null, true); }
testInnerClass
16,096
void () { doTest(false, null, true); }
testHierarchy
16,097
void () { doTest(true, null, false); }
testAnonymous
16,098
void () { doTest(true, "Existing class does not have appropriate constructor", false); }
testWrongFieldAssignment
16,099
void () { doTest(true, null, false); }
testInferFieldType