Search in sources :

Example 1 with TargetVersionResponse

use of com.emc.vipr.model.sys.TargetVersionResponse in project coprhd-controller by CoprHD.

the class UpgradeService method getTargetVersion.

/**
 * Show the current target version
 *
 * @brief Show the target version
 * @prereq none
 * @return Target version response
 */
@GET
@Path("target-version/")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public TargetVersionResponse getTargetVersion() {
    SoftwareVersion version = null;
    try {
        version = _coordinator.getTargetInfo(RepositoryInfo.class).getCurrentVersion();
    } catch (Exception e) {
        throw APIException.internalServerErrors.getObjectFromError("current version", "coordinator", e);
    }
    TargetVersionResponse resp = new TargetVersionResponse();
    resp.setTargetVersion(version.toString());
    return resp;
}
Also used : SoftwareVersion(com.emc.storageos.coordinator.client.model.SoftwareVersion) TargetVersionResponse(com.emc.vipr.model.sys.TargetVersionResponse) RemoteRepositoryException(com.emc.storageos.systemservices.exceptions.RemoteRepositoryException) ServiceUnavailableException(com.emc.storageos.svcs.errorhandling.resources.ServiceUnavailableException) InvalidSoftwareVersionException(com.emc.storageos.coordinator.exceptions.InvalidSoftwareVersionException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) LocalRepositoryException(com.emc.storageos.systemservices.exceptions.LocalRepositoryException) IOException(java.io.IOException) CoordinatorClientException(com.emc.storageos.systemservices.exceptions.CoordinatorClientException) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with TargetVersionResponse

use of com.emc.vipr.model.sys.TargetVersionResponse in project coprhd-controller by CoprHD.

the class DisasterRecoveryServiceTest method mockViPRSystemClient.

protected ViPRSystemClient mockViPRSystemClient(final String version) {
    class MockViPRSystemClient extends ViPRSystemClient {

        // .upgrade().getTargetVersion().getTargetVersion()
        @Override
        public com.emc.vipr.client.system.Upgrade upgrade() {
            com.emc.vipr.client.system.Upgrade upgrade = mock(com.emc.vipr.client.system.Upgrade.class);
            TargetVersionResponse targetVersionResponse = new TargetVersionResponse(version);
            doReturn(targetVersionResponse).when(upgrade).getTargetVersion();
            return upgrade;
        }
    }
    return new MockViPRSystemClient();
}
Also used : ViPRSystemClient(com.emc.vipr.client.ViPRSystemClient) TargetVersionResponse(com.emc.vipr.model.sys.TargetVersionResponse)

Aggregations

TargetVersionResponse (com.emc.vipr.model.sys.TargetVersionResponse)2 SoftwareVersion (com.emc.storageos.coordinator.client.model.SoftwareVersion)1 InvalidSoftwareVersionException (com.emc.storageos.coordinator.exceptions.InvalidSoftwareVersionException)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 ServiceUnavailableException (com.emc.storageos.svcs.errorhandling.resources.ServiceUnavailableException)1 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)1 LocalRepositoryException (com.emc.storageos.systemservices.exceptions.LocalRepositoryException)1 RemoteRepositoryException (com.emc.storageos.systemservices.exceptions.RemoteRepositoryException)1 ViPRSystemClient (com.emc.vipr.client.ViPRSystemClient)1 IOException (java.io.IOException)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1