You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/03/18 21:35:10 UTC

[GitHub] [incubator-pinot] jackjlli commented on a change in pull request #6691: [wip][test] upgrade jdk to 11

jackjlli commented on a change in pull request #6691:
URL: https://github.com/apache/incubator-pinot/pull/6691#discussion_r597255619



##########
File path: pinot-controller/src/test/java/org/apache/pinot/controller/api/TestHttpServerMock.java
##########
@@ -0,0 +1,60 @@
+/**
+ * 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.pinot.controller.api;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.glassfish.grizzly.http.server.HttpHandler;
+import org.glassfish.grizzly.http.server.HttpServer;
+
+
+class TestHttpServerMock {
+  private HttpServer _httpServer;
+  private String _endpoint;
+
+  public void start(String path, HttpHandler handler)
+      throws IOException {
+    int port = findRandomOpenPort();
+    _httpServer = HttpServer.createSimpleServer(null, port);
+    _httpServer.getServerConfiguration().addHttpHandler(handler, path);
+    new Thread(() -> {
+      try {
+        _httpServer.start();
+      } catch (IOException e) {
+        throw new RuntimeException(e);

Review comment:
       Would it be good to log a message here?

##########
File path: pinot-controller/src/test/java/org/apache/pinot/controller/api/TestHttpServerMock.java
##########
@@ -0,0 +1,60 @@
+/**
+ * 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.pinot.controller.api;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.glassfish.grizzly.http.server.HttpHandler;
+import org.glassfish.grizzly.http.server.HttpServer;
+
+
+class TestHttpServerMock {

Review comment:
       Put a javadoc here on how this class will be used.

##########
File path: pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/util/SegmentDeletionManagerTest.java
##########
@@ -245,6 +245,8 @@ public void testRemoveDeletedSegments()
     for (int i = 2; i < 5; i++) {
       createTestFileWithAge(dummyDir2.getAbsolutePath() + File.separator + "file" + i, i);
     }
+    // Sleep 1 second to ensure the clock moves.
+    Thread.sleep(1000);

Review comment:
       Nit: 1000L




-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org