Merge branches 'develop' and 'feature/pre-release-finetuning' of https://git-wip-us.apache.org/repos/asf/incubator-edgent into feature/pre-release-finetuning
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 5f1c8c8..d57cdc1 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -142,7 +142,7 @@
## Building Edgent For Using Edgent
__Note:__ Apache Edgent releases include convenience binaries. Use of them
-is covered in [samples/APPLICATION_DEVELOPMENT.md](samples/APPLICATION_DEVELOPMENT.md).
+is covered in [samples/APPLICATION_DEVELOPMENT.md](https://github.com/apache/incubator-edgent-samples/blob/develop/APPLICATION_DEVELOPMENT.md).
If instead you want to build Edgent for your use there are two different use-cases:
@@ -171,7 +171,7 @@
### Building Edgent for NOT using it with Maven
Build Edgent as described above to populate the local maven repository.
-Then see [samples/APPLICATION_DEVELOPMENT.md](samples/APPLICATION_DEVELOPMENT.md)
+Then see [samples/APPLICATION_DEVELOPMENT.md](https://github.com/apache/incubator-edgent-samples/blob/develop/APPLICATION_DEVELOPMENT.md)
for information about the `get-edgent-jars.sh` script.
An alternative to using the `get-edgent-jars.sh` script is to
@@ -484,10 +484,11 @@
* `analytics` - Analytics for use by Edgent applications.
* `utils` - Optional utilities for Edgent applications.
* `console` - Development console that allows visualization of the streams within an Edgent application during development.
-* `samples` - Sample applications, from Hello World to some sensor simulation applications.
* `android` - Code specific to Android.
* `test` - SVT
+Samples are located at https://github.com/apache/incubator-edgent-samples
+
## Coding Conventions
Placeholder: see [EDGENT-23](https://issues.apache.org/jira/browse/EDGENT-23)
diff --git a/README b/README
index ce57c19..40d08ad 100644
--- a/README
+++ b/README
@@ -12,7 +12,8 @@
$ ./mvnw clean install # add -DskipTests to omit running the tests
You can now construct applications that use Edgent. The Edgent samples
-are a good place to start and are available as a separate download.
+are a good place to start and are available as a separate download
+at https://github.com/apache/incubator-edgent-samples
Additional Information
----------------------
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 7da5c39..fc2bbd8 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -71,6 +71,7 @@
Miscellaneous changes
---------------------
+EDGENT-438 Improve WebSocketClientTest skip-if-cant-connect
EDGENT-436 Change tests that use complete() TMO for successful runs
EDGENT-435 CME in TrackingScheduledExecutor seen with testMultiTopologyPollWithError()
EDGENT-434 Desensitize PlumbingTest.testParallelBalanced
diff --git a/connectors/websocket/src/test/java/org/apache/edgent/test/connectors/wsclient/javax/websocket/WebSocketClientConnectTestHelper.java b/connectors/websocket/src/test/java/org/apache/edgent/test/connectors/wsclient/javax/websocket/WebSocketClientConnectTestHelper.java
new file mode 100644
index 0000000..41878f7
--- /dev/null
+++ b/connectors/websocket/src/test/java/org/apache/edgent/test/connectors/wsclient/javax/websocket/WebSocketClientConnectTestHelper.java
@@ -0,0 +1,64 @@
+/*
+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.connectors.wsclient.javax.websocket;
+
+import java.net.URI;
+import java.util.Properties;
+
+import javax.websocket.ClientEndpoint;
+import javax.websocket.ContainerProvider;
+import javax.websocket.OnError;
+import javax.websocket.Session;
+import javax.websocket.WebSocketContainer;
+
+import org.eclipse.jetty.util.component.LifeCycle;
+
+@ClientEndpoint
+public class WebSocketClientConnectTestHelper {
+
+ @OnError
+ public void onError(Session client, Throwable t) {
+ System.err.println("Unable to connect to WebSocket server: "+t.getMessage());
+ }
+
+ public static void connectToServer(Properties config) throws Exception {
+ // Verify we can create a real websocket connection to the server.
+ //
+ // We do the following instead of a simple socket connect
+ // because in at least one location, the websocket connect/upgrade
+ // fails with: expecting 101 got 403 (Forbidden).
+ // There's something about that location that's not
+ // allowing a websocket to be created to the (public) server.
+ // Everything works fine from other locations.
+ //
+ String wsUri = config.getProperty("ws.uri");
+ URI uri = new URI(wsUri);
+ WebSocketContainer container = ContainerProvider.getWebSocketContainer();
+ try {
+ Session session = container.connectToServer(WebSocketClientConnectTestHelper.class, uri);
+ session.close();
+ }
+ finally {
+ if (container instanceof LifeCycle) {
+ ((LifeCycle)container).stop();
+ }
+ }
+ }
+
+}
diff --git a/connectors/websocket/src/test/java/org/apache/edgent/test/connectors/wsclient/javax/websocket/WebSocketClientTest.java b/connectors/websocket/src/test/java/org/apache/edgent/test/connectors/wsclient/javax/websocket/WebSocketClientTest.java
index 4ef65c9..b256bfe 100644
--- a/connectors/websocket/src/test/java/org/apache/edgent/test/connectors/wsclient/javax/websocket/WebSocketClientTest.java
+++ b/connectors/websocket/src/test/java/org/apache/edgent/test/connectors/wsclient/javax/websocket/WebSocketClientTest.java
@@ -23,8 +23,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
-import java.net.InetSocketAddress;
-import java.net.Socket;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
@@ -772,21 +770,15 @@
}
private void skipTestIfCantConnect(Properties config) throws Exception {
- String wsUri = config.getProperty("ws.uri");
- // Skip tests if the WebSocket server can't be contacted.
- try {
- URI uri = new URI(wsUri);
- int port = uri.getPort();
- if (port == -1)
- port = uri.getScheme().equals("ws") ? 80 : 443;
- Socket s = new Socket();
- s.connect(new InetSocketAddress(uri.getHost(), port), 5*1000/*cn-timeout-msec*/);
- s.close();
- } catch (Exception e) {
- System.err.println("Unable to connect to WebSocket server "+wsUri+" : "+e.getMessage());
- e.printStackTrace();
- assumeTrue(false);
- }
+ String wsUri = config.getProperty("ws.uri");
+ try {
+ WebSocketClientConnectTestHelper.connectToServer(config);
+ } catch (Exception e) {
+ System.err.println("Unable to connect to WebSocket server "+wsUri+" : "+e.getMessage());
+ e.printStackTrace();
+ System.err.println("skipTestIfCantConnect(): SKIPPING TEST");
+ assumeTrue(false);
+ }
}
@Test