Skip to content

[#1070] downgrading SnakeYaml to 1.31 #1071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Downgrade SnakeYaml to 1.31 [#1070]

## [1.9.1] - 2022-10-28

Expand Down
2 changes: 1 addition & 1 deletion robot-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.32</version>
<version>1.31</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package org.obolibrary.robot;

import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import org.yaml.snakeyaml.error.YAMLException;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;

/** Tests for the ReportOperation. */
public class ReportOperationTest extends CoreTest {

private static final String oboInOwl = "http://www.geneontology.org/formats/oboInOwl#";
private static final String obo = "http://purl.obolibrary.org/obo/";

/** Test report produces correct JSON. */
@Test
public void testReportProducesValidJson() throws Exception {
Expand Down Expand Up @@ -45,4 +53,40 @@ private void testReportProducesCorrectOutput(String extension) throws Exception
Assert.fail();
}
}

private OWLOntology generateOntologyWithLotsOfViolations() throws OWLOntologyCreationException {
final OWLOntologyManager m = OWLManager.createOWLOntologyManager();
final OWLDataFactory f = m.getOWLDataFactory();
final OWLOntology o = m.createOntology(IRI.create(URI.create("https://example.org/o")));

final OWLAnnotationProperty pLabel = f.getRDFSLabel();
final OWLAnnotationProperty pHasExactSynonym = f.getOWLAnnotationProperty(IRI.create(oboInOwl + "hasExactSynonym"));
final OWLAnnotationProperty pHasRelatedSynonym = f.getOWLAnnotationProperty(IRI.create(oboInOwl + "hasRelatedSynonym"));
final OWLAnnotationProperty pIAO_0000115 = f.getOWLAnnotationProperty(IRI.create(obo + "IAO_0000115"));

for (int i = 0; i < 5000; i++) {
final IRI iriC = IRI.create("https://example.org/o/a" + i);
m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pLabel, iriC, f.getOWLLiteral(" X\tX")));
m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pLabel, iriC, f.getOWLLiteral("obsolete X\tX")));
m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pHasExactSynonym, iriC, f.getOWLLiteral(" X\tX")));
m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pHasRelatedSynonym, iriC, f.getOWLLiteral(" X\tX")));
m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pIAO_0000115, iriC, f.getOWLLiteral("x")));
}
return o;
}

// disabling, as the test takes a few minutes to run
// @Test
public void testReportProducesCorrectOutput() throws Exception {
try {
final IOHelper iohelper = new IOHelper();
final File outputFile =
File.createTempFile("1070-codepoint-defaults-output", ".json");
final OWLOntology o = generateOntologyWithLotsOfViolations();
ReportOperation.report(o, iohelper, outputFile.toString(), Collections.emptyMap());
} catch (YAMLException e) {
e.printStackTrace();
Assert.fail();
}
}
}