Package org.sonatype.nexus.rest.model

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


  @Test
  public void checkState()
      throws Exception
  {
    StatusResource status = getNexusStatusUtil().getNexusStatus().getData();
    assertFalse(status.isFirstStart());
    assertTrue(status.isInstanceUpgraded());
    assertTrue(status.isConfigurationUpgraded());
  }
View Full Code Here


  {
    // initial nexus start upgraded config, so we just bounce it
    stopNexus();
    startNexus();

    StatusResource status = getNexusStatusUtil().getNexusStatus().getData();
    assertFalse(status.isFirstStart());
    assertFalse(status.isInstanceUpgraded());
    assertFalse(status.isConfigurationUpgraded());
  }
View Full Code Here

  @Test
  public void checkState()
      throws Exception
  {
    StatusResource status = getNexusStatusUtil().getNexusStatus().getData();
    assertTrue(status.isFirstStart());
    assertFalse(status.isInstanceUpgraded());
    assertFalse(status.isConfigurationUpgraded());
  }
View Full Code Here

  public void testSecurityDisabledStatus()
      throws Exception
  {

    NexusStatusUtil statusUtil = getNexusStatusUtil();
    StatusResource statusResource = statusUtil.getNexusStatus(true).getData();

    List<ClientPermission> permisisons = statusResource.getClientPermissions().getPermissions();

    Assert.assertTrue("Permissions are empty, expected a whole bunch, not zero.", permisisons.size() > 0);
    for (ClientPermission clientPermission : permisisons) {
      Assert.assertEquals(
          "Permission '" + clientPermission.getId() + "' should have had a value of '15', the value was" +
View Full Code Here

  public StatusResourceResponse get(Context context, Request request, Response response, Variant variant)
      throws ResourceException
  {
    final SystemStatus status = systemStatusProvider.get();

    final StatusResource resource = new StatusResource();

    resource.setAppName(status.getAppName());

    resource.setFormattedAppName(status.getFormattedAppName());

    resource.setVersion(status.getVersion());

    resource.setApiVersion(status.getApiVersion());

    resource.setEditionLong(status.getEditionLong());

    resource.setEditionShort(status.getEditionShort());

    resource.setAttributionsURL(status.getAttributionsURL());

    resource.setPurchaseURL(status.getPurchaseURL());

    resource.setUserLicenseURL(status.getUserLicenseURL());

    resource.setState(status.getState().toString());

    resource.setInitializedAt(status.getInitializedAt());

    resource.setStartedAt(status.getStartedAt());

    resource.setLastConfigChange(status.getLastConfigChange());

    resource.setFirstStart(status.isFirstStart());

    resource.setInstanceUpgraded(status.isInstanceUpgraded());

    resource.setConfigurationUpgraded(status.isConfigurationUpgraded());

    resource.setErrorCause(spit(status.getErrorCause()));

    // if ( status.getConfigurationValidationResponse() != null )
    // {
    // resource.setConfigurationValidationResponse( new StatusConfigurationValidationResponse() );
    //
    // resource.getConfigurationValidationResponse().setValid(
    // status.getConfigurationValidationResponse().isValid() );
    //
    // resource.getConfigurationValidationResponse().setModified(
    // status.getConfigurationValidationResponse().isModified() );
    //
    // for ( ValidationMessage msg : status.getConfigurationValidationResponse().getValidationErrors() )
    // {
    // resource.getConfigurationValidationResponse().addValidationError( msg.toString() );
    // }
    // for ( ValidationMessage msg : status.getConfigurationValidationResponse().getValidationWarnings() )
    // {
    // resource.getConfigurationValidationResponse().addValidationWarning( msg.toString() );
    // }
    // }

    final Form form = request.getResourceRef().getQueryAsForm();
    if (form.getFirst("perms") != null) {
      resource.setClientPermissions(getClientPermissions(request));
    }

    resource.setBaseUrl(BaseUrlHolder.get());

    resource.setLicenseInstalled(status.isLicenseInstalled());

    resource.setLicenseExpired(status.isLicenseExpired());

    resource.setTrialLicense(status.isTrialLicense());

    StatusResourceResponse result = new StatusResourceResponse();

    result.setData(resource);
View Full Code Here

  public void testStatusResourceResponse()
      throws ParseException
  {
    StatusResourceResponse resourceResponse = new StatusResourceResponse();

    StatusResource status = new StatusResource();
    NexusAuthenticationClientPermissions perms = new NexusAuthenticationClientPermissions();
    ClientPermission permission = new ClientPermission();
    permission.setId("id");
    permission.setValue(5);
    perms.addPermission(permission);
    perms.setLoggedIn(true);
    perms.setLoggedInUsername("fred");
    perms.setLoggedInUserSource("source");

    status.setClientPermissions(perms);
    status.setConfigurationUpgraded(true);
    status.setErrorCause("errorCause");
    status.setFirstStart(true);
    status.setInitializedAt(this.dateFormat.parse("01/01/2001"));
    status.setInstanceUpgraded(true);
    status.setLastConfigChange(this.dateFormat.parse("01/01/2002"));
    status.setOperationMode("operationMode");
    status.setStartedAt(this.dateFormat.parse("01/01/2003"));
    status.setState("STATE");
    status.setVersion("version");
    status.setApiVersion("apiversion");
    status.setAppName("appname");
    status.setBaseUrl("baseurl");
    status.setEditionLong("long edition name");
    status.setEditionShort("short");
    status.setAttributionsURL("http://my.attributions.com/url");
    status.setPurchaseURL("http://my.store.com/url");
    status.setUserLicenseURL("http://my.userlicense.com/url");

    status.setFormattedAppName("formatted");

    StatusConfigurationValidationResponse validation = new StatusConfigurationValidationResponse();
    validation.setModified(true);
    validation.setValid(true);

    validation.addValidationError("error1");
    validation.addValidationError("error2");

    validation.addValidationWarning("warning1");
    validation.addValidationWarning("warning2");
    status.setConfigurationValidationResponse(validation);

    resourceResponse.setData(status);

    this.marshalUnmarchalThenCompare(resourceResponse, this.xstreamXML); // FIXME: JSON READER CANNOT PARSE DATES
    // CORRECTLY.
View Full Code Here

  }

  @Override
  public NexusStatus getStatus() {
    try {
      final StatusResource response = serviceResource("status")
          .get(StatusResourceResponse.class)
          .getData();
      return new NexusStatus(response.getAppName(), response.getFormattedAppName(), response.getVersion(),
          response.getApiVersion(), response.getEditionLong(), response.getEditionShort(), response.getState(),
          response.getInitializedAt(), response.getStartedAt(), response.getLastConfigChange(), -1,
          response.isFirstStart(), response.isInstanceUpgraded(), response.isConfigurationUpgraded(),
          response.getBaseUrl());
    }
    catch (UniformInterfaceException e) {
      throw convert(e);
    }
    catch (ClientHandlerException e) {
View Full Code Here

        io.println("Requesting restart..."); // TODO: i18n

        client.ext(AdminClient.class).restart();

        StatusResource status = client.ext(BasicClient.class).status();
        io.println("State: {}", status.getState()); // TODO: i18n
       
        return Result.SUCCESS;
    }
View Full Code Here

        io.println("Requesting stop..."); // TODO: i18n

        client.ext(AdminClient.class).stop();

        StatusResource status = client.ext(BasicClient.class).status();
        io.println("State: {}", status.getState()); // TODO: i18n

        return Result.SUCCESS;
    }
View Full Code Here

        io.println("Requesting start..."); // TODO: i18n
       
        client.ext(AdminClient.class).start();

        StatusResource status = client.ext(BasicClient.class).status();
        io.println("State: {}", status.getState()); // TODO: i18n

        return Result.SUCCESS;
    }
View Full Code Here

TOP

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

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.