use of com.axway.apim.lib.StandardImportParams in project apim-cli by Axway-API-Management-Plus.
the class JSONRemoteHostAdapterTest method testNonStagedMultiRemoteHosts.
@Test
public void testNonStagedMultiRemoteHosts() throws AppException {
StandardImportParams importParams = new StandardImportParams();
String configFileName = this.getClass().getClassLoader().getResource(PACKAGE + "two-remotehosts-config.json").getFile();
importParams.setConfig(configFileName);
JSONAPIManagerConfigAdapter adapter = new JSONAPIManagerConfigAdapter(importParams);
Map<String, RemoteHost> remoteHosts = adapter.getManagerConfig().getRemoteHosts();
Assert.assertEquals(remoteHosts.size(), 2, "Two Remote Hosts are expected");
RemoteHost remoteHost1 = remoteHosts.get("My-First-Remote-Host");
RemoteHost remoteHost2 = remoteHosts.get("My-Second-Remote-Host");
Assert.assertEquals(remoteHost1.getName(), "localhostrathna");
Assert.assertEquals(remoteHost1.getPort(), new Integer(80));
Assert.assertEquals(remoteHost1.getOrganization().getName(), "API Development");
Assert.assertEquals(remoteHost1.getCreatedBy().getName(), "API Administrator");
Assert.assertEquals(remoteHost1.getCreatedBy().getId(), "f60e3e05-cdf3-4b70-affc-4cb61a10f4bb");
Assert.assertEquals(remoteHost2.getName(), "samplehost.com");
Assert.assertEquals(remoteHost2.getPort(), new Integer(80));
Assert.assertEquals(remoteHost2.getOrganization().getName(), "FHIR");
Assert.assertEquals(remoteHost2.getCreatedBy().getName(), "Fred Smith");
Assert.assertEquals(remoteHost2.getCreatedBy().getLoginName(), "fred");
Assert.assertEquals(remoteHost2.getCreatedBy().getId(), "c888af4e-0728-4e82-880c-7cf490138220");
}
use of com.axway.apim.lib.StandardImportParams in project apim-cli by Axway-API-Management-Plus.
the class RemoteHostCLIOptionsTest method testSettingsImportParams.
@Test
public void testSettingsImportParams() throws ParseException, AppException {
String[] args = { "-c", "mySettings.json", "-stageConfig", "myStagedSettings.json" };
CLIOptions options = APIManagerSetupImportCLIOptions.create(args);
StandardImportParams params = (StandardImportParams) options.getParams();
Assert.assertEquals(params.getConfig(), "mySettings.json");
Assert.assertEquals(params.getStageConfig(), "myStagedSettings.json");
Assert.assertNotNull(params.getProperties(), "Properties should never be null. They must be created as a base or per stage.");
}
use of com.axway.apim.lib.StandardImportParams 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());
}
}
use of com.axway.apim.lib.StandardImportParams in project apim-cli by Axway-API-Management-Plus.
the class JSONAPIManagerConfigAdapterTest method testInvalidStagedConfig.
@Test
public void testInvalidStagedConfig() throws AppException {
StandardImportParams importParams = new StandardImportParams();
String configFileName = this.getClass().getClassLoader().getResource(PACKAGE + "apimanager-config.json").getFile();
importParams.setConfig(configFileName);
importParams.setStage("invalid-stage");
JSONAPIManagerConfigAdapter adapter = new JSONAPIManagerConfigAdapter(importParams);
APIManagerConfig managerConfig = adapter.getManagerConfig();
Assert.assertEquals(managerConfig.getConfig().getPortalName(), "My API Manager");
}
use of com.axway.apim.lib.StandardImportParams in project apim-cli by Axway-API-Management-Plus.
the class JSONAPIManagerConfigAdapterTest method testValidStagedConfig.
@Test
public void testValidStagedConfig() throws AppException {
StandardImportParams importParams = new StandardImportParams();
String configFileName = this.getClass().getClassLoader().getResource(PACKAGE + "apimanager-config.json").getFile();
importParams.setConfig(configFileName);
importParams.setStage("test-stage");
JSONAPIManagerConfigAdapter adapter = new JSONAPIManagerConfigAdapter(importParams);
APIManagerConfig managerConfig = adapter.getManagerConfig();
Assert.assertEquals(managerConfig.getConfig().getPortalName(), "Axway API Manager Test-Stage");
}
Aggregations