format and imports
This commit is contained in:
parent
02c7bf1c3c
commit
b614988674
@ -33,7 +33,7 @@ public abstract class AbstractProcess {
|
|||||||
private static Logger log = LogManager.getLogger(AbstractProcess.class);
|
private static Logger log = LogManager.getLogger(AbstractProcess.class);
|
||||||
|
|
||||||
protected Gson gson;
|
protected Gson gson;
|
||||||
|
|
||||||
protected Yaml yaml;
|
protected Yaml yaml;
|
||||||
|
|
||||||
protected ConfigManager config = ConfigManager.getInstance();
|
protected ConfigManager config = ConfigManager.getInstance();
|
||||||
@ -41,7 +41,7 @@ public abstract class AbstractProcess {
|
|||||||
protected AbstractProcess() {
|
protected AbstractProcess() {
|
||||||
|
|
||||||
gson = new GsonBuilder().create();
|
gson = new GsonBuilder().create();
|
||||||
|
|
||||||
yaml = new Yaml();
|
yaml = new Yaml();
|
||||||
|
|
||||||
setTrustStoreCredentials();
|
setTrustStoreCredentials();
|
||||||
@ -310,7 +310,7 @@ public abstract class AbstractProcess {
|
|||||||
}
|
}
|
||||||
return listOfApis;
|
return listOfApis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common function used for upload API
|
* Common function used for upload API
|
||||||
*
|
*
|
||||||
@ -322,11 +322,11 @@ public abstract class AbstractProcess {
|
|||||||
*/
|
*/
|
||||||
protected static HttpResponse makeFileRequest(String method, String urlStr, Map<String, String> httpHeaders,
|
protected static HttpResponse makeFileRequest(String method, String urlStr, Map<String, String> httpHeaders,
|
||||||
byte[] buff, String attachmentFileName) throws Exception {
|
byte[] buff, String attachmentFileName) throws Exception {
|
||||||
|
|
||||||
if (buff==null) {
|
if (buff == null) {
|
||||||
log.error("Cannot send NULL payload to rest service.");
|
log.error("Cannot send NULL payload to rest service.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String crlf = "\r\n";
|
String crlf = "\r\n";
|
||||||
|
|
||||||
String twoHyphens = "--";
|
String twoHyphens = "--";
|
||||||
@ -369,14 +369,14 @@ public abstract class AbstractProcess {
|
|||||||
int responseCode = con.getResponseCode();
|
int responseCode = con.getResponseCode();
|
||||||
|
|
||||||
if (responseCode == 200 || responseCode == 201) {
|
if (responseCode == 200 || responseCode == 201) {
|
||||||
in = con.getInputStream();
|
in = con.getInputStream();
|
||||||
} else {
|
} else {
|
||||||
in = con.getErrorStream();
|
in = con.getErrorStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (in.available() > 0) {
|
while (in.available() > 0) {
|
||||||
int read = in.read(buf);
|
int read = in.read(buf);
|
||||||
res = res.concat(new String(buf, 0, read));
|
res = res.concat(new String(buf, 0, read));
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.setHeaders(con.getHeaderFields());
|
resp.setHeaders(con.getHeaderFields());
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package cz.trask.apioperator.impl;
|
package cz.trask.apioperator.impl;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -138,7 +137,8 @@ public class ExportToWso2 extends AbstractProcess {
|
|||||||
private int publishApiToWso2(String fileName, byte[] data, TokenResponse tokenResponse) {
|
private int publishApiToWso2(String fileName, byte[] data, TokenResponse tokenResponse) {
|
||||||
int responseCode = -1;
|
int responseCode = -1;
|
||||||
try {
|
try {
|
||||||
String url = config.getTargetPublisherApiUrl().concat(String.format("?preserveProvider=false&overwrite=true"));
|
String url = config.getTargetPublisherApiUrl()
|
||||||
|
.concat(String.format("?preserveProvider=false&overwrite=true"));
|
||||||
|
|
||||||
log.info("API Import URL: " + url);
|
log.info("API Import URL: " + url);
|
||||||
|
|
||||||
|
|||||||
@ -138,9 +138,9 @@ public class ImportToApicurio extends AbstractProcess {
|
|||||||
Collections.emptyMap(), true);
|
Collections.emptyMap(), true);
|
||||||
|
|
||||||
List<ZipEntryData> zipEntries = ZipExtractor.extractFilesFromZip(exportedZip.getResponseBytes());
|
List<ZipEntryData> zipEntries = ZipExtractor.extractFilesFromZip(exportedZip.getResponseBytes());
|
||||||
|
|
||||||
String swagger = null;
|
String swagger = null;
|
||||||
|
|
||||||
for (ZipEntryData e : zipEntries) {
|
for (ZipEntryData e : zipEntries) {
|
||||||
if (e.getType().toString().equals(FileType.OPENAPI.toString())) {
|
if (e.getType().toString().equals(FileType.OPENAPI.toString())) {
|
||||||
log.debug("Found main API definition file: {}", e.getName());
|
log.debug("Found main API definition file: {}", e.getName());
|
||||||
@ -148,7 +148,7 @@ public class ImportToApicurio extends AbstractProcess {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3) Deserialize JSON responses
|
// 3) Deserialize JSON responses
|
||||||
TypeToken<Map<String, Object>> mapType = new TypeToken<>() {
|
TypeToken<Map<String, Object>> mapType = new TypeToken<>() {
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,93 +4,93 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ApiDefinition {
|
public class ApiDefinition {
|
||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private Object description;
|
private Object description;
|
||||||
private String context;
|
private String context;
|
||||||
private String version;
|
private String version;
|
||||||
private String provider;
|
private String provider;
|
||||||
private String apiDefinition;
|
private String apiDefinition;
|
||||||
private Object wsdlUri;
|
private Object wsdlUri;
|
||||||
private String lifeCycleStatus;
|
private String lifeCycleStatus;
|
||||||
private boolean isDefaultVersion;
|
private boolean isDefaultVersion;
|
||||||
private String type;
|
private String type;
|
||||||
private List<String> transport;
|
private List<String> transport;
|
||||||
private List<Object> operations;
|
private List<Object> operations;
|
||||||
private String authorizationHeader;
|
private String authorizationHeader;
|
||||||
private List<String> securityScheme;
|
private List<String> securityScheme;
|
||||||
private List<String> tags;
|
private List<String> tags;
|
||||||
private List<Tier> tiers;
|
private List<Tier> tiers;
|
||||||
private boolean hasThumbnail;
|
private boolean hasThumbnail;
|
||||||
private Map<String, Object> additionalProperties;
|
private Map<String, Object> additionalProperties;
|
||||||
private Monetization monetization;
|
private Monetization monetization;
|
||||||
private List<Object> ingressURLs;
|
private List<Object> ingressURLs;
|
||||||
private List<EndpointURLs> endpointURLs;
|
private List<EndpointURLs> endpointURLs;
|
||||||
private BusinessInformation businessInformation;
|
private BusinessInformation businessInformation;
|
||||||
private List<String> labels;
|
private List<String> labels;
|
||||||
private List<String> environmentList;
|
private List<String> environmentList;
|
||||||
private List<Object> scopes;
|
private List<Object> scopes;
|
||||||
private String avgRating;
|
private String avgRating;
|
||||||
private AdvertiseInfo advertiseInfo;
|
private AdvertiseInfo advertiseInfo;
|
||||||
private boolean isSubscriptionAvailable;
|
private boolean isSubscriptionAvailable;
|
||||||
private List<String> categories;
|
private List<String> categories;
|
||||||
private List<String> keyManagers;
|
private List<String> keyManagers;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
|
|
||||||
public static class Tier {
|
public static class Tier {
|
||||||
private String tierName;
|
private String tierName;
|
||||||
private String tierPlan;
|
private String tierPlan;
|
||||||
private Object monetizationAttributes;
|
private Object monetizationAttributes;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EndpointURLs {
|
public static class EndpointURLs {
|
||||||
private String environmentName;
|
private String environmentName;
|
||||||
private String environmentType;
|
private String environmentType;
|
||||||
private URLs URLs;
|
private URLs URLs;
|
||||||
private DefaultVersionURLs defaultVersionURLs;
|
private DefaultVersionURLs defaultVersionURLs;
|
||||||
|
|
||||||
public static class URLs {
|
public static class URLs {
|
||||||
private String http;
|
private String http;
|
||||||
private String https;
|
private String https;
|
||||||
private Object ws;
|
private Object ws;
|
||||||
private Object wss;
|
private Object wss;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DefaultVersionURLs {
|
public static class DefaultVersionURLs {
|
||||||
private Object http;
|
private Object http;
|
||||||
private Object https;
|
private Object https;
|
||||||
private Object ws;
|
private Object ws;
|
||||||
private Object wss;
|
private Object wss;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Monetization {
|
public static class Monetization {
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BusinessInformation {
|
public static class BusinessInformation {
|
||||||
private String businessOwner;
|
private String businessOwner;
|
||||||
private String businessOwnerEmail;
|
private String businessOwnerEmail;
|
||||||
private String technicalOwner;
|
private String technicalOwner;
|
||||||
private String technicalOwnerEmail;
|
private String technicalOwnerEmail;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AdvertiseInfo {
|
public static class AdvertiseInfo {
|
||||||
private boolean advertised;
|
private boolean advertised;
|
||||||
private String originalStoreUrl;
|
private String originalStoreUrl;
|
||||||
private String apiOwner;
|
private String apiOwner;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,95 +2,120 @@ package cz.trask.apioperator.model;
|
|||||||
|
|
||||||
public class EventAPIInfo {
|
public class EventAPIInfo {
|
||||||
|
|
||||||
String apiName;
|
String apiName;
|
||||||
String apiId;
|
String apiId;
|
||||||
String uuid;
|
String uuid;
|
||||||
String apiVersion;
|
String apiVersion;
|
||||||
String apiContext;
|
String apiContext;
|
||||||
String apiProvider;
|
String apiProvider;
|
||||||
String apiType;
|
String apiType;
|
||||||
String apiStatus;
|
String apiStatus;
|
||||||
String eventId;
|
String eventId;
|
||||||
String timeStamp;
|
String timeStamp;
|
||||||
String type;
|
String type;
|
||||||
String tenantId;
|
String tenantId;
|
||||||
String tenantDomain;
|
String tenantDomain;
|
||||||
|
|
||||||
public String getApiName() {
|
public String getApiName() {
|
||||||
return apiName;
|
return apiName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApiName(String apiName) {
|
public void setApiName(String apiName) {
|
||||||
this.apiName = apiName;
|
this.apiName = apiName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApiId() {
|
public String getApiId() {
|
||||||
return apiId;
|
return apiId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApiId(String apiId) {
|
public void setApiId(String apiId) {
|
||||||
this.apiId = apiId;
|
this.apiId = apiId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUuid() {
|
public String getUuid() {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUuid(String uuid) {
|
public void setUuid(String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApiVersion() {
|
public String getApiVersion() {
|
||||||
return apiVersion;
|
return apiVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApiVersion(String apiVersion) {
|
public void setApiVersion(String apiVersion) {
|
||||||
this.apiVersion = apiVersion;
|
this.apiVersion = apiVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApiContext() {
|
public String getApiContext() {
|
||||||
return apiContext;
|
return apiContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApiContext(String apiContext) {
|
public void setApiContext(String apiContext) {
|
||||||
this.apiContext = apiContext;
|
this.apiContext = apiContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApiProvider() {
|
public String getApiProvider() {
|
||||||
return apiProvider;
|
return apiProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApiProvider(String apiProvider) {
|
public void setApiProvider(String apiProvider) {
|
||||||
this.apiProvider = apiProvider;
|
this.apiProvider = apiProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApiType() {
|
public String getApiType() {
|
||||||
return apiType;
|
return apiType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApiType(String apiType) {
|
public void setApiType(String apiType) {
|
||||||
this.apiType = apiType;
|
this.apiType = apiType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApiStatus() {
|
public String getApiStatus() {
|
||||||
return apiStatus;
|
return apiStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApiStatus(String apiStatus) {
|
public void setApiStatus(String apiStatus) {
|
||||||
this.apiStatus = apiStatus;
|
this.apiStatus = apiStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEventId() {
|
public String getEventId() {
|
||||||
return eventId;
|
return eventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventId(String eventId) {
|
public void setEventId(String eventId) {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTimeStamp() {
|
public String getTimeStamp() {
|
||||||
return timeStamp;
|
return timeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeStamp(String timeStamp) {
|
public void setTimeStamp(String timeStamp) {
|
||||||
this.timeStamp = timeStamp;
|
this.timeStamp = timeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTenantId() {
|
public String getTenantId() {
|
||||||
return tenantId;
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTenantId(String tenantId) {
|
public void setTenantId(String tenantId) {
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTenantDomain() {
|
public String getTenantDomain() {
|
||||||
return tenantDomain;
|
return tenantDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTenantDomain(String tenantDomain) {
|
public void setTenantDomain(String tenantDomain) {
|
||||||
this.tenantDomain = tenantDomain;
|
this.tenantDomain = tenantDomain;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package cz.trask.apioperator.model;
|
package cz.trask.apioperator.model;
|
||||||
|
|
||||||
public enum FileType {
|
public enum FileType {
|
||||||
APIDEF,
|
APIDEF, OPENAPI, WSDL, POLICY, UNKNOWN
|
||||||
OPENAPI,
|
|
||||||
WSDL,
|
|
||||||
POLICY,
|
|
||||||
UNKNOWN
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user