mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
MicrodataCompletionTest and RealFetchTest must remove added resources
This commit is contained in:
@@ -1,24 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.ide.highlighter.XmlFileType;
|
||||
import com.intellij.javaee.ExternalResourceManager;
|
||||
import com.intellij.javaee.ExternalResourceManagerExImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
@@ -30,7 +17,6 @@ import java.util.List;
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class RealFetchTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
|
||||
public void testFetchDtd() {
|
||||
|
||||
final String url = "http://java.sun.com/dtd/preferences.dtd";
|
||||
@@ -47,7 +33,7 @@ public class RealFetchTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
|
||||
final String url = "http://java.sun.com/dtd/preferences.dtd";
|
||||
VirtualFile virtualFile = myFixture.getTempDirFixture().createFile("images.dtd", "");
|
||||
ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource(url, virtualFile.getPath()));
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily(url, virtualFile.getPath(), getTestRootDisposable());
|
||||
|
||||
myFixture.configureByText(XmlFileType.INSTANCE, "<!DOCTYPE images SYSTEM \"<error descr=\"Resource registered by this uri is not recognized (Settings | Languages & Frameworks | Schemas and DTDs)\">http://java.sun.com/dtd/prefer<caret>ences.dtd</error>\"><images> </images>");
|
||||
myFixture.testHighlighting();
|
||||
|
||||
@@ -1,23 +1,8 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.html;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.javaee.ExternalResourceManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.javaee.ExternalResourceManagerExImpl;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
|
||||
@@ -108,7 +93,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase {
|
||||
|
||||
public void testPropValue() {
|
||||
final VirtualFile virtualFile = myFixture.copyFileToProject("Person.html");
|
||||
ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", virtualFile.getPath()));
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", virtualFile.getPath(), getTestRootDisposable());
|
||||
doTestInHtml("<section itemscope itemtype=\"http://data-vocabulary.org/Person\"><div itemprop=\"<caret>\"></div></section>",
|
||||
"name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address"
|
||||
);
|
||||
@@ -116,7 +101,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase {
|
||||
|
||||
public void testPropValueSchemaOrgFormat() {
|
||||
final VirtualFile virtualFile = myFixture.copyFileToProject("Product.html");
|
||||
ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource("http://schema.org/Product", virtualFile.getPath()));
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://schema.org/Product", virtualFile.getPath(), getTestRootDisposable());
|
||||
doTestInHtml("<section itemscope itemtype=\"http://schema.org/Product\"><div itemprop=\"<caret>\"></div></section>",
|
||||
"additionalType",
|
||||
"aggregateRating",
|
||||
@@ -153,7 +138,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase {
|
||||
|
||||
public void testPropValueSchemaOrgFormatWithLinks() {
|
||||
final VirtualFile virtualFile = myFixture.copyFileToProject("Rating.html");
|
||||
ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource("http://schema.org/Rating", virtualFile.getPath()));
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://schema.org/Rating", virtualFile.getPath(), getTestRootDisposable());
|
||||
doTestInHtml("<section itemscope itemtype=\"http://schema.org/Rating\"><div itemprop=\"<caret>\"></div></section>",
|
||||
"alternateName",
|
||||
"bestRating",
|
||||
@@ -172,10 +157,8 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase {
|
||||
public void testPropValueFromTwoTypes() {
|
||||
final VirtualFile personFile = myFixture.copyFileToProject("Person.html");
|
||||
final VirtualFile addressFile = myFixture.copyFileToProject("Address.html");
|
||||
ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", personFile.getPath());
|
||||
ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Address", addressFile.getPath());
|
||||
});
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", personFile.getPath(), getTestRootDisposable());
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Address", addressFile.getPath(), getTestRootDisposable());
|
||||
doTestInHtml(
|
||||
"<section itemscope itemtype=\"http://data-vocabulary.org/Person http://data-vocabulary.org/Address\"><div itemprop=\"<caret>\"></div></section>",
|
||||
"name", "nickname", "photo", "title", "role", "url", "affiliation", "friend", "acquaintance", "address",
|
||||
@@ -185,7 +168,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase {
|
||||
|
||||
public void testPropValueFromRef() {
|
||||
final VirtualFile virtualFile = myFixture.copyFileToProject("Person.html");
|
||||
ApplicationManager.getApplication().runWriteAction(() -> ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", virtualFile.getPath()));
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", virtualFile.getPath(), getTestRootDisposable());
|
||||
doTestInHtml("<body>" +
|
||||
"<section itemscope itemtype=\"http://data-vocabulary.org/Person\" itemref=\"foo\"></section>" +
|
||||
"<section id=\"foo\"><div itemprop=\"<caret>\"></div></section>" +
|
||||
@@ -197,10 +180,8 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase {
|
||||
public void testPropValueNestedScopes() {
|
||||
final VirtualFile personFile = myFixture.copyFileToProject("Person.html");
|
||||
final VirtualFile addressFile = myFixture.copyFileToProject("Address.html");
|
||||
ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", personFile.getPath());
|
||||
ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Address", addressFile.getPath());
|
||||
});
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", personFile.getPath(), getTestRootDisposable());
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Address", addressFile.getPath(), getTestRootDisposable());
|
||||
doTestInHtml("<div itemscope itemtype=\"http://data-vocabulary.org/Person\">\n" +
|
||||
" My name is <span itemprop=\"name\">Smith</span>\n" +
|
||||
" <span itemprop=\"<caret>\" itemscope itemtype=\"http://data-vocabulary.org/Address\">\n" +
|
||||
@@ -215,10 +196,8 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase {
|
||||
public void testPropValueNestedScopesDifferentTrees() {
|
||||
final VirtualFile personFile = myFixture.copyFileToProject("Person.html");
|
||||
final VirtualFile addressFile = myFixture.copyFileToProject("Address.html");
|
||||
ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Person", personFile.getPath());
|
||||
ExternalResourceManager.getInstance().addResource("http://data-vocabulary.org/Address", addressFile.getPath());
|
||||
});
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Person", personFile.getPath(), getTestRootDisposable());
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily("http://data-vocabulary.org/Address", addressFile.getPath(), getTestRootDisposable());
|
||||
doTestInHtml("<div itemscope itemtype=\"http://data-vocabulary.org/Person\" >\n" +
|
||||
" name is <span itemprop=\"name\">ann</span>\n" +
|
||||
" role is <span itemprop=\"role\">smth</span>\n" +
|
||||
|
||||
Reference in New Issue
Block a user