-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XMLDocumentTest to test performance (see #48)
- Loading branch information
1 parent
b0389c6
commit e092e44
Showing
2 changed files
with
15,198 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
org.eclipse.lsp4xml/src/test/java/org/eclipse/lsp4xml/internal/parser/XMLDocumentTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.eclipse.lsp4xml.internal.parser; | ||
|
||
import java.io.InputStream; | ||
|
||
import org.eclipse.lsp4xml.commons.TextDocument; | ||
import org.eclipse.lsp4xml.model.XMLDocument; | ||
import org.junit.Test; | ||
|
||
public class XMLDocumentTest { | ||
|
||
@Test | ||
public void testLargeFile() { | ||
InputStream in = XMLDocumentTest.class.getResourceAsStream("/xml/largeFile.xml"); | ||
String text = convertStreamToString(in); | ||
TextDocument document = new TextDocument(text, "largeFile.xml"); | ||
long start = System.currentTimeMillis(); | ||
XMLDocument xmlDocument = XMLParser.getInstance().parse(document); | ||
System.err.println("Parsed in " + (System.currentTimeMillis() - start) + " ms."); | ||
} | ||
|
||
static String convertStreamToString(InputStream is) { | ||
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); | ||
return s.hasNext() ? s.next() : ""; | ||
} | ||
} |
Oops, something went wrong.