root / extensions / apachehc / src / test / java / org / jclouds / http / apachehc / ApacheHCHttpCommandExecutorServiceTest.java @ 35e7942d
History | View | Annotate | Download (2.1 kB)
1 |
/**
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
4 |
*
|
5 |
* ====================================================================
|
6 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
7 |
* you may not use this file except in compliance with the License.
|
8 |
* You may obtain a copy of the License at
|
9 |
*
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0
|
11 |
*
|
12 |
* Unless required by applicable law or agreed to in writing, software
|
13 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
14 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 |
* See the License for the specific language governing permissions and
|
16 |
* limitations under the License.
|
17 |
* ====================================================================
|
18 |
*/
|
19 |
package org.jclouds.http.apachehc; |
20 |
|
21 |
import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS; |
22 |
import static org.jclouds.Constants.*; |
23 |
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST; |
24 |
import static org.jclouds.Constants.PROPERTY_USER_THREADS; |
25 |
|
26 |
import java.util.Properties; |
27 |
|
28 |
import org.jclouds.http.BaseHttpCommandExecutorServiceIntegrationTest; |
29 |
import org.jclouds.http.apachehc.config.ApacheHCHttpCommandExecutorServiceModule; |
30 |
import org.testng.annotations.Test; |
31 |
|
32 |
import com.google.inject.Module; |
33 |
|
34 |
/**
|
35 |
* Tests the functionality of the {@link ApacheHCHttpCommandExecutorService}
|
36 |
*
|
37 |
* @author Adrian Cole
|
38 |
*/
|
39 |
@Test
|
40 |
public class ApacheHCHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorServiceIntegrationTest { |
41 |
static {
|
42 |
System.setProperty("http.conn-manager.timeout", 1000 + ""); |
43 |
} |
44 |
|
45 |
protected Module createConnectionModule() {
|
46 |
return new ApacheHCHttpCommandExecutorServiceModule(); |
47 |
} |
48 |
|
49 |
protected void addConnectionProperties(Properties props) { |
50 |
props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 20 + ""); |
51 |
props.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + ""); |
52 |
props.setProperty(PROPERTY_CONNECTION_TIMEOUT, 100 + ""); |
53 |
props.setProperty(PROPERTY_SO_TIMEOUT, 100 + ""); |
54 |
props.setProperty(PROPERTY_IO_WORKER_THREADS, 3 + ""); |
55 |
props.setProperty(PROPERTY_USER_THREADS, 0 + ""); |
56 |
} |
57 |
|
58 |
} |