Package org.sonatype.nexus.rest.model

Examples of org.sonatype.nexus.rest.model.GlobalConfigurationResourceResponse


  }

  public static GlobalConfigurationResource getCurrentSettings()
      throws IOException
  {
    return getData(new GlobalConfigurationResourceResponse());
  }
View Full Code Here


      throws IOException
  {
    Preconditions.checkNotNull(wrapper);
    String responseText = RequestFacade.doGetForText("service/local/global_settings/current");
    final XStreamRepresentation rep = new XStreamRepresentation(xstream, responseText, MediaType.APPLICATION_XML);
    final GlobalConfigurationResourceResponse configResponse =
        (GlobalConfigurationResourceResponse) rep.getPayload(wrapper);
    return configResponse.getData();
  }
View Full Code Here

  public static Status save(final GlobalConfigurationResource globalConfig)
      throws IOException
  {
    Preconditions.checkNotNull(globalConfig);
    final GlobalConfigurationResourceResponse configResponse = wrapData(globalConfig);
    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", MediaType.APPLICATION_XML);
    representation.setPayload(configResponse);
    return RequestFacade.doPutForStatus("service/local/global_settings/current", representation, null);
  }
View Full Code Here

   * @param resource the resource to wrap
   * @return a wrapper containing the resource
   */
  public static GlobalConfigurationResourceResponse wrapData(final GlobalConfigurationResource resource) {
    Preconditions.checkNotNull(resource);
    final GlobalConfigurationResourceResponse wrapper = new GlobalConfigurationResourceResponse();
    wrapper.setData(resource);
    return wrapper;
  }
View Full Code Here

  // ==

  @Override
  public Object getPayloadInstance() {
    return new GlobalConfigurationResourceResponse();
  }
View Full Code Here

      }
      else {
        fillCurrentConfiguration(request, resource);
      }

      GlobalConfigurationResourceResponse result = new GlobalConfigurationResourceResponse();

      result.setData(resource);

      return result;
    }
  }
View Full Code Here

    }
    else if (!CURRENT_CONFIG_NAME.equals(configurationName)) {
      throw new ResourceException(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
    }
    else {
      GlobalConfigurationResourceResponse configRequest = (GlobalConfigurationResourceResponse) payload;

      if (configRequest != null) {
        GlobalConfigurationResource resource = configRequest.getData();

        try {
          if (resource.getSmtpSettings() != null) {
            SmtpSettings settings = resource.getSmtpSettings();
View Full Code Here

    this.validateXmlHasNoPackageNames(resourceResponse);
  }

  @Test
  public void testGlobalConfigurationResourceResponse() {
    GlobalConfigurationResourceResponse resourceResponse = new GlobalConfigurationResourceResponse();

    GlobalConfigurationResource resource = new GlobalConfigurationResource();
    resource.setSecurityAnonymousAccessEnabled(true);
    resource.setSecurityAnonymousPassword("anonPass");
    resource.setSecurityAnonymousUsername("anonUser");
    // TODO: Figure out why this is causing test to fail...
    // resource.setSecurityRealms( Arrays.asList( "realm1", "realm2" ) );

    RestApiSettings restSet = new RestApiSettings();
    restSet.setBaseUrl("baseUrl");
    restSet.setForceBaseUrl(false);
    resource.setGlobalRestApiSettings(restSet);

    RemoteConnectionSettings connSet = new RemoteConnectionSettings();
    connSet.setConnectionTimeout(2);
    connSet.setQueryString("queryString");
    connSet.setRetrievalRetryCount(6);
    connSet.setUserAgentString("userAgentString");
    resource.setGlobalConnectionSettings(connSet);

    RemoteHttpProxySettingsDTO proxyHttpSet = new RemoteHttpProxySettingsDTO();
    proxyHttpSet.setProxyHostname("proxyHostname1");
    proxyHttpSet.setProxyPort(78);
    AuthenticationSettings authSet = new AuthenticationSettings();
    authSet.setNtlmDomain("ntlmDomain1");
    authSet.setNtlmHost("ntlmHost1");
    authSet.setPassword("password1");
    authSet.setUsername("username1");
    proxyHttpSet.setAuthentication(authSet);

    RemoteHttpProxySettingsDTO proxyHttpsSet = new RemoteHttpProxySettingsDTO();
    proxyHttpsSet.setProxyHostname("proxyHostname2");
    proxyHttpsSet.setProxyPort(87);
    AuthenticationSettings httpsAuthSet = new AuthenticationSettings();
    httpsAuthSet.setNtlmDomain("ntlmDomain2");
    httpsAuthSet.setNtlmHost("ntlmHost2");
    httpsAuthSet.setPassword("password2");
    httpsAuthSet.setUsername("username2");
    proxyHttpsSet.setAuthentication(httpsAuthSet);

    RemoteProxySettingsDTO proxySet = new RemoteProxySettingsDTO();
    proxySet.setHttpProxySettings(proxyHttpSet);
    proxySet.setHttpsProxySettings(proxyHttpsSet);

    resource.setRemoteProxySettings(proxySet);

    SmtpSettings smtpSet = new SmtpSettings();
    smtpSet.setHost("host");
    smtpSet.setPassword("password");
    smtpSet.setPort(42);
    smtpSet.setSslEnabled(true);
    smtpSet.setSystemEmailAddress("foo@bar.com");
    smtpSet.setTlsEnabled(true);
    smtpSet.setUsername("username");
    resource.setSmtpSettings(smtpSet);

    resourceResponse.setData(resource);

    this.marshalUnmarchalThenCompare(resourceResponse);
    this.validateXmlHasNoPackageNames(resourceResponse);
  }
View Full Code Here

    }
  }

  @VisibleForTesting
  void setConfiguration(final GlobalConfigurationResource configuration) {
    final GlobalConfigurationResourceResponse request = new GlobalConfigurationResourceResponse();
    request.setData(configuration);

    try {
      getNexusClient().serviceResource("global_settings/current").put(request);
    }
    catch (UniformInterfaceException e) {
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.rest.model.GlobalConfigurationResourceResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.