Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LoginToken to Salesforce reflective class list #742

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import org.apache.camel.component.salesforce.internal.dto.LoginToken;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.ProtocolHandlers;

class SalesforceProcessor {
private static final List<Class<?>> SALESFORCE_REFLECTIVE_CLASSES = Arrays.asList(
HttpClient.class,
LoginToken.class,
ProtocolHandlers.class);

private static final String FEATURE = "camel-salesforce";
Expand Down
8 changes: 0 additions & 8 deletions integration-tests/salesforce/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-salesforce</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-direct</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-log</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jsonb</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,30 @@
*/
package org.apache.camel.quarkus.component.salesforce;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.FluentProducerTemplate;
import org.apache.camel.component.salesforce.SalesforceEndpointConfig;

@Path("/test")
@ApplicationScoped
@Path("/salesforce")
public class SalesforceResource {

@Inject
CamelContext context;
FluentProducerTemplate template;

@Path("/case/{id}")
@Path("/document/{id}")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Object getCase(@PathParam("id") String id) {
ProducerTemplate template = context.createProducerTemplate();

return template.requestBody("direct:case", id);
public Object getDocument(@PathParam("id") String id) {
return template.withBody(id)
.withHeader(SalesforceEndpointConfig.SOBJECT_EXT_ID_NAME, "Name")
.withHeader(SalesforceEndpointConfig.SOBJECT_NAME, "Document")
.to("salesforce:getSObjectWithId?rawPayload=true")
.request();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@
*/
package org.apache.camel.quarkus.component.salesforce;

import io.quarkus.runtime.annotations.RegisterForReflection;
import org.apache.camel.builder.RouteBuilder;
import io.quarkus.test.junit.NativeImageTest;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;

@RegisterForReflection
public class SalesforceRoutes extends RouteBuilder {
@EnabledIfEnvironmentVariable(named = "SALESFORCE_USERNAME", matches = ".+")
@EnabledIfEnvironmentVariable(named = "SALESFORCE_PASSWORD", matches = ".+")
@EnabledIfEnvironmentVariable(named = "SALESFORCE_CLIENTID", matches = ".+")
@EnabledIfEnvironmentVariable(named = "SALESFORCE_CLIENTSECRET", matches = ".+")
@NativeImageTest
class SalesforceIT extends SalesforceTest {

@Override
public void configure() {
from("direct:case")
.autoStartup(false)
.setHeader("sObjectName").constant("Case")
.to("salesforce:getSObject?rawPayload=true")
.to("log:sf?showAll=true");

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.component.salesforce;

import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;

import static org.hamcrest.core.Is.is;

@EnabledIfEnvironmentVariable(named = "SALESFORCE_USERNAME", matches = ".+")
@EnabledIfEnvironmentVariable(named = "SALESFORCE_PASSWORD", matches = ".+")
@EnabledIfEnvironmentVariable(named = "SALESFORCE_CLIENTID", matches = ".+")
@EnabledIfEnvironmentVariable(named = "SALESFORCE_CLIENTSECRET", matches = ".+")
@QuarkusTest
class SalesforceTest {

@Test
public void testSalesforceComponent() {
RestAssured.get("/salesforce/document/test")
.then()
.statusCode(200)
.body("attributes.type", is("Document"));
}
}