|
| 1 | +/** |
| 2 | + * |
| 3 | + */ |
| 4 | +package com.github.jsonldjava.core; |
| 5 | + |
| 6 | +import static org.junit.Assert.*; |
| 7 | + |
| 8 | +import java.io.File; |
| 9 | +import java.io.FileInputStream; |
| 10 | +import java.io.FileNotFoundException; |
| 11 | +import java.io.FileReader; |
| 12 | +import java.io.IOException; |
| 13 | +import java.util.zip.GZIPInputStream; |
| 14 | + |
| 15 | +import org.junit.After; |
| 16 | +import org.junit.Before; |
| 17 | +import org.junit.Ignore; |
| 18 | +import org.junit.Test; |
| 19 | + |
| 20 | +import com.github.jsonldjava.utils.JsonUtils; |
| 21 | + |
| 22 | +/** |
| 23 | + * |
| 24 | + * @author Peter Ansell p_ansell@yahoo.com |
| 25 | + */ |
| 26 | +public class JsonLdPerformanceTest { |
| 27 | + |
| 28 | + /** |
| 29 | + * Test performance parsing using test data from: |
| 30 | + * |
| 31 | + * https://dl.dropboxusercontent.com/s/yha7x0paj8zvvz5/2000007922.jsonld.gz |
| 32 | + * |
| 33 | + * @throws Exception |
| 34 | + */ |
| 35 | + @Ignore("Enable as necessary for manual testing, particularly to test that it fails due to irregular URIs") |
| 36 | + @Test |
| 37 | + public final void test() throws Exception { |
| 38 | + long parseStart = System.currentTimeMillis(); |
| 39 | + Object inputObject = JsonUtils.fromInputStream(new GZIPInputStream(new FileInputStream( |
| 40 | + new File("/home/ans025/Downloads/2000007922.jsonld.gz")))); |
| 41 | + long parseEnd = System.currentTimeMillis(); |
| 42 | + System.out.printf("Parse time: %d", (parseEnd - parseStart)); |
| 43 | + JsonLdOptions opts = new JsonLdOptions("urn:test:"); |
| 44 | + |
| 45 | + long compactStart = System.currentTimeMillis(); |
| 46 | + JsonLdProcessor.compact(inputObject, null, opts); |
| 47 | + long compactEnd = System.currentTimeMillis(); |
| 48 | + System.out.printf("Compaction time: %d", (compactEnd - compactStart)); |
| 49 | + } |
| 50 | + |
| 51 | +} |
0 commit comments