Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
300,900
void () { doTestWithLocations( new String[] [] { {"http://example.com/persistence","XIncludeTestSchema.xsd"} }, "xml" ); }
testDtdElementRefs
300,901
void () { doTestWithLocations(null, "xsd"); doTestWithLocations(null, "dtd"); doTestWithLocations(null, "xml"); }
testDuplicates
300,902
void () { doTestWithLocations(null, "xsd"); }
testMinMaxOccursInSchema
300,903
void () { doTestWithLocations(null, "xsl"); }
testXslt2
300,904
void () { doTestWithLocations(null, "xsd"); }
testDefaultAndFixedInSchema
300,905
void () { doTestWithLocations( new String[] [] { {"http://www.foo.org/test",getTestName(false)+".xsd"}, {"http://www.bar.org/test",getTestName(false)+"_2.xsd"} }, "xml" ); }
testAnyAttributesInAttrGroup
300,906
void () { final String testName = getTestName(false); configureByFiles( null, BASE_PATH + testName +".xml", BASE_PATH +testName +"-inc.xml", BASE_PATH +testName +"TestSchema.xsd" ); ExternalResourceManagerEx.getInstanceEx().addIgnoredResources(Collections.singletonList("oxf:/apps/somefile.xml"), getTestRootDisposable()); doDoTest(true, false, true); VirtualFile[] includedFiles = FileIncludeManager.getManager(getProject()).getIncludedFiles(getFile().getVirtualFile(), true); assertEquals(1, includedFiles.length); }
testXInclude
300,907
void () { final String[][] urls = { {"http://www.springframework.org/schema/beans/spring-beans-2.0.xsd", "spring-beans-2.0.xsd"}, {"http://www.springframework.org/schema/tool", "spring-tool-2.5.xsd"}, {"http://www.springframework.org/schema/context/spring-context-2.5.xsd", "spring-context-2.5.xsd"}, {"urn:xxx","mule.xsd"}, {"urn:yyy","mule-management.xsd"} }; doTestWithLocations(urls, "xml"); }
testMuleConfigHighlighting
300,908
void () { String path = getTestName(false) + File.separatorChar; final String[][] urls = { {"http://www.springframework.org/schema/beans/spring-beans-2.0.xsd", "spring-beans-2.0.xsd"}, {"http://www.springframework.org/schema/tool", "spring-tool-2.5.xsd"}, {"http://www.springframework.org/schema/context/spring-context-2.5.xsd", "spring-context-2.5.xsd"}, {"http://www.mulesource.org/schema/mule/core/2.2",path + "mule2_2.xsd"}, {"http://www.mulesource.org/schema/mule/cxf/2.2",path + "mule2_2-cxf.xsd"}, {"http://cxf.apache.org/core",path + "cxf_core.xsd"}, {"http://cxf.apache.org/configuration/beans",path + "cxf-beans.xsd"}, {"http://www.mulesource.org/schema/mule/schemadoc/2.2",path + "mule2_2-schemadoc.xsd"} }; doTestWithLocations(urls, "xml"); }
testMuleConfigHighlighting2
300,909
boolean () { return "testComplexRedefine3".equals(getName()); }
clearModelBeforeConfiguring
300,910
void () { final String testName = getTestName(false); String[][] urls = { {"http://extended", testName + ".xsd"}, {"http://simple", testName + "_2.xsd"} }; doTestWithLocations(urls, "xml"); }
testComplexRedefine5
300,911
void () { final String testName = getTestName(false); String[][] urls = { {"urn:jboss:bean-deployer:2.0", testName + ".xsd"}, {"", testName + "_2.xsd"} }; doTestWithLocations(urls,"xml"); }
testComplexRedefine6
300,912
void () { configureByFiles(null,BASE_PATH + getTestName(false) + ".xml", BASE_PATH + "mylib.jar"); String path = myFile.getVirtualFile().getParent().getPath() + "/"; String[][] urls = { {"http://graphml.graphdrawing.org/xmlns",path + "mylib.jar!/graphml.xsd"}, {"http://graphml.graphdrawing.org/xmlns/1.0/graphml-structure.xsd",path + "mylib.jar!/graphml-structure.xsd"}, {"http://www.w3.org/1999/xlink",path + "mylib.jar!/xlink.xsd"} }; for(String[] s:urls) ExternalResourceManagerExImpl.registerResourceTemporarily(s[0], s[1], getTestRootDisposable()); doDoTest(true, false); }
testComplexRedefineFromJar
300,913
void () { doTestWithLocations(null, "xml"); final List<XmlAttribute> attrs = new ArrayList<>(2); myFile.acceptChildren(new XmlRecursiveElementVisitor() { @Override public void visitXmlAttribute(final @NotNull XmlAttribute attribute) { if (!attribute.isNamespaceDeclaration()) attrs.add(attribute); } }); assertEquals(4,attrs.size()); checkAttribute(attrs.get(0), ""); checkAttribute(attrs.get(1), "foo2"); checkAttribute(attrs.get(2), ""); checkAttribute(attrs.get(3), "foo4"); }
testUnqualifiedAttributePsi
300,914
void (final @NotNull XmlAttribute attribute) { if (!attribute.isNamespaceDeclaration()) attrs.add(attribute); }
visitXmlAttribute
300,915
void (final XmlAttribute xmlAttribute, String expectedNs) { final String attrNs = xmlAttribute.getNamespace(); assertEquals(expectedNs, attrNs); final XmlTag parent = xmlAttribute.getParent(); assertEquals(parent.getAttribute(xmlAttribute.getLocalName(), attrNs), xmlAttribute); //final String parentNs = parent.getNamespace(); //if (!parentNs.equals(attrNs)) assertNull(parent.getAttribute(xmlAttribute.getLocalName(), parentNs)); assertEquals(parent.getAttributeValue(xmlAttribute.getLocalName(), attrNs), xmlAttribute.getValue()); //if (!parentNs.equals(attrNs)) assertNull(parent.getAttributeValue(xmlAttribute.getLocalName(), parentNs)); }
checkAttribute
300,916
void () { doTestWithLocations(null, "xsd"); }
testProblemWithImportedNsReference
300,917
void () { doTestWithLocations(null, "xsd"); }
testProblemWithMemberTypes
300,918
void () { final String testName = getTestName(false); doTestWithLocations( new String[][] { {"http://www.w3.org/TR/xhtml-modularization/DTD/xhtml-inlstyle-1.mod",testName + ".mod"} }, "dtd" ); }
testDtdHighlighting
300,919
void () { doTestWithLocations(new String[][]{ {"schemas/Forms.xsd", "Forms.xsd"} }, "xml"); }
testMappedSchemaLocation
300,920
void () { configureByFiles(null, BASE_PATH + "anyAttribute.xml", BASE_PATH + "services-1.0.xsd"); doDoTest(true, false); }
testAnyAttribute
300,921
void () { configureByFiles(null, BASE_PATH + "UnityEngine.xml", BASE_PATH + "UnityEngine.UIElements.xsd"); doDoTest(true, false); }
testAnyAttributeDefaultNamespace
300,922
void () { configureByFiles(null, BASE_PATH + "qualified.xml", BASE_PATH + "qualified.xsd"); doDoTest(true, false); }
testQualifiedAttributeReference
300,923
void () { configureByFiles(null, BASE_PATH + "UnqualifiedElement.xml", BASE_PATH + "UnqualifiedElement.xsd"); doDoTest(true, false); }
testUnqualifiedElement
300,924
void () { configureByFiles(null, BASE_PATH + "EnumeratedBoolean.xml", BASE_PATH + "EnumeratedBoolean.xsd"); doDoTest(true, false); }
testEnumeratedBoolean
300,925
void () { configureByFiles(null, BASE_PATH + "servers.xml", BASE_PATH + "servers.xsd"); doDoTest(true, false); }
testEnumeratedList
300,926
void () { configureByFiles(null, BASE_PATH + "enumerations.xml", BASE_PATH + "enumerations.xsd"); doDoTest(true, false); }
testEnumeratedExtension
300,927
void () { configureByFiles(null, BASE_PATH + "CustomBoolean.xml", BASE_PATH + "CustomBoolean.xsd"); doDoTest(true, false); }
testCustomBoolean
300,928
void () { configureByFiles(null, BASE_PATH + "XMLSchema_1_1.xsd"); doHighlighting(); }
testStackOverflowInSchema
300,929
void () { configureByFiles(null, BASE_PATH + "Versioning.xsd"); doDoTest(true, false); }
testSchemaVersioning
300,930
void () { configureByFiles(null, BASE_PATH + "BillionLaughs.xml"); XmlFile file = (XmlFile)getFile(); int[] count = {0}; XmlUtil.processXmlElements(file.getRootTag(), element -> { count[0]++; return true;}, false); assertEquals(9, count[0]); }
testBillionLaughs
300,931
void () { Locale locale = Locale.getDefault(); try { Locale.setDefault(Locale.ENGLISH); configureByFiles(null, BASE_PATH + "BillionLaughs.xml"); doDoTest(false, false); } finally { Locale.setDefault(locale); } }
testBillionLaughsValidation
300,932
void () { configureByFiles(null, BASE_PATH + "MaxOccurLimit.xml", BASE_PATH + "MaxOccurLimit.xsd"); assertTrue(doHighlighting().stream().anyMatch(info -> info.getSeverity() == HighlightSeverity.ERROR)); configureByFiles(null, BASE_PATH + "MaxOccurLimit.xml", BASE_PATH + "MaxOccurLimit.xsd"); System.setProperty(ValidateXmlActionHandler.JDK_XML_MAX_OCCUR_LIMIT, "10000"); assertFalse(doHighlighting().stream().anyMatch(info -> info.getSeverity() == HighlightSeverity.ERROR)); }
testMaxOccurLimitValidation
300,933
void () { configureByFiles(null, BASE_PATH + "ImportedAttr/main.xml", BASE_PATH + "ImportedAttr/main.xsd", BASE_PATH + "ImportedAttr/include.xsd"); doHighlighting(); }
testImportedAttr
300,934
void () { configureByFiles(null, BASE_PATH + "test.xhtml"); doDoTest(true, false); }
testXhtml
300,935
LocalInspectionTool[] () { return new LocalInspectionTool[]{ new RequiredAttributesInspection(), new XmlDuplicatedIdInspection(), new XmlInvalidIdInspection(), new CheckDtdReferencesInspection(), new XmlUnboundNsPrefixInspection(), new XmlPathReferenceInspection() }; }
configureLocalInspectionTools
300,936
void () { final ExternalResourceManagerEx manager = ExternalResourceManagerEx.getInstanceEx(); myOldDoctype = manager.getDefaultHtmlDoctype(getProject()); manager.setDefaultHtmlDoctype("fake", getProject()); }
disableHtmlSupport
300,937
void () { ExternalResourceManagerEx.getInstanceEx().setDefaultHtmlDoctype(myOldDoctype, getProject()); }
enableHtmlSupport
300,938
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; }
getTestDataPath
300,939
void () { myFixture.enableInspections(new XmlDefaultAttributeValueInspection()); myFixture.configureByText(XmlFileType.INSTANCE, "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=<warning descr=\"Redundant default attribute value assignment\">\"unqua<caret>lified\"</warning>>\n" + "</schema>"); myFixture.checkHighlighting(); IntentionAction action = myFixture.findSingleIntention(XmlAnalysisBundle.message("xml.quickfix.remove.attribute.family") + " e"); myFixture.launchAction(action); myFixture.checkResult("<schema xmlns=\"http://www.w3.org/2001/XMLSchema\">\n" + "</schema>"); }
testDefaultAttributeValue
300,940
void () { myFixture.enableInspections(new XmlDefaultAttributeValueInspection()); myFixture.configureByText(HtmlFileType.INSTANCE, """ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form action="index.php"> <input type="hidden" name="name_1" value="val_1"> <input type="hidden" name="name_2" value="val_2"> <button type="button">Proper js button</button> <button type="submit">Proper submit button</button> <button>Behave as submit when missing type="button"</button> </form> </body> </html> """); myFixture.checkHighlighting(); }
testHtmlFromRncSchema
300,941
void () { myFixture.enableInspections(new XmlDefaultAttributeValueInspection()); myFixture.configureByText(HtmlFileType.INSTANCE, "<input type=\"text\"/>"); myFixture.checkHighlighting(); }
testDefaultAttributeInHtml
300,942
void () { myFixture.enableInspections(new XmlDefaultAttributeValueInspection()); myFixture.testHighlighting("def.xml", "def.xsd"); }
testRequiredFixedAttribute
300,943
void () { myFixture.enableInspections(new XmlDefaultAttributeValueInspection()); myFixture.addFileToProject("foo.xsd", """ <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="def/attr"> <element name="foo"> <complexType> <attribute name="bar" default=""/> </complexType> </element> </schema>"""); myFixture.configureByText("foo.xml", "<foo xmlns=\"def/attr\" bar=/>"); myFixture.doHighlighting(); }
testEmptyDefaultAttributeValue
300,944
void () { myFixture.enableInspections(new XmlDeprecatedElementInspection()); myFixture.testHighlighting("deprecated.xml", "deprecated.xsd"); }
testDeprecations
300,945
void () { myFixture.testHighlighting("cdataEndHighlighting.xml"); }
testCDataEndHighlightingXml
300,946
void () { myFixture.testHighlighting("cdataEndHighlighting.html"); }
testCDataEndHighlightingHtml
300,947
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/xml"; }
getTestDataPath
300,948
LocalInspectionTool[] () { return new LocalInspectionTool[]{ new RequiredAttributesInspection(), new XmlDuplicatedIdInspection(), new XmlInvalidIdInspection(), new CheckDtdReferencesInspection(), new XmlUnboundNsPrefixInspection(), new XmlPathReferenceInspection() }; }
configureLocalInspectionTools
300,949
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; }
getTestDataPath
300,950
void () { checkValidation("<idea-plugin xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n" + "</idea-plugin>"); }
testCannotFindDeclaration
300,951
void () { checkValidation(""" <idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="extensionPoints.xml" xpointer="xpointer(/extensionPoints/*)"/> </idea-plugin>"""); }
testUnsupportedIncludeScheme
300,952
void (String text) { myFixture.enableInspections(CheckXmlFileWithXercesValidatorInspection.class); myFixture.configureByText(XmlFileType.INSTANCE, text); myFixture.testHighlighting(); }
checkValidation
300,953
String () { return "/quickFix/ignoreExternalResources"; }
getBasePath
300,954
void (@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) { findActionAndCheck(actionHint, testFullPath); }
doAction
300,955
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; }
getTestDataPath
300,956
void () { XmlFile file = (XmlFile)myFixture.configureByText(XmlFileType.INSTANCE, "<a b=\" &<caret>\"/>"); PsiElement element = file.getRootTag().getAttribute("b").getValueElement(); LanguageInjectionSupport support = TemporaryPlacesRegistry.getInstance(getProject()).getLanguageInjectionSupport(); assertTrue(support.addInjectionInPlace(PlainTextLanguage.INSTANCE, (PsiLanguageInjectionHost)element)); IntentionAction intention = myFixture.getAvailableIntention(XmlAnalysisBundle.message("xml.quickfix.escape.ampersand")); assertNotNull(intention); ShowIntentionActionsHandler.chooseActionAndInvoke(file, myFixture.getEditor(), intention, ""); myFixture.checkResult("<a b=\" &amp;\"/>"); }
testEscapeAmpersandInInjected
300,957
String () { return "/codeInsight/daemonCodeAnalyzer/quickFix/removeExtraClosingTag"; }
getBasePath
300,958
String () { return XmlTestUtil.getXmlTestDataPath(); }
getTestDataPath
300,959
String () { return "/quickFix/fetchExternalResources"; }
getBasePath
300,960
void () { doExtractionOfEmbeddedFiles( "1.dtd", "xhtml-lat1.ent", "xhtml-symbol.ent", "xhtml-special.ent"); doExtractionOfEmbeddedFiles( "1.xsd", "j2ee_1_4.xsd", "jsp_2_0.xsd"); doExtractionOfEmbeddedFiles( new String[] { "2.dtd", "2.mod" }, new String[][] { new String[] {"dbnotnx.mod", "dbcentx.mod", "dbpoolx.mod", "dbhierx.mod", "dbgenent.mod"}, new String[] {"htmltblx.mod", "calstblx.dtd"} } ); doExtractionOfEmbeddedFiles( new String[] { "3.dtd"}, new String[][] { new String[] {"onix-international.elt"} } ); doExtractionOfEmbeddedFiles( "3.xsd", "j2ee_1_4.xsd", "jsp_2_0.xsd"); doExtractionOfEmbeddedFiles( "4.xml", "http://www.springframework.org/schema/beans/spring-beans.xsd", "http://www.springframework.org/schema/aop/spring-aop.xsd", "http://www.springframework.org/schema/tx/spring-tx.xsd"); }
testExtractionOfEmbeddedFiles
300,961
void () { doExtractionOfEmbeddedFiles( "6.xml", "http://jboss.com/products/seam/components-1.2.xsd"); }
testSeamImport
300,962
void () { doExtractionOfEmbeddedFiles("BPMN20.xsd", "BPMNDI.xsd", "Semantic.xsd"); }
testBPMN
300,963
void () { doExtractionOfEmbeddedFiles("web-1.1", "http://geronimo.apache.org/xml/ns/geronimo-naming-1.1.xsd", "http://geronimo.apache.org/xml/ns/geronimo-security-1.1.xsd", "http://geronimo.apache.org/xml/ns/geronimo-module-1.1.xsd"); }
testGeronimo
300,964
void (String shortFileName,String... expectedFileNames) { doExtractionOfEmbeddedFiles(new String[] {shortFileName}, new String[][] {expectedFileNames} ); }
doExtractionOfEmbeddedFiles
300,965
void (String[] shortFileName,String[][] expectedFileNames) { final List<VirtualFile> files = new ArrayList<>(shortFileName.length); for(String s: shortFileName) { if (FileUtilRt.getExtension(s).length() < 3) { s += ".xsd"; } files.add(getVirtualFile( getBasePath() + "/"+ s )); } int fileIndex = 0; for (int i = 0; i < expectedFileNames.length; i++) { String[] expectedFileNameArray = expectedFileNames[i]; Set<String> strings = FetchExtResourceAction.extractEmbeddedFileReferences( files.get(fileIndex), fileIndex != 0 ? files.get(0) : null, getPsiManager(), shortFileName[i]); assertEquals(expectedFileNameArray.length, strings.size()); int index = 0; for (final String string : strings) { assertEquals(expectedFileNameArray[index], string); ++index; } fileIndex++; } }
doExtractionOfEmbeddedFiles
300,966
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; }
getTestDataPath
300,967
String () { return "/quickFix/manuallySetupExternalResources"; }
getBasePath
300,968
void (@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) { findActionAndCheck(actionHint, testFullPath); }
doAction
300,969
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; }
getTestDataPath
300,970
String () { return "/codeInsight/daemonCodeAnalyzer/quickFix/createTypeElementAttributeEtcInSchema"; }
getBasePath
300,971
String () { return XmlTestUtil.getXmlTestDataPath(); }
getTestDataPath
300,972
String () { return "/codeInsight/daemonCodeAnalyzer/quickFix/renameToSimilarAttribute"; }
getBasePath
300,973
String () { return XmlTestUtil.getXmlTestDataPath(); }
getTestDataPath
300,974
String () { return "/quickFix/replaceTagEmptyBodyWithEmptyEnd"; }
getBasePath
300,975
String () { return XmlTestUtil.getXmlTestDataPath(); }
getTestDataPath
300,976
void () { final String url = "http://java.sun.com/dtd/preferences.dtd"; assertEquals(url, ExternalResourceManager.getInstance().getResourceLocation(url, getProject())); myFixture.configureByText(XmlFileType.INSTANCE, "<!DOCTYPE images SYSTEM \"http://java.sun.com/dtd/prefer<caret>ences.dtd\">"); invokeFetchIntention(url); String location = ExternalResourceManager.getInstance().getResourceLocation(url, getProject()); assertNotSame(url, location); assertTrue(location.endsWith("preferences.dtd")); // no ".xml" suffix added ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().removeResource(url)); }
testFetchDtd
300,977
void (String url) { IntentionAction intention = myFixture.getAvailableIntention(XmlBundle.message("xml.intention.fetch.name")); assertNotNull(intention); try { intention.invoke(getProject(), myFixture.getEditor(), myFixture.getFile()); } catch (Throwable e) { Throwable cause = ExceptionUtil.getRootCause(e); if (cause.getMessage().startsWith(XmlBundle.message("xml.intention.fetch.error.fetching.title")) || cause.getMessage().startsWith("Could not fetch")) { ExternalResourcesChecker.reportUnavailability(url, cause); } throw new RuntimeException(e); } }
invokeFetchIntention
300,978
void () { final String url = "https://community.rti.com/schema/6.0.0/rti_dds_qos_profiles.xsd"; assertEquals(url, ExternalResourceManager.getInstance().getResourceLocation(url, getProject())); myFixture.configureByText(XmlFileType.INSTANCE, """ <dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://community.rti.com/schema/6.0.0/rti_dds_qos_pr<caret>ofiles.xsd"> <qos_library name="MyLibrary"> <qos_profile name="MyProfile" base_name="BuiltinQosLib::Baseline.6.0.0"> </qos_profile> </qos_library> </dds>"""); invokeFetchIntention(url); myFixture.testHighlighting(); ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().removeResource(url)); }
testRelativePath
300,979
void () { final String url = "https://community.rti.com/schema/6.0.0/rti_dds_profiles.xsd"; assertEquals(url, ExternalResourceManager.getInstance().getResourceLocation(url, getProject())); myFixture.configureByText(XmlFileType.INSTANCE, """ <?xml version="1.0" encoding="UTF-8" ?> <dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://community.rti.com/schema/6.0.0/rti_dd<caret>s_profiles.xsd"> <types/> <domain_library name="xxx"/> <domain_participant_library name="ffff"/> </dds>"""); invokeFetchIntention(url); myFixture.testHighlighting(); XmlFile file = (XmlFile)myFixture.getFile(); XmlAttributeDescriptor descriptor = file.getRootTag().getSubTags()[1].getAttribute("name").getDescriptor(); PsiFile containingFile = descriptor.getDeclaration().getContainingFile(); assertNotNull(containingFile.getParent()); assertEquals("definitions", containingFile.getParent().getName()); ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().removeResource(url)); }
testNestedRelativePath
300,980
void () { String url = "https://csrc.nist.gov/schema/xccdf/1.2/xc<caret>cdf_1.2.xsd"; myFixture.configureByText(XmlFileType.INSTANCE, """ <Benchmark xmlns="http://checklists.nist.gov/xccdf/1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://checklists.nist.gov/xccdf/1.2 https://csrc.nist.gov/schema/xccdf/1.2/xc<caret>cdf_1.2.xsd" id="xccdf_N_benchmark_S"> </Benchmark>"""); invokeFetchIntention(url.replace("<caret>", "")); myFixture.testHighlighting(); ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().removeResource(url)); }
testAbsolutePath
300,981
String () { return "/quickFix/fetchExternalResources"; }
getBasePath
300,982
void (@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) { IntentionAction action = findActionAndCheck(actionHint, testFullPath); if (action != null && testName.equals("5.xml")) { final String uri = FetchExtResourceAction.findUri(getFile(), getEditor().getCaretModel().getOffset()); final String url = FetchExtResourceAction.findUrl(getFile(), getEditor().getCaretModel().getOffset(), uri); assertEquals("http://www.springframework.org/schema/aop/spring-aop.xsd",url); } }
doAction
300,983
String () { return XmlTestUtil.getXmlTestDataPath(); }
getTestDataPath
300,984
void () { PsiFile file = myFixture.configureByText(XmlFileType.INSTANCE, "<a> <caret> </a>"); assertTrue(new CollapseTagIntention().isAvailable(getProject(), myFixture.getEditor(), file)); }
testAvailable
300,985
void () { PsiFile file = myFixture.configureByText(XmlFileType.INSTANCE, "<a> <caret> <b/> </a>"); assertFalse(new CollapseTagIntention().isAvailable(getProject(), myFixture.getEditor(), file)); }
testNotAvailable
300,986
void () { PsiFile file = myFixture.configureByText(XmlFileType.INSTANCE, "<a/>"); assertFalse(new CollapseTagIntention().isAvailable(getProject(), myFixture.getEditor(), file)); }
testAlreadyCollapsed
300,987
void () { myFixture.enableInspections(new CheckTagEmptyBodyInspection()); PsiFile file = myFixture.configureByText(XmlFileType.INSTANCE, """ <a> <b><caret></b> </a>"""); assertTrue(new CollapseTagIntention().isAvailable(getProject(), myFixture.getEditor(), file)); IntentionAction action = myFixture.findSingleIntention("Collapse"); assertNotNull(action); WriteCommandAction.runWriteCommandAction(getProject(), () -> action.invoke(getProject(), myFixture.getEditor(), file)); myFixture.checkResult(""" <a> <b/> </a>"""); }
testCollapseInnerTag
300,988
void () { FileType[] MARKUP_FILE_TYPES = {XmlFileType.INSTANCE, HtmlFileType.INSTANCE, XHtmlFileType.INSTANCE}; mySettings.setDefaultRightMargin(60); for (FileType fileType : MARKUP_FILE_TYPES) { checkWrapOnTyping( fileType, "12345", "<my-tag-with-long-name attr='this.is.my.attribute.that.is.already.<caret>rather.long'>\n" + "</my-tag-with-long-name>", """ <my-tag-with-long-name\s attr='this.is.my.attribute.that.is.already.12345<caret>rather.long'> </my-tag-with-long-name>""" ); } }
testWrapInAttributeValue
300,989
void () { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()) .createFileFromText("a.xhtml", XHtmlFileType.INSTANCE, """ <a> <b/> </a>"""); XmlTag rootTag = file.getDocument().getRootTag(); XmlTag finalRootTag = rootTag; WriteCommandAction.runWriteCommandAction(null, () -> finalRootTag.getSubTags()[0].delete()); assertEquals(""" <a> </a>""", file.getText()); file = (XmlFile)PsiFileFactory.getInstance(getProject()) .createFileFromText("a.xhtml", XHtmlFileType.INSTANCE, "<html><body><div>text</div></body></html>"); rootTag = file.getDocument().getRootTag(); XmlTag finalRootTag1 = rootTag; WriteCommandAction.runWriteCommandAction(null, () -> { finalRootTag1.getSubTags()[0].getSubTags()[0].setAttribute("a", ""); }); assertEquals("<html><body><div a=\"\">text</div></body></html>", file.getText()); }
testXHTML
300,990
void () { XmlTag tag = XmlElementFactory.getInstance(getProject()) .createTagFromText(""" <fabrique-element element="wpd" name="Index"> <wpd/> </fabrique-element>"""); tag.add(tag.createChildTag("layout", "", """ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <fabrique:inheritorLayout/>""", false)); }
testAddLayoutSubTag
300,991
void () { Project ideaProject = getProject(); PsiManager psiManager = PsiManager.getInstance(ideaProject); XmlFile fileFromText = (XmlFile)PsiFileFactory.getInstance(psiManager.getProject()) .createFileFromText("sample.xhtml", XHtmlFileType.INSTANCE, "<html><body><p/></body></html>", LocalTimeCounter.currentTime(), true); XmlTag htmlTag = fileFromText.getDocument().getRootTag(); XmlTag bodyTag = htmlTag.getSubTags()[0]; XmlTag tagP = bodyTag.getSubTags()[0]; //do not remove: to hold the reference //noinspection unused Document document = PsiDocumentManager.getInstance(ideaProject).getDocument(htmlTag.getContainingFile()); execute(() -> CodeStyleManager.getInstance(ideaProject).performActionWithFormatterDisabled((Runnable)() -> { try { XmlTag childTag = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText("<p/>"); bodyTag.addAfter(childTag, tagP); } catch (IncorrectOperationException ignored) { } })); assertEquals("<html><body><p/><p/></body></html>", htmlTag.getText()); }
testAddTag
300,992
void (Runnable runnable) { ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance() .executeCommand(getProject(), runnable, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION)); }
execute
300,993
void () { XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>a <b>123 <z/> ff</b> c</a>"); XmlTag bTag = aTag.findFirstSubTag("b"); CodeStyle.getSettings(getProject()).getCustomSettings(XmlCodeStyleSettings.class).XML_KEEP_WHITESPACES = true; XmlTagChild[] valueChildren = bTag.getValue().getChildren(); aTag.addRangeBefore(valueChildren[0], valueChildren[valueChildren.length - 1], bTag); WriteCommandAction.runWriteCommandAction(null, () -> bTag.delete()); assertEquals("<a>a 123 <z/> ff c</a>", aTag.getText()); }
testKuralenok_DeleteTagKeepingContent
300,994
void () { String html = "<html><head /><body><hr /></body>\n</html>"; XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("a.html", HtmlFileType.INSTANCE, html); XmlTag body = file.getDocument().getRootTag().findFirstSubTag("body"); XmlTag hr = body.getSubTags()[0]; XmlText text = XmlElementFactory.getInstance(getProject()).createDisplayText("p"); PsiElement element = body.addAfter(text, hr); assertEquals(body, element.getParent()); }
testSCR1542
300,995
void () { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("a.xhtml", XHtmlFileType.INSTANCE, """ <html> <body xmlns:fabrique="https://www.jetbrains.com/schemas/fabrique/page-template"><p> ujhgjhgjhg<table style="width: 82px; height: 84px"><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></table> jhgjhgjhgjhgjhg</p> </body> </html>"""); XmlTag html = file.getDocument().getRootTag(); XmlTag table = html.findFirstSubTag("body").findFirstSubTag("p").findFirstSubTag("table"); assertEquals("table", table.getName()); WriteCommandAction.runWriteCommandAction(null, () -> table.delete()); assertEquals(""" <html> <body xmlns:fabrique="https://www.jetbrains.com/schemas/fabrique/page-template"><p> ujhgjhgjhg jhgjhgjhgjhgjhg</p> </body> </html>""", file.getText()); }
testDeleteTable
300,996
void () { String html = """ <html> <head /> <body xmlns:fabrique="https://www.jetbrains.com/schemas/fabrique/page-template"> <div style="border: 1px solid green; margin: 2px; padding: 2px;"><p><span style="color: red"><span style="font-size: 15pt">12345678</span></span></p></div> </body> </html>"""; XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("a.xhtml", XHtmlFileType.INSTANCE, html); XmlTag body = file.getDocument().getRootTag().findFirstSubTag("body"); XmlTag span = body.findFirstSubTag("div").findFirstSubTag("p").findFirstSubTag("span").findFirstSubTag("span"); String text = "<span\n style=\"font-size:15pt\">1234</span>"; XmlTag[] tag = {XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText(text)}; WriteCommandAction.runWriteCommandAction(null, () -> { tag[0] = (XmlTag)span.replace(tag[0]); }); assertEquals(text, tag[0].getText()); }
testReplaceTag
300,997
void () { PsiFile file = myFixture.configureByText(XmlFileType.INSTANCE, "<!-- foo -->"); XmlComment element = (XmlComment)file.findElementAt(0).getParent(); assertEquals(" foo ", element.getCommentText()); }
testXmlComment
300,998
XmlFile (@NonNls final String xml) { return (XmlFile)createLightFile("a.xml", XmlFileType.INSTANCE, xml); }
createXmlFile
300,999
PsiFile (final String fileName, final FileType fileType, final String text) { return PsiFileFactory.getInstance(getProject()).createFileFromText(fileName, fileType, text); }
createLightFile