use of com.axway.apim.users.lib.params.UserExportParams in project apim-cli by Axway-API-Management-Plus.
the class UserCLIOptionsTest method testExportUserParameters.
@Test
public void testExportUserParameters() throws ParseException, AppException {
String[] args = { "-s", "prod", "-id", "UUID-ID-OF-THE-USER", "-loginName", "*mark24*", "-n", "*Mark*", "-email", "*@axway.com*", "-type", "external", "-org", "*Partner*", "-role", "oadmin", "-state", "pending", "-enabled", "false", "-o", "json" };
CLIOptions options = UserExportCLIOptions.create(args);
UserExportParams params = (UserExportParams) 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.standard);
Assert.assertEquals(params.getOutputFormat(), OutputFormat.json);
// Validate user filter parameters
Assert.assertEquals(params.getId(), "UUID-ID-OF-THE-USER");
Assert.assertEquals(params.getLoginName(), "*mark24*");
Assert.assertEquals(params.getName(), "*Mark*");
Assert.assertEquals(params.getEmail(), "*@axway.com*");
Assert.assertEquals(params.getType(), "external");
Assert.assertEquals(params.getOrg(), "*Partner*");
Assert.assertEquals(params.getRole(), "oadmin");
Assert.assertEquals(params.getState(), "pending");
Assert.assertFalse(params.isEnabled());
Assert.assertNotNull(params.getProperties(), "Properties should never be null. They must be created as a base or per stage.");
}
use of com.axway.apim.users.lib.params.UserExportParams 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;
}
use of com.axway.apim.users.lib.params.UserExportParams in project apim-cli by Axway-API-Management-Plus.
the class UserApp method export.
@CLIServiceMethod(name = "get", description = "Get users from API-Manager in different formats")
public static int export(String[] args) {
UserExportParams params;
try {
params = (UserExportParams) UserExportCLIOptions.create(args).getParams();
} catch (AppException e) {
LOG.error("Error " + e.getMessage());
return e.getError().getCode();
}
UserApp app = new UserApp();
return app.export(params).getRc();
}
use of com.axway.apim.users.lib.params.UserExportParams in project apim-cli by Axway-API-Management-Plus.
the class UserApp method delete.
@CLIServiceMethod(name = "delete", description = "Delete selected user(s) from the API-Manager")
public static int delete(String[] args) {
UserExportParams params;
try {
params = (UserExportParams) UserDeleteCLIOptions.create(args).getParams();
} catch (AppException e) {
LOG.error("Error " + e.getMessage());
return e.getError().getCode();
/*} catch (ParseException e) {
LOG.error("Error " + e.getMessage());
return ErrorCode.MISSING_PARAMETER.getCode();*/
}
UserApp app = new UserApp();
return app.delete(params).getRc();
}
use of com.axway.apim.users.lib.params.UserExportParams in project apim-cli by Axway-API-Management-Plus.
the class UserCLIOptionsTest method testEnabledToggleDefault.
@Test
public void testEnabledToggleDefault() throws ParseException, AppException {
String[] args = { "-s", "prod" };
CLIOptions options = UserExportCLIOptions.create(args);
UserExportParams params = (UserExportParams) options.getParams();
Assert.assertNull(params.isEnabled(), "Should be null, if not given");
}
Aggregations