You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/01/11 14:27:38 UTC
[camel] branch master updated: Fixed test after http-base-component
was added
This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 841a302 Fixed test after http-base-component was added
841a302 is described below
commit 841a30224f042fbffec1a79be57a9c2b42169822
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 11 15:27:17 2020 +0100
Fixed test after http-base-component was added
---
.../camel/component/elytron/ElytronBearerTokenTest.java | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/components/camel-elytron/src/test/java/org/apache/camel/component/elytron/ElytronBearerTokenTest.java b/components/camel-elytron/src/test/java/org/apache/camel/component/elytron/ElytronBearerTokenTest.java
index 922918a..dfd6929 100644
--- a/components/camel-elytron/src/test/java/org/apache/camel/component/elytron/ElytronBearerTokenTest.java
+++ b/components/camel-elytron/src/test/java/org/apache/camel/component/elytron/ElytronBearerTokenTest.java
@@ -28,10 +28,8 @@ import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
import io.undertow.util.Headers;
import org.apache.camel.CamelExecutionException;
-import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.http.common.HttpOperationFailedException;
+import org.apache.camel.http.base.HttpOperationFailedException;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -74,22 +72,18 @@ public class ElytronBearerTokenTest extends BaseElytronTest {
@Test
public void testBearerTokenBadRole() throws Exception {
- HttpOperationFailedException httpOperationFailedException = null;
try {
String response = template.requestBodyAndHeader("elytron:http://localhost:{{port}}/myapp",
"empty body",
Headers.AUTHORIZATION.toString(),
"Bearer " + createToken("alice", "guest", new Date(new Date().getTime() + 10000), getKeyPair().getPrivate()),
String.class);
+ fail("Should throw exception");
- } catch (CamelExecutionException exception) {
- if (exception.getCause() instanceof HttpOperationFailedException) {
- httpOperationFailedException = (HttpOperationFailedException)exception.getCause();
- }
+ } catch (CamelExecutionException e) {
+ HttpOperationFailedException he = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
+ assertEquals(403, he.getStatusCode());
}
-
- assertNotNull(httpOperationFailedException);
- assertEquals(403, httpOperationFailedException.getStatusCode());
}
@Override