Search in sources :

Example 1 with AppExportParams

use of com.axway.apim.appexport.lib.AppExportParams in project apim-cli by Axway-API-Management-Plus.

the class ApplicationExportApp method delete.

@CLIServiceMethod(name = "delete", description = "Delete selected application(s) from the API-Manager")
public static int delete(String[] args) {
    AppExportParams params;
    try {
        params = (AppExportParams) AppExportCLIOptions.create(args).getParams();
    } catch (AppException e) {
        LOG.error("Error " + e.getMessage());
        return e.getError().getCode();
    }
    ApplicationExportApp app = new ApplicationExportApp();
    return app.delete(params).getRc();
}
Also used : AppException(com.axway.apim.lib.errorHandling.AppException) AppExportParams(com.axway.apim.appexport.lib.AppExportParams) CLIServiceMethod(com.axway.apim.cli.CLIServiceMethod)

Example 2 with AppExportParams

use of com.axway.apim.appexport.lib.AppExportParams in project apim-cli by Axway-API-Management-Plus.

the class ApplicationExportApp method export.

@CLIServiceMethod(name = "get", description = "Get Applications from the API-Manager in different formats")
public static int export(String[] args) {
    AppExportParams params;
    try {
        params = (AppExportParams) AppExportCLIOptions.create(args).getParams();
    } catch (AppException e) {
        LOG.error("Error " + e.getMessage());
        return e.getError().getCode();
    }
    ApplicationExportApp app = new ApplicationExportApp();
    return app.export(params).getRc();
}
Also used : AppException(com.axway.apim.lib.errorHandling.AppException) AppExportParams(com.axway.apim.appexport.lib.AppExportParams) CLIServiceMethod(com.axway.apim.cli.CLIServiceMethod)

Example 3 with AppExportParams

use of com.axway.apim.appexport.lib.AppExportParams in project apim-cli by Axway-API-Management-Plus.

the class ExportAppTestAction method runTest.

@Override
public ExportResult runTest(TestContext context) {
    AppExportParams params = new AppExportParams();
    addParameters(params, context);
    params.setName(getVariable(context, PARAM_NAME));
    ApplicationExportApp app = new ApplicationExportApp();
    LOG.info("Running " + app.getClass().getSimpleName() + " with params: " + params);
    ExportResult result = app.export(params);
    if (this.getExpectedReturnCode(context) != result.getRc()) {
        throw new ValidationException("Expected RC was: " + this.getExpectedReturnCode(context) + " but got: " + result.getRc());
    }
    return result;
}
Also used : ValidationException(com.consol.citrus.exceptions.ValidationException) ApplicationExportApp(com.axway.apim.appexport.ApplicationExportApp) AppExportParams(com.axway.apim.appexport.lib.AppExportParams) ExportResult(com.axway.apim.lib.ExportResult)

Example 4 with AppExportParams

use of com.axway.apim.appexport.lib.AppExportParams in project apim-cli by Axway-API-Management-Plus.

the class AppCLIOptionsTest method testExportApplicationParameters.

@Test
public void testExportApplicationParameters() throws ParseException, AppException {
    String[] args = { "-s", "prod", "-n", "*My Great App*", "-id", "UUID-ID-OF-THE-APP", "-state", "pending", "-orgName", "*Partners*", "-createdBy", "Tom", "-credential", "*9877979779*", "-redirectUrl", "*localhost*", "-o", "json", "-wide" };
    CLIOptions options = AppExportCLIOptions.create(args);
    AppExportParams params = (AppExportParams) options.getParams();
    // Validate core parameters are included
    Assert.assertEquals(params.getUsername(), "apiadmin");
    Assert.assertEquals(params.getPassword(), "changeme");
    Assert.assertEquals(params.getHostname(), "localhost");
    // Validate standard export parameters are included
    Assert.assertEquals(params.getWide(), Wide.wide);
    Assert.assertEquals(params.getOutputFormat(), OutputFormat.json);
    // Validate App-Import parameters
    Assert.assertEquals(params.getName(), "*My Great App*");
    Assert.assertEquals(params.getId(), "UUID-ID-OF-THE-APP");
    Assert.assertEquals(params.getState(), "pending");
    Assert.assertEquals(params.getOrgName(), "*Partners*");
    Assert.assertEquals(params.getCreatedBy(), "Tom");
    Assert.assertEquals(params.getCredential(), "*9877979779*");
    Assert.assertEquals(params.getRedirectUrl(), "*localhost*");
    Assert.assertNotNull(params.getProperties(), "Properties should never be null. They must be created as a base or per stage.");
}
Also used : AppImportCLIOptions(com.axway.apim.appimport.lib.AppImportCLIOptions) CLIOptions(com.axway.apim.lib.CLIOptions) AppExportCLIOptions(com.axway.apim.appexport.lib.AppExportCLIOptions) AppExportParams(com.axway.apim.appexport.lib.AppExportParams) Test(org.testng.annotations.Test)

Aggregations

AppExportParams (com.axway.apim.appexport.lib.AppExportParams)4 CLIServiceMethod (com.axway.apim.cli.CLIServiceMethod)2 AppException (com.axway.apim.lib.errorHandling.AppException)2 ApplicationExportApp (com.axway.apim.appexport.ApplicationExportApp)1 AppExportCLIOptions (com.axway.apim.appexport.lib.AppExportCLIOptions)1 AppImportCLIOptions (com.axway.apim.appimport.lib.AppImportCLIOptions)1 CLIOptions (com.axway.apim.lib.CLIOptions)1 ExportResult (com.axway.apim.lib.ExportResult)1 ValidationException (com.consol.citrus.exceptions.ValidationException)1 Test (org.testng.annotations.Test)1