X-Git-Url: https://git.mdrn.pl/pylucene.git/blobdiff_plain/a2e61f0c04805cfcb8706176758d1283c7e3a55c..aaeed5504b982cf3545252ab528713250aa33eed:/lucene-java-3.4.0/lucene/contrib/facet/src/test/org/apache/lucene/facet/index/CategoryListPayloadStreamTest.java?ds=sidebyside diff --git a/lucene-java-3.4.0/lucene/contrib/facet/src/test/org/apache/lucene/facet/index/CategoryListPayloadStreamTest.java b/lucene-java-3.4.0/lucene/contrib/facet/src/test/org/apache/lucene/facet/index/CategoryListPayloadStreamTest.java deleted file mode 100644 index 218c1eb..0000000 --- a/lucene-java-3.4.0/lucene/contrib/facet/src/test/org/apache/lucene/facet/index/CategoryListPayloadStreamTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.apache.lucene.facet.index; - -import java.io.ByteArrayInputStream; - -import org.junit.Test; - -import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.facet.index.CategoryListPayloadStream; -import org.apache.lucene.util.encoding.DGapIntDecoder; -import org.apache.lucene.util.encoding.DGapIntEncoder; -import org.apache.lucene.util.encoding.IntDecoder; -import org.apache.lucene.util.encoding.NOnesIntDecoder; -import org.apache.lucene.util.encoding.NOnesIntEncoder; -import org.apache.lucene.util.encoding.UniqueValuesIntEncoder; - -/** - * 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. - */ - -public class CategoryListPayloadStreamTest extends LuceneTestCase { - - /** - * Verifies that a CategoryListPayloadStream can properly encode values into - * a byte stream for later constructing a Payload. - */ - @Test - public void testStream() throws Exception { - - CategoryListPayloadStream clps = new CategoryListPayloadStream( - new UniqueValuesIntEncoder(new DGapIntEncoder( - new NOnesIntEncoder(3)))); - - clps.appendIntToStream(1); - clps.appendIntToStream(10); - clps.appendIntToStream(100); - clps.appendIntToStream(1000); - clps.appendIntToStream(10000); - clps.appendIntToStream(100000); - clps.appendIntToStream(1000000); - clps.appendIntToStream(10000000); - clps.appendIntToStream(100000000); - clps.appendIntToStream(1000000000); - clps.appendIntToStream(Integer.MAX_VALUE); - - ByteArrayInputStream bais = new ByteArrayInputStream(clps - .convertStreamToByteArray()); - IntDecoder decoder = new DGapIntDecoder(new NOnesIntDecoder(3)); - decoder.reInit(bais); - assertEquals("Wrong value in byte stream", 1, decoder.decode()); - assertEquals("Wrong value in byte stream", 10, decoder.decode()); - assertEquals("Wrong value in byte stream", 100, decoder.decode()); - assertEquals("Wrong value in byte stream", 1000, decoder.decode()); - assertEquals("Wrong value in byte stream", 10000, decoder.decode()); - assertEquals("Wrong value in byte stream", 100000, decoder.decode()); - assertEquals("Wrong value in byte stream", 1000000, decoder.decode()); - assertEquals("Wrong value in byte stream", 10000000, decoder.decode()); - assertEquals("Wrong value in byte stream", 100000000, decoder.decode()); - assertEquals("Wrong value in byte stream", 1000000000, decoder.decode()); - assertEquals("Wrong value in byte stream", Integer.MAX_VALUE, decoder.decode()); - assertEquals("End of stream not reached", IntDecoder.EOS, decoder.decode()); - - clps.reset(); - decoder.reInit(bais); - assertEquals("End of stream not reached", IntDecoder.EOS, decoder.decode()); - } - -}