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 2017/11/04 09:05:02 UTC

[camel] 01/02: CAMEL-11836: Upgrade to Jetty 9.4.x

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

commit a840c8214b04d6800f0a1ab01d605442cf3524e1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Nov 3 13:05:39 2017 +0100

    CAMEL-11836: Upgrade to Jetty 9.4.x
---
 .../camel/component/atom/JettyTestServer.java      |   5 +-
 .../component/jetty/HttpRoundtripHeaderTest.java   | 125 ---------------------
 .../camel/component/rss/JettyTestServer.java       |   5 +-
 parent/pom.xml                                     |   2 +-
 4 files changed, 9 insertions(+), 128 deletions(-)

diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/JettyTestServer.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/JettyTestServer.java
index 417f41e..4d7ae4e 100644
--- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/JettyTestServer.java
+++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/JettyTestServer.java
@@ -29,6 +29,7 @@ import org.eclipse.jetty.security.ConstraintMapping;
 import org.eclipse.jetty.security.ConstraintSecurityHandler;
 import org.eclipse.jetty.security.HashLoginService;
 import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.security.UserStore;
 import org.eclipse.jetty.security.authentication.BasicAuthenticator;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.servlet.ServletContextHandler;
@@ -85,7 +86,9 @@ public final class JettyTestServer {
     private SecurityHandler basicAuth(String username, String password, String realm) {
 
         HashLoginService l = new HashLoginService();
-        l.putUser(username, Credential.getCredential(password), new String[]{"user"});
+        UserStore us = new UserStore();
+        us.addUser(username, Credential.getCredential(password), new String[]{"user"});
+        l.setUserStore(us);
         l.setName(realm);
 
         Constraint constraint = new Constraint();
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java
deleted file mode 100644
index c125bc6..0000000
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * 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.component.jetty;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.DefaultHeaderFilterStrategy;
-import org.apache.camel.util.IOHelper;
-import org.junit.Test;
-
-public class HttpRoundtripHeaderTest extends BaseJettyTest {
-    protected final String uri = "http://localhost:" + getPort() + "/WhichWillGetCloseException";
-    protected final String jettyUri = "jetty:" + uri;
-    protected final String outputText = ":output";
-    protected String inputText = "input";
-    protected String expectedText = inputText + outputText;
-
-    // http://issues.apache.org/activemq/browse/CAMEL-324
-    @Test
-    public void testHttpRoundTripHeaders() throws Exception {
-        MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:results", MockEndpoint.class);
-        mockEndpoint.expectedMessageCount(1);
-
-        InputStream answer = (InputStream) template.requestBody(uri, inputText);
-
-        verifyMockGotExpectedText(mockEndpoint, expectedText);
-
-        // read the response data
-        String lastLine = readLastLine(answer);
-
-        assertNotNull("last response line", lastLine);
-        assertEquals("response matches: " + expectedText, expectedText, lastLine);
-    }
-
-    @Test
-    public void testHttpRoundTripHeadersWithNoIgnoredHeaders() throws Exception {
-        MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:results", MockEndpoint.class);
-        mockEndpoint.expectedMessageCount(1);
-
-        JettyHttpEndpoint endpoint = context.getEndpoint(jettyUri, JettyHttpEndpoint.class);
-        // override the default set of ignored headers which includes Content-Length
-        ((DefaultHeaderFilterStrategy)endpoint.getHeaderFilterStrategy()).setOutFilter(null);
-
-        // read the response data
-        InputStream answer = (InputStream) template.requestBody(uri, inputText);
-        verifyMockGotExpectedText(mockEndpoint, expectedText);
-
-        String lastLine = readLastLine(answer);
-        assertNotNull("last response line", lastLine);
-        
-        // Content-Length from request will truncate the output to just the inputText
-        assertEquals("response matches: " + inputText, inputText, lastLine);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() {
-                Processor processor = new Processor() {
-                    public void process(Exchange exchange) {
-                        String input = (String) exchange.getIn().getBody();
-                        // append some text to invalidate Context-Length
-                        // for the http reply
-                        exchange.getIn().setBody(input + outputText);
-                    }
-                };
-
-                // the unmarshaller does a copy from in message to out
-                // including all headers
-                from(jettyUri).unmarshal().string().process(processor).to("mock:results");
-            }
-        };
-    }
-
-    private void verifyMockGotExpectedText(MockEndpoint mockEndpoint, String expected) throws InterruptedException {
-        mockEndpoint.assertIsSatisfied();
-        List<Exchange> list = mockEndpoint.getReceivedExchanges();
-        Exchange exchange = list.get(0);
-        assertNotNull("exchange", exchange);
-        Message in = exchange.getIn();
-        assertNotNull("in", in);
-        Map<String, Object> headers = in.getHeaders();
-        assertTrue("no headers are propagated", !headers.isEmpty());
-        assertEquals("body has expectedText:" + expected, expected, in.getBody());
-    }
-
-    private String readLastLine(InputStream answer) throws IOException {
-        String lastLine = null;
-        BufferedReader reader = IOHelper.buffered(new InputStreamReader(answer));
-        while (true) {
-            String line = reader.readLine();
-            if (line == null) {
-                break;
-            }
-            lastLine = line;
-            log.info("Read: " + line);
-        }
-        reader.close();
-        return lastLine;
-    }
-}
diff --git a/components/camel-rss/src/test/java/org/apache/camel/component/rss/JettyTestServer.java b/components/camel-rss/src/test/java/org/apache/camel/component/rss/JettyTestServer.java
index 9c0b9e2..8977342 100644
--- a/components/camel-rss/src/test/java/org/apache/camel/component/rss/JettyTestServer.java
+++ b/components/camel-rss/src/test/java/org/apache/camel/component/rss/JettyTestServer.java
@@ -29,6 +29,7 @@ import org.eclipse.jetty.security.ConstraintMapping;
 import org.eclipse.jetty.security.ConstraintSecurityHandler;
 import org.eclipse.jetty.security.HashLoginService;
 import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.security.UserStore;
 import org.eclipse.jetty.security.authentication.BasicAuthenticator;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.servlet.ServletContextHandler;
@@ -85,7 +86,9 @@ public final class JettyTestServer {
 
     private SecurityHandler basicAuth(String username, String password, String realm) {
         HashLoginService l = new HashLoginService();
-        l.putUser(username, Credential.getCredential(password), new String[]{"user"});
+        UserStore us = new UserStore();
+        us.addUser(username, Credential.getCredential(password), new String[]{"user"});
+        l.setUserStore(us);
         l.setName(realm);
 
         Constraint constraint = new Constraint();
diff --git a/parent/pom.xml b/parent/pom.xml
index 61b5de8..34c79df 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -376,7 +376,7 @@
     <jersey-version>2.11</jersey-version>
     <jetty6-bundle-version>6.1.26_4</jetty6-bundle-version>
     <jetty92-version>9.2.22.v20170606</jetty92-version>
-    <jetty9-version>9.3.21.v20170918</jetty9-version>
+    <jetty9-version>9.4.7.v20170914</jetty9-version>
     <jetty-version>${jetty9-version}</jetty-version>
     <jetty-plugin-version>${jetty-version}</jetty-plugin-version>
     <jetty-runner-groupId>org.eclipse.jetty</jetty-runner-groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.