/*
 * Copyright (C) 2008 feilong
 *
 * Licensed 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.
 */
package com.feilong.taglib.display.pager;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.feilong.json.jsonlib.JsonUtil;
import com.feilong.taglib.display.pager.command.PagerConstants;
import com.feilong.taglib.display.pager.command.PagerParams;

import static com.feilong.core.date.DateExtensionUtil.formatDuration;

public class IndexAndHrefMapTest extends BasePagerTest{

    /** The Constant LOGGER. */
    private static final Logger LOGGER = LoggerFactory.getLogger(IndexAndHrefMapTest.class);

    /**
     * Gets the all index and href map.
     * 
     * @throws IllegalArgumentException
     *             the illegal argument exception
     * @throws IllegalAccessException
     *             the illegal access exception
     * @throws InvocationTargetException
     *             the invocation target exception
     * @throws SecurityException
     *             the security exception
     * @throws NoSuchMethodException
     *             the no such method exception
     */
    @Test
    public void getAllIndexAndHrefMap() throws IllegalArgumentException,IllegalAccessException,InvocationTargetException,SecurityException,
                    NoSuchMethodException{

        int z = 80000;

        Date beginDate = new Date();

        Method declaredMethod = PagerBuilder.class.getDeclaredMethod("getAllIndexAndHrefMap", PagerParams.class, Set.class);
        declaredMethod.setAccessible(true);

        Set<Integer> set = new HashSet<>();
        set.add(PagerConstants.DEFAULT_TEMPLATE_PAGE_NO);

        for (int i = 100; i < 120; ++i){
            set.add(i);
        }
        PagerParams pagerParams = getPagerParams();
        LOGGER.debug(JsonUtil.format(pagerParams));

        for (int j = 0; j < z; ++j){
            //@SuppressWarnings({ "unchecked", "unused" })
            //Map<Integer, String> invoke = (Map<Integer, String>) 
            declaredMethod.invoke(PagerBuilder.class, pagerParams, set);
        }

        LOGGER.debug("{},time:{}", z, formatDuration(beginDate));
    }
}
@@ -635,16 +635,87 @@
 pager;%0A%0A
+import static com.feilong.core.date.DateExtensionUtil.formatDuration;%0A%0A
 import j
@@ -758,16 +758,16 @@
 eption;%0A
-
 import j
@@ -1116,79 +1116,8 @@
 s;%0A%0A
-import static com.feilong.core.date.DateExtensionUtil.formatDuration;%0A%0A
 publ
@@ -1299,500 +1299,8 @@
 );%0A%0A
-    /**%0A     * Gets the all index and href map.%0A     * %0A     * @throws IllegalArgumentException%0A     *             the illegal argument exception%0A     * @throws IllegalAccessException%0A     *             the illegal access exception%0A     * @throws InvocationTargetException%0A     *             the invocation target exception%0A     * @throws SecurityException%0A     *             the security exception%0A     * @throws NoSuchMethodException%0A     *             the no such method exception%0A     */%0A
     

update javadoc