Permalink
Browse files

Move tests from elk-cli to elk-reasoner

Also add realization tests with interrupts.
  • Loading branch information...
aifargonos committed Jan 17, 2017
1 parent 58c7f3f commit 4ca2ff361474ec1b5e6784cb8fd1368b9feb7bfc
Showing with 127 additions and 214 deletions.
  1. +0 −23 elk-cli/pom.xml
  2. +2 −2 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/BaseRealizationCorrectnessTest.java
  3. +1 −1 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/DiffRealizationCorrectnessTest.java
  4. +4 −7 ...elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/ElkDiffClassificationCorrectnessTest.java
  5. +4 −7 ...rc/test/java/org/semanticweb/elk/reasoner/ElkDiffObjectPropertyClassificationCorrectnessTest.java
  6. +4 −7 ... → elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/ElkDiffRealizationCorrectnessTest.java
  7. +4 −7 ... → elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/ElkHashRealizationCorrectnessTest.java
  8. +3 −6 ...gate.java → elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/ElkReasoningTestDelegate.java
  9. +1 −1 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/HashRealizationCorrectnessTest.java
  10. +7 −10 ...rc/test/java/org/semanticweb/elk/reasoner/query/ElkClassExpressionEquivalentClassesQueryTest.java
  11. +7 −10 ...asoner/src/test/java/org/semanticweb/elk/reasoner/query/ElkClassExpressionInstancesQueryTest.java
  12. +6 −10 ...r/src/test/java/org/semanticweb/elk/reasoner/query/ElkClassExpressionSatisfiabilityQueryTest.java
  13. +7 −10 ...soner/src/test/java/org/semanticweb/elk/reasoner/query/ElkClassExpressionSubClassesQueryTest.java
  14. +7 −10 ...ner/src/test/java/org/semanticweb/elk/reasoner/query/ElkClassExpressionSuperClassesQueryTest.java
  15. +6 −10 ....java → elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/query/ElkEntailmentQueryTest.java
  16. +7 −9 ...lk-reasoner/src/test/java/org/semanticweb/elk/reasoner/query/ElkEquivalentEntitiesTestOutput.java
  17. +9 −16 ... → elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/query/ElkExpectedTestOutputLoader.java
  18. +6 −8 ...a/org/semanticweb/elk/reasoner/query/ElkIncrementalClassExpressionEquivalentClassesQueryTest.java
  19. +6 −8 ...test/java/org/semanticweb/elk/reasoner/query/ElkIncrementalClassExpressionInstancesQueryTest.java
  20. +4 −6 ...oner/src/test/java/org/semanticweb/elk/reasoner/query/ElkIncrementalClassExpressionQueryTest.java
  21. +4 −7 ...java/org/semanticweb/elk/reasoner/query/ElkIncrementalClassExpressionSatisfiabilityQueryTest.java
  22. +6 −8 ...est/java/org/semanticweb/elk/reasoner/query/ElkIncrementalClassExpressionSubClassesQueryTest.java
  23. +6 −8 ...t/java/org/semanticweb/elk/reasoner/query/ElkIncrementalClassExpressionSuperClassesQueryTest.java
  24. +6 −11 ...-reasoner/src/test/java/org/semanticweb/elk/reasoner/query/ElkIncrementalEntailmentQueryTest.java
  25. +7 −9 ...→ elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/query/ElkRelatedEntitiesTestOutput.java
  26. +3 −3 ...TestUtil.java → elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/query/QueryTestUtils.java
View
@@ -26,16 +26,6 @@
<artifactId>elk-util-io</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>elk-util-hashing</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>elk-util-collections</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>elk-util-common</artifactId>
@@ -70,19 +60,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>elk-util-testing</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>elk-util-concurrent</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -38,13 +38,13 @@
@RunWith(PolySuite.class)
public abstract class BaseRealizationCorrectnessTest<EO extends TestOutput>
extends
ReasoningCorrectnessTestWithOutput<UrlTestInput, EO, InstanceTaxonomyTestOutput<?>, ReasoningTestManifest<EO, InstanceTaxonomyTestOutput<?>>, ReasoningTestWithOutputDelegate<InstanceTaxonomyTestOutput<?>>> {
ReasoningCorrectnessTestWithInterrupts<UrlTestInput, EO, InstanceTaxonomyTestOutput<?>, ReasoningTestManifest<EO, InstanceTaxonomyTestOutput<?>>, ReasoningTestWithOutputAndInterruptsDelegate<InstanceTaxonomyTestOutput<?>>> {
final static String INPUT_DATA_LOCATION = "realization_test_input";
public BaseRealizationCorrectnessTest(
final ReasoningTestManifest<EO, InstanceTaxonomyTestOutput<?>> testManifest,
final ReasoningTestWithOutputDelegate<InstanceTaxonomyTestOutput<?>> testDelegate) {
final ReasoningTestWithOutputAndInterruptsDelegate<InstanceTaxonomyTestOutput<?>> testDelegate) {
super(testManifest, testDelegate);
}
@@ -53,7 +53,7 @@
public DiffRealizationCorrectnessTest(
final ReasoningTestManifest<InstanceTaxonomyTestOutput<?>, InstanceTaxonomyTestOutput<?>> testManifest,
final ReasoningTestWithOutputDelegate<InstanceTaxonomyTestOutput<?>> testDelegate) {
final ReasoningTestWithOutputAndInterruptsDelegate<InstanceTaxonomyTestOutput<?>> testDelegate) {
super(testManifest, testDelegate);
}
@@ -20,14 +20,11 @@
* limitations under the License.
* #L%
*/
package org.semanticweb.elk.cli;
package org.semanticweb.elk.reasoner;
import java.util.Arrays;
import org.semanticweb.elk.owl.interfaces.ElkClass;
import org.semanticweb.elk.reasoner.DiffClassificationCorrectnessTest;
import org.semanticweb.elk.reasoner.ReasoningTestManifest;
import org.semanticweb.elk.reasoner.TaxonomyTestOutput;
import org.semanticweb.elk.reasoner.taxonomy.model.Taxonomy;
import org.semanticweb.elk.testing.TestInput;
@@ -36,7 +33,7 @@
*
* pavel.klinov@uni-ulm.de
*/
public class CLIDiffClassificationCorrectnessTest
public class ElkDiffClassificationCorrectnessTest
extends DiffClassificationCorrectnessTest {
static final String[] IGNORE_LIST = {};
@@ -45,9 +42,9 @@
Arrays.sort(IGNORE_LIST);
}
public CLIDiffClassificationCorrectnessTest(
public ElkDiffClassificationCorrectnessTest(
final ReasoningTestManifest<TaxonomyTestOutput<?>, TaxonomyTestOutput<?>> testManifest) {
super(testManifest, new CliReasoningTestDelegate<TaxonomyTestOutput<?>>(
super(testManifest, new ElkReasoningTestDelegate<TaxonomyTestOutput<?>>(
testManifest) {
@Override
@@ -20,21 +20,18 @@
* limitations under the License.
* #L%
*/
package org.semanticweb.elk.cli;
package org.semanticweb.elk.reasoner;
import java.util.Arrays;
import org.semanticweb.elk.owl.interfaces.ElkObjectProperty;
import org.semanticweb.elk.reasoner.DiffObjectPropertyClassificationCorrectnessTest;
import org.semanticweb.elk.reasoner.ReasoningTestManifest;
import org.semanticweb.elk.reasoner.TaxonomyTestOutput;
import org.semanticweb.elk.reasoner.taxonomy.model.Taxonomy;
import org.semanticweb.elk.testing.TestInput;
/**
* @author Peter Skocovsky
*/
public class CLIDiffObjectPropertyClassificationCorrectnessTest
public class ElkDiffObjectPropertyClassificationCorrectnessTest
extends DiffObjectPropertyClassificationCorrectnessTest {
static final String[] IGNORE_LIST = {};
@@ -43,9 +40,9 @@
Arrays.sort(IGNORE_LIST);
}
public CLIDiffObjectPropertyClassificationCorrectnessTest(
public ElkDiffObjectPropertyClassificationCorrectnessTest(
final ReasoningTestManifest<TaxonomyTestOutput<?>, TaxonomyTestOutput<?>> testManifest) {
super(testManifest, new CliReasoningTestDelegate<TaxonomyTestOutput<?>>(
super(testManifest, new ElkReasoningTestDelegate<TaxonomyTestOutput<?>>(
testManifest) {
@Override
@@ -20,15 +20,12 @@
* limitations under the License.
* #L%
*/
package org.semanticweb.elk.cli;
package org.semanticweb.elk.reasoner;
import java.util.Arrays;
import org.semanticweb.elk.owl.interfaces.ElkClass;
import org.semanticweb.elk.owl.interfaces.ElkNamedIndividual;
import org.semanticweb.elk.reasoner.DiffRealizationCorrectnessTest;
import org.semanticweb.elk.reasoner.InstanceTaxonomyTestOutput;
import org.semanticweb.elk.reasoner.ReasoningTestManifest;
import org.semanticweb.elk.reasoner.taxonomy.model.InstanceTaxonomy;
import org.semanticweb.elk.testing.TestInput;
@@ -37,7 +34,7 @@
*
* pavel.klinov@uni-ulm.de
*/
public class CLIDiffRealizationCorrectnessTest extends
public class ElkDiffRealizationCorrectnessTest extends
DiffRealizationCorrectnessTest {
static final String[] IGNORE_LIST = {
@@ -49,10 +46,10 @@
Arrays.sort(IGNORE_LIST);
}
public CLIDiffRealizationCorrectnessTest(
public ElkDiffRealizationCorrectnessTest(
final ReasoningTestManifest<InstanceTaxonomyTestOutput<?>, InstanceTaxonomyTestOutput<?>> testManifest) {
super(testManifest,
new CliReasoningTestDelegate<InstanceTaxonomyTestOutput<?>>(
new ElkReasoningTestDelegate<InstanceTaxonomyTestOutput<?>>(
testManifest) {
@Override
@@ -23,13 +23,10 @@
/**
*
*/
package org.semanticweb.elk.cli;
package org.semanticweb.elk.reasoner;
import org.semanticweb.elk.owl.interfaces.ElkClass;
import org.semanticweb.elk.owl.interfaces.ElkNamedIndividual;
import org.semanticweb.elk.reasoner.HashRealizationCorrectnessTest;
import org.semanticweb.elk.reasoner.InstanceTaxonomyTestOutput;
import org.semanticweb.elk.reasoner.ReasoningTestManifest;
import org.semanticweb.elk.reasoner.taxonomy.model.InstanceTaxonomy;
import org.semanticweb.elk.testing.HashTestOutput;
@@ -41,13 +38,13 @@
* pavel.klinov@uni-ulm.de
*/
public class CLIHashRealizationCorrectnessTest
public class ElkHashRealizationCorrectnessTest
extends HashRealizationCorrectnessTest {
public CLIHashRealizationCorrectnessTest(
public ElkHashRealizationCorrectnessTest(
final ReasoningTestManifest<HashTestOutput, InstanceTaxonomyTestOutput<?>> testManifest) {
super(testManifest,
new CliReasoningTestDelegate<InstanceTaxonomyTestOutput<?>>(
new ElkReasoningTestDelegate<InstanceTaxonomyTestOutput<?>>(
testManifest) {
@Override
@@ -19,24 +19,21 @@
* limitations under the License.
* #L%
*/
package org.semanticweb.elk.cli;
package org.semanticweb.elk.reasoner;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Random;
import org.semanticweb.elk.RandomSeedProvider;
import org.semanticweb.elk.reasoner.RandomReasonerInterrupter;
import org.semanticweb.elk.reasoner.Reasoner;
import org.semanticweb.elk.reasoner.ReasoningTestWithOutputAndInterruptsDelegate;
import org.semanticweb.elk.reasoner.TestReasonerUtils;
import org.semanticweb.elk.reasoner.stages.ElkInterruptedException;
import org.semanticweb.elk.testing.TestManifest;
import org.semanticweb.elk.testing.TestOutput;
import org.semanticweb.elk.testing.UrlTestInput;
public abstract class CliReasoningTestDelegate<AO extends TestOutput>
public abstract class ElkReasoningTestDelegate<AO extends TestOutput>
implements ReasoningTestWithOutputAndInterruptsDelegate<AO> {
public static final double INTERRUPTION_CHANCE = 0.3;
@@ -45,7 +42,7 @@
private Reasoner reasoner_;
public CliReasoningTestDelegate(
public ElkReasoningTestDelegate(
final TestManifest<? extends UrlTestInput> manifest) {
this.manifest_ = manifest;
}
@@ -45,7 +45,7 @@
public HashRealizationCorrectnessTest(
final ReasoningTestManifest<HashTestOutput, InstanceTaxonomyTestOutput<?>> testManifest,
final ReasoningTestWithOutputDelegate<InstanceTaxonomyTestOutput<?>> testDelegate) {
final ReasoningTestWithOutputAndInterruptsDelegate<InstanceTaxonomyTestOutput<?>> testDelegate) {
super(testManifest, testDelegate);
}
@@ -19,7 +19,7 @@
* limitations under the License.
* #L%
*/
package org.semanticweb.elk.cli.query;
package org.semanticweb.elk.reasoner.query;
import java.io.IOException;
import java.io.InputStream;
@@ -28,13 +28,10 @@
import java.util.Collection;
import org.junit.runner.RunWith;
import org.semanticweb.elk.cli.CliReasoningTestDelegate;
import org.semanticweb.elk.io.IOUtils;
import org.semanticweb.elk.owl.interfaces.ElkClass;
import org.semanticweb.elk.owl.interfaces.ElkClassExpression;
import org.semanticweb.elk.reasoner.query.BaseQueryTest;
import org.semanticweb.elk.reasoner.query.QueryTestInput;
import org.semanticweb.elk.reasoner.query.EquivalentEntitiesTestOutput;
import org.semanticweb.elk.reasoner.ElkReasoningTestDelegate;
import org.semanticweb.elk.reasoner.taxonomy.model.Node;
import org.semanticweb.elk.testing.ConfigurationUtils;
import org.semanticweb.elk.testing.ConfigurationUtils.MultiManifestCreator;
@@ -44,13 +41,13 @@
import org.semanticweb.elk.testing.TestManifestWithOutput;
@RunWith(PolySuite.class)
public class CliClassExpressionEquivalentClassesQueryTest extends
public class ElkClassExpressionEquivalentClassesQueryTest extends
BaseQueryTest<ElkClassExpression, EquivalentEntitiesTestOutput<ElkClass>> {
public CliClassExpressionEquivalentClassesQueryTest(
public ElkClassExpressionEquivalentClassesQueryTest(
final TestManifestWithOutput<QueryTestInput<ElkClassExpression>, EquivalentEntitiesTestOutput<ElkClass>, EquivalentEntitiesTestOutput<ElkClass>> manifest) {
super(manifest,
new CliReasoningTestDelegate<EquivalentEntitiesTestOutput<ElkClass>>(
new ElkReasoningTestDelegate<EquivalentEntitiesTestOutput<ElkClass>>(
manifest) {
@Override
@@ -59,7 +56,7 @@ public CliClassExpressionEquivalentClassesQueryTest(
final Node<ElkClass> equivalent = getReasoner()
.getEquivalentClassesQuietly(
manifest.getInput().getQuery());
return new CliEquivalentEntitiesTestOutput(equivalent);
return new ElkEquivalentEntitiesTestOutput(equivalent);
}
});
@@ -83,7 +80,7 @@ public static Configuration getConfig()
try {
outputIS = output.openStream();
return CliExpectedTestOutputLoader.load(outputIS)
return ElkExpectedTestOutputLoader.load(outputIS)
.getEquivalentEntitiesManifests(input);
} finally {
@@ -19,7 +19,7 @@
* limitations under the License.
* #L%
*/
package org.semanticweb.elk.cli.query;
package org.semanticweb.elk.reasoner.query;
import java.io.IOException;
import java.io.InputStream;
@@ -29,13 +29,10 @@
import java.util.Set;
import org.junit.runner.RunWith;
import org.semanticweb.elk.cli.CliReasoningTestDelegate;
import org.semanticweb.elk.io.IOUtils;
import org.semanticweb.elk.owl.interfaces.ElkClassExpression;
import org.semanticweb.elk.owl.interfaces.ElkNamedIndividual;
import org.semanticweb.elk.reasoner.query.BaseQueryTest;
import org.semanticweb.elk.reasoner.query.QueryTestInput;
import org.semanticweb.elk.reasoner.query.RelatedEntitiesTestOutput;
import org.semanticweb.elk.reasoner.ElkReasoningTestDelegate;
import org.semanticweb.elk.reasoner.taxonomy.ElkIndividualKeyProvider;
import org.semanticweb.elk.reasoner.taxonomy.model.Node;
import org.semanticweb.elk.testing.ConfigurationUtils;
@@ -46,13 +43,13 @@
import org.semanticweb.elk.testing.TestManifestWithOutput;
@RunWith(PolySuite.class)
public class CliClassExpressionInstancesQueryTest extends
public class ElkClassExpressionInstancesQueryTest extends
BaseQueryTest<ElkClassExpression, RelatedEntitiesTestOutput<ElkNamedIndividual>> {
public CliClassExpressionInstancesQueryTest(
public ElkClassExpressionInstancesQueryTest(
final TestManifestWithOutput<QueryTestInput<ElkClassExpression>, RelatedEntitiesTestOutput<ElkNamedIndividual>, RelatedEntitiesTestOutput<ElkNamedIndividual>> manifest) {
super(manifest,
new CliReasoningTestDelegate<RelatedEntitiesTestOutput<ElkNamedIndividual>>(
new ElkReasoningTestDelegate<RelatedEntitiesTestOutput<ElkNamedIndividual>>(
manifest) {
@Override
@@ -62,7 +59,7 @@ public CliClassExpressionInstancesQueryTest(
.getInstancesQuietly(
manifest.getInput().getQuery(),
true);
return new CliRelatedEntitiesTestOutput<ElkNamedIndividual>(
return new ElkRelatedEntitiesTestOutput<ElkNamedIndividual>(
subNodes, ElkIndividualKeyProvider.INSTANCE);
}
@@ -87,7 +84,7 @@ public static Configuration getConfig()
try {
outputIS = output.openStream();
return CliExpectedTestOutputLoader.load(outputIS)
return ElkExpectedTestOutputLoader.load(outputIS)
.getInstancesManifests(input);
} finally {
Oops, something went wrong.

0 comments on commit 4ca2ff3

Please sign in to comment.