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