001/**
002 * Copyright 2015 DuraSpace, Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.fcrepo.client.integration;
018
019import java.util.concurrent.TimeUnit;
020
021import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
022import org.fcrepo.client.FcrepoClient;
023import org.junit.runner.RunWith;
024import org.springframework.test.context.ContextConfiguration;
025import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
026
027/**
028 * @author bbpennel
029 */
030@RunWith(SpringJUnit4ClassRunner.class)
031@ContextConfiguration("/spring-test/test-container.xml")
032public abstract class AbstractResourceIT {
033
034    protected static final int SERVER_PORT = Integer.parseInt(System
035            .getProperty("fcrepo.dynamic.test.port", "8080"));
036
037    protected static final String HOSTNAME = "localhost";
038
039    protected static final String serverAddress = "http://" + HOSTNAME + ":" +
040            SERVER_PORT + "/rest/";
041
042    protected final PoolingHttpClientConnectionManager connectionManager =
043            new PoolingHttpClientConnectionManager();
044
045    protected static FcrepoClient client;
046
047    protected AbstractResourceIT() {
048        connectionManager.setMaxTotal(Integer.MAX_VALUE);
049        connectionManager.setDefaultMaxPerRoute(20);
050        connectionManager.closeIdleConnections(3, TimeUnit.SECONDS);
051    }
052}