LUCENE-6439: Create test-framework/src/test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1674946 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2015-04-20 17:23:58 +00:00
parent f4207755d9
commit c3209306cb
36 changed files with 73 additions and 64 deletions

View File

@ -53,7 +53,7 @@
</target>
<!-- "-clover.load" is *not* a useless dependency. do not remove -->
<target name="test" depends="-clover.load, -init-totals, test-core, test-modules, -check-totals"
<target name="test" depends="-clover.load, -init-totals, test-core, test-test-framework, test-modules, -check-totals"
description="Runs all unit tests (core, modules and back-compat)"
/>
@ -449,9 +449,18 @@
<ant dir="core" target="compile-test" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<ant dir="test-framework" target="compile-test" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<modules-crawl target="compile-test" failonerror="true"/>
</sequential>
</target>
<target name="test-test-framework">
<ant dir="test-framework" target="test" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
</target>
<target name="test-modules">
<modules-crawl target="test" failonerror="true"/>
@ -470,6 +479,9 @@
<ant dir="${common.dir}/core" target="jacoco" inheritAll="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<ant dir="${common.dir}/test-framework" target="jacoco" inheritAll="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
<modules-crawl target="jacoco" failonerror="true"/>
<!-- produce aggregate report -->
@ -486,7 +498,6 @@
<classfiles>
<fileset dir="${common.dir}/build">
<include name="**/classes/java/**/*.class"/>
<exclude name="test-framework/**"/>
<exclude name="tools/**"/>
</fileset>
</classfiles>

View File

@ -24,29 +24,9 @@ import java.util.Arrays;
import java.util.List;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
public class TestDirectory extends BaseDirectoryTestCase {
@Override
protected Directory getDirectory(Path path) throws IOException {
final Directory dir;
if (random().nextBoolean()) {
dir = newDirectory();
} else {
dir = newFSDirectory(path);
}
if (dir instanceof MockDirectoryWrapper) {
// test manipulates directory directly
((MockDirectoryWrapper)dir).setEnableVirusScanner(false);
}
return dir;
}
// we wrap the directory in slow stuff, so only run nightly
@Override @Nightly
public void testThreadSafety() throws Exception {
super.testThreadSafety();
}
public class TestDirectory extends LuceneTestCase {
// Test that different instances of FSDirectory can coexist on the same
// path, can read, write, and lock files.

View File

@ -30,7 +30,17 @@
<fileset dir="lib"/>
</path>
<path id="test.classpath"/>
<path id="test.classpath">
<pathelement location="${build.dir}/classes/java"/>
<pathelement location="${build.dir}/classes/test"/>
<path refid="classpath"/>
<path refid="junit-path"/>
</path>
<path id="junit.classpath">
<path refid="test.classpath"/>
<pathelement path="${java.class.path}"/>
</path>
<!--
Specialize compile-core to depend on lucene-core and lucene-codecs compilation.
@ -38,16 +48,11 @@
<target name="compile-core" depends="init,compile-lucene-core,compile-codecs,common.compile-core"
description="Compiles test-framework classes"/>
<!-- redefine the clover setup, because we dont want to run clover for the test-framework -->
<target name="-clover.setup" if="run.clover"/>
<!-- redefine the test compilation, so it's just a no-op -->
<target name="compile-test"/>
<!-- redefine the forbidden apis for tests, as we check ourselves - no sysout testing -->
<target name="-check-forbidden-tests" depends="-init-forbidden-apis,compile-core">
<forbidden-apis suppressAnnotation="**.SuppressForbidden" signaturesFile="${common.dir}/tools/forbiddenApis/tests.txt" classpathref="forbidden-apis.allclasses.classpath">
<fileset dir="${build.dir}/classes/java"/>
<fileset dir="${build.dir}/classes/test"/>
</forbidden-apis>
</target>
<target name="-check-forbidden-sysout"/>

View File

@ -18,19 +18,14 @@ package org.apache.lucene.codecs.asserting;
*/
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.index.BasePostingsFormatTestCase;
import org.apache.lucene.index.BaseDocValuesFormatTestCase;
/** Test AssertingPostingsFormat directly */
public class TestAssertingDocValuesFormat extends BasePostingsFormatTestCase {
/** Test AssertingDocValuesFormat directly */
public class TestAssertingDocValuesFormat extends BaseDocValuesFormatTestCase {
private final Codec codec = new AssertingCodec();
@Override
protected Codec getCodec() {
return codec;
}
@Override
protected boolean isPostingsEnumReuseImplemented() {
return false;
}
}

View File

@ -18,10 +18,10 @@ package org.apache.lucene.codecs.asserting;
*/
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.index.BaseStoredFieldsFormatTestCase;
import org.apache.lucene.index.BaseTermVectorsFormatTestCase;
/** Test AssertingStoredFieldsFormat directly */
public class TestAssertingTermVectorsFormat extends BaseStoredFieldsFormatTestCase {
/** Test AssertingTermVectorsFormat directly */
public class TestAssertingTermVectorsFormat extends BaseTermVectorsFormatTestCase {
private final Codec codec = new AssertingCodec();
@Override

View File

@ -18,15 +18,34 @@ package org.apache.lucene.store;
*/
import java.io.IOException;
import java.nio.file.Path;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.LuceneTestCase.Nightly;
public class TestMockDirectoryWrapper extends LuceneTestCase {
public class TestMockDirectoryWrapper extends BaseDirectoryTestCase {
@Override
protected Directory getDirectory(Path path) throws IOException {
final MockDirectoryWrapper dir;
if (random().nextBoolean()) {
dir = newMockDirectory();
} else {
dir = newMockFSDirectory(path);
}
dir.setEnableVirusScanner(false); // test manipulates filesystem directly
return dir;
}
// we wrap the directory in slow stuff, so only run nightly
@Override @Nightly
public void testThreadSafety() throws Exception {
super.testThreadSafety();
}
public void testFailIfIndexWriterNotClosed() throws IOException {
MockDirectoryWrapper dir = newMockDirectory();
@ -103,6 +122,5 @@ public class TestMockDirectoryWrapper extends LuceneTestCase {
iw.commit();
iw.close();
dir.close();
}
}
}

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
import org.junit.After;
import org.junit.Assert;

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
import org.apache.lucene.codecs.Codec;
import org.junit.Assert;

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -19,7 +19,7 @@ package org.apache.lucene.util;
import java.util.concurrent.CountDownLatch;
import org.apache.lucene.util.junitcompat.WithNestedTests;
import org.apache.lucene.util.WithNestedTests;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

View File

@ -22,7 +22,7 @@ import org.junit.Assert;
/**
* Check large and special graphs.
*/
public class TestRamUsageEstimatorOnWildAnimals extends LuceneTestCase {
public class TestRamUsageTesterOnWildAnimals extends LuceneTestCase {
public static class ListElement {
ListElement next;
}

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more

View File

@ -1,4 +1,4 @@
package org.apache.lucene;
package org.apache.lucene.util;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Ignore;

View File

@ -1,4 +1,4 @@
package org.apache.lucene.util.junitcompat;
package org.apache.lucene.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more