lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/2] lucenenet git commit: Moved Codecs Tests to their rightful place + folder uppercasing
Date Tue, 20 Jan 2015 22:51:55 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 9d9e50f79 -> 5de15ec25


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/Memory/TestFSTPulsing41PostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/Memory/TestFSTPulsing41PostingsFormat.cs b/src/Lucene.Net.Tests.Codecs/Memory/TestFSTPulsing41PostingsFormat.cs
new file mode 100644
index 0000000..f1daa94
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/Memory/TestFSTPulsing41PostingsFormat.cs
@@ -0,0 +1,40 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+	/*
+	 * 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.
+	 */
+
+	using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+
+	/// <summary>
+	/// Tests FSTPulsing41PostingsFormat 
+	/// </summary>
+	public class TestFSTPulsing41PostingsFormat : BasePostingsFormatTestCase
+	{
+	  private readonly Codec codec = TestUtil.alwaysPostingsFormat(new FSTPulsing41PostingsFormat());
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return codec;
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/Memory/TestMemoryDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/Memory/TestMemoryDocValuesFormat.cs b/src/Lucene.Net.Tests.Codecs/Memory/TestMemoryDocValuesFormat.cs
new file mode 100644
index 0000000..f1f78c3
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/Memory/TestMemoryDocValuesFormat.cs
@@ -0,0 +1,45 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+	/*
+	 * 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.
+	 */
+
+	using BaseCompressingDocValuesFormatTestCase = org.apache.lucene.index.BaseCompressingDocValuesFormatTestCase;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+
+	/// <summary>
+	/// Tests MemoryDocValuesFormat
+	/// </summary>
+	public class TestMemoryDocValuesFormat : BaseCompressingDocValuesFormatTestCase
+	{
+	  private readonly Codec codec = TestUtil.alwaysDocValuesFormat(new MemoryDocValuesFormat());
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return codec;
+		  }
+	  }
+
+	  protected internal override bool codecAcceptsHugeBinaryValues(string field)
+	  {
+		return false;
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/Memory/TestMemoryPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/Memory/TestMemoryPostingsFormat.cs b/src/Lucene.Net.Tests.Codecs/Memory/TestMemoryPostingsFormat.cs
new file mode 100644
index 0000000..62da9a8
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/Memory/TestMemoryPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.memory
+{
+
+	/*
+	 * 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.
+	 */
+
+	using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+
+	/// <summary>
+	/// Tests MemoryPostingsFormat
+	/// </summary>
+	public class TestMemoryPostingsFormat : BasePostingsFormatTestCase
+	{
+	  // TODO: randomize doPack
+	  private readonly Codec codec = TestUtil.alwaysPostingsFormat(new MemoryPostingsFormat());
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return codec;
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/Properties/AssemblyInfo.cs b/src/Lucene.Net.Tests.Codecs/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..a54794e
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Lucene.Net.Codecs.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Lucene.Net.Codecs.Tests")]
+[assembly: AssemblyCopyright("Copyright ©  2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("39e5e0c8-c1d3-4583-b9f7-8fbd695e5601")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/Pulsing/Test10KPulsings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/Pulsing/Test10KPulsings.cs b/src/Lucene.Net.Tests.Codecs/Pulsing/Test10KPulsings.cs
new file mode 100644
index 0000000..c9fab57
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/Pulsing/Test10KPulsings.cs
@@ -0,0 +1,183 @@
+using System.Text;
+
+namespace org.apache.lucene.codecs.pulsing
+{
+
+	/*
+	 * 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.
+	 */
+
+
+	using MockAnalyzer = org.apache.lucene.analysis.MockAnalyzer;
+	using Document = org.apache.lucene.document.Document;
+	using Field = org.apache.lucene.document.Field;
+	using FieldType = org.apache.lucene.document.FieldType;
+	using TextField = org.apache.lucene.document.TextField;
+	using DocsEnum = org.apache.lucene.index.DocsEnum;
+	using IndexOptions = org.apache.lucene.index.FieldInfo.IndexOptions;
+	using IndexReader = org.apache.lucene.index.IndexReader;
+	using MultiFields = org.apache.lucene.index.MultiFields;
+	using RandomIndexWriter = org.apache.lucene.index.RandomIndexWriter;
+	using TermsEnum = org.apache.lucene.index.TermsEnum;
+	using DocIdSetIterator = org.apache.lucene.search.DocIdSetIterator;
+	using BaseDirectoryWrapper = org.apache.lucene.store.BaseDirectoryWrapper;
+	using LuceneTestCase = org.apache.lucene.util.LuceneTestCase;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+
+	/// <summary>
+	/// Pulses 10k terms/docs, 
+	/// originally designed to find JRE bugs (https://issues.apache.org/jira/browse/LUCENE-3335)
+	/// 
+	/// @lucene.experimental
+	/// </summary>
+//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent
attributes:
+//ORIGINAL LINE: @LuceneTestCase.Nightly public class Test10KPulsings extends org.apache.lucene.util.LuceneTestCase
+	public class Test10KPulsings : LuceneTestCase
+	{
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void test10kPulsed() throws Exception
+	  public virtual void test10kPulsed()
+	  {
+		// we always run this test with pulsing codec.
+		Codec cp = TestUtil.alwaysPostingsFormat(new Pulsing41PostingsFormat(1));
+
+		File f = createTempDir("10kpulsed");
+		BaseDirectoryWrapper dir = newFSDirectory(f);
+		dir.CheckIndexOnClose = false; // we do this ourselves explicitly
+		RandomIndexWriter iw = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(random())).setCodec(cp));
+
+		Document document = new Document();
+		FieldType ft = new FieldType(TextField.TYPE_STORED);
+
+		switch (TestUtil.Next(random(), 0, 2))
+		{
+		  case 0:
+			  ft.IndexOptions = IndexOptions.DOCS_ONLY;
+			  break;
+		  case 1:
+			  ft.IndexOptions = IndexOptions.DOCS_AND_FREQS;
+			  break;
+		  default:
+			  ft.IndexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+			  break;
+		}
+
+		Field field = newField("field", "", ft);
+		document.add(field);
+
+		NumberFormat df = new DecimalFormat("00000", new DecimalFormatSymbols(Locale.ROOT));
+
+		for (int i = 0; i < 10050; i++)
+		{
+		  field.StringValue = df.format(i);
+		  iw.addDocument(document);
+		}
+
+		IndexReader ir = iw.Reader;
+		iw.close();
+
+		TermsEnum te = MultiFields.getTerms(ir, "field").iterator(null);
+		DocsEnum de = null;
+
+		for (int i = 0; i < 10050; i++)
+		{
+		  string expected = df.format(i);
+		  assertEquals(expected, te.next().utf8ToString());
+		  de = TestUtil.docs(random(), te, null, de, DocsEnum.FLAG_NONE);
+		  assertTrue(de.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
+		  assertEquals(DocIdSetIterator.NO_MORE_DOCS, de.nextDoc());
+		}
+		ir.close();
+
+		TestUtil.checkIndex(dir);
+		dir.close();
+	  }
+
+	  /// <summary>
+	  /// a variant, that uses pulsing, but uses a high TF to force pass thru to the underlying
codec
+	  /// </summary>
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void test10kNotPulsed() throws Exception
+	  public virtual void test10kNotPulsed()
+	  {
+		// we always run this test with pulsing codec.
+		int freqCutoff = TestUtil.Next(random(), 1, 10);
+		Codec cp = TestUtil.alwaysPostingsFormat(new Pulsing41PostingsFormat(freqCutoff));
+
+		File f = createTempDir("10knotpulsed");
+		BaseDirectoryWrapper dir = newFSDirectory(f);
+		dir.CheckIndexOnClose = false; // we do this ourselves explicitly
+		RandomIndexWriter iw = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(random())).setCodec(cp));
+
+		Document document = new Document();
+		FieldType ft = new FieldType(TextField.TYPE_STORED);
+
+		switch (TestUtil.Next(random(), 0, 2))
+		{
+		  case 0:
+			  ft.IndexOptions = IndexOptions.DOCS_ONLY;
+			  break;
+		  case 1:
+			  ft.IndexOptions = IndexOptions.DOCS_AND_FREQS;
+			  break;
+		  default:
+			  ft.IndexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+			  break;
+		}
+
+		Field field = newField("field", "", ft);
+		document.add(field);
+
+		NumberFormat df = new DecimalFormat("00000", new DecimalFormatSymbols(Locale.ROOT));
+
+//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
+//ORIGINAL LINE: final int freq = freqCutoff + 1;
+		int freq = freqCutoff + 1;
+
+		for (int i = 0; i < 10050; i++)
+		{
+		  StringBuilder sb = new StringBuilder();
+		  for (int j = 0; j < freq; j++)
+		  {
+			sb.Append(df.format(i));
+			sb.Append(' '); // whitespace
+		  }
+		  field.StringValue = sb.ToString();
+		  iw.addDocument(document);
+		}
+
+		IndexReader ir = iw.Reader;
+		iw.close();
+
+		TermsEnum te = MultiFields.getTerms(ir, "field").iterator(null);
+		DocsEnum de = null;
+
+		for (int i = 0; i < 10050; i++)
+		{
+		  string expected = df.format(i);
+		  assertEquals(expected, te.next().utf8ToString());
+		  de = TestUtil.docs(random(), te, null, de, DocsEnum.FLAG_NONE);
+		  assertTrue(de.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
+		  assertEquals(DocIdSetIterator.NO_MORE_DOCS, de.nextDoc());
+		}
+		ir.close();
+
+		TestUtil.checkIndex(dir);
+		dir.close();
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/Pulsing/TestPulsingPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/Pulsing/TestPulsingPostingsFormat.cs b/src/Lucene.Net.Tests.Codecs/Pulsing/TestPulsingPostingsFormat.cs
new file mode 100644
index 0000000..249e8e1
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/Pulsing/TestPulsingPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.pulsing
+{
+
+	/*
+	 * 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.
+	 */
+
+	using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+
+	/// <summary>
+	/// Tests PulsingPostingsFormat
+	/// </summary>
+	public class TestPulsingPostingsFormat : BasePostingsFormatTestCase
+	{
+	  // TODO: randomize cutoff
+	  private readonly Codec codec = TestUtil.alwaysPostingsFormat(new Pulsing41PostingsFormat());
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return codec;
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/Pulsing/TestPulsingReuse.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/Pulsing/TestPulsingReuse.cs b/src/Lucene.Net.Tests.Codecs/Pulsing/TestPulsingReuse.cs
new file mode 100644
index 0000000..f35c108
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/Pulsing/TestPulsingReuse.cs
@@ -0,0 +1,134 @@
+using System.Collections.Generic;
+
+namespace org.apache.lucene.codecs.pulsing
+{
+
+	/*
+	 * 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.
+	 */
+
+
+	using MockAnalyzer = org.apache.lucene.analysis.MockAnalyzer;
+	using NestedPulsingPostingsFormat = org.apache.lucene.codecs.nestedpulsing.NestedPulsingPostingsFormat;
+	using Document = org.apache.lucene.document.Document;
+	using Field = org.apache.lucene.document.Field;
+	using TextField = org.apache.lucene.document.TextField;
+	using AtomicReader = org.apache.lucene.index.AtomicReader;
+	using DirectoryReader = org.apache.lucene.index.DirectoryReader;
+	using DocsAndPositionsEnum = org.apache.lucene.index.DocsAndPositionsEnum;
+	using DocsEnum = org.apache.lucene.index.DocsEnum;
+	using RandomIndexWriter = org.apache.lucene.index.RandomIndexWriter;
+	using TermsEnum = org.apache.lucene.index.TermsEnum;
+	using BaseDirectoryWrapper = org.apache.lucene.store.BaseDirectoryWrapper;
+	using Directory = org.apache.lucene.store.Directory;
+	using LuceneTestCase = org.apache.lucene.util.LuceneTestCase;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+
+	/// <summary>
+	/// Tests that pulsing codec reuses its enums and wrapped enums
+	/// </summary>
+	public class TestPulsingReuse : LuceneTestCase
+	{
+	  // TODO: this is a basic test. this thing is complicated, add more
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void testSophisticatedReuse() throws Exception
+	  public virtual void testSophisticatedReuse()
+	  {
+		// we always run this test with pulsing codec.
+		Codec cp = TestUtil.alwaysPostingsFormat(new Pulsing41PostingsFormat(1));
+		Directory dir = newDirectory();
+		RandomIndexWriter iw = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(random())).setCodec(cp));
+		Document doc = new Document();
+		doc.add(new TextField("foo", "a b b c c c d e f g g h i i j j k", Field.Store.NO));
+		iw.addDocument(doc);
+		DirectoryReader ir = iw.Reader;
+		iw.close();
+
+		AtomicReader segment = getOnlySegmentReader(ir);
+		DocsEnum reuse = null;
+		IDictionary<DocsEnum, bool?> allEnums = new IdentityHashMap<DocsEnum, bool?>();
+		TermsEnum te = segment.terms("foo").iterator(null);
+		while (te.next() != null)
+		{
+		  reuse = te.docs(null, reuse, DocsEnum.FLAG_NONE);
+		  allEnums[reuse] = true;
+		}
+
+		assertEquals(2, allEnums.Count);
+
+		allEnums.Clear();
+		DocsAndPositionsEnum posReuse = null;
+		te = segment.terms("foo").iterator(null);
+		while (te.next() != null)
+		{
+		  posReuse = te.docsAndPositions(null, posReuse);
+		  allEnums[posReuse] = true;
+		}
+
+		assertEquals(2, allEnums.Count);
+
+		ir.close();
+		dir.close();
+	  }
+
+	  /// <summary>
+	  /// tests reuse with Pulsing1(Pulsing2(Standard)) </summary>
+//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
+//ORIGINAL LINE: public void testNestedPulsing() throws Exception
+	  public virtual void testNestedPulsing()
+	  {
+		// we always run this test with pulsing codec.
+		Codec cp = TestUtil.alwaysPostingsFormat(new NestedPulsingPostingsFormat());
+		BaseDirectoryWrapper dir = newDirectory();
+		RandomIndexWriter iw = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(random())).setCodec(cp));
+		Document doc = new Document();
+		doc.add(new TextField("foo", "a b b c c c d e f g g g h i i j j k l l m m m", Field.Store.NO));
+		// note: the reuse is imperfect, here we would have 4 enums (lost reuse when we get an
enum for 'm')
+		// this is because we only track the 'last' enum we reused (not all).
+		// but this seems 'good enough' for now.
+		iw.addDocument(doc);
+		DirectoryReader ir = iw.Reader;
+		iw.close();
+
+		AtomicReader segment = getOnlySegmentReader(ir);
+		DocsEnum reuse = null;
+		IDictionary<DocsEnum, bool?> allEnums = new IdentityHashMap<DocsEnum, bool?>();
+		TermsEnum te = segment.terms("foo").iterator(null);
+		while (te.next() != null)
+		{
+		  reuse = te.docs(null, reuse, DocsEnum.FLAG_NONE);
+		  allEnums[reuse] = true;
+		}
+
+		assertEquals(4, allEnums.Count);
+
+		allEnums.Clear();
+		DocsAndPositionsEnum posReuse = null;
+		te = segment.terms("foo").iterator(null);
+		while (te.next() != null)
+		{
+		  posReuse = te.docsAndPositions(null, posReuse);
+		  allEnums[posReuse] = true;
+		}
+
+		assertEquals(4, allEnums.Count);
+
+		ir.close();
+		dir.close();
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/Sep/TestSepPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/Sep/TestSepPostingsFormat.cs b/src/Lucene.Net.Tests.Codecs/Sep/TestSepPostingsFormat.cs
new file mode 100644
index 0000000..72fef6f
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/Sep/TestSepPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.sep
+{
+
+	/*
+	 * 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.
+	 */
+
+	using MockSepPostingsFormat = org.apache.lucene.codecs.mocksep.MockSepPostingsFormat;
+	using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+	using TestUtil = org.apache.lucene.util.TestUtil;
+
+	/// <summary>
+	/// Tests sep layout
+	/// </summary>
+	public class TestSepPostingsFormat : BasePostingsFormatTestCase
+	{
+	  // TODO: randomize cutoff
+	  private readonly Codec codec = TestUtil.alwaysPostingsFormat(new MockSepPostingsFormat());
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return codec;
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextDocValuesFormat.cs b/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextDocValuesFormat.cs
new file mode 100644
index 0000000..a6b8681
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextDocValuesFormat.cs
@@ -0,0 +1,39 @@
+namespace org.apache.lucene.codecs.simpletext
+{
+
+	/*
+	 * 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.
+	 */
+
+	using BaseDocValuesFormatTestCase = org.apache.lucene.index.BaseDocValuesFormatTestCase;
+
+	/// <summary>
+	/// Tests SimpleTextDocValuesFormat
+	/// </summary>
+	public class TestSimpleTextDocValuesFormat : BaseDocValuesFormatTestCase
+	{
+	  private readonly Codec codec = new SimpleTextCodec();
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return codec;
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextPostingsFormat.cs b/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextPostingsFormat.cs
new file mode 100644
index 0000000..ff628f8
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextPostingsFormat.cs
@@ -0,0 +1,42 @@
+namespace org.apache.lucene.codecs.simpletext
+{
+
+	/*
+	 * 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.
+	 */
+
+	using BasePostingsFormatTestCase = org.apache.lucene.index.BasePostingsFormatTestCase;
+	using Nightly = org.apache.lucene.util.LuceneTestCase.Nightly;
+
+	/// <summary>
+	/// Tests SimpleText's postings
+	/// </summary>
+//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent
attributes:
+//ORIGINAL LINE: @Nightly public class TestSimpleTextPostingsFormat extends org.apache.lucene.index.BasePostingsFormatTestCase
+	public class TestSimpleTextPostingsFormat : BasePostingsFormatTestCase // please figure
out why I am so horrendously slow!
+	{
+	  private readonly Codec codec = new SimpleTextCodec();
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return codec;
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextStoredFieldsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextStoredFieldsFormat.cs b/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextStoredFieldsFormat.cs
new file mode 100644
index 0000000..2a7c3c2
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextStoredFieldsFormat.cs
@@ -0,0 +1,35 @@
+namespace org.apache.lucene.codecs.simpletext
+{
+
+	/*
+	 * 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.
+	 */
+
+	using BaseStoredFieldsFormatTestCase = org.apache.lucene.index.BaseStoredFieldsFormatTestCase;
+
+	public class TestSimpleTextStoredFieldsFormat : BaseStoredFieldsFormatTestCase
+	{
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return new SimpleTextCodec();
+		  }
+	  }
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5de15ec2/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextTermVectorsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextTermVectorsFormat.cs b/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextTermVectorsFormat.cs
new file mode 100644
index 0000000..ef41ca9
--- /dev/null
+++ b/src/Lucene.Net.Tests.Codecs/SimpleText/TestSimpleTextTermVectorsFormat.cs
@@ -0,0 +1,36 @@
+namespace org.apache.lucene.codecs.simpletext
+{
+
+	/*
+	 * 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.
+	 */
+
+	using BaseTermVectorsFormatTestCase = org.apache.lucene.index.BaseTermVectorsFormatTestCase;
+
+	public class TestSimpleTextTermVectorsFormat : BaseTermVectorsFormatTestCase
+	{
+
+	  protected internal override Codec Codec
+	  {
+		  get
+		  {
+			return new SimpleTextCodec();
+		  }
+	  }
+
+	}
+
+}
\ No newline at end of file


Mime
View raw message