You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/07/21 08:31:47 UTC

[GitHub] [camel-quarkus] zbendhiba opened a new pull request #2921: Salesforce - Mock existing integration tests

zbendhiba opened a new pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921


   Fixes #2667
   
   This PR covers just one part of the 2667 gitHub issue, which is mocking the existing examples. There will be another PR for more test coverage.
    
   The mocking scenario is the same used in some tests in the Camel project, but using wiremock. We can mock if using template, so the Route that starts in this project, is out of the scope, and is loaded only if salesforce credentials are set with environment variables. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on pull request #2921: Salesforce - Mock existing integration tests

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921#issuecomment-884202995


   Perfect, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on pull request #2921: Salesforce - Mock existing integration tests

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921#issuecomment-885443591


   Oh, sorry, haven't I approved?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on pull request #2921: Salesforce - Mock existing integration tests

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921#issuecomment-884185350


   > Nice work, thanks @zbendhiba
   > Could you please update the README adding the info, that the test is by default run against a mock and how to make sure that it is run against a real Salesforce much like we have it in other tests using Wiremock?
   
   @ppalaga  thanks for catching this. I've just pushed a fix for the Readme file


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga merged pull request #2921: Salesforce - Mock existing integration tests

Posted by GitBox <gi...@apache.org>.
ppalaga merged pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2921: Salesforce - Mock existing integration tests

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921#discussion_r673789941



##########
File path: integration-tests/salesforce/src/main/java/org/apache/camel/quarkus/component/salesforce/SalesforceRoutes.java
##########
@@ -16,13 +16,66 @@
  */
 package org.apache.camel.quarkus.component.salesforce;
 
+import java.util.Optional;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import io.quarkus.arc.Unremovable;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.salesforce.AuthenticationType;
+import org.apache.camel.component.salesforce.SalesforceComponent;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
 
+@ApplicationScoped
 public class SalesforceRoutes extends RouteBuilder {
 
+    @ConfigProperty(name = "SALESFORCE_USERNAME", defaultValue = "username")
+    String username;
+
+    @ConfigProperty(name = "SALESFORCE_PASSWORD", defaultValue = "password")
+    String password;
+
+    @ConfigProperty(name = "SALESFORCE_CLIENTID", defaultValue = "clientId")
+    String clientId;
+
+    @ConfigProperty(name = "SALESFORCE_CLIENTSECRET", defaultValue = "clientSecret")
+    String clientSecret;
+
+    @Produces
+    @ApplicationScoped
+    @Unremovable
+    @Named("salesforce")

Review comment:
       ```suggestion
       @Named("salesforce")
   ```
   
   You probably want `@javax.enterprise.inject.Produces` instead of `@javax.ws.rs.Produces`. The fact that it works swhows, that both is redundant :). `@ApplicationScoped` is inherited from the class and `@Unremovable` is implicit for `@Named`
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2921: Salesforce - Mock existing integration tests

Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921#discussion_r673809329



##########
File path: integration-tests/salesforce/src/main/java/org/apache/camel/quarkus/component/salesforce/SalesforceRoutes.java
##########
@@ -16,13 +16,66 @@
  */
 package org.apache.camel.quarkus.component.salesforce;
 
+import java.util.Optional;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import io.quarkus.arc.Unremovable;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.salesforce.AuthenticationType;
+import org.apache.camel.component.salesforce.SalesforceComponent;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
 
+@ApplicationScoped
 public class SalesforceRoutes extends RouteBuilder {
 
+    @ConfigProperty(name = "SALESFORCE_USERNAME", defaultValue = "username")
+    String username;
+
+    @ConfigProperty(name = "SALESFORCE_PASSWORD", defaultValue = "password")
+    String password;
+
+    @ConfigProperty(name = "SALESFORCE_CLIENTID", defaultValue = "clientId")
+    String clientId;
+
+    @ConfigProperty(name = "SALESFORCE_CLIENTSECRET", defaultValue = "clientSecret")
+    String clientSecret;
+
+    @Produces
+    @ApplicationScoped
+    @Unremovable
+    @Named("salesforce")

Review comment:
       All the fame belongs to @jamesnetherton from whom I learned all of this recently :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on pull request #2921: Salesforce - Mock existing integration tests

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921#issuecomment-884942271


   @ppalaga I can merge this one ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #2921: Salesforce - Mock existing integration tests

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #2921:
URL: https://github.com/apache/camel-quarkus/pull/2921#discussion_r673802174



##########
File path: integration-tests/salesforce/src/main/java/org/apache/camel/quarkus/component/salesforce/SalesforceRoutes.java
##########
@@ -16,13 +16,66 @@
  */
 package org.apache.camel.quarkus.component.salesforce;
 
+import java.util.Optional;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import javax.ws.rs.Produces;
+
+import io.quarkus.arc.Unremovable;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.salesforce.AuthenticationType;
+import org.apache.camel.component.salesforce.SalesforceComponent;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
 
+@ApplicationScoped
 public class SalesforceRoutes extends RouteBuilder {
 
+    @ConfigProperty(name = "SALESFORCE_USERNAME", defaultValue = "username")
+    String username;
+
+    @ConfigProperty(name = "SALESFORCE_PASSWORD", defaultValue = "password")
+    String password;
+
+    @ConfigProperty(name = "SALESFORCE_CLIENTID", defaultValue = "clientId")
+    String clientId;
+
+    @ConfigProperty(name = "SALESFORCE_CLIENTSECRET", defaultValue = "clientSecret")
+    String clientSecret;
+
+    @Produces
+    @ApplicationScoped
+    @Unremovable
+    @Named("salesforce")

Review comment:
       @ppalaga good catch




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org