ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [21/50] [abbrv] ignite git commit: IGNITE-9340 Update jetty version in Apache Ignite (ignite-rest-http) - Fixes #4602.
Date Wed, 29 Aug 2018 16:51:01 GMT
IGNITE-9340 Update jetty version in Apache Ignite (ignite-rest-http) - Fixes #4602.

Signed-off-by: Dmitriy Pavlov <dpavlov@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a9ede2d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a9ede2d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a9ede2d

Branch: refs/heads/ignite-9273
Commit: 0a9ede2d853fc9ae07fe53c96464d4a8091f25b9
Parents: b369ff0
Author: Dmitriy Pavlov <dpavlov@apache.org>
Authored: Thu Aug 23 16:59:20 2018 +0300
Committer: Dmitriy Pavlov <dpavlov@apache.org>
Committed: Thu Aug 23 16:59:20 2018 +0300

----------------------------------------------------------------------
 modules/rest-http/pom.xml                       | 22 ++++++
 .../http/jetty/GridJettyRestHandler.java        |  8 +--
 .../http/jetty/GridJettyRestProtocol.java       | 12 ++--
 .../protocols/http/jetty/GridRestSuite.java     | 35 +++++++++
 .../http/jetty/RestSetupSimpleTest.java         | 76 ++++++++++++++++++++
 .../http/GridHttpDeploymentSelfTest.java        | 12 +---
 .../internal/websession/WebSessionSelfTest.java | 39 ++++++----
 parent/pom.xml                                  |  2 +-
 8 files changed, 171 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9ede2d/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 8cc31da..84dc8a4 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -130,6 +130,28 @@
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>${spring-5.0.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring-5.0.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9ede2d/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 99a8844..729016b 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -86,13 +86,13 @@ public class GridJettyRestHandler extends AbstractHandler {
     private static final String CHARSET = StandardCharsets.UTF_8.name();
 
     /** */
-    private static final String  USER_PARAM = "user";
+    private static final String USER_PARAM = "user";
 
     /** */
-    private static final String  PWD_PARAM = "password";
+    private static final String PWD_PARAM = "password";
 
     /** */
-    private static final String  CACHE_NAME_PARAM = "cacheName";
+    private static final String CACHE_NAME_PARAM = "cacheName";
 
     /** */
     private static final String BACKUPS_PARAM = "backups";
@@ -113,7 +113,7 @@ public class GridJettyRestHandler extends AbstractHandler {
     private static final String IGNITE_PASSWORD = "ignite.password";
 
     /** */
-    private static final String  TEMPLATE_NAME_PARAM = "templateName";
+    private static final String TEMPLATE_NAME_PARAM = "templateName";
 
     /** */
     private static final NullOutputStream NULL_OUTPUT_STREAM = new NullOutputStream();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9ede2d/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
index 11c0eb6..1818d7c 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
@@ -63,13 +63,11 @@ public class GridJettyRestProtocol extends GridRestProtocolAdapter {
      */
     static {
         if (!IgniteSystemProperties.getBoolean(IGNITE_JETTY_LOG_NO_OVERRIDE)) {
-            Properties p = new Properties();
-
-            p.setProperty("org.eclipse.jetty.LEVEL", "WARN");
-            p.setProperty("org.eclipse.jetty.util.log.LEVEL", "OFF");
-            p.setProperty("org.eclipse.jetty.util.component.LEVEL", "OFF");
-
-            StdErrLog.setProperties(p);
+            // See also https://www.eclipse.org/jetty/documentation/9.4.x/configuring-logging.html
+            // It seems that using system properties should be fine.
+            System.setProperty("org.eclipse.jetty.LEVEL", "WARN");
+            System.setProperty("org.eclipse.jetty.util.log.LEVEL", "OFF");
+            System.setProperty("org.eclipse.jetty.util.component.LEVEL", "OFF");
 
             try {
                 Class<?> logCls = Class.forName("org.apache.log4j.Logger");

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9ede2d/modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridRestSuite.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridRestSuite.java
b/modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridRestSuite.java
new file mode 100644
index 0000000..c69ce7f
--- /dev/null
+++ b/modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridRestSuite.java
@@ -0,0 +1,35 @@
+/*
+ * 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.ignite.internal.processors.rest.protocols.http.jetty;
+
+import junit.framework.TestSuite;
+
+/**
+ * Integration tests for Grid REST functionality; Jetty is under the hood.
+ */
+public class GridRestSuite extends TestSuite {
+    /**
+     * @return Suite that contains all tests for REST.
+     */
+    public static TestSuite suite() {
+        TestSuite suite = new TestSuite("Apache Ignite REST Api suite");
+
+        suite.addTest(new TestSuite(RestSetupSimpleTest.class));
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9ede2d/modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/RestSetupSimpleTest.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/RestSetupSimpleTest.java
b/modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/RestSetupSimpleTest.java
new file mode 100644
index 0000000..7c076f7
--- /dev/null
+++ b/modules/rest-http/src/test/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/RestSetupSimpleTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.ignite.internal.processors.rest.protocols.http.jetty;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Map;
+import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Integration test for Grid REST functionality; Jetty is under the hood.
+ */
+public class RestSetupSimpleTest extends GridCommonAbstractTest {
+    /** Jetty port. */
+    private static final int JETTY_PORT = 8080;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws
Exception {
+        IgniteConfiguration configuration = super.getConfiguration(igniteInstanceName);
+
+        configuration.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return configuration;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrid(0);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids(true);
+    }
+
+    /**
+     * Runs version command using GridJettyRestProtocol.
+     */
+    public void testVersionCommand() throws Exception {
+        URLConnection conn = new URL("http://localhost:" + JETTY_PORT + "/ignite?cmd=version").openConnection();
+
+        conn.connect();
+
+        try (InputStreamReader streamReader = new InputStreamReader(conn.getInputStream()))
{
+            ObjectMapper objMapper = new ObjectMapper();
+            Map<String, Object> myMap = objMapper.readValue(streamReader,
+                new TypeReference<Map<String, Object>>() {
+                });
+
+            log.info("Version command response is: " + myMap);
+
+            assertTrue(myMap.containsKey("response"));
+            assertEquals(0, myMap.get("successStatus"));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9ede2d/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
index c0044c3..00c4d67 100644
--- a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
+++ b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
@@ -21,7 +21,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
-import javax.servlet.http.HttpServletResponse;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.deployment.uri.GridUriDeploymentAbstractSelfTest;
 import org.apache.ignite.spi.deployment.uri.UriDeploymentSpi;
@@ -31,9 +30,6 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTestConfig;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.handler.ResourceHandler;
-import org.eclipse.jetty.util.resource.Resource;
-
-import static org.eclipse.jetty.http.HttpHeader.LAST_MODIFIED;
 
 /**
  * Test http scanner.
@@ -80,13 +76,7 @@ public class GridHttpDeploymentSelfTest extends GridUriDeploymentAbstractSelfTes
 
         srv.addConnector(conn);
 
-        ResourceHandler hnd = new ResourceHandler() {
-            @Override protected void doResponseHeaders(HttpServletResponse resp, Resource
res, String mimeTyp) {
-                super.doResponseHeaders(resp, res, mimeTyp);
-
-                resp.setDateHeader(LAST_MODIFIED.asString(), res.lastModified());
-            }
-        };
+        ResourceHandler hnd = new ResourceHandler();
 
         hnd.setDirectoriesListed(true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9ede2d/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
b/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
index e566624..269b273 100644
--- a/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
+++ b/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
@@ -65,6 +65,12 @@ public class WebSessionSelfTest extends GridCommonAbstractTest {
     /** Servers count in load test. */
     private static final int SRV_CNT = 3;
 
+    /** Session invalidated marker. Added to HTTP response to indicate that session invalidation
was successful. */
+    public static final String INVALIDATED = "invalidated";
+
+    /** Session invalidated failed marker fot HTTP reponse. */
+    public static final String FAILED = "failed";
+
     /**
      * @return Name of the cache for this test.
      */
@@ -675,7 +681,13 @@ public class WebSessionSelfTest extends GridCommonAbstractTest {
 
                 assertEquals("true", reqSesValid);
 
-                assertEquals("invalidated", rdr.readLine());
+                StringBuilder sb = new StringBuilder();
+                String line;
+
+                while ((line = rdr.readLine()) != null)
+                    sb.append(line);
+
+                assertTrue(sb.toString().contains(INVALIDATED));
             }
         }
         finally {
@@ -1075,10 +1087,11 @@ public class WebSessionSelfTest extends GridCommonAbstractTest {
 
                 try {
                     req.getSession().invalidate();
-                    res.getWriter().println("invalidated");
+
+                    res.getWriter().println(INVALIDATED);
                 }
                 catch (Exception ignored) {
-                    res.getWriter().println("failed");
+                    res.getWriter().println(FAILED);
                 }
 
                 res.getWriter().flush();
@@ -1120,10 +1133,10 @@ public class WebSessionSelfTest extends GridCommonAbstractTest {
                 res.getWriter().flush();
 
             } else if (req.getPathInfo().equals("/simple")) {
-                HttpSession session = req.getSession();
-                X.println(">>>", "Request session simple: " + session.getId(), ">>>");
+                HttpSession ses = req.getSession();
+                X.println(">>>", "Request session simple: " + ses.getId(), ">>>");
 
-                res.getWriter().write(session.getId());
+                res.getWriter().write(ses.getId());
 
                 res.getWriter().flush();
             }
@@ -1138,11 +1151,11 @@ public class WebSessionSelfTest extends GridCommonAbstractTest {
                     X.printerrln("Login failed due to exception.", e);
                 }
 
-                HttpSession session = req.getSession();
+                HttpSession ses = req.getSession();
 
-                X.println(">>>", "Logged In session: " + session.getId(), ">>>");
+                X.println(">>>", "Logged In session: " + ses.getId(), ">>>");
 
-                res.getWriter().write(session.getId());
+                res.getWriter().write(ses.getId());
 
                 res.getWriter().flush();
             }
@@ -1248,9 +1261,11 @@ public class WebSessionSelfTest extends GridCommonAbstractTest {
 
         /** {@inheritDoc} */
         @Override public int hashCode() {
-            int result = val != null ? val.hashCode() : 0;
-            result = 31 * result + (keepBinaryFlag ? 1 : 0);
-            return result;
+            int res = val != null ? val.hashCode() : 0;
+
+            res = 31 * res + (keepBinaryFlag ? 1 : 0);
+
+            return res;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9ede2d/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 7c3d879..6b18bbb 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -80,7 +80,7 @@
         <javax.cache.tck.version>1.0.1</javax.cache.tck.version>
         <javax.cache.version>1.0.0</javax.cache.version>
         <jetbrains.annotations.version>13.0</jetbrains.annotations.version>
-        <jetty.version>9.2.11.v20150529</jetty.version>
+        <jetty.version>9.4.11.v20180605</jetty.version>
         <jmh.version>1.13</jmh.version>
         <jms.spec.version>1.1.1</jms.spec.version>
         <jsch.bundle.version>0.1.54_1</jsch.bundle.version>


Mime
View raw message