X-Git-Url: https://git.mdrn.pl/pylucene.git/blobdiff_plain/a2e61f0c04805cfcb8706176758d1283c7e3a55c..aaeed5504b982cf3545252ab528713250aa33eed:/lucene-java-3.4.0/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/PerfTaskTest.java?ds=sidebyside diff --git a/lucene-java-3.4.0/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/PerfTaskTest.java b/lucene-java-3.4.0/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/PerfTaskTest.java deleted file mode 100644 index 2133faa..0000000 --- a/lucene-java-3.4.0/lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/PerfTaskTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.apache.lucene.benchmark.byTask.tasks; - -/** - * 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 java.util.Properties; - -import org.apache.lucene.benchmark.BenchmarkTestCase; -import org.apache.lucene.benchmark.byTask.PerfRunData; -import org.apache.lucene.benchmark.byTask.utils.Config; - -/** Tests the functionality of the abstract {@link PerfTask}. */ -public class PerfTaskTest extends BenchmarkTestCase { - - private static final class MyPerfTask extends PerfTask { - - public MyPerfTask(PerfRunData runData) { - super(runData); - } - - @Override - public int doLogic() throws Exception { - return 0; - } - - public int getLogStep() { return logStep; } - - } - - private PerfRunData createPerfRunData(boolean setLogStep, int logStepVal, - boolean setTaskLogStep, int taskLogStepVal) throws Exception { - Properties props = new Properties(); - if (setLogStep) { - props.setProperty("log.step", Integer.toString(logStepVal)); - } - if (setTaskLogStep) { - props.setProperty("log.step.MyPerf", Integer.toString(taskLogStepVal)); - } - props.setProperty("directory", "RAMDirectory"); // no accidental FS dir. - Config config = new Config(props); - return new PerfRunData(config); - } - - private void doLogStepTest(boolean setLogStep, int logStepVal, - boolean setTaskLogStep, int taskLogStepVal, int expLogStepValue) throws Exception { - PerfRunData runData = createPerfRunData(setLogStep, logStepVal, setTaskLogStep, taskLogStepVal); - MyPerfTask mpt = new MyPerfTask(runData); - assertEquals(expLogStepValue, mpt.getLogStep()); - } - - public void testLogStep() throws Exception { - doLogStepTest(false, -1, false, -1, PerfTask.DEFAULT_LOG_STEP); - doLogStepTest(true, -1, false, -1, Integer.MAX_VALUE); - doLogStepTest(true, 100, false, -1, 100); - doLogStepTest(false, -1, true, -1, Integer.MAX_VALUE); - doLogStepTest(false, -1, true, 100, 100); - } - -}