@@ -0,0 +1,2235 @@
+/*%0A * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.b2international.index;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.io.IOException;%0Aimport java.util.Collection;%0A%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Aimport com.b2international.index.Fixtures.Data;%0Aimport com.b2international.index.query.Expressions;%0Aimport com.b2international.index.query.Query;%0Aimport com.google.common.base.Stopwatch;%0Aimport com.google.common.collect.ImmutableSet;%0A%0A/**%0A * @since 4.7%0A */%0Apublic class DocLoadPerformanceTest extends BaseIndexTest %7B%0A%0A%09protected static final int NOI = 1_000_000;%0A%0A%09@Override%0A%09protected Collection%3CClass%3C?%3E%3E getTypes() %7B%0A%09%09return ImmutableSet.%3CClass%3C?%3E%3Eof(Data.class);%0A%09%7D%0A%09%0A%09@Ignore%0A%09@Test%0A%09public void docLoadTest() throws Exception %7B%0A%09%09Stopwatch w = Stopwatch.createStarted();%0A%09%09index().write(new IndexWrite%3CVoid%3E() %7B%0A%09%09%09@Override%0A%09%09%09public Void execute(Writer index) throws IOException %7B%0A%09%09%09%09for (int i = 0; i %3C NOI; i++) %7B%0A%09%09%09%09%09index.put(String.valueOf(i), new Data(%22field1%22+i, %22field2%22+i));%0A%09%09%09%09%7D%0A%09%09%09%09index.commit();%0A%09%09%09%09return null;%0A%09%09%09%7D%0A%09%09%7D);%0A%09%09System.err.println(%22Index took: %22 + w);%0A%09%09%0A%09%09for (int i = 0; i %3C 10; i++) %7B%0A%09%09%09w.reset().start();%0A%09%09%09final Hits%3CData%3E hits = index().read(new IndexRead%3CHits%3CData%3E%3E() %7B%0A%09%09%09%09@Override%0A%09%09%09%09public Hits%3CData%3E execute(Searcher index) throws IOException %7B%0A%09%09%09%09%09return index.search(Query.builder(Data.class)%0A%09%09%09%09%09%09%09.selectAll()%0A%09%09%09%09%09%09%09.where(Expressions.matchAll())%0A%09%09%09%09%09%09%09.limit(Integer.MAX_VALUE)%0A%09%09%09%09%09%09%09.build());%0A%09%09%09%09%7D%0A%09%09%09%7D);%0A%09%09%09System.err.println(%22Docload took: %22 + w);%0A%09%09%09System.err.println(%22---------------%22);%0A%09%09%09assertEquals(NOI, hits.getHits().size());%0A%09%09%7D%0A%09%09%0A%09%7D%0A%0A%7D%0A

add DocLoadPerformanceTest