X-Git-Url: https://git.mdrn.pl/pylucene.git/blobdiff_plain/a2e61f0c04805cfcb8706176758d1283c7e3a55c..aaeed5504b982cf3545252ab528713250aa33eed:/lucene-java-3.4.0/lucene/backwards/src/test/org/apache/lucene/search/TestThreadSafe.java diff --git a/lucene-java-3.4.0/lucene/backwards/src/test/org/apache/lucene/search/TestThreadSafe.java b/lucene-java-3.4.0/lucene/backwards/src/test/org/apache/lucene/search/TestThreadSafe.java deleted file mode 100755 index 110bb94..0000000 --- a/lucene-java-3.4.0/lucene/backwards/src/test/org/apache/lucene/search/TestThreadSafe.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.apache.lucene.search; -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.store.Directory; -import org.apache.lucene.index.IndexReader; -import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.index.IndexWriterConfig; -import org.apache.lucene.index.IndexWriterConfig.OpenMode; -import org.apache.lucene.analysis.MockAnalyzer; -import org.apache.lucene.document.*; - -import java.util.Random; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; -import java.io.IOException; - -public class TestThreadSafe extends LuceneTestCase { - Directory dir1; - - IndexReader ir1; - - class Thr extends Thread { - final int iter; - final Random rand; - final AtomicBoolean failed; - - // pass in random in case we want to make things reproducable - public Thr(int iter, Random rand, AtomicBoolean failed) { - this.iter = iter; - this.rand = rand; - this.failed = failed; - } - - @Override - public void run() { - try { - for (int i=0; i fields = doc.getFields(); - for (final Fieldable f : fields ) { - validateField(f); - } - - } - - } - - - void validateField(Fieldable f) { - String val = f.stringValue(); - if (!val.startsWith("^") || !val.endsWith("$")) { - throw new RuntimeException("Invalid field:" + f.toString() + " val=" +val); - } - } - - String[] words = "now is the time for all good men to come to the aid of their country".split(" "); - - void buildDir(Directory dir, int nDocs, int maxFields, int maxFieldLen) throws IOException { - IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(10)); - for (int j=0; j