Commit 97f22b38 authored by WUUUGI's avatar WUUUGI

Merge branch 'master' of gitlab.com:schrieveslaach/NLPf into feature/dependency-graph

parents 82c923ca 3a59949d
Pipeline #17630690 (#) failed with stages
in 27 minutes and 23 seconds
package de.schrieveslaach.nlpf.maven.plugin;
/*-
* ========================LICENSE_START=================================
* nlp-maven-plugin
* %%
* Copyright (C) 2017 - 2018 Schrieveslaach
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* =========================LICENSE_END==================================
*/
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.maven.plugin.testing.MojoRule;
import org.junit.Rule;
import org.junit.Test;
import java.io.File;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.io.FileMatchers.anExistingFile;
import static org.junit.Assert.assertThat;
public class IsolatedToolsTestMojoIT extends BaseMojoIT {
@Rule
public MojoRule rule = new MojoRule();
@Test
public void shouldTestNlpModels() throws Exception {
File testProjectBaseDir = getTestProjectBaseDir("/sample-project");
storeExampleCasFiles(testProjectBaseDir);
rule.executeMojo(testProjectBaseDir, "train");
rule.executeMojo(testProjectBaseDir, "tools-test");
File testDataFile = new File(testProjectBaseDir, "target/isolated-tools-test-data/19E3EABBD27BDC429F1CB0431092DFF99537820F1F58A13FF3A97DDCF2F31291732D000AC0713B0EDF514167556624BFE4F242FC49C7B11C7AA90B2EBBBA0539.json");
assertThat(testDataFile, is(anExistingFile()));
ObjectMapper mapper = new ObjectMapper();
TestResult testResult = mapper.readValue(testDataFile, TestResult.class);
assertThat(testResult, is(notNullValue()));
}
}
......@@ -49,7 +49,7 @@ public class PackageMojoIT extends BaseMojoIT {
storeExampleCasFiles(testProjectBaseDir);
rule.executeMojo(testProjectBaseDir, "train");
rule.executeMojo(testProjectBaseDir, "test");
rule.executeMojo(testProjectBaseDir, "pipelines-test");
rule.executeMojo(testProjectBaseDir, "package");
File packageFile = new File(testProjectBaseDir, "target/domain-specific-corpus-1.0-SNAPSHOT.jar");
......
......@@ -35,7 +35,7 @@ import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.io.FileMatchers.anExistingFile;
import static org.junit.Assert.assertThat;
public class TestMojoIT extends BaseMojoIT {
public class PipelinesTestMojoIT extends BaseMojoIT {
@Rule
public MojoRule rule = new MojoRule();
......@@ -46,9 +46,9 @@ public class TestMojoIT extends BaseMojoIT {
storeExampleCasFiles(testProjectBaseDir);
rule.executeMojo(testProjectBaseDir, "train");
rule.executeMojo(testProjectBaseDir, "test");
rule.executeMojo(testProjectBaseDir, "pipelines-test");
File testDataFile = new File(testProjectBaseDir, "target/nlp-test-data/0.json");
File testDataFile = new File(testProjectBaseDir, "target/nlp-pipelines-test-data/0.json");
assertThat(testDataFile, is(anExistingFile()));
ObjectMapper mapper = new ObjectMapper();
......
package de.schrieveslaach.nlpf.maven.plugin;
/*-
* ========================LICENSE_START=================================
* nlp-maven-plugin
* %%
* Copyright (C) 2017 - 2018 Schrieveslaach
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* =========================LICENSE_END==================================
*/
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import de.schrieveslaach.nlpf.maven.plugin.reader.ClearTypesCombinationReader;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.uima.UIMAException;
import org.apache.uima.analysis_engine.AnalysisEngineDescription;
import org.apache.uima.collection.CollectionReaderDescription;
import org.apache.uima.fit.descriptor.TypeCapability;
import org.apache.uima.jcas.JCas;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import static de.schrieveslaach.nlpf.maven.plugin.EngineDescriptionUtil.hash;
import static de.schrieveslaach.nlpf.maven.plugin.JCasDataUtil.loadJCas;
import static org.apache.uima.fit.pipeline.SimplePipeline.runPipeline;
@Mojo(name = "tools-test", requiresDependencyResolution = ResolutionScope.COMPILE)
public class IsolatedToolsTestMojo extends AbstractTestMojo {
@Override
public void executeWithUimaClassLoader() throws MojoExecutionException {
List<JCas> testData = loadJCas(collectionReaderDescriptionService.createTestReaderDescriptions());
loadEngineDescriptions().parallelStream()
.map(engineDescription -> testNlpTool(engineDescription, testData))
.filter(Objects::nonNull)
.forEach(TestResultWrapper::store);
}
@SneakyThrows({MojoExecutionException.class, UIMAException.class})
private TestResultWrapper testNlpTool(AnalysisEngineDescription engineDescription, List<JCas> testData) {
String[] outputTypes = getOutputTypesOfDescription(engineDescription);
CollectionReaderDescription testReaderDescription = collectionReaderDescriptionService.createTestReaderDescriptions(
ClearTypesCombinationReader.class,
ClearTypesCombinationReader.PARAM_TYPES_TO_CLEAR, outputTypes
);
List<JCas> plainTestData = loadJCas(testReaderDescription);
for (JCas jCas : plainTestData) {
runPipeline(jCas, engineDescription);
}
TestResult testResult = new TestResult(engineDescription, getClass().getClassLoader());
measureAndAddToTestResult(testData, plainTestData, testResult, engineDescription);
return new TestResultWrapper(testResult, engineDescription);
}
private String[] getOutputTypesOfDescription(AnalysisEngineDescription engineDescription) {
Class<?> implementationClass = analysisEngineService.loadAnalysisEngineImplementation(engineDescription);
TypeCapability typeCapability = implementationClass.getAnnotation(TypeCapability.class);
return typeCapability.outputs();
}
@AllArgsConstructor
private class TestResultWrapper {
private TestResult testResult;
private AnalysisEngineDescription engineDescription;
@SneakyThrows(IOException.class)
private void store() {
File dataDirectory = directoryService.getIsolatedToolsTestDataDirectory();
File testDataFile = new File(dataDirectory, hash(engineDescription) + ".json");
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
try (FileOutputStream fos = new FileOutputStream(testDataFile)) {
mapper.writeValue(fos, testResult);
}
}
}
}
......@@ -124,7 +124,7 @@ public class PackageMojo extends AbstractMojo {
}
private TestResult getBestPipelineResult() throws MojoExecutionException {
File testDataFile = new File(directoryService.getTestDataDirectory(), "0.json");
File testDataFile = new File(directoryService.getPipelinesTestDataDirectory(), "0.json");
try (FileInputStream fis = new FileInputStream(testDataFile)) {
ObjectMapper mapper = new ObjectMapper();
......
......@@ -56,6 +56,7 @@ import java.util.SortedSet;
import java.util.TreeSet;
import static de.schrieveslaach.nlpf.maven.plugin.EngineDescriptionUtil.hash;
import static java.util.Arrays.asList;
@JsonDeserialize(using = TestResult.TestResultDeserializer.class)
@JsonSerialize(using = TestResult.TestResultSerializer.class)
......@@ -71,9 +72,12 @@ class TestResult implements Comparable<TestResult> {
private TestResult() {
}
TestResult(AnalysisEngineDescription engineDescription, ClassLoader classLoader) {
this(asList(engineDescription), classLoader);
}
TestResult(Iterable<AnalysisEngineDescription> pipeline, ClassLoader classLoader) {
aeGraph.init(Lists.newArrayList(pipeline), classLoader);
for (AnalysisEngineDescription aed : pipeline) {
pipelineDescriptors.add(hash(aed) + ".xml");
}
......
......@@ -97,12 +97,26 @@ public class DirectoryService {
/**
* Returns the directory in the {@link MavenProject#getBuild() build directory} which contains the
* measured f-scores, determined during {@code mvn test}.
* measured f-scores for the NLP pipelines, determined during
* {@code mvn de.schrieveslaach.nlpf:nlp-maven-plugin:pipelines-test}.
*
* @return
*/
public File getTestDataDirectory() {
File descriptorsDirectory = new File(mavenProject.getBuild().getDirectory(), "nlp-test-data");
public File getPipelinesTestDataDirectory() {
File descriptorsDirectory = new File(mavenProject.getBuild().getDirectory(), "nlp-pipelines-test-data");
descriptorsDirectory.mkdirs();
return descriptorsDirectory;
}
/**
* Returns the directory in the {@link MavenProject#getBuild() build directory} which contains the
* measured f-scores for the test of isolated NLP tool, determined during
* {@code mvn de.schrieveslaach.nlpf:nlp-maven-plugin:tools-test}.
*
* @return
*/
public File getIsolatedToolsTestDataDirectory() {
File descriptorsDirectory = new File(mavenProject.getBuild().getDirectory(), "isolated-tools-test-data");
descriptorsDirectory.mkdirs();
return descriptorsDirectory;
}
......@@ -138,4 +152,5 @@ public class DirectoryService {
public File getPipelineTxtFile() {
return new File(mavenProject.getBuild().getDirectory(), "pipeline.txt");
}
}
......@@ -42,7 +42,8 @@
de.schrieveslaach.nlpf:nlp-maven-plugin:execute-engine-factories
</process-test-classes>
<test>
de.schrieveslaach.nlpf:nlp-maven-plugin:test
de.schrieveslaach.nlpf:nlp-maven-plugin:tools-test,
de.schrieveslaach.nlpf:nlp-maven-plugin:pipelines-test
</test>
<package>
de.schrieveslaach.nlpf:nlp-maven-plugin:package
......
package de.schrieveslaach.nlpf.maven.plugin;
/*-
* ========================LICENSE_START=================================
* nlp-maven-plugin
* %%
* Copyright (C) 2017 - 2018 Schrieveslaach
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* =========================LICENSE_END==================================
*/
import de.schrieveslaach.nlpf.maven.plugin.reader.ClearTypesCombinationReader;
import de.schrieveslaach.nlpf.maven.plugin.service.AnalysisEngineDescriptionService;
import de.schrieveslaach.nlpf.maven.plugin.service.ClassLoaderService;
import de.schrieveslaach.nlpf.maven.plugin.service.CollectionReaderDescriptionService;
import de.schrieveslaach.nlpf.maven.plugin.service.DirectoryService;
import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiReader;
import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter;
import lombok.SneakyThrows;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.uima.UIMAException;
import org.apache.uima.analysis_component.AnalysisComponent;
import org.apache.uima.analysis_engine.AnalysisEngineDescription;
import org.apache.uima.collection.CollectionReaderDescription;
import org.apache.uima.jcas.JCas;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
import org.mockito.Mock;
import org.xml.sax.SAXException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import static de.schrieveslaach.nlpf.maven.plugin.EngineDescriptionUtil.hash;
import static de.schrieveslaach.nlpf.testing.JCasTestFactory.createOpenNlpExample;
import static de.schrieveslaach.nlpf.testing.JCasTestFactory.createSatyaNadellaExample;
import static de.schrieveslaach.nlpf.testing.JCasTestFactory.createTorwaldsExampleWithPosTags;
import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngineDescription;
import static org.apache.uima.fit.factory.CollectionReaderFactory.createReaderDescription;
import static org.apache.uima.fit.pipeline.SimplePipeline.runPipeline;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
public abstract class AbstractTestMojoTest {
@Rule
public final TemporaryFolder folder = new TemporaryFolder();
@Mock
protected DirectoryService directoryService;
@Mock
private AnalysisEngineDescriptionService analysisEngineDescriptionService;
@Mock
private CollectionReaderDescriptionService collectionReaderDescriptionService;
@Mock
private ClassLoaderService classLoaderService;
@Before
public void mockClassLoaderService() {
when(classLoaderService.getDependencyClassLoader()).thenReturn(getClass().getClassLoader());
}
@Before
public void mockDirectoryService() {
when(directoryService.getPipelinesTestDataDirectory()).then(invocation -> {
File directory = new File(new File(folder.getRoot(), "target"), "nlp-pipelines-test-data");
directory.mkdirs();
return directory;
});
when(directoryService.getIsolatedToolsTestDataDirectory()).then(invocation -> {
File directory = new File(new File(folder.getRoot(), "target"), "isolated-tools-test-data");
directory.mkdirs();
return directory;
});
when(directoryService.getModelsBaseDirectory()).then(invocation -> {
File directory = new File(new File(folder.getRoot(), "target"), "models");
directory.mkdirs();
return directory;
});
}
@Before
public void mockAnalysisEngineDescriptionService() {
when(analysisEngineDescriptionService.loadAnalysisEngineImplementation(any(AnalysisEngineDescription.class))).then(invocation -> {
AnalysisEngineDescription engineDescription = invocation.getArgument(0);
return Class.forName(engineDescription.getImplementationName());
});
when(analysisEngineDescriptionService.getAnalysisEngineName(any(AnalysisEngineDescription.class))).then(invocation -> {
AnalysisEngineDescription engineDescription = invocation.getArgument(0);
return Class.forName(engineDescription.getImplementationName()).getSimpleName();
});
}
@SneakyThrows({IOException.class, UIMAException.class})
public void mockEngineDescriptionsInDescriptorsDirectory(Class<? extends AnalysisComponent>... engineDescriptions) {
File descriptorsDirectory = folder.newFolder("target", "descriptors");
when(directoryService.getDescriptorsDirectory()).thenReturn(descriptorsDirectory);
for (Class<? extends AnalysisComponent> cls : engineDescriptions) {
AnalysisEngineDescription aed = createEngineDescription(cls);
saveEngineDescription(descriptorsDirectory, aed);
}
}
@SneakyThrows(IOException.class)
public void mockEngineDescriptionsInDescriptorsDirectory(AnalysisEngineDescription... descriptions) {
File descriptorsDirectory = folder.newFolder("target", "descriptors");
when(directoryService.getDescriptorsDirectory()).thenReturn(descriptorsDirectory);
for (AnalysisEngineDescription aed : descriptions) {
saveEngineDescription(descriptorsDirectory, aed);
}
}
@SneakyThrows({IOException.class, SAXException.class})
public void saveEngineDescription(File descriptorsDirectory, AnalysisEngineDescription aed) {
File nerDescriptor = new File(descriptorsDirectory, hash(aed) + ".xml");
try (FileOutputStream fos = new FileOutputStream(nerDescriptor)) {
aed.toXML(fos);
}
}
@SneakyThrows({IOException.class, UIMAException.class, MojoExecutionException.class, SAXException.class})
public void provideTestJCas() {
JCas satyaNadellaExample = createSatyaNadellaExample();
JCas openNlpExample = createOpenNlpExample();
JCas torwaldsExample = createTorwaldsExampleWithPosTags();
File testDirectory = folder.newFolder("src", "test", "corpus");
runPipeline(satyaNadellaExample,
createEngineDescription(
XmiWriter.class,
XmiWriter.PARAM_TARGET_LOCATION, testDirectory,
XmiWriter.PARAM_OVERWRITE, true
)
);
runPipeline(openNlpExample,
createEngineDescription(
XmiWriter.class,
XmiWriter.PARAM_TARGET_LOCATION, testDirectory,
XmiWriter.PARAM_OVERWRITE, true
)
);
runPipeline(torwaldsExample,
createEngineDescription(
XmiWriter.class,
XmiWriter.PARAM_TARGET_LOCATION, testDirectory,
XmiWriter.PARAM_OVERWRITE, true
)
);
CollectionReaderDescription readerDescription = createReaderDescription(
XmiReader.class,
XmiReader.PARAM_PATTERNS, new File(testDirectory, "*.xmi")
);
when(collectionReaderDescriptionService.createTestReaderDescriptions()).thenReturn(readerDescription);
File configurationFile = folder.newFile();
try (FileOutputStream fos = new FileOutputStream(configurationFile)) {
readerDescription.toXML(fos);
}
when(collectionReaderDescriptionService.createTestReaderDescriptions(any(), any())).then(invocation -> {
String[] params = invocation.getArgument(2);
return createReaderDescription(
ClearTypesCombinationReader.class,
ClearTypesCombinationReader.PARAM_READERS, new String[]{
configurationFile.toString()
},
ClearTypesCombinationReader.PARAM_TYPES_TO_CLEAR, params
);
});
}
}
package de.schrieveslaach.nlpf.maven.plugin;
/*-
* ========================LICENSE_START=================================
* nlp-maven-plugin
* %%
* Copyright (C) 2017 - 2018 Schrieveslaach
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
* =========================LICENSE_END==================================
*/
import de.schrieveslaach.nlpf.maven.plugin.annotators.MyNamedEntityRecognizer;
import de.schrieveslaach.nlpf.maven.plugin.annotators.MyPosTagger;
import de.tudarmstadt.ukp.dkpro.core.api.parameter.ComponentParameters;
import de.tudarmstadt.ukp.dkpro.core.opennlp.OpenNlpNamedEntityRecognizer;
import org.apache.commons.io.FileUtils;
import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.junit.MockitoJUnitRunner;
import java.io.File;
import java.nio.charset.Charset;
import java.util.Collections;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngineDescription;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.io.FileMatchers.anExistingFile;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class IsolatedToolsTestMojoTest extends AbstractTestMojoTest {
@InjectMocks
private IsolatedToolsTestMojo mojo;
public static String jsonTestResult() {
return new JSONObject()
.put("descriptors", asList(
MyPosTagger.DEFAULT_HASH_CODE + ".xml"
))
.put("measures", asList(
new JSONObject()
.put("analysisEngineName", "MyPosTagger")
.put("outputType", "de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS")
.put("variant", JSONObject.NULL)
.put("measure", new JSONObject()
.put("f-measure", 0.352)
.put("precision", 0.352)
.put("recall", 0.352))
))
.put("nodes", asList(
new JSONObject()
.put("id", 1)
.put("label", "de.schrieveslaach.nlpf.maven.plugin.annotators.MyPosTagger")
))
.put("edges", emptyList())
.toString();
}
public static String jsonOpenNlpPersonTestResult() {
return new JSONObject()
.put("descriptors", asList(
"933D4E2CC3B73F2359007BA5990F68AFFEFCA031E364D5354A3F7DE9B8308C6CCD89B5E89FF169D72798D92C80C5DBB458BF6FE914779B5E4EE94D6A7F18EEB8.xml"
))
.put("measures", asList(
new JSONObject()
.put("analysisEngineName", "OpenNlpNamedEntityRecognizer")
.put("outputType", "de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity")
.put("variant", "person")
.put("measure", new JSONObject()
.put("f-measure", 0.5)
.put("precision", 0.75)
.put("recall", 0.375))
))
.put("nodes", asList(
new JSONObject()
.put("id", 1)
.put("label", "OpenNLP Named Entity Recognizer (variant = person)")
))
.put("edges", emptyList())
.toString();
}
@Before
public void mockDirectoryService() {
when(directoryService.getIsolatedToolsTestDataDirectory()).then(invocation -> {
File directory = new File(new File(folder.getRoot(), "target"), "isolated-tools-test-data");
directory.mkdirs();
return directory;
});
when(directoryService.getModelsBaseDirectory()).then(invocation -> {
File directory = new File(new File(folder.getRoot(), "target"), "models");
directory.mkdirs();
return directory;
});
}
@Test
public void shouldExecutePOSTaggerIsolated_MyPosTagger() throws Exception {
mockEngineDescriptionsInDescriptorsDirectory(MyPosTagger.class);
provideTestJCas();
mojo.execute();
File testResult = assertThatIsolatedTestDataFileExists(MyPosTagger.DEFAULT_HASH_CODE);
String json = FileUtils.readFileToString(testResult, Charset.defaultCharset());
assertThat(json, jsonEquals(jsonTestResult()).withTolerance(0.001));
}
@Test
public void shouldExecutePOSTaggerIsolated_OpenNlpNER() throws Exception {
mockEngineDescriptionsInDescriptorsDirectory(
createEngineDescription(OpenNlpNamedEntityRecognizer.class, ComponentParameters.PARAM_VARIANT, "person"),
createEngineDescription(MyNamedEntityRecognizer.class, ComponentParameters.PARAM_VARIANT, "person"),
createEngineDescription(OpenNlpNamedEntityRecognizer.class, ComponentParameters.PARAM_VARIANT, "organization"),
createEngineDescription(MyNamedEntityRecognizer.class, ComponentParameters.PARAM_VARIANT, "organization")
);
provideTestJCas();
mojo.execute();
assertThatIsolatedTestDataFileExists("2F4E6A71ED34C855CFF9FD2F568A0AFDDEBFFDA127438393769467A254D391603E219A631E14BE43B208BC0CDFA87F665D0779ED2F9430483830A50828E62B59");
assertThatIsolatedTestDataFileExists("4C7420B966C09DB213E219FB05DDD257FB585B15812EA02B770AA41015F2C31F7C6F714BD9DAE0945505DE22BB4F474AD5A434698DA13B532ECEED2E95D43692");
assertThatIsolatedTestDataFileExists("DCA1B1EA9F8F959CD4F15CFF0724A11583977970F20E086B59DC614B76BECF75D745576C2DEC217DD191AF994325AED4CEC0A3CF960C1329E929F66338C5E5F");
File openNerPersonTestResult = assertThatIsolatedTestDataFileExists("933D4E2CC3B73F2359007BA5990F68AFFEFCA031E364D5354A3F7DE9B8308C6CCD89B5E89FF169D72798D92C80C5DBB458BF6FE914779B5E4EE94D6A7F18EEB8");
String json = FileUtils.readFileToString(openNerPersonTestResult, Charset.defaultCharset());
assertThat(json, jsonEquals(jsonOpenNlpPersonTestResult()).withTolerance(0.001));
}
private File assertThatIsolatedTestDataFileExists(String hash) {
File testResult = new File(folder.getRoot(), "target/isolated-tools-test-data/" + hash + ".json");
assertThat(testResult, is(anExistingFile()));
return testResult;
}
}
......@@ -23,7 +23,6 @@ package de.schrieveslaach.nlpf.maven.plugin;
*/
import de.schrieveslaach.nlpf.maven.plugin.service.DirectoryService;
import de.schrieveslaach.nlpf.maven.plugin.PackageMojo;
import lombok.SneakyThrows;
import org.apache.commons.io.FileUtils;
import org.apache.maven.artifact.Artifact;
......@@ -91,7 +90,7 @@ public class PackageMojoTest {
when(directoryService.getDescriptorsDirectory()).thenReturn(new File(target, "descriptors"));
when(directoryService.getPipelineTxtFile()).thenReturn(new File(target, "pipeline.txt"));