Java tutorial
/** * Copyright 2015 DuraSpace, Inc. * * 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 org.fcrepo.client.integration; import java.util.concurrent.TimeUnit; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.fcrepo.client.FcrepoClient; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** * @author bbpennel */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/spring-test/test-container.xml") public abstract class AbstractResourceIT { protected static final int SERVER_PORT = Integer .parseInt(System.getProperty("fcrepo.dynamic.test.port", "8080")); protected static final String HOSTNAME = "localhost"; protected static final String serverAddress = "http://" + HOSTNAME + ":" + SERVER_PORT + "/rest/"; protected final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); protected static FcrepoClient client; protected AbstractResourceIT() { connectionManager.setMaxTotal(Integer.MAX_VALUE); connectionManager.setDefaultMaxPerRoute(20); connectionManager.closeIdleConnections(3, TimeUnit.SECONDS); } }