Package org.sonatype.nexus.rest.model

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


    // *

    Assert.assertNotNull(settings.getGlobalRestApiSettings());

    // enable it, not that even the baseUrl is not set, it will be filled with a defaut one
    RestApiSettings restApiSettings = new RestApiSettings();
    settings.setGlobalRestApiSettings(restApiSettings);
    SettingsMessageUtil.save(settings);
    settings = SettingsMessageUtil.getCurrentSettings();

    Assert.assertNotNull(settings.getGlobalRestApiSettings());
    Assert.assertTrue(StringUtils.isNotEmpty(settings.getGlobalRestApiSettings().getBaseUrl()));
    Assert.assertEquals(settings.getGlobalRestApiSettings().isForceBaseUrl(), false);

    // now edit it
    restApiSettings.setBaseUrl("http://myhost/nexus");
    restApiSettings.setForceBaseUrl(true);
    settings.setGlobalRestApiSettings(restApiSettings);
    SettingsMessageUtil.save(settings);
    settings = SettingsMessageUtil.getCurrentSettings();

    Assert.assertNotNull(settings.getGlobalRestApiSettings());
View Full Code Here


      throws Exception
  {
    baseUrl = nexusBaseUrl.replace("nexus", "nexus1696").replace("http", "https");

    GlobalConfigurationResource settings = SettingsMessageUtil.getCurrentSettings();
    RestApiSettings restApiSettings = new RestApiSettings();
    restApiSettings.setForceBaseUrl(true);
    restApiSettings.setBaseUrl(baseUrl);
    settings.setGlobalRestApiSettings(restApiSettings);

    SettingsMessageUtil.save(settings);
  }
View Full Code Here

      throws Exception
  {
    baseUrl = nexusBaseUrl;

    GlobalConfigurationResource settings = SettingsMessageUtil.getCurrentSettings();
    RestApiSettings restApiSettings = new RestApiSettings();
    restApiSettings.setForceBaseUrl(true);
    restApiSettings.setBaseUrl(baseUrl);
    settings.setGlobalRestApiSettings(restApiSettings);

    SettingsMessageUtil.save(settings);
  }
View Full Code Here

  public static RestApiSettings convert(GlobalRestApiSettings settings) {
    if (settings == null || !settings.isEnabled()) {
      return null;
    }

    RestApiSettings result = new RestApiSettings();

    result.setBaseUrl(settings.getBaseUrl());

    result.setForceBaseUrl(settings.isForceBaseUrl());

    result.setUiTimeout(settings.getUITimeout() / 1000);

    return result;
  }
View Full Code Here

  public static RestApiSettings convert(CRestApiSettings settings) {
    if (settings == null) {
      return null;
    }

    RestApiSettings result = new RestApiSettings();

    result.setBaseUrl(settings.getBaseUrl());

    result.setForceBaseUrl(settings.isForceBaseUrl());

    result.setUiTimeout(settings.getUiTimeout() / 1000);

    return result;
  }
View Full Code Here

          else {
            getNexusConfiguration().setAnonymousAccess(false, null, null);
          }

          if (resource.getGlobalRestApiSettings() != null) {
            RestApiSettings restApiSettings = resource.getGlobalRestApiSettings();

            getGlobalRestApiSettings().setForceBaseUrl(restApiSettings.isForceBaseUrl());

            if (StringUtils.isEmpty(resource.getGlobalRestApiSettings().getBaseUrl())) {
              getGlobalRestApiSettings().setBaseUrl(null);
            }
            else {
              getGlobalRestApiSettings().setBaseUrl(
                  new Reference(restApiSettings.getBaseUrl()).getTargetRef().toString());
            }

            getGlobalRestApiSettings().setUITimeout(restApiSettings.getUiTimeout() * 1000);
          }
          else {
            getGlobalRestApiSettings().disable();
          }

View Full Code Here

    resource.setGlobalConnectionSettings(convert(readDefaultGlobalRemoteConnectionSettings()));

    resource.setRemoteProxySettings(convert(readDefaultRemoteProxySettings()));

    RestApiSettings restApiSettings = convert(readDefaultRestApiSettings());
    if (restApiSettings != null) {
      restApiSettings.setBaseUrl(getContextRoot(request).getTargetRef().toString());
    }
    resource.setGlobalRestApiSettings(restApiSettings);

    resource.setSmtpSettings(convert(readDefaultSmtpConfiguration()));
  }
View Full Code Here

    resource.setGlobalConnectionSettings(convert(getGlobalRemoteConnectionSettings()));

    resource.setRemoteProxySettings(convert(getGlobalRemoteProxySettings()));

    RestApiSettings restApiSettings = convert(getGlobalRestApiSettings());
    if (restApiSettings != null && StringUtils.isEmpty(restApiSettings.getBaseUrl())) {
      restApiSettings.setBaseUrl(getContextRoot(request).getTargetRef().toString());
    }
    resource.setGlobalRestApiSettings(restApiSettings);

    resource.setSmtpSettings(convert(getNexusEmailer()));
  }
View Full Code Here

    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");
View Full Code Here

    configuration.setGlobalRestApiSettings(settings);
  }

  @Override
  protected RestApiSettings createSettings() {
    return new RestApiSettings();
  }
View Full Code Here

TOP

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

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.