Skip to content

Commit

Permalink
Merge pull request #39 from xlalik/main
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrSojka authored Jun 16, 2022
2 parents b850d54 + 51ae3be commit adc6fa9
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 59 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ mathml-canonicalizer.iml
/.settings/
/.classpath
/.project
/.vs/
38 changes: 19 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacs</id>
Expand All @@ -87,7 +87,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -97,15 +97,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand All @@ -130,7 +130,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -143,7 +143,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.4.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -156,13 +156,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<version>3.0.0</version>
</plugin>
<!-- Download Java source and javadoc JARs. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<version>3.3.0</version>
<executions>
<execution>
<goals>
Expand All @@ -183,7 +183,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<version>3.0.0-M5</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
Expand All @@ -194,33 +194,33 @@
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6</version>
<version>2.0.6.1</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.4</version>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.6</version>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-legacy</artifactId>
<version>2.9.0</version>
</dependency>
<!-- TEST DEPENDENCIES -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package cz.muni.fi.mir.mathmlcanonicalization;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand All @@ -28,8 +28,8 @@

import org.apache.commons.io.output.ByteArrayOutputStream;
import org.jdom2.JDOMException;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import cz.muni.fi.mir.mathmlcanonicalization.modules.ModuleException;
import cz.muni.fi.mir.mathmlcanonicalization.modules.ModuleTestResources;
Expand Down Expand Up @@ -79,7 +79,7 @@ public void shouldCreateDefaultCanonicalizer() throws Exception {
}
}

@Ignore
@Disabled
@Test
public void stressTest() throws Exception {
long start = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;
import org.jdom2.output.XMLOutputter;
import org.junit.*;
import org.junit.jupiter.api.*;
import org.xml.sax.SAXException;

/**
Expand All @@ -38,7 +38,7 @@
*
* @author David Formanek
*/
@Ignore // no tests
@Disabled // no tests
abstract class AbstractModuleTest {

private static final Logger LOGGER = Logger.getLogger(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package cz.muni.fi.mir.mathmlcanonicalization.modules;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/**
* Test for ElementMinimizer canonicalization stream module
Expand All @@ -28,8 +28,8 @@ public class ElementMinimizerTest extends AbstractModuleTest {
private static final Module DEFAULT_INSTANCE = new ElementMinimizer();
private static final String RESOURCE_SUBDIR = ElementMinimizerTest.class.getSimpleName() + "/";

@BeforeClass
public static void setUpBeforeClass() {
@BeforeAll
public static void setUpBeforeAll() {
DEFAULT_INSTANCE.setProperty("remove", "mspace maligngroup malignmark mstyle mpadded menclose maction");
DEFAULT_INSTANCE.setProperty("remove_all", "mphantom merror");
DEFAULT_INSTANCE.setProperty("keepAttributes", "mathvariant=bold encoding");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package cz.muni.fi.mir.mathmlcanonicalization.modules;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/**
* Test for FunctionNormalizer canonicalization DOM Module.
Expand All @@ -28,8 +28,8 @@ public class FunctionNormalizerTest extends AbstractModuleTest {
private static final Module DEFAULT_INSTANCE = new FunctionNormalizer();
private static final String RESOURCE_SUBDIR = FunctionNormalizerTest.class.getSimpleName() + "/";

@BeforeClass
public static void setUpBeforeClass() {
@BeforeAll
public static void setUpBeforeAll() {
DEFAULT_INSTANCE.setProperty("functionoperators", "\u2061");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package cz.muni.fi.mir.mathmlcanonicalization.modules;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/**
* Test for MfencedReplacer canonicalization DOM Module.
Expand All @@ -41,8 +41,8 @@ public MfencedReplacerTest() {
CONFIGURED_INSTANCE.setProperty("outermrow", "0");
}

@BeforeClass
public static void setUpBeforeClass() {
@BeforeAll
public static void setUpBeforeAll() {
DEFAULT_INSTANCE.setProperty("outermrow", "1");
DEFAULT_INSTANCE.setProperty("innermrow", "1");
DEFAULT_INSTANCE.setProperty("open", "(");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package cz.muni.fi.mir.mathmlcanonicalization.modules;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/**
* Test for MrowNormalizer canonicalization DOM Module.
Expand All @@ -36,8 +36,8 @@ public MrowNormalizerTest() {
CONFIGURED_INSTANCE.setProperty("wrapOutside", "1");
}

@BeforeClass
public static void setUpBeforeClass() {
@BeforeAll
public static void setUpBeforeAll() {
DEFAULT_INSTANCE.setProperty("wrapOutside", "1");
DEFAULT_INSTANCE.setProperty("wrapInside", "1");
DEFAULT_INSTANCE.setProperty("open", "( [ {");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package cz.muni.fi.mir.mathmlcanonicalization.modules;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/**
* Test for OperatorNormalizer canonicalization DOM Module.
Expand All @@ -28,8 +28,8 @@ public class OperatorNormalizerTest extends AbstractModuleTest {
private static final Module DEFAULT_INSTANCE = new OperatorNormalizer();
private static final String RESOURCE_SUBDIR = OperatorNormalizerTest.class.getSimpleName() + "/";

@BeforeClass
public static void setUpBeforeClass() {
@BeforeAll
public static void setUpBeforeAll() {
DEFAULT_INSTANCE.setProperty("removeempty", "true");
DEFAULT_INSTANCE.setProperty("removeoperators", "\u2062 \u22c5 * \u2063 \u2064");
DEFAULT_INSTANCE.setProperty("replaceoperators", "+-:\u00b1 -+:\u00b1 \u00ad:-");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package cz.muni.fi.mir.mathmlcanonicalization.modules;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/**
* Test for ScriptNormalizer canonicalization DOM Module.
Expand All @@ -28,8 +28,8 @@ public class ScriptNormalizerTest extends AbstractModuleTest {
private static final Module DEFAULT_INSTANCE = new ScriptNormalizer();
private static final String RESOURCE_SUBDIR = ScriptNormalizerTest.class.getSimpleName() + "/";

@BeforeClass
public static void setUpBeforeClass() {
@BeforeAll
public static void setUpBeforeAll() {
DEFAULT_INSTANCE.setProperty("swapscripts", "true");
DEFAULT_INSTANCE.setProperty("splitscriptselements", "mi");
DEFAULT_INSTANCE.setProperty("unifyscripts", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package cz.muni.fi.mir.mathmlcanonicalization.modules;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

/**
* Test for UnaryOperatorRemover canonicalization DOM Module.
Expand All @@ -28,8 +28,8 @@ public class UnaryOperatorRemoverTest extends AbstractModuleTest {
private static final Module DEFAULT_INSTANCE = new UnaryOperatorRemover();
private static final String RESOURCE_SUBDIR = UnaryOperatorRemoverTest.class.getSimpleName() + "/";

@BeforeClass
public static void setUpBeforeClass() {
@BeforeAll
public static void setUpBeforeAll() {
DEFAULT_INSTANCE.setProperty("pmathremoveunaryoperators", "+ - \u2064 \u2212 \u2213 \u2214 \u2238 \u2295 \u2296 \u229d \u229e \u229f");
DEFAULT_INSTANCE.setProperty("cmathremoveunaryoperators", "plus minus");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import org.apache.commons.io.IOUtils;
import org.custommonkey.xmlunit.XMLTestCase;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

/**
*
Expand Down Expand Up @@ -58,7 +58,7 @@ public void testInjectXHTMLPlusMathMLPlusSVGDTD() throws IOException {
IOUtils.copy(expResult, expResultWriter, StandardCharsets.UTF_8);
String expResultString = expResultWriter.toString();

assertEquals("DTD not properly injected", expResultString, resultString);
assertEquals(expResultString, resultString, "DTD not properly injected");

}

Expand All @@ -77,7 +77,7 @@ public void testRemoveDTD() throws Exception {
IOUtils.copy(result, resultWriter);
String resultString = resultWriter.toString();

assertFalse("DTD not properly removed – string '<!DOCTYPE' presented in the result", resultString.contains("<!DOCTYPE"));
assertFalse(resultString.contains("<!DOCTYPE"), "DTD not properly removed – string '<!DOCTYPE' presented in the result");

InputStreamReader expResult = new InputStreamReader(this.getClass().getResourceAsStream(RESOURCE_SUBDIR + "testRemoveDTD.output.xml"));
// Once read, the input stream can not be read again.
Expand Down

0 comments on commit adc6fa9

Please sign in to comment.