Skip to content

Commit 2bac633

Browse files
authored
Merge pull request #303 from sid-srini/fix_netbeans_tests_on_windows
Fix Netbeans tests failures
2 parents 08ed2f7 + bf8f272 commit 2bac633

File tree

3 files changed

+281
-1
lines changed

3 files changed

+281
-1
lines changed

build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
patches/7722.diff
5656
patches/7724.diff
5757
patches/7733.diff
58+
patches/7910.diff
5859
patches/mvn-sh.diff
5960
patches/generate-dependencies.diff
6061
patches/rename-debugger.diff

patches/7910.diff

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
diff --git a/.gitattributes b/.gitattributes
2+
index b96c7fd985..7c9b72b889 100644
3+
--- a/.gitattributes
4+
+++ b/.gitattributes
5+
@@ -35,3 +35,7 @@
6+
7+
# Define some file types explicitly as being binary.
8+
*.jar binary
9+
+
10+
+# Define rules for files in specific paths, such as test data,
11+
+# for line endings, binary types etc.
12+
+java/java.hints/test/unit/data/goldenfiles/** text eol=lf
13+
diff --git a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/TreeRuleTestBase.java b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/TreeRuleTestBase.java
14+
index ede2a586e888..a351d52bd5fc 100644
15+
--- a/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/TreeRuleTestBase.java
16+
+++ b/java/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/TreeRuleTestBase.java
17+
@@ -242,9 +242,11 @@ protected String performFixTest(String fileName, String code, int pos, String er
18+
String realCode = toCheckDocument.getText(0, toCheckDocument.getLength());
19+
20+
//ignore whitespaces:
21+
- realCode = realCode.replaceAll("[ \t\n]+", " ");
22+
+ realCode = realCode.replaceAll("\\s+", " ");
23+
24+
if (golden != null) {
25+
+ //ignore CRLF/LF differences in golden:
26+
+ if (!"\n".equals(System.lineSeparator())) golden = golden.replaceAll(System.lineSeparator(), " ");
27+
assertEquals("The output code does not match the expected code.", golden, realCode);
28+
}
29+
30+
diff --git a/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java b/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
31+
index bcd1c07c8701..fb4f11400726 100644
32+
--- a/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
33+
+++ b/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
34+
@@ -685,6 +685,7 @@ public void testPreserveValidMethods1() throws Exception {
35+
" System.err.println(\"Hello, world!\");\n" +
36+
" }\n" +
37+
"}");
38+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
39+
assertEquals(expected, file2Fixed);
40+
}
41+
42+
@@ -729,6 +730,7 @@ public void testClearInvalidMethod() throws Exception {
43+
" throw new java.lang.RuntimeException(\"Uncompilable code - compiler.err.cant.resolve.location\");\n" +
44+
" }\n" +
45+
"}");
46+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
47+
assertEquals(expected, file2Fixed);
48+
}
49+
50+
@@ -792,6 +794,7 @@ public void testPreserveValidInitializers() throws Exception {
51+
" private int F5a;\n" +
52+
" private int F5b;\n" +
53+
"}");
54+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
55+
assertEquals(expected, file2Fixed);
56+
}
57+
58+
@@ -834,6 +837,7 @@ public void testBrokenClassHeader1() throws Exception {
59+
" throw new java.lang.RuntimeException(\"Uncompilable code\");\n" +
60+
" }\n" +
61+
"}");
62+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
63+
assertEquals(expected, file2Fixed);
64+
}
65+
66+
@@ -883,6 +887,7 @@ public void testNullReturnUnknown() throws Exception {
67+
" throw new java.lang.RuntimeException(\"Uncompilable code\");\n" +
68+
" }\n" +
69+
"}");
70+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
71+
assertEquals(expected, file2Fixed);
72+
}
73+
74+
@@ -932,6 +937,7 @@ public void testBrokenNewClass() throws Exception {
75+
" throw new java.lang.RuntimeException(\"Uncompilable code\");\n" +
76+
" }\n" +
77+
"}");
78+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
79+
assertEquals(expected, file2Fixed);
80+
}
81+
82+
@@ -983,6 +989,7 @@ public void testReturnBroken() throws Exception {
83+
" throw new java.lang.RuntimeException(\"Uncompilable code\");\n" +
84+
" }\n" +
85+
"}");
86+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
87+
assertEquals(expected, file2Fixed);
88+
}
89+
90+
@@ -1037,6 +1044,7 @@ public void testAssertBroken() throws Exception {
91+
" throw new java.lang.RuntimeException(\"Uncompilable code\");\n" +
92+
" }\n" +
93+
"}");
94+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
95+
assertEquals(expected, file2Fixed);
96+
}
97+
98+
@@ -1117,6 +1125,7 @@ public void testAnonymousComplex() throws Exception {
99+
" };\n" +
100+
" }\n" +
101+
"}");
102+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
103+
assertEquals(expected, file2Fixed);
104+
}
105+
106+
@@ -1165,6 +1174,7 @@ public void testFieldInit() throws Exception {
107+
" super();\n" +
108+
" }\n" +
109+
"}");
110+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
111+
assertEquals(expected, file2Fixed);
112+
}
113+
114+
@@ -1239,6 +1249,7 @@ public void testAnonymousComplex2() throws Exception {
115+
" }\n" +
116+
" }\n" +
117+
"}");
118+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
119+
assertEquals(expected, file2Fixed);
120+
}
121+
122+
@@ -1285,6 +1296,7 @@ public void testNewClass() throws Exception {
123+
" throw new java.lang.RuntimeException(\"Uncompilable code - compiler.err.cant.apply.symbol\");\n" +
124+
" }\n" +
125+
"}");
126+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
127+
assertEquals(expected, file2Fixed);
128+
}
129+
130+
@@ -1336,6 +1348,7 @@ public void testUndefNewArray() throws Exception {
131+
" throw new java.lang.RuntimeException(\"Uncompilable code\");\n" +
132+
" }\n" +
133+
"}");
134+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
135+
assertEquals(expected, file2Fixed);
136+
}
137+
138+
@@ -1412,6 +1425,7 @@ public void testUndefAnonymous() throws Exception {
139+
" }\n" +
140+
" }\n" +
141+
"}");
142+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
143+
assertEquals(expected, file2Fixed);
144+
}
145+
146+
@@ -1471,6 +1485,7 @@ public void testWeirdSuperCall() throws Exception {
147+
" }\n" +
148+
" }\n" +
149+
"}");
150+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
151+
assertEquals(expected, file2Fixed);
152+
}
153+
154+
@@ -1590,6 +1605,7 @@ public void testAnonymousComplex3() throws Exception {
155+
" }\n" +
156+
" }\n" +
157+
"}");
158+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
159+
assertEquals(expected, file2Fixed);
160+
}
161+
162+
@@ -1690,6 +1706,7 @@ public void testAnonymousComplex4() throws Exception {
163+
" throw new java.lang.RuntimeException(\"Uncompilable code - compiler.err.cant.resolve.location.args\");\n" +
164+
" }\n" +
165+
"}");
166+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
167+
assertEquals(expected, file2Fixed);
168+
}
169+
170+
@@ -1763,6 +1780,7 @@ public void testAnonymousComplexCorrect() throws Exception {
171+
" }\n" +
172+
" }\n" +
173+
"}");
174+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
175+
assertEquals(expected, file2Fixed);
176+
}
177+
178+
@@ -1806,6 +1824,7 @@ public void testWarningsAreNotErrors() throws Exception {
179+
" }\n" +
180+
" Test t;\n" +
181+
"}");
182+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
183+
assertEquals(expected, file2Fixed);
184+
}
185+
186+
@@ -1878,6 +1897,7 @@ public void testSuperCall() throws Exception {
187+
" public default void test2() {\n" +
188+
" }\n" +
189+
"}");
190+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
191+
assertEquals(expected, file2Fixed);
192+
}
193+
194+
@@ -1923,6 +1943,7 @@ public void testStaticInit() throws Exception {
195+
" System.err.println();\n" +
196+
" }\n" +
197+
"}");
198+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
199+
assertEquals(expected, file2Fixed);
200+
}
201+
202+
@@ -2161,6 +2182,7 @@ public void testMethodWithErroneousInMemberRef() throws Exception {
203+
" \n" +
204+
" public Object test(Object o);\n" +
205+
"}");
206+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
207+
assertEquals(expected, file2Fixed);
208+
}
209+
210+
@@ -2242,6 +2264,7 @@ public void testPatternSwitch() throws Exception {
211+
" throw new java.lang.RuntimeException(\"Uncompilable code\");\n" +
212+
" }\n" +
213+
"}");
214+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
215+
assertEquals(expected, file2Fixed);
216+
}
217+
218+
@@ -2294,6 +2317,7 @@ public void testTypeTest() throws Exception {
219+
" }\n" +
220+
" }\n" +
221+
"}");
222+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
223+
assertEquals(expected, file2Fixed);
224+
}
225+
226+
@@ -2339,6 +2363,7 @@ public void testWrongRecordComponent() throws Exception {
227+
" }\n" +
228+
" private final int wait;\n" +
229+
"}");
230+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
231+
assertEquals(expected, file2Fixed);
232+
}
233+
234+
@@ -2391,6 +2416,7 @@ public void testRecord1() throws Exception {
235+
" }\n" +
236+
" private final int i;\n" +
237+
"}");
238+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
239+
assertEquals(expected, file2Fixed);
240+
}
241+
242+
@@ -2428,6 +2454,7 @@ public void testRecord2() throws Exception {
243+
" }\n" +
244+
" private final int i;\n" +
245+
"}");
246+
+ if (!"\n".equals(System.lineSeparator())) file2Fixed.replaceAll((k, v) -> v.replaceAll(System.lineSeparator(), "\n"));
247+
assertEquals(expected, file2Fixed);
248+
}
249+

patches/rename-debugger.diff

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ index 87ec97a64b..781f97f44e 100644
99
public final class AttachConfigurations {
1010

1111
- static final String CONFIG_TYPE = "java+"; // NOI18N
12-
+ static final String CONFIG_TYPE = "jdk"; // NOI18N
12+
+ public static final String CONFIG_TYPE = "jdk"; // NOI18N
1313
static final String CONFIG_REQUEST = "attach"; // NOI18N
1414

1515
static final RequestProcessor RP = new RequestProcessor(AttachConfigurations.class);
@@ -26,3 +26,33 @@ index 91bf8e30db..6d9a77e63a 100644
2626

2727
@Override
2828
public CompletableFuture<List<CompletionItem>> configurations(Supplier<CompletableFuture<Project>> projectSupplier) {
29+
diff --git a/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java b/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
30+
index 4fce71a094..2b6362ce37 100644
31+
--- a/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
32+
+++ b/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
33+
@@ -177,6 +177,7 @@ import org.netbeans.api.sendopts.CommandLine;
34+
import org.netbeans.junit.NbTestCase;
35+
import org.netbeans.modules.java.hints.infrastructure.JavaErrorProvider;
36+
import org.netbeans.modules.java.lsp.server.TestCodeLanguageClient;
37+
+import org.netbeans.modules.java.lsp.server.debugging.attach.AttachConfigurations;
38+
import org.netbeans.modules.java.lsp.server.input.QuickPickItem;
39+
import org.netbeans.modules.java.lsp.server.input.ShowQuickPickParams;
40+
import org.netbeans.modules.java.lsp.server.input.ShowInputBoxParams;
41+
@@ -1223,7 +1224,7 @@ public class ServerTest extends NbTestCase {
42+
}
43+
44+
private void checkAttachToPort(DebugConnector c) {
45+
- assertEquals("java+", c.getType());
46+
+ assertEquals(AttachConfigurations.CONFIG_TYPE, c.getType());
47+
List<String> arguments = c.getArguments();
48+
assertEquals(2, arguments.size());
49+
assertEquals("hostName", arguments.get(0));
50+
@@ -1232,7 +1233,7 @@ public class ServerTest extends NbTestCase {
51+
}
52+
53+
private void checkAttachToProcess(DebugConnector c) {
54+
- assertEquals("java+", c.getType());
55+
+ assertEquals(AttachConfigurations.CONFIG_TYPE, c.getType());
56+
List<String> arguments = c.getArguments();
57+
assertEquals(1, arguments.size());
58+
assertEquals("processId", arguments.get(0));

0 commit comments

Comments
 (0)