Attempt fix at custom serializer race condition

master
agibsonccc 2021-03-26 09:11:05 +09:00
parent 016c0e8afe
commit b874696c64
2 changed files with 5 additions and 45 deletions

View File

@ -105,46 +105,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>org/datanucleus/**</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" />
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -21,6 +21,7 @@
package org.nd4j.linalg.dataset; package org.nd4j.linalg.dataset;
import lombok.Getter; import lombok.Getter;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -66,11 +67,11 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
@Tag(TagNames.FILE_IO) @Tag(TagNames.FILE_IO)
public class NormalizerSerializerTest extends BaseNd4jTestWithBackends { public class NormalizerSerializerTest extends BaseNd4jTestWithBackends {
@TempDir File tmpFile; @TempDir File tmpFile;
private NormalizerSerializer SUT; private static NormalizerSerializer SUT;
@BeforeEach @BeforeAll
public void setUp() throws IOException { public static void setUp() throws IOException {
SUT = NormalizerSerializer.getDefault(); SUT = NormalizerSerializer.getDefault();
} }
@ -298,7 +299,6 @@ public class NormalizerSerializerTest extends BaseNd4jTestWithBackends {
public void testCustomNormalizerWithoutRegisteredStrategy(Nd4jBackend backend) throws Exception { public void testCustomNormalizerWithoutRegisteredStrategy(Nd4jBackend backend) throws Exception {
assertThrows(RuntimeException.class, () -> { assertThrows(RuntimeException.class, () -> {
File normalizerFile = Files.createTempFile(tmpFile.toPath(),"pre-process-" + UUID.randomUUID().toString(),"bin").toFile(); File normalizerFile = Files.createTempFile(tmpFile.toPath(),"pre-process-" + UUID.randomUUID().toString(),"bin").toFile();
SUT.write(new MyNormalizer(123), normalizerFile); SUT.write(new MyNormalizer(123), normalizerFile);
}); });