You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2017/12/11 02:01:46 UTC
[1/6] incubator-edgent git commit: [Edgent-439] enable console port
override
Repository: incubator-edgent
Updated Branches:
refs/heads/develop e4c3d3df9 -> cf5580553
[Edgent-439] enable console port override
add override via system property edgent.console.port
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/b78b50cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/b78b50cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/b78b50cb
Branch: refs/heads/develop
Commit: b78b50cb222c122478af351a0d19ac7f2dc42674
Parents: 05faa33
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Sun Dec 10 18:06:30 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Sun Dec 10 18:06:30 2017 -0500
----------------------------------------------------------------------
.../org/apache/edgent/console/server/HttpServer.java | 14 ++++++++++----
.../providers/development/DevelopmentProvider.java | 6 +++++-
2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b78b50cb/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
----------------------------------------------------------------------
diff --git a/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java b/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
index 302200d..2449b38 100644
--- a/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
+++ b/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
@@ -19,6 +19,8 @@ under the License.
package org.apache.edgent.console.server;
+import java.io.File;
+
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
@@ -27,8 +29,12 @@ import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.webapp.WebAppContext;
-import java.io.File;
-
+/**
+ * The "Edgent Console".
+ * <p>
+ * The Console's HTTP server starts with a random available port unless
+ * a port is specified via the {@code edgent.console.port} system property.
+ */
public class HttpServer {
/**
@@ -41,8 +47,8 @@ public class HttpServer {
* The static class that creates the singleton HttpServer object.
*/
private static class HttpServerHolder {
- // use port 0 so we know the server will always start
- private static final Server JETTYSERVER = new Server(0);
+ // use port 0 if system prop not set, so we know the server will always start
+ private static final Server JETTYSERVER = new Server(Integer.getInteger("edgent.console.port", 0));
private static final WebAppContext WEBAPP = new WebAppContext();
private static final HttpServer INSTANCE = new HttpServer();
private static boolean INITIALIZED = false;
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b78b50cb/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
----------------------------------------------------------------------
diff --git a/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java b/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
index 67106f6..e84f17b 100644
--- a/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
+++ b/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
@@ -44,7 +44,11 @@ import com.google.gson.JsonObject;
* <UL>
* <LI>
* starting an embedded web-server providing the Edgent development console
- * that shows live graphs for running applications.
+ * that shows live graphs for running applications.
+ * The console {@link HttpServer} is registered as a service with
+ * the provider and is accessible via {@link #getServices()}.
+ * The console's HTTP server starts with a random available port unless
+ * a port is specified via the {@code edgent.console.port} system property.
* </LI>
* <LI>
* Creating a metrics registry with metrics registered
[5/6] incubator-edgent git commit: don't reuse console/server test
JVMs
Posted by dl...@apache.org.
don't reuse console/server test JVMs
HttpServerPortTest will fail if it isn't the first test run (due to
HttpServer internals)
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/bc362a2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/bc362a2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/bc362a2a
Branch: refs/heads/develop
Commit: bc362a2aff06dcf9371cc2fb9f0a809ab34c36e4
Parents: f24699a
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Sun Dec 10 20:47:13 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Sun Dec 10 20:47:13 2017 -0500
----------------------------------------------------------------------
console/server/pom.xml | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/bc362a2a/console/server/pom.xml
----------------------------------------------------------------------
diff --git a/console/server/pom.xml b/console/server/pom.xml
index 7c5944c..956ff17 100644
--- a/console/server/pom.xml
+++ b/console/server/pom.xml
@@ -84,6 +84,14 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- needed because of HttpServer impl and HttpServerPortTest -->
+ <reuseForks>false</reuseForks>
+ </configuration>
+ </plugin>
</plugins>
</build>
[4/6] incubator-edgent git commit: add log to dbg test failure on
travis
Posted by dl...@apache.org.
add log to dbg test failure on travis
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/f24699a0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/f24699a0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/f24699a0
Branch: refs/heads/develop
Commit: f24699a0b1963eb000dbd83c0049fe837eb9b7a2
Parents: 1ac18e4
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Sun Dec 10 20:23:05 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Sun Dec 10 20:23:05 2017 -0500
----------------------------------------------------------------------
.../main/java/org/apache/edgent/console/server/HttpServer.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/f24699a0/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
----------------------------------------------------------------------
diff --git a/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java b/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
index 2449b38..dd89093 100644
--- a/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
+++ b/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
@@ -28,6 +28,8 @@ import org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.webapp.WebAppContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The "Edgent Console".
@@ -37,6 +39,8 @@ import org.eclipse.jetty.webapp.WebAppContext;
*/
public class HttpServer {
+ private static final Logger logger = LoggerFactory.getLogger(HttpServer.class);
+
/**
* The only constructor. A private no-argument constructor. Called only once from the static HttpServerHolder class.
*/
@@ -69,6 +73,7 @@ public class HttpServer {
*/
public static HttpServer getInstance() throws Exception {
if (!HttpServerHolder.INITIALIZED) {
+ logger.info("initializing");
HttpServerHolder.WEBAPP.setContextPath("/console");
ServletContextHandler contextJobs = new ServletContextHandler(ServletContextHandler.SESSIONS);
contextJobs.setContextPath("/jobs");
[2/6] incubator-edgent git commit: add console port override test
Posted by dl...@apache.org.
add console port override test
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/123fd3ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/123fd3ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/123fd3ac
Branch: refs/heads/develop
Commit: 123fd3ac7df05b4ab264203dd31190f4cf6a035d
Parents: b78b50c
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Sun Dec 10 19:16:37 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Sun Dec 10 19:16:37 2017 -0500
----------------------------------------------------------------------
.../test/console/server/HttpServerTestPort.java | 58 ++++++++++++++++++++
1 file changed, 58 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/123fd3ac/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerTestPort.java
----------------------------------------------------------------------
diff --git a/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerTestPort.java b/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerTestPort.java
new file mode 100644
index 0000000..95778bc
--- /dev/null
+++ b/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerTestPort.java
@@ -0,0 +1,58 @@
+/*
+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.edgent.test.console.server;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.edgent.console.server.HttpServer;
+import org.junit.Test;
+
+/**
+ * This is a separate test because the HttpServer implementation
+ * precludes changing the console port within a jvm instance.
+ */
+public class HttpServerTestPort {
+
+ int getAvailablePort() throws IOException {
+ try (Socket s = new Socket()) {
+ s.bind(null);
+ return s.getLocalPort();
+ }
+ }
+
+ @Test
+ public void overridePortNumber() throws Exception {
+ // count on the OS not immediately reusing an available local port.
+ int port = getAvailablePort();
+ int port2 = getAvailablePort();
+ assumeTrue(port != port2);
+
+ System.setProperty("edgent.console.port", String.valueOf(port));
+ HttpServer myHttpServer = HttpServer.getInstance();
+ myHttpServer.startServer();
+
+ int portNum = myHttpServer.getConsolePortNumber();
+ assertEquals(port, portNum);
+ }
+
+}
[6/6] incubator-edgent git commit: Merge pull request #331
Posted by dl...@apache.org.
Merge pull request #331
This closes #331
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/cf558055
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/cf558055
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/cf558055
Branch: refs/heads/develop
Commit: cf55805539648a82823f93c833ad1be409f97893
Parents: e4c3d3d bc362a2
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Sun Dec 10 21:01:37 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Sun Dec 10 21:01:37 2017 -0500
----------------------------------------------------------------------
console/server/pom.xml | 8 +++
.../edgent/console/server/HttpServer.java | 19 +++++--
.../test/console/server/HttpServerPortTest.java | 58 ++++++++++++++++++++
.../development/DevelopmentProvider.java | 6 +-
4 files changed, 86 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
[3/6] incubator-edgent git commit: fix port override test class name
Posted by dl...@apache.org.
fix port override test class name
Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/1ac18e4d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/1ac18e4d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/1ac18e4d
Branch: refs/heads/develop
Commit: 1ac18e4de70678412bfc1a3b83825ce711b33ba4
Parents: 123fd3a
Author: Dale LaBossiere <dl...@us.ibm.com>
Authored: Sun Dec 10 19:28:57 2017 -0500
Committer: Dale LaBossiere <dl...@us.ibm.com>
Committed: Sun Dec 10 19:28:57 2017 -0500
----------------------------------------------------------------------
.../test/console/server/HttpServerPortTest.java | 58 ++++++++++++++++++++
.../test/console/server/HttpServerTestPort.java | 58 --------------------
2 files changed, 58 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/1ac18e4d/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerPortTest.java
----------------------------------------------------------------------
diff --git a/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerPortTest.java b/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerPortTest.java
new file mode 100644
index 0000000..64e8b22
--- /dev/null
+++ b/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerPortTest.java
@@ -0,0 +1,58 @@
+/*
+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.edgent.test.console.server;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.edgent.console.server.HttpServer;
+import org.junit.Test;
+
+/**
+ * This is a separate test because the HttpServer implementation
+ * precludes changing the console port within a jvm instance.
+ */
+public class HttpServerPortTest {
+
+ int getAvailablePort() throws IOException {
+ try (Socket s = new Socket()) {
+ s.bind(null);
+ return s.getLocalPort();
+ }
+ }
+
+ @Test
+ public void testOverridePortNumber() throws Exception {
+ // count on the OS not immediately reusing an available local port.
+ int port = getAvailablePort();
+ int port2 = getAvailablePort();
+ assumeTrue(port != port2);
+
+ System.setProperty("edgent.console.port", String.valueOf(port));
+ HttpServer myHttpServer = HttpServer.getInstance();
+ myHttpServer.startServer();
+
+ int portNum = myHttpServer.getConsolePortNumber();
+ assertEquals(port, portNum);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/1ac18e4d/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerTestPort.java
----------------------------------------------------------------------
diff --git a/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerTestPort.java b/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerTestPort.java
deleted file mode 100644
index 95778bc..0000000
--- a/console/server/src/test/java/org/apache/edgent/test/console/server/HttpServerTestPort.java
+++ /dev/null
@@ -1,58 +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.edgent.test.console.server;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.IOException;
-import java.net.Socket;
-
-import org.apache.edgent.console.server.HttpServer;
-import org.junit.Test;
-
-/**
- * This is a separate test because the HttpServer implementation
- * precludes changing the console port within a jvm instance.
- */
-public class HttpServerTestPort {
-
- int getAvailablePort() throws IOException {
- try (Socket s = new Socket()) {
- s.bind(null);
- return s.getLocalPort();
- }
- }
-
- @Test
- public void overridePortNumber() throws Exception {
- // count on the OS not immediately reusing an available local port.
- int port = getAvailablePort();
- int port2 = getAvailablePort();
- assumeTrue(port != port2);
-
- System.setProperty("edgent.console.port", String.valueOf(port));
- HttpServer myHttpServer = HttpServer.getInstance();
- myHttpServer.startServer();
-
- int portNum = myHttpServer.getConsolePortNumber();
- assertEquals(port, portNum);
- }
-
-}