Skip to content

Commit

Permalink
Reactivated all tests. Fixed Codacy issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelRoeder committed Aug 25, 2023
1 parent 0c53058 commit 84de9c8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.dice_research.enexa.vocab.IANAMediaType;
import org.dice_research.rdf.RdfHelper;
import org.dice_research.sparql.SparqlQueryUtils;
import org.semanticweb.owlapi.formats.OWLXMLDocumentFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -134,6 +133,8 @@ public static void main(String[] args) {
* @param targetMediaResource
* @return
*/
@SuppressWarnings("unused")
@Deprecated
private static Lang getOutputLang(Resource targetMediaResource) {
Lang outputLang = IANAMediaType.resource2Lang(targetMediaResource);
// If this is one of the languages we can handle...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
package org.dice_research.enexa.transform;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Random;

import javax.annotation.CheckForNull;

import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import org.apache.commons.io.IOUtils;
import org.apache.jena.atlas.web.ContentType;
import org.apache.jena.atlas.web.TypedInputStream;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFLanguages;
import org.apache.jena.riot.RDFParser;
import org.apache.jena.riot.WebContent;
import org.apache.jena.riot.system.StreamRDF;
import org.apache.jena.riot.system.StreamRDFWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public AbstractTransformatorTest(Model expectedModel, String outputFormatIri, Mo
this.inputFormatIris = inputFormatIris;
this.inputLangs = new Lang[inputFormatIris.length];
// Print information about this test
System.out.println("Test output format: " + IANAMediaType.iri2ContentType(outputFormatIri.toString()));
System.out.println("Test output format: " + IANAMediaType.iri2ContentType(outputFormatIri));
System.out.print(" input formats: ");
for (int i = 0; i < inputFormatIris.length; ++i) {
inputLangs[i] = IANAMediaType.iri2Lang(inputFormatIris[i]);
Expand All @@ -59,35 +59,35 @@ public AbstractTransformatorTest(Model expectedModel, String outputFormatIri, Mo
}
}

// @Test
// public void testCompInFileExt() {
// try {
// createFilesAndTest(true, true);
// } catch (Exception e) {
// e.printStackTrace();
// Assert.fail();
// }
// }
//
// @Test
// public void testFileExt() {
// try {
// createFilesAndTest(true, false);
// } catch (Exception e) {
// e.printStackTrace();
// Assert.fail();
// }
// }
//
// @Test
// public void testCompIn() {
// try {
// createFilesAndTest(false, true);
// } catch (Exception e) {
// e.printStackTrace();
// Assert.fail();
// }
// }
@Test
public void testCompInFileExt() {
try {
createFilesAndTest(true, true);
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}

@Test
public void testFileExt() {
try {
createFilesAndTest(true, false);
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}

@Test
public void testCompIn() {
try {
createFilesAndTest(false, true);
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}

@Test
public void test() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
Expand All @@ -51,7 +50,6 @@ public RDF2OntologyTransformatorTest(Model expectedModel, String outputFormatIri

@Override
protected void compareModels(InputStream is, String outputFormatIri, Model expectedModel) {
// String contentType = IANAMediaType.iri2ContentType(outputFormatIri);
try {
File expectedFile = File.createTempFile("test-expected-result-", ".nt");
try (Writer writer = new FileWriter(expectedFile, StandardCharsets.UTF_8)) {
Expand All @@ -71,12 +69,10 @@ protected void compareModels(InputStream is, String outputFormatIri, Model expec
OWLOntology readOnt = manager.loadOntologyFromOntologyDocument(is);

for (OWLAxiom a : expectedOntology.getAxioms()) {
System.out.println(a);
Assert.assertTrue("Read ontology does not contain the expected axiom " + a.toString(),
readOnt.containsAxiom(a));
}
for (OWLAxiom a : readOnt.getAxioms()) {
System.out.println(a);
Assert.assertTrue("Read ontology contains the additional axiom " + a.toString(),
expectedOntology.containsAxiom(a));
}
Expand Down

0 comments on commit 84de9c8

Please sign in to comment.