org.sonatype.nexus.repository.rest.api.model.HttpClientConnectionAttributes Java Examples

The following examples show how to use org.sonatype.nexus.repository.rest.api.model.HttpClientConnectionAttributes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: P2ResourceITSupport.java    From nexus-repository-p2 with Eclipse Public License 1.0 5 votes vote down vote up
protected AbstractRepositoryApiRequest createProxyRequest(boolean strictContentTypeValidation) {
  StorageAttributes storage =
      new StorageAttributes("default", strictContentTypeValidation);
  CleanupPolicyAttributes cleanup = new CleanupPolicyAttributes(Collections.emptyList());
  ProxyAttributes proxy = new ProxyAttributes(REMOTE_URL, 1, 2);
  NegativeCacheAttributes negativeCache = new NegativeCacheAttributes(false, 1440);
  HttpClientConnectionAttributes connection =
      new HttpClientConnectionAttributes(1, null, 5, false, false);
  HttpClientAttributes httpClient = new HttpClientAttributes(false, true, connection, null);

  // SET YOUR FORMAT DATA
  return new P2ProxyRepositoryApiRequest(PROXY_NAME, true, storage, cleanup,
      proxy, negativeCache,
      httpClient, null);
}
 
Example #2
Source File: ResourceITSupport.java    From nexus-repository-helm with Eclipse Public License 1.0 5 votes vote down vote up
protected AbstractRepositoryApiRequest createProxyRequest(boolean strictContentTypeValidation) {
  HostedStorageAttributes storage =
      new HostedStorageAttributes("default", strictContentTypeValidation, WritePolicy.ALLOW.name());
  CleanupPolicyAttributes cleanup = new CleanupPolicyAttributes(Collections.emptyList());
  ProxyAttributes proxy = new ProxyAttributes("http://example.net", 1, 2);
  NegativeCacheAttributes negativeCache = new NegativeCacheAttributes(false, 1440);
  HttpClientConnectionAttributes connection =
      new HttpClientConnectionAttributes(1, null, 5, false, false);
  HttpClientAttributes httpClient = new HttpClientAttributes(false, true, connection, null);

  // SET YOUR FORMAT DATA
  return new HelmProxyRepositoryApiRequest(PROXY_NAME, true, storage, cleanup,
      proxy, negativeCache,
      httpClient, null);
}
 
Example #3
Source File: RResourceITSupport.java    From nexus-repository-r with Eclipse Public License 1.0 5 votes vote down vote up
protected AbstractRepositoryApiRequest createProxyRequest(final boolean strictContentValidation) {
  StorageAttributes storage = new StorageAttributes("default", strictContentValidation);
  CleanupPolicyAttributes cleanup = new CleanupPolicyAttributes(Collections.emptyList());
  ProxyAttributes proxy = new ProxyAttributes(REMOTE_URL, 1, 2);
  NegativeCacheAttributes negativeCache = new NegativeCacheAttributes(false, 1440);
  HttpClientConnectionAttributes connection = new HttpClientConnectionAttributes(1, null, 5, false, false);
  HttpClientAttributes httpClient = new HttpClientAttributes(false, true, connection, null);

  return new RProxyRepositoryApiRequest(PROXY_NAME, true, storage, cleanup,
      proxy, negativeCache,
      httpClient, null);
}
 
Example #4
Source File: ConanResourceITSupport.java    From nexus-repository-conan with Eclipse Public License 1.0 5 votes vote down vote up
protected AbstractRepositoryApiRequest createProxyRequest(boolean strictContentTypeValidation) {
  StorageAttributes storage =
      new StorageAttributes("default", strictContentTypeValidation);
  CleanupPolicyAttributes cleanup = new CleanupPolicyAttributes(Collections.emptyList());
  ProxyAttributes proxy = new ProxyAttributes(REMOTE_URL, 1, 2);
  NegativeCacheAttributes negativeCache = new NegativeCacheAttributes(false, 1440);
  HttpClientConnectionAttributes connection =
      new HttpClientConnectionAttributes(1, null, 5, false, false);
  HttpClientAttributes httpClient = new HttpClientAttributes(false, true, connection, null);

  // SET YOUR FORMAT DATA
  return new ConanProxyRepositoryApiRequest(PROXY_NAME, true, storage, cleanup,
      proxy, negativeCache,
      httpClient, null);
}
 
Example #5
Source File: ProxyRepositoryApiRequestToConfigurationConverter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void convertHttpClient(final T request, final Configuration configuration) {
  HttpClientAttributes httpClient = request.getHttpClient();
  if (nonNull(httpClient)) {
    NestedAttributesMap httpClientConfiguration = configuration.attributes("httpclient");
    httpClientConfiguration.set("blocked", httpClient.getBlocked());
    httpClientConfiguration.set("autoBlock", httpClient.getAutoBlock());
    HttpClientConnectionAttributes connection = httpClient.getConnection();
    NestedAttributesMap connectionConfiguration = httpClientConfiguration.child("connection");
    convertConnection(connection, connectionConfiguration);
    convertAuthentication(httpClient, httpClientConfiguration);
  }
}
 
Example #6
Source File: ProxyRepositoryApiRequestToConfigurationConverter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private void convertConnection(
    final HttpClientConnectionAttributes connection,
    final NestedAttributesMap connectionConfiguration)
{
  if (nonNull(connection)) {
    connectionConfiguration.set("retries", connection.getRetries());
    connectionConfiguration.set("userAgentSuffix", connection.getUserAgentSuffix());
    connectionConfiguration.set("timeout", connection.getTimeout());
    connectionConfiguration.set("enableCircularRedirects", connection.getEnableCircularRedirects());
    connectionConfiguration.set("enableCookies", connection.getEnableCookies());
  }
}
 
Example #7
Source File: SimpleApiRepositoryAdapterTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private static void assertConnection(
    final HttpClientConnectionAttributes connection,
    final Boolean enableCircularRedirects,
    final Boolean enableCookies,
    final Integer retries,
    final Integer timeout,
    final String uaSuffix)
{
  assertThat(connection.getEnableCircularRedirects(), is(enableCircularRedirects));
  assertThat(connection.getEnableCookies(), is(enableCookies));
  assertThat(connection.getRetries(), is(retries));
  assertThat(connection.getTimeout(), is(timeout));
  assertThat(connection.getUserAgentSuffix(), is(uaSuffix));
}