You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2020/09/07 21:21:44 UTC
[netbeans] branch master updated: Fix unittest for webcommon caused
by download failures from cdnjs
This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new a778c9e Fix unittest for webcommon caused by download failures from cdnjs
a778c9e is described below
commit a778c9e7588cb28dc821bac42bfb07955d49b656
Author: Matthias Bläsing <mb...@doppel-helix.eu>
AuthorDate: Mon Sep 7 20:22:02 2020 +0200
Fix unittest for webcommon caused by download failures from cdnjs
It seems that for some networks CDNJS requires sending a User-Agent
header. This changeset adds it to the requests.
---
.../org/netbeans/modules/javascript2/extjs/model/ExtModelTest.java | 6 +++++-
.../netbeans/modules/javascript2/extjs/model/JsStructureTest.java | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/webcommon/javascript2.extjs/test/unit/src/org/netbeans/modules/javascript2/extjs/model/ExtModelTest.java b/webcommon/javascript2.extjs/test/unit/src/org/netbeans/modules/javascript2/extjs/model/ExtModelTest.java
index 0bdb719..4505108 100644
--- a/webcommon/javascript2.extjs/test/unit/src/org/netbeans/modules/javascript2/extjs/model/ExtModelTest.java
+++ b/webcommon/javascript2.extjs/test/unit/src/org/netbeans/modules/javascript2/extjs/model/ExtModelTest.java
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
+import java.net.URLConnection;
import org.netbeans.modules.javascript2.model.ModelTestBase;
/**
@@ -36,12 +37,15 @@ public class ExtModelTest extends ModelTestBase {
}
@Override
+ @SuppressWarnings("NestedAssignment")
protected void setUp() throws Exception {
super.setUp();
File classManagerJs = new File(getDataDir(), "testfiles/completion/applyMethod/ClassManager.js");
if(! classManagerJs.exists()) {
URL source = new URL("https://cdnjs.cloudflare.com/ajax/libs/extjs/4.2.1/src/class/ClassManager.js");
- try(InputStream is = source.openStream();
+ URLConnection connection = source.openConnection();
+ connection.addRequestProperty("User-Agent", "NetBeans Unittesting");
+ try(InputStream is = connection.getInputStream();
OutputStream os = new FileOutputStream(classManagerJs)) {
byte[] buffer = new byte[1024 * 10];
int read;
diff --git a/webcommon/javascript2.extjs/test/unit/src/org/netbeans/modules/javascript2/extjs/model/JsStructureTest.java b/webcommon/javascript2.extjs/test/unit/src/org/netbeans/modules/javascript2/extjs/model/JsStructureTest.java
index 3233a46..26a94a2 100644
--- a/webcommon/javascript2.extjs/test/unit/src/org/netbeans/modules/javascript2/extjs/model/JsStructureTest.java
+++ b/webcommon/javascript2.extjs/test/unit/src/org/netbeans/modules/javascript2/extjs/model/JsStructureTest.java
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
+import java.net.URLConnection;
import org.netbeans.modules.javascript2.editor.JsTestBase;
import org.openide.filesystems.FileObject;
@@ -38,12 +39,15 @@ public class JsStructureTest extends JsTestBase {
}
@Override
+ @SuppressWarnings("NestedAssignment")
protected void setUp() throws Exception {
super.setUp();
File classManagerJs = new File(getDataDir(), "testfiles/completion/applyMethod/ClassManager.js");
if(! classManagerJs.exists()) {
URL source = new URL("https://cdnjs.cloudflare.com/ajax/libs/extjs/4.2.1/src/class/ClassManager.js");
- try(InputStream is = source.openStream();
+ URLConnection connection = source.openConnection();
+ connection.addRequestProperty("User-Agent", "NetBeans Unittesting");
+ try(InputStream is = connection.getInputStream();
OutputStream os = new FileOutputStream(classManagerJs)) {
byte[] buffer = new byte[1024 * 10];
int read;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists