You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2019/02/22 12:12:12 UTC
[camel] branch master updated: Fix unstable ordering in generated
spring-boot configs
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 030d7d2 Fix unstable ordering in generated spring-boot configs
030d7d2 is described below
commit 030d7d274f17fcf0e3027a1ade7f8f26de04cfe3
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 22 12:55:52 2019 +0100
Fix unstable ordering in generated spring-boot configs
---
.../GoogleBigQueryComponentConfiguration.java | 36 +--
.../GoogleBigQuerySQLComponentConfiguration.java | 36 +--
.../GooglePubsubComponentConfiguration.java | 36 +--
.../SalesforceComponentConfiguration.java | 254 ++++++++++-----------
.../packaging/SpringBootAutoConfigurationMojo.java | 12 +-
5 files changed, 191 insertions(+), 183 deletions(-)
diff --git a/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/springboot/GoogleBigQueryComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/springboot/GoogleBigQueryComponentConfiguration.java
index ae495d7..00bc712 100644
--- a/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/springboot/GoogleBigQueryComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/springboot/GoogleBigQueryComponentConfiguration.java
@@ -92,26 +92,10 @@ public class GoogleBigQueryComponentConfiguration
public static class GoogleBigQueryConnectionFactoryNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.google.bigquery.GoogleBigQueryConnectionFactory.class;
- private String credentialsFileLocation;
- private String serviceURL;
private String serviceAccount;
private String serviceAccountKey;
-
- public String getCredentialsFileLocation() {
- return credentialsFileLocation;
- }
-
- public void setCredentialsFileLocation(String credentialsFileLocation) {
- this.credentialsFileLocation = credentialsFileLocation;
- }
-
- public String getServiceURL() {
- return serviceURL;
- }
-
- public void setServiceURL(String serviceURL) {
- this.serviceURL = serviceURL;
- }
+ private String credentialsFileLocation;
+ private String serviceURL;
public String getServiceAccount() {
return serviceAccount;
@@ -128,5 +112,21 @@ public class GoogleBigQueryComponentConfiguration
public void setServiceAccountKey(String serviceAccountKey) {
this.serviceAccountKey = serviceAccountKey;
}
+
+ public String getCredentialsFileLocation() {
+ return credentialsFileLocation;
+ }
+
+ public void setCredentialsFileLocation(String credentialsFileLocation) {
+ this.credentialsFileLocation = credentialsFileLocation;
+ }
+
+ public String getServiceURL() {
+ return serviceURL;
+ }
+
+ public void setServiceURL(String serviceURL) {
+ this.serviceURL = serviceURL;
+ }
}
}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/sql/springboot/GoogleBigQuerySQLComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/sql/springboot/GoogleBigQuerySQLComponentConfiguration.java
index b0c05de..c27707a 100644
--- a/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/sql/springboot/GoogleBigQuerySQLComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-bigquery-starter/src/main/java/org/apache/camel/component/google/bigquery/sql/springboot/GoogleBigQuerySQLComponentConfiguration.java
@@ -80,26 +80,10 @@ public class GoogleBigQuerySQLComponentConfiguration
public static class GoogleBigQueryConnectionFactoryNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.google.bigquery.GoogleBigQueryConnectionFactory.class;
- private String credentialsFileLocation;
- private String serviceURL;
private String serviceAccount;
private String serviceAccountKey;
-
- public String getCredentialsFileLocation() {
- return credentialsFileLocation;
- }
-
- public void setCredentialsFileLocation(String credentialsFileLocation) {
- this.credentialsFileLocation = credentialsFileLocation;
- }
-
- public String getServiceURL() {
- return serviceURL;
- }
-
- public void setServiceURL(String serviceURL) {
- this.serviceURL = serviceURL;
- }
+ private String credentialsFileLocation;
+ private String serviceURL;
public String getServiceAccount() {
return serviceAccount;
@@ -116,5 +100,21 @@ public class GoogleBigQuerySQLComponentConfiguration
public void setServiceAccountKey(String serviceAccountKey) {
this.serviceAccountKey = serviceAccountKey;
}
+
+ public String getCredentialsFileLocation() {
+ return credentialsFileLocation;
+ }
+
+ public void setCredentialsFileLocation(String credentialsFileLocation) {
+ this.credentialsFileLocation = credentialsFileLocation;
+ }
+
+ public String getServiceURL() {
+ return serviceURL;
+ }
+
+ public void setServiceURL(String serviceURL) {
+ this.serviceURL = serviceURL;
+ }
}
}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentConfiguration.java
index f875af5..1eb9d4b 100644
--- a/platforms/spring-boot/components-starter/camel-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentConfiguration.java
@@ -69,26 +69,10 @@ public class GooglePubsubComponentConfiguration
public static class GooglePubsubConnectionFactoryNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.google.pubsub.GooglePubsubConnectionFactory.class;
- private String credentialsFileLocation;
- private String serviceURL;
private String serviceAccount;
private String serviceAccountKey;
-
- public String getCredentialsFileLocation() {
- return credentialsFileLocation;
- }
-
- public void setCredentialsFileLocation(String credentialsFileLocation) {
- this.credentialsFileLocation = credentialsFileLocation;
- }
-
- public String getServiceURL() {
- return serviceURL;
- }
-
- public void setServiceURL(String serviceURL) {
- this.serviceURL = serviceURL;
- }
+ private String credentialsFileLocation;
+ private String serviceURL;
public String getServiceAccount() {
return serviceAccount;
@@ -105,5 +89,21 @@ public class GooglePubsubComponentConfiguration
public void setServiceAccountKey(String serviceAccountKey) {
this.serviceAccountKey = serviceAccountKey;
}
+
+ public String getCredentialsFileLocation() {
+ return credentialsFileLocation;
+ }
+
+ public void setCredentialsFileLocation(String credentialsFileLocation) {
+ this.credentialsFileLocation = credentialsFileLocation;
+ }
+
+ public String getServiceURL() {
+ return serviceURL;
+ }
+
+ public void setServiceURL(String serviceURL) {
+ this.serviceURL = serviceURL;
+ }
}
}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java
index 6b2c241..051bb65 100644
--- a/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java
@@ -453,6 +453,133 @@ public class SalesforceComponentConfiguration
this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
}
+ public static class SalesforceLoginConfigNestedConfiguration {
+ public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.salesforce.SalesforceLoginConfig.class;
+ /**
+ * Configuration object for Salesforce login properties
+ */
+ private String instanceUrl;
+ /**
+ * Salesforce login URL, defaults to https://login.salesforce.com
+ */
+ private String loginUrl = "https://login.salesforce.com";
+ /**
+ * Salesforce connected application Consumer Key
+ */
+ private String clientId;
+ /**
+ * Salesforce connected application Consumer Secret
+ */
+ private String clientSecret;
+ /**
+ * Keystore parameters for keystore containing certificate and private
+ * key needed for OAuth 2.0 JWT Bearer Token Flow.
+ */
+ private KeyStoreParameters keystore;
+ /**
+ * Salesforce connected application Consumer token
+ */
+ private String refreshToken;
+ /**
+ * Salesforce connected application Consumer token
+ */
+ private AuthenticationType type;
+ /**
+ * Salesforce account user name
+ */
+ private String userName;
+ /**
+ * Salesforce account password
+ */
+ private String password;
+ /**
+ * Flag to enable/disable lazy OAuth, default is false. When enabled,
+ * OAuth token retrieval or generation is not done until the first API
+ * call
+ */
+ private Boolean lazyLogin = false;
+
+ public String getInstanceUrl() {
+ return instanceUrl;
+ }
+
+ public void setInstanceUrl(String instanceUrl) {
+ this.instanceUrl = instanceUrl;
+ }
+
+ public String getLoginUrl() {
+ return loginUrl;
+ }
+
+ public void setLoginUrl(String loginUrl) {
+ this.loginUrl = loginUrl;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public String getClientSecret() {
+ return clientSecret;
+ }
+
+ public void setClientSecret(String clientSecret) {
+ this.clientSecret = clientSecret;
+ }
+
+ public KeyStoreParameters getKeystore() {
+ return keystore;
+ }
+
+ public void setKeystore(KeyStoreParameters keystore) {
+ this.keystore = keystore;
+ }
+
+ public String getRefreshToken() {
+ return refreshToken;
+ }
+
+ public void setRefreshToken(String refreshToken) {
+ this.refreshToken = refreshToken;
+ }
+
+ public AuthenticationType getType() {
+ return type;
+ }
+
+ public void setType(AuthenticationType type) {
+ this.type = type;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public Boolean getLazyLogin() {
+ return lazyLogin;
+ }
+
+ public void setLazyLogin(Boolean lazyLogin) {
+ this.lazyLogin = lazyLogin;
+ }
+ }
+
public static class SalesforceEndpointConfigNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.salesforce.SalesforceEndpointConfig.class;
/**
@@ -1047,131 +1174,4 @@ public class SalesforceComponentConfiguration
this.notFoundBehaviour = notFoundBehaviour;
}
}
-
- public static class SalesforceLoginConfigNestedConfiguration {
- public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.salesforce.SalesforceLoginConfig.class;
- /**
- * Configuration object for Salesforce login properties
- */
- private String instanceUrl;
- /**
- * Salesforce login URL, defaults to https://login.salesforce.com
- */
- private String loginUrl = "https://login.salesforce.com";
- /**
- * Salesforce connected application Consumer Key
- */
- private String clientId;
- /**
- * Salesforce connected application Consumer Secret
- */
- private String clientSecret;
- /**
- * Keystore parameters for keystore containing certificate and private
- * key needed for OAuth 2.0 JWT Bearer Token Flow.
- */
- private KeyStoreParameters keystore;
- /**
- * Salesforce connected application Consumer token
- */
- private String refreshToken;
- /**
- * Salesforce connected application Consumer token
- */
- private AuthenticationType type;
- /**
- * Salesforce account user name
- */
- private String userName;
- /**
- * Salesforce account password
- */
- private String password;
- /**
- * Flag to enable/disable lazy OAuth, default is false. When enabled,
- * OAuth token retrieval or generation is not done until the first API
- * call
- */
- private Boolean lazyLogin = false;
-
- public String getInstanceUrl() {
- return instanceUrl;
- }
-
- public void setInstanceUrl(String instanceUrl) {
- this.instanceUrl = instanceUrl;
- }
-
- public String getLoginUrl() {
- return loginUrl;
- }
-
- public void setLoginUrl(String loginUrl) {
- this.loginUrl = loginUrl;
- }
-
- public String getClientId() {
- return clientId;
- }
-
- public void setClientId(String clientId) {
- this.clientId = clientId;
- }
-
- public String getClientSecret() {
- return clientSecret;
- }
-
- public void setClientSecret(String clientSecret) {
- this.clientSecret = clientSecret;
- }
-
- public KeyStoreParameters getKeystore() {
- return keystore;
- }
-
- public void setKeystore(KeyStoreParameters keystore) {
- this.keystore = keystore;
- }
-
- public String getRefreshToken() {
- return refreshToken;
- }
-
- public void setRefreshToken(String refreshToken) {
- this.refreshToken = refreshToken;
- }
-
- public AuthenticationType getType() {
- return type;
- }
-
- public void setType(AuthenticationType type) {
- this.type = type;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public Boolean getLazyLogin() {
- return lazyLogin;
- }
-
- public void setLazyLogin(Boolean lazyLogin) {
- this.lazyLogin = lazyLogin;
- }
- }
}
\ No newline at end of file
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
index 72ea213..3e35afa 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
@@ -35,6 +35,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@@ -764,7 +765,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
javaClass.addAnnotation(Generated.class.getName()).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName());
javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", prefix);
- Set<JavaClass> nestedTypes = new HashSet<>();
+ Set<JavaClass> nestedTypes = new LinkedHashSet<>();
for (ComponentOptionModel option : model.getComponentOptions()) {
if (skipComponentOption(model, option)) {
@@ -1211,7 +1212,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
.filter(m -> m.getName().matches("(get|is)[A-Z][a-zA-Z0-9]*"))
.collect(Collectors.toList());
allSetters.stream()
- .sorted(Comparator.comparing(m -> sourceCode.indexOf("void " + m.getName() + "(")))
+ .sorted(Comparator.comparing(m -> getSetterPosition(sourceCode, m)))
.map(m -> Strings.uncapitalize(m.getName().substring(3)))
.forEach(fn -> {
Class<?> ft;
@@ -1297,6 +1298,13 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
return null;
}
+ private int getSetterPosition(String sourceCode, java.lang.reflect.Method m) {
+ int i0 = sourceCode.indexOf("void " + m.getName() + "(");
+ int i1 = sourceCode.indexOf(m.getDeclaringClass().getSimpleName() + " " + m.getName() + "(");
+ int l = sourceCode.length();
+ return Math.min(i0 > 0 ? i0 : l, i1 > 0 ? i1 : l);
+ }
+
private String getSetterJavaDoc(String sourceCode, String name) {
int idx = sourceCode.indexOf("public void set" + Strings.capitalize(name) + "(");
if (idx > 0) {