Search in sources :

Example 1 with ValidationException

use of com.consol.citrus.exceptions.ValidationException in project apim-cli by Axway-API-Management-Plus.

the class ImportAppTestAction method runTest.

@Override
public void runTest(TestContext context) {
    AppImportParams params = new AppImportParams();
    addParameters(params, context);
    params.setConfig(this.configFile.getPath());
    ClientApplicationImportApp app = new ClientApplicationImportApp();
    LOG.info("Running " + app.getClass().getSimpleName() + " with params: " + params);
    ImportResult result = app.importApp(params);
    if (this.getExpectedReturnCode(context) != result.getRc()) {
        throw new ValidationException("Expected RC was: " + this.getExpectedReturnCode(context) + " but got: " + result.getRc());
    }
}
Also used : AppImportParams(com.axway.apim.appimport.lib.AppImportParams) ImportResult(com.axway.apim.lib.ImportResult) ValidationException(com.consol.citrus.exceptions.ValidationException) ClientApplicationImportApp(com.axway.apim.appimport.ClientApplicationImportApp)

Example 2 with ValidationException

use of com.consol.citrus.exceptions.ValidationException in project apim-cli by Axway-API-Management-Plus.

the class CLIAbstractImportTestAction method copyTestAssets.

private void copyTestAssets(File sourceDir, File testDir) {
    if (!sourceDir.exists()) {
        throw new ValidationException("Unable to copy test assets to test directory: '" + testDir + "'. Could not find sourceDir: '" + sourceDir + "'");
    }
    FileFilter filter = new WildcardFileFilter(new String[] { "*.crt", "*.jpg", "*.png", "*.pem" });
    try {
        LOG.info("Copy *.crt, *.jpg, *.png, *.pem from source: " + sourceDir + " into test-dir: '" + testDir + "'");
        FileUtils.copyDirectory(sourceDir, testDir, filter, true);
    } catch (IOException e) {
        LOG.error("Unable to copy test assets from source: '" + sourceDir + "' into test directory: '" + testDir + "'", e);
    }
}
Also used : ValidationException(com.consol.citrus.exceptions.ValidationException) IOException(java.io.IOException) FileFilter(java.io.FileFilter) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Example 3 with ValidationException

use of com.consol.citrus.exceptions.ValidationException in project apim-cli by Axway-API-Management-Plus.

the class ExportManagerConfigTestAction method runTest.

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

Example 4 with ValidationException

use of com.consol.citrus.exceptions.ValidationException in project apim-cli by Axway-API-Management-Plus.

the class ImportManagerConfigTestAction method runTest.

@Override
public void runTest(TestContext context) {
    StandardImportParams params = new StandardImportParams();
    addParameters(params, context);
    params.setConfig(this.configFile.getPath());
    APIManagerSettingsApp app = new APIManagerSettingsApp();
    LOG.info("Running " + app.getClass().getSimpleName() + " with params: " + params);
    ImportResult result = app.importConfig(params);
    if (this.getExpectedReturnCode(context) != result.getRc()) {
        throw new ValidationException("Expected RC was: " + this.getExpectedReturnCode(context) + " but got: " + result.getRc());
    }
}
Also used : ImportResult(com.axway.apim.lib.ImportResult) ValidationException(com.consol.citrus.exceptions.ValidationException) StandardImportParams(com.axway.apim.lib.StandardImportParams) APIManagerSettingsApp(com.axway.apim.setup.APIManagerSettingsApp)

Example 5 with ValidationException

use of com.consol.citrus.exceptions.ValidationException in project apim-cli by Axway-API-Management-Plus.

the class ExportUserTestAction method runTest.

@Override
public ExportResult runTest(TestContext context) {
    UserExportParams params = new UserExportParams();
    addParameters(params, context);
    params.setLoginName(getParamLoginName(context));
    UserApp app = new UserApp();
    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 : UserExportParams(com.axway.apim.users.lib.params.UserExportParams) ValidationException(com.consol.citrus.exceptions.ValidationException) UserApp(com.axway.apim.users.UserApp) ExportResult(com.axway.apim.lib.ExportResult)

Aggregations

ValidationException (com.consol.citrus.exceptions.ValidationException)14 ExportResult (com.axway.apim.lib.ExportResult)4 ImportResult (com.axway.apim.lib.ImportResult)3 File (java.io.File)3 OrganizationApp (com.axway.apim.organization.OrganizationApp)2 APIManagerSettingsApp (com.axway.apim.setup.APIManagerSettingsApp)2 UserApp (com.axway.apim.users.UserApp)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 CustomResourceDefinitionContext (io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext)2 IOException (java.io.IOException)2 ApplicationExportApp (com.axway.apim.appexport.ApplicationExportApp)1 AppExportParams (com.axway.apim.appexport.lib.AppExportParams)1 ClientApplicationImportApp (com.axway.apim.appimport.ClientApplicationImportApp)1 AppImportParams (com.axway.apim.appimport.lib.AppImportParams)1 StandardImportParams (com.axway.apim.lib.StandardImportParams)1 OrgExportParams (com.axway.apim.organization.lib.OrgExportParams)1 OrgImportParams (com.axway.apim.organization.lib.OrgImportParams)1 APIManagerSetupExportParams (com.axway.apim.setup.lib.APIManagerSetupExportParams)1 UserImportParams (com.axway.apim.users.lib.UserImportParams)1 UserExportParams (com.axway.apim.users.lib.params.UserExportParams)1