Skip to content

Commit c28e8e7

Browse files
author
Chris Wiechmann
committed
Merge branch 'develop' into test-with-7.7-20200130
2 parents b479808 + 3c5ddd7 commit c28e8e7

33 files changed

Lines changed: 860 additions & 102 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
### Fixed
9+
- Custom-Properties missing in API-Export (See issue [#13](https://github.com/Axway-API-Management-Plus/apim-cli/issues/13))
810

9-
## [0.0.9] 2020-04-08
11+
## [1.0.0] 2020-06-15
1012
### Added
11-
- Initial version
12-
- Refactored Swagger-Promote to support modularized approach
13-
- Migrated API-Import & Export to a dedicated module
14-
- Added new module to manage applications
13+
- Initial version of the APIM-CLI
14+
- Swagger-Promote completely refactored
15+
- Migrated API-Import & Export to dedicated modules
16+
- New modules to manage applications (Import and Export)
17+
- Get APIs and Applications (Filtered, different formats)
18+
- Delete APIs (Front and Backend)
19+
- Publish APIs
20+
- Introduced API-Management programming interface
21+
22+
### Fixed
23+
- Cannot set Oauth authentication Profile using its name (See issue [#2](https://github.com/Axway-API-Management-Plus/apim-cli/issues/2))

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,24 @@ Available commands and options:
2323
apim app - Manage your applications
2424
apim api - Manage your APIs
2525
```
26-
To get a list of commands for each group call for instance `apim app`:
26+
To get for instance a `wide` list of APIs on the stage: `prod` execute the following command:
27+
```
28+
apim api get -s prod -wide
29+
```
30+
```
31+
....
32+
+--------------------------------------+-----------------+----------------+---------+---------------------+-------------+-------------+----------+----------------------+
33+
| API-Id | Path | Name | Version | V-Host | State | Security | Policies | Organization |
34+
+--------------------------------------+-----------------+----------------+---------+---------------------+-------------+-------------+----------+----------------------+
35+
| 518b15c9-350c-47d8-9ad6-16ce02ef9dfe | /vhost-test-950 | VHost Test 950 | 1.0.0 | api123.customer.com | unpublished | passThrough | None | API Development 5538 |
36+
| 39b7b2aa-7df8-44e0-b399-4e9d59dbad6d | /vhost-test-411 | VHost Test 411 | 1.0.0 | api123.customer.com | published | passThrough | None | API Development 5916 |
37+
+--------------------------------------+-----------------+----------------+---------+---------------------+-------------+-------------+----------+----------------------+
38+
......
39+
```
2740

28-
For an up-to-date list of the supported groups and commands, see the [documentation](https://github.com/Axway-API-Management-Plus/apim-cli/wiki#supported-commands).
41+
To get a list of commands for each group call for instance `apim app`
2942

30-
The CLI is flexible and more commands will be added. You can find a list of available commands in the .
43+
The CLI is flexible and more commands will be added. For an up-to-date list of the supported groups and commands, see the [documentation](https://github.com/Axway-API-Management-Plus/apim-cli/wiki#supported-commands).
3144

3245
## Quality assurance process
3346
By using this CLI to control your Axway API management infrastructure it becomes a key component of your CI/CD process. Product quality is therefore very important so that you can be confident this CLI is doing what it's supposed to do.
@@ -38,11 +51,11 @@ The automated End-2-End test suite contains of __113__ different scenarios, whic
3851

3952
| Version | Branch | Status | Comment |
4053
| :--- | :--- | :---: | :--- |
41-
| 7.6.2 SP4 | develop | [![Build Status](https://travis-ci.org/Axway-API-Management-Plus/apim-cli.svg?branch=develop)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
42-
| 7.7.0 SP2 | test-with-7.7-SP2 | [![Build Status](https://travis-ci.org/Axway-API-Management-Plus/apim-cli.svg?branch=test-with-7.7-SP2)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
43-
| 7.7-20200130 | test-with-7.7-20200130 | [![Build Status](https://travis-ci.org/Axway-API-Management-Plus/apim-cli.svg?branch=test-with-7.7-20200130)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)|The release has been tested, but during automated testing, some of the quota tests are flaky.|
44-
| 7.7-20200331 | test-with-7.7-20200331 | [![Build Status](https://travis-ci.org/Axway-API-Management-Plus/apim-cli.svg?branch=test-with-7.7-20200331)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)|The release has been tested, but during automated testing, some of the quota tests are flaky.|
45-
| 7.7-2020053ß | test-with-7.7-20200530 | [![Build Status](https://travis-ci.org/Axway-API-Management-Plus/apim-cli.svg?branch=test-with-7.7-20200530)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)|The release has been tested, but during automated testing, some of the quota tests are flaky.|
54+
| 7.6.2 SP4 | develop | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/develop)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
55+
| 7.7.0 SP2 | test-with-7.7-SP2 | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/test-with-7.7-SP2)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
56+
| 7.7-20200130 | test-with-7.7-20200130 | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/test-with-7.7-20200130)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
57+
| 7.7-20200331 | test-with-7.7-20200331 | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/test-with-7.7-20200331)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
58+
| 7.7-20200530 | test-with-7.7-20200530 | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/test-with-7.7-20200530)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
4659

4760
Version 7.5.3 is NOT supported. Version 7.6.2 SP3 is required.
4861

distribution/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.github.axway-api-management-plus.apim-cli</groupId>
77
<artifactId>parent</artifactId>
8-
<version>1.0.0-RC2-SNAPSHOT</version>
8+
<version>1.1.0-SNAPSHOT</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

modules/api-export/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.github.axway-api-management-plus.apim-cli</groupId>
66
<artifactId>parent</artifactId>
7-
<version>1.0.0-RC2-SNAPSHOT</version>
7+
<version>1.1.0-SNAPSHOT</version>
88
<relativePath>../../pom.xml</relativePath>
99
</parent>
1010

modules/api-export/src/main/java/com/axway/apim/api/export/impl/APIResultHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import org.slf4j.Logger;
88
import org.slf4j.LoggerFactory;
99

10+
import com.axway.apim.adapter.APIManagerAdapter;
11+
import com.axway.apim.adapter.APIManagerAdapter.CUSTOM_PROP_TYPE;
1012
import com.axway.apim.adapter.apis.APIFilter;
1113
import com.axway.apim.adapter.apis.APIFilter.Builder;
14+
import com.axway.apim.adapter.apis.APIFilter.Builder.APIType;
1215
import com.axway.apim.adapter.apis.APIFilter.METHOD_TRANSLATION;
1316
import com.axway.apim.adapter.apis.APIFilter.POLICY_TRANSLATION;
14-
import com.axway.apim.adapter.apis.APIFilter.Builder.APIType;
1517
import com.axway.apim.api.API;
1618
import com.axway.apim.api.export.lib.APIExportParams;
1719
import com.axway.apim.lib.errorHandling.AppException;
@@ -75,6 +77,7 @@ protected Builder getBaseAPIFilterBuilder() {
7577
.hasId(params.getValue("id"))
7678
.hasName(params.getValue("name"))
7779
.hasState(params.getValue("state"))
80+
.includeCustomProperties(APIManagerAdapter.getAllConfiguredCustomProperties(CUSTOM_PROP_TYPE.api))
7881
.translateMethods(METHOD_TRANSLATION.AS_NAME)
7982
.translatePolicies(POLICY_TRANSLATION.TO_NAME);
8083
return builder;

modules/api-export/src/main/java/com/axway/apim/api/export/impl/ConsoleAPIExporter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private void printUltra(List<API> apis) {
7878
new Column().header("Policies").dataAlign(HorizontalAlign.LEFT).maxColumnWidth(30).with(api -> getUsedPolicies(api)),
7979
new Column().header("Organization").dataAlign(HorizontalAlign.LEFT).with(api -> api.getOrganization().getName()),
8080
new Column().header("Orgs").with(api -> getOrgCount(api)),
81-
new Column().header("Apps").with(api -> Integer.toString(api.getApplications().size())),
81+
new Column().header("Apps").with(api -> getAppCount(api)),
8282
new Column().header("Quotas").with(api -> Boolean.toString(hasQuota(api))),
8383
new Column().header("Tags").dataAlign(HorizontalAlign.LEFT).maxColumnWidth(30).with(api -> getTags(api))
8484
)));
@@ -138,13 +138,19 @@ private String getTags(API api) {
138138

139139
private String getOrgCount(API api) {
140140
try {
141+
if(api.getClientOrganizations()==null) return "N/A";
141142
return Integer.toString(api.getClientOrganizations().size());
142143
} catch (AppException e) {
143144
LOG.error("Error getting API client organization");
144145
return "Err";
145146
}
146147
}
147148

149+
private String getAppCount(API api) {
150+
if(api.getApplications()==null) return "N/A";
151+
return Integer.toString(api.getApplications().size());
152+
}
153+
148154
private String getUsedPolicies(API api) {
149155
List<String> policies = new ArrayList<String>();
150156
Iterator<OutboundProfile> it;

modules/api-export/src/test/java/com/axway/apim/export/test/basic/CompleteAPIExportTestIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.io.FileNotFoundException;
99
import java.io.IOException;
1010
import java.util.List;
11+
import java.util.Map;
1112

1213
import org.testng.annotations.Optional;
1314
import org.testng.annotations.Parameters;
@@ -127,6 +128,10 @@ private void exportAPI(TestContext context, boolean ignoreAdminAccount) throws F
127128
APIQuota exportedSystemQuota = mapper.convertValue(exportedAPIConfig.get("systemQuota"), new TypeReference<APIQuota>(){});
128129
assertEquals(importedSystemQuota, exportedSystemQuota, "systemQuota are not equal.");
129130
}
131+
132+
Map<String, String> importedCustomProperties = mapper.convertValue(importedAPIConfig.get("customProperties"), new TypeReference<Map<String, String>>(){});
133+
Map<String, String> exportedCustomProperties = mapper.convertValue(exportedAPIConfig.get("customProperties"), new TypeReference<Map<String, String>>(){});
134+
assertEquals(importedCustomProperties, exportedCustomProperties, "CustomProperties are not equal.");
130135

131136
assertEquals(exportedAPIConfig.get("caCerts").size(), 4);
132137

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.axway.apim.export.test.impl;
2+
3+
import java.io.IOException;
4+
import java.util.List;
5+
6+
import org.apache.commons.cli.ParseException;
7+
import org.testng.annotations.BeforeClass;
8+
import org.testng.annotations.Test;
9+
10+
import com.axway.apim.adapter.apis.APIManagerMockBase;
11+
import com.axway.apim.api.API;
12+
import com.axway.apim.api.export.impl.ConsoleAPIExporter;
13+
import com.axway.apim.api.export.lib.APIExportGetCLIOptions;
14+
import com.axway.apim.api.export.lib.APIExportParams;
15+
import com.axway.apim.lib.errorHandling.AppException;
16+
import com.fasterxml.jackson.core.JsonParseException;
17+
import com.fasterxml.jackson.core.type.TypeReference;
18+
import com.fasterxml.jackson.databind.JsonMappingException;
19+
import com.fasterxml.jackson.databind.MapperFeature;
20+
import com.fasterxml.jackson.databind.ObjectMapper;
21+
22+
public class ConsoleAPIExportTest extends APIManagerMockBase {
23+
24+
private static final String TEST_PACKAGE = "test/export/files/apiLists/";
25+
26+
ObjectMapper mapper = new ObjectMapper();
27+
28+
29+
@BeforeClass
30+
public void setTest() throws AppException, IOException {
31+
setupMockData();
32+
mapper.disable(MapperFeature.USE_ANNOTATIONS);
33+
}
34+
35+
@Test
36+
public void runStandardConsoleAPIExport() throws JsonParseException, JsonMappingException, IOException, AppException, ParseException {
37+
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<List<API>>(){});
38+
39+
APIExportParams cmdParams = new APIExportParams(new APIExportGetCLIOptions(new String[] {}));
40+
ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams);
41+
consoleExp.execute(apis);
42+
}
43+
44+
@Test
45+
public void runWideConsoleAPIExport() throws JsonParseException, JsonMappingException, IOException, AppException, ParseException {
46+
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<List<API>>(){});
47+
48+
APIExportParams cmdParams = new APIExportParams(new APIExportGetCLIOptions(new String[] {"-wide"}));
49+
ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams);
50+
consoleExp.execute(apis);
51+
}
52+
53+
@Test
54+
public void runUltraConsoleAPIExport() throws JsonParseException, JsonMappingException, IOException, AppException, ParseException {
55+
List<API> apis = mapper.readValue(this.getClass().getClassLoader().getResourceAsStream(TEST_PACKAGE + "three-apis-no-clientOrgs-and-clientApps.json"), new TypeReference<List<API>>(){});
56+
57+
APIExportParams cmdParams = new APIExportParams(new APIExportGetCLIOptions(new String[] {"-ultra"}));
58+
ConsoleAPIExporter consoleExp = new ConsoleAPIExporter(cmdParams);
59+
consoleExp.execute(apis);
60+
}
61+
}

0 commit comments

Comments
 (0)