mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+6
-12
@@ -23,7 +23,6 @@ import org.jetbrains.jps.model.artifact.JpsArtifactService;
|
||||
import org.jetbrains.jps.model.serialization.artifact.JpsArtifactSerializer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -53,17 +52,12 @@ public class JpsArtifactSerializationTest extends JpsSerializationTestCase {
|
||||
}
|
||||
|
||||
private void doTestSaveArtifact(JpsArtifact artifact, File expectedFile) {
|
||||
try {
|
||||
Element actual = new Element("component").setAttribute("name", "ArtifactManager");
|
||||
JpsArtifactSerializer.saveArtifact(artifact, actual);
|
||||
JpsMacroExpander
|
||||
expander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH)));
|
||||
Element expected = JpsLoaderBase.loadRootElement(expectedFile, expander);
|
||||
PlatformTestUtil.assertElementsEqual(expected, actual);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Element actual = new Element("component").setAttribute("name", "ArtifactManager");
|
||||
JpsArtifactSerializer.saveArtifact(artifact, actual);
|
||||
JpsMacroExpander
|
||||
expander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH)));
|
||||
Element expected = JpsLoaderBase.loadRootElement(expectedFile, expander);
|
||||
PlatformTestUtil.assertElementsEqual(expected, actual);
|
||||
}
|
||||
|
||||
private static JpsArtifactService getService() {
|
||||
|
||||
+4
-9
@@ -80,15 +80,10 @@ public class JpsGlobalSerializationTest extends JpsSerializationTestCase {
|
||||
}
|
||||
|
||||
private void assertOptionsFilesEqual(File originalOptionsDir, File targetOptionsDir, final String fileName) {
|
||||
try {
|
||||
JpsMacroExpander expander = new JpsMacroExpander(getPathVariables());
|
||||
Element expected = JpsLoaderBase.loadRootElement(new File(originalOptionsDir, fileName), expander);
|
||||
Element actual = JpsLoaderBase.loadRootElement(new File(targetOptionsDir, fileName), expander);
|
||||
PlatformTestUtil.assertElementsEqual(expected, actual);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
JpsMacroExpander expander = new JpsMacroExpander(getPathVariables());
|
||||
Element expected = JpsLoaderBase.loadRootElement(new File(originalOptionsDir, fileName), expander);
|
||||
Element actual = JpsLoaderBase.loadRootElement(new File(targetOptionsDir, fileName), expander);
|
||||
PlatformTestUtil.assertElementsEqual(expected, actual);
|
||||
}
|
||||
|
||||
public void testLoadEncoding() {
|
||||
|
||||
+7
-13
@@ -32,7 +32,6 @@ import org.jetbrains.jps.model.serialization.library.JpsLibraryTableSerializer;
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModuleRootModelSerializer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -215,18 +214,13 @@ public class JpsProjectSerializationTest extends JpsSerializationTestCase {
|
||||
}
|
||||
|
||||
private void doTestSaveLibrary(File libFile, String libName, JpsLibrary library) {
|
||||
try {
|
||||
Element actual = new Element("library");
|
||||
JpsLibraryTableSerializer.saveLibrary(library, actual, libName);
|
||||
JpsMacroExpander
|
||||
macroExpander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), getFileInSampleProject(""));
|
||||
Element rootElement = JpsLoaderBase.loadRootElement(libFile, macroExpander);
|
||||
Element expected = rootElement.getChild("library");
|
||||
PlatformTestUtil.assertElementsEqual(expected, actual);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Element actual = new Element("library");
|
||||
JpsLibraryTableSerializer.saveLibrary(library, actual, libName);
|
||||
JpsMacroExpander
|
||||
macroExpander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), getFileInSampleProject(""));
|
||||
Element rootElement = JpsLoaderBase.loadRootElement(libFile, macroExpander);
|
||||
Element expected = rootElement.getChild("library");
|
||||
PlatformTestUtil.assertElementsEqual(expected, actual);
|
||||
}
|
||||
|
||||
private void doTestSaveModule(JpsModule module, final String moduleFilePath) {
|
||||
|
||||
+3
-2
@@ -33,8 +33,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class LibraryDependentToolWindowManager extends AbstractProjectComponent {
|
||||
private final ToolWindowManagerEx myToolWindowManager;
|
||||
|
||||
protected LibraryDependentToolWindowManager(Project project,
|
||||
ToolWindowManagerEx toolWindowManager) {
|
||||
protected LibraryDependentToolWindowManager(Project project, ToolWindowManagerEx toolWindowManager) {
|
||||
super(project);
|
||||
myToolWindowManager = toolWindowManager;
|
||||
}
|
||||
@@ -42,6 +41,7 @@ public class LibraryDependentToolWindowManager extends AbstractProjectComponent
|
||||
@Override
|
||||
public void projectOpened() {
|
||||
final ModuleRootListener rootListener = new ModuleRootListener() {
|
||||
@Override
|
||||
public void rootsChanged(ModuleRootEvent event) {
|
||||
if (!myProject.isDisposed()) {
|
||||
checkToolWindowStatuses(myProject);
|
||||
@@ -62,6 +62,7 @@ public class LibraryDependentToolWindowManager extends AbstractProjectComponent
|
||||
assert !project.isDisposed();
|
||||
|
||||
DumbService.getInstance(project).smartInvokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (LibraryDependentToolWindow libraryToolWindow : Extensions.getExtensions(LibraryDependentToolWindow.EXTENSION_POINT_NAME)) {
|
||||
boolean exists;
|
||||
|
||||
@@ -132,12 +132,7 @@ public class PlatformTestUtil {
|
||||
public static <T> void registerExtension(@NotNull ExtensionsArea area, @NotNull ExtensionPointName<T> name, @NotNull final T t, @NotNull Disposable parentDisposable) {
|
||||
final ExtensionPoint<T> extensionPoint = area.getExtensionPoint(name.getName());
|
||||
extensionPoint.registerExtension(t);
|
||||
Disposer.register(parentDisposable, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
extensionPoint.unregisterExtension(t);
|
||||
}
|
||||
});
|
||||
Disposer.register(parentDisposable, () -> extensionPoint.unregisterExtension(t));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -334,6 +329,7 @@ public class PlatformTestUtil {
|
||||
|
||||
@TestOnly
|
||||
public static AWTEvent dispatchNextEventIfAny(@NotNull IdeEventQueue eventQueue) throws InterruptedException {
|
||||
assert SwingUtilities.isEventDispatchThread() : Thread.currentThread();
|
||||
AWTEvent event = eventQueue.peekEvent();
|
||||
if (event == null) return null;
|
||||
AWTEvent event1 = eventQueue.getNextEvent();
|
||||
@@ -824,21 +820,13 @@ public class PlatformTestUtil {
|
||||
final File tempDirectory1;
|
||||
final File tempDirectory2;
|
||||
|
||||
final JarFile jarFile1 = new JarFile(file1);
|
||||
try {
|
||||
final JarFile jarFile2 = new JarFile(file2);
|
||||
try {
|
||||
try (JarFile jarFile1 = new JarFile(file1)) {
|
||||
try (JarFile jarFile2 = new JarFile(file2)) {
|
||||
tempDirectory1 = PlatformTestCase.createTempDir("tmp1");
|
||||
tempDirectory2 = PlatformTestCase.createTempDir("tmp2");
|
||||
ZipUtil.extract(jarFile1, tempDirectory1, null);
|
||||
ZipUtil.extract(jarFile2, tempDirectory2, null);
|
||||
}
|
||||
finally {
|
||||
jarFile2.close();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
jarFile1.close();
|
||||
}
|
||||
|
||||
final VirtualFile dirAfter = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDirectory1);
|
||||
@@ -852,7 +840,7 @@ public class PlatformTestUtil {
|
||||
assertDirectoriesEqual(dirAfter, dirBefore);
|
||||
}
|
||||
|
||||
public static void assertElementsEqual(final Element expected, final Element actual) throws IOException {
|
||||
public static void assertElementsEqual(final Element expected, final Element actual) {
|
||||
if (!JDOMUtil.areElementsEqual(expected, actual)) {
|
||||
Assert.assertEquals(JDOMUtil.writeElement(expected), JDOMUtil.writeElement(actual));
|
||||
}
|
||||
@@ -937,7 +925,7 @@ public class PlatformTestUtil {
|
||||
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
|
||||
private static final OutputStream NULL = new OutputStream() {
|
||||
@Override
|
||||
public void write(int b) throws IOException { }
|
||||
public void write(int b) { }
|
||||
};
|
||||
|
||||
public static void assertSuccessful(@NotNull GeneralCommandLine command) {
|
||||
|
||||
Reference in New Issue
Block a user