Compare commits

...

2 Commits

Author SHA1 Message Date
rdavidek
e26477e8d1 JaT fixes 2026-02-17 11:12:19 +01:00
rdavidek
738be0aa10 fixed app owner with url encoder 2026-02-15 15:49:55 +01:00
5 changed files with 38 additions and 11 deletions

Binary file not shown.

View File

@ -9,6 +9,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLEncoder;
import java.security.KeyStore;
@ -71,6 +73,8 @@ public abstract class AbstractProcess {
public static ObjectMapper mapper;
public static ObjectMapper mapperYaml;
public static Proxy proxy;
public final RegistryClient client;
@ -89,6 +93,9 @@ public abstract class AbstractProcess {
config = ConfigManager.getInstance().getConfig();
setTrustStoreCredentials();
if (config.getProxy() != null && config.getProxy().getHost() != null && !config.getProxy().getHost().isEmpty())
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(config.getProxy().getHost(), config.getProxy().getPort()));
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
@ -338,7 +345,7 @@ public abstract class AbstractProcess {
URL url = new URL(urlStr);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
HttpsURLConnection con = (HttpsURLConnection) url.openConnection(proxy);
con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);
@ -450,7 +457,7 @@ public abstract class AbstractProcess {
URL url = new URL(urlStr);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
HttpsURLConnection con = (HttpsURLConnection) url.openConnection(proxy);
con.setUseCaches(false);
con.setDoOutput(true);
configureHttpsConnection(con);

View File

@ -1,6 +1,8 @@
package cz.trask.migration.impl.v32;
import java.io.ByteArrayInputStream;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@ -85,7 +87,7 @@ public class Wso2AppsToApicurio extends AbstractProcess {
HttpResponse exportedZip = makeRequest(
"GET", config.getSource().getAdminApiUrl() + "/export/applications?appName=" + app.getName()
+ "&appOwner=" + app.getOwner() + "&withKeys=true",
+ "&appOwner=" + URLEncoder.encode(app.getOwner(), Charset.forName("UTF-8")) + "&withKeys=true",
httpHeaders, Collections.emptyMap(), true);
List<ZipEntryData> zipEntries = ZipUtils.extractFilesFromZip(exportedZip.getResponseBytes());
@ -146,7 +148,7 @@ public class Wso2AppsToApicurio extends AbstractProcess {
ApplicationList listOfApps = null;
try {
String url = adminApiUrl.concat(String.format("/applications"));
String url = adminApiUrl.concat(String.format("/applications?limit=9999"));
log.debug("Getting Applications with token: '" + tokenResponse.getAccess_token() + "' URL: " + url);

View File

@ -21,6 +21,8 @@ public class ApplicationConfig {
private int maxThreads;
@JsonProperty("store_migrated_artifacts")
private boolean storeMigratedArtifacts = false;
@JsonProperty("proxy")
private Proxy proxy;
@Data
public static class TrustStore {
@ -66,4 +68,16 @@ public class ApplicationConfig {
private String wso2ApisDir;
}
@Data
public static class Proxy {
@JsonProperty("host")
private String host;
@JsonProperty("port")
private int port;
@JsonProperty("username")
private String username;
@JsonProperty("password")
private String password;
}
}

View File

@ -1,3 +1,7 @@
proxy:
host: proxy.jtfg.com
port: 3128
source:
registration_api_url: https://developerstest.jtfg.com/client-registration/v0.17/register
publisher_api_url: https://developerstest.jtfg.com/api/am/publisher
@ -8,12 +12,12 @@ source:
wso2_apis_dir: apis
target:
registration_api_url: https://localhost:9443/client-registration/v0.17/register
publisher_api_url: https://localhost:9443/api/am/publisher/v4/apis/import
admin_api_url: https://localhost:9443/api/am/admin/v4
devportal_api_url: https://localhost:9443/api/am/devportal
publisher_token_url: https://localhost:9443/oauth2/token
wso2_user: YWRtaW46YWRtaW4=
registration_api_url: https://wso2apiportal-int.apps.oshift-int.jtfg.com/client-registration/v0.17/register
publisher_api_url: https://wso2apiportal-int.apps.oshift-int.jtfg.com/api/am/publisher/v4/apis/import
admin_api_url: https://wso2apiportal-int.apps.oshift-int.jtfg.com/api/am/admin/v4
devportal_api_url: https://wso2apiportal-int.apps.oshift-int.jtfg.com/api/am/devportal
publisher_token_url: https://wso2apiportal-int.apps.oshift-int.jtfg.com/oauth2/token
wso2_user: YWRtaW46Tiw5YzEpeFh0NTNr
truststore:
path: client-truststore.jks
@ -28,6 +32,6 @@ apicurio:
default_api_group: api
overwrite_existing_application: true
max_threads: 8
max_threads: 1
store_migrated_artifacts: true