diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml index c56911c..30d548b 100644 --- a/.github/workflows/up.yml +++ b/.github/workflows/up.yml @@ -45,4 +45,4 @@ jobs: title: 'New version in README' assignees: yegor256 branch: up - base: master \ No newline at end of file + base: master diff --git a/src/it/groovy/invoker.properties b/src/it/groovy/invoker.properties index d749feb..5cdf32a 100644 --- a/src/it/groovy/invoker.properties +++ b/src/it/groovy/invoker.properties @@ -26,4 +26,4 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED # OF THE POSSIBILITY OF SUCH DAMAGE. -invoker.goals = clean \ No newline at end of file +invoker.goals = clean diff --git a/src/it/groovy/verify.groovy b/src/it/groovy/verify.groovy index 414c5e7..269b23c 100644 --- a/src/it/groovy/verify.groovy +++ b/src/it/groovy/verify.groovy @@ -35,4 +35,4 @@ def same = new XMLDocument(new File(basedir, 'same.xmir')) assert fist.equals(same) -assert log.text.contains("BUILD SUCCESS") \ No newline at end of file +assert log.text.contains("BUILD SUCCESS") diff --git a/src/main/java/com/jcabi/xml/ClasspathInput.java b/src/main/java/com/jcabi/xml/ClasspathInput.java old mode 100755 new mode 100644 diff --git a/src/main/java/com/jcabi/xml/ClasspathResolver.java b/src/main/java/com/jcabi/xml/ClasspathResolver.java old mode 100755 new mode 100644 diff --git a/src/main/java/com/jcabi/xml/StrictXML.java b/src/main/java/com/jcabi/xml/StrictXML.java old mode 100755 new mode 100644 diff --git a/src/main/java/com/jcabi/xml/XSLDocument.java b/src/main/java/com/jcabi/xml/XSLDocument.java index bb29b26..298584a 100644 --- a/src/main/java/com/jcabi/xml/XSLDocument.java +++ b/src/main/java/com/jcabi/xml/XSLDocument.java @@ -43,7 +43,6 @@ import java.nio.file.Path; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.atomic.AtomicReference; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; diff --git a/src/test/java/com/jcabi/xml/StrictXMLTest.java b/src/test/java/com/jcabi/xml/StrictXMLTest.java old mode 100755 new mode 100644 diff --git a/src/test/java/com/jcabi/xml/XSLDocumentTest.java b/src/test/java/com/jcabi/xml/XSLDocumentTest.java index 85ccf55..d11f274 100644 --- a/src/test/java/com/jcabi/xml/XSLDocumentTest.java +++ b/src/test/java/com/jcabi/xml/XSLDocumentTest.java @@ -30,15 +30,15 @@ package com.jcabi.xml; import com.jcabi.matchers.XhtmlMatchers; -import java.util.concurrent.CountDownLatch; +import com.yegor256.Together; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.lang3.StringUtils; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.api.Test; /** @@ -246,7 +246,7 @@ void catchesSaxonWarnings() { ).transform(new XMLDocument("")); } - @Test + @RepeatedTest(10) void transformsInManyThreads() throws Exception { final XSL xsl = new XSLDocument( this.getClass().getResourceAsStream("first.xsl") @@ -254,25 +254,14 @@ void transformsInManyThreads() throws Exception { final XML xml = new XMLDocument( this.getClass().getResourceAsStream("simple.xml") ); - final AtomicInteger done = new AtomicInteger(0); - final CountDownLatch latch = new CountDownLatch(1); final int total = 50; - final ExecutorService exec = Executors.newFixedThreadPool(total); - for (int task = 0; task < total; ++task) { - exec.submit( - () -> { - latch.await(); - xsl.transform(xml); - xsl.transform(xml); - done.incrementAndGet(); - return 0; - } - ); - } - latch.countDown(); - exec.shutdown(); - exec.awaitTermination(1L, TimeUnit.MINUTES); - MatcherAssert.assertThat(done.get(), Matchers.equalTo(total)); + MatcherAssert.assertThat( + new Together<>( + total, + t -> xsl.transform(xml) + ).asList().size(), + Matchers.equalTo(total) + ); } } diff --git a/src/test/resources/com/jcabi/xml/sample-namespaces.xsd b/src/test/resources/com/jcabi/xml/sample-namespaces.xsd old mode 100755 new mode 100644