use of com.axway.apim.organization.lib.OrgImportParams in project apim-cli by Axway-API-Management-Plus.
the class JSONOrganizationAdapterTest method readManyOrgsWithStageTest.
@Test(expectedExceptions = AppException.class)
public void readManyOrgsWithStageTest() throws AppException {
String testFile = JSONOrganizationAdapterTest.class.getResource(testPackage + "/OrganizationArray.json").getPath();
assertTrue(new File(testFile).exists(), "Test file doesn't exists");
OrgImportParams importParams = new OrgImportParams();
importParams.setConfig(testFile);
importParams.setStage("test-stage");
JSONOrgAdapter adapter = new JSONOrgAdapter(importParams);
// Stage for a list of organizations is not supported!
adapter.getOrganizations();
}
use of com.axway.apim.organization.lib.OrgImportParams in project apim-cli by Axway-API-Management-Plus.
the class JSONOrganizationAdapterTest method readSingleOrgTest.
@Test
public void readSingleOrgTest() throws AppException {
String testFile = JSONOrganizationAdapterTest.class.getResource(testPackage + "/SingleOrganization.json").getPath();
assertTrue(new File(testFile).exists(), "Test file doesn't exists");
OrgImportParams importParams = new OrgImportParams();
importParams.setConfig(testFile);
JSONOrgAdapter adapter = new JSONOrgAdapter(importParams);
List<Organization> orgs = adapter.getOrganizations();
assertEquals(orgs.size(), 1, "Expected 1 org returned from the Adapter");
Organization org = orgs.get(0);
assertNotNull(org.getImage(), "Organization should have an image attached");
}
use of com.axway.apim.organization.lib.OrgImportParams in project apim-cli by Axway-API-Management-Plus.
the class JSONOrganizationAdapterTest method readSingleOrgTestWithStagedConfig.
@Test
public void readSingleOrgTestWithStagedConfig() throws AppException {
String testFile = JSONOrganizationAdapterTest.class.getResource(testPackage + "/SingleOrganization.json").getPath();
assertTrue(new File(testFile).exists(), "Test file doesn't exists");
OrgImportParams importParams = new OrgImportParams();
importParams.setConfig(testFile);
importParams.setStageConfig("StagedSingleOrganization.json");
JSONOrgAdapter adapter = new JSONOrgAdapter(importParams);
List<Organization> orgs = adapter.getOrganizations();
assertEquals(orgs.size(), 1, "Expected 1 org returned from the Adapter");
Organization org = orgs.get(0);
assertNotNull(org.getImage(), "Organization should have an image attached");
assertEquals(org.getDescription(), "Staged description for this organization");
}
use of com.axway.apim.organization.lib.OrgImportParams in project apim-cli by Axway-API-Management-Plus.
the class JSONOrganizationAdapterTest method readManyOrgsTest.
@Test
public void readManyOrgsTest() throws AppException {
String testFile = JSONOrganizationAdapterTest.class.getResource(testPackage + "/OrganizationArray.json").getPath();
assertTrue(new File(testFile).exists(), "Test file doesn't exists");
OrgImportParams importParams = new OrgImportParams();
importParams.setConfig(testFile);
JSONOrgAdapter adapter = new JSONOrgAdapter(importParams);
List<Organization> orgs = adapter.getOrganizations();
assertEquals(orgs.size(), 2, "Expected 2 apps returned from the Adapter");
}
use of com.axway.apim.organization.lib.OrgImportParams in project apim-cli by Axway-API-Management-Plus.
the class OrganizationApp method importOrganization.
@CLIServiceMethod(name = "import", description = "Import organizatio(s) into the API-Manager")
public static int importOrganization(String[] args) {
OrgImportParams params;
try {
params = (OrgImportParams) OrgImportCLIOptions.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();*/
}
OrganizationApp orgApp = new OrganizationApp();
return orgApp.importOrganization(params);
}
Aggregations