13
13
*******************************************************************************/
14
14
package org .eclipse .core .tests .internal .builders ;
15
15
16
+ import static org .junit .Assert .assertArrayEquals ;
17
+
16
18
import org .eclipse .core .internal .events .BuildContext ;
17
19
import org .eclipse .core .internal .resources .BuildConfiguration ;
18
20
import org .eclipse .core .resources .*;
@@ -133,22 +135,22 @@ public void testBuildContext() {
133
135
IBuildContext context ;
134
136
135
137
context = new BuildContext (p0v0 , new IBuildConfiguration [] {p0v0 , p1v0 }, buildOrder );
136
- assertEquals ("1.0" , new IBuildConfiguration [] {}, context .getAllReferencedBuildConfigs ());
137
- assertEquals ("1.1" , new IBuildConfiguration [] {p0v1 , p1v0 }, context .getAllReferencingBuildConfigs ());
138
- assertEquals ("1.2" , new IBuildConfiguration [] {p0v0 , p1v0 }, context .getRequestedConfigs ());
138
+ assertArrayEquals ("1.0" , new IBuildConfiguration [] {}, context .getAllReferencedBuildConfigs ());
139
+ assertArrayEquals ("1.1" , new IBuildConfiguration [] { p0v1 , p1v0 }, context .getAllReferencingBuildConfigs ());
140
+ assertArrayEquals ("1.2" , new IBuildConfiguration [] { p0v0 , p1v0 }, context .getRequestedConfigs ());
139
141
140
142
context = new BuildContext (p0v1 , buildOrder , buildOrder );
141
- assertEquals ("2.0" , new IBuildConfiguration [] {p0v0 }, context .getAllReferencedBuildConfigs ());
142
- assertEquals ("2.1" , new IBuildConfiguration [] {p1v0 }, context .getAllReferencingBuildConfigs ());
143
+ assertArrayEquals ("2.0" , new IBuildConfiguration [] { p0v0 }, context .getAllReferencedBuildConfigs ());
144
+ assertArrayEquals ("2.1" , new IBuildConfiguration [] { p1v0 }, context .getAllReferencingBuildConfigs ());
143
145
144
146
context = new BuildContext (p1v0 , buildOrder , buildOrder );
145
- assertEquals ("3.0" , new IBuildConfiguration [] {p0v0 , p0v1 }, context .getAllReferencedBuildConfigs ());
146
- assertEquals ("3.1" , new IBuildConfiguration [] {}, context .getAllReferencingBuildConfigs ());
147
+ assertArrayEquals ("3.0" , new IBuildConfiguration [] { p0v0 , p0v1 }, context .getAllReferencedBuildConfigs ());
148
+ assertArrayEquals ("3.1" , new IBuildConfiguration [] {}, context .getAllReferencingBuildConfigs ());
147
149
148
150
// And it works with no build context too
149
151
context = new BuildContext (p1v0 );
150
- assertEquals ("4.0" , new IBuildConfiguration [] {}, context .getAllReferencedBuildConfigs ());
151
- assertEquals ("4.1" , new IBuildConfiguration [] {}, context .getAllReferencingBuildConfigs ());
152
+ assertArrayEquals ("4.0" , new IBuildConfiguration [] {}, context .getAllReferencedBuildConfigs ());
153
+ assertArrayEquals ("4.1" , new IBuildConfiguration [] {}, context .getAllReferencingBuildConfigs ());
152
154
}
153
155
154
156
public void testSingleProjectBuild () throws CoreException {
@@ -186,16 +188,22 @@ public void testWorkspaceBuildProject() throws CoreException {
186
188
assertTrue ("1.0" , ContextBuilder .checkValid ());
187
189
188
190
IBuildContext context = ContextBuilder .getContext (project0 .getActiveBuildConfig ());
189
- assertEquals ("2.0" , new IBuildConfiguration [] {project2 .getActiveBuildConfig (), project1 .getActiveBuildConfig ()}, context .getAllReferencedBuildConfigs ());
191
+ assertArrayEquals ("2.0" ,
192
+ new IBuildConfiguration [] { project2 .getActiveBuildConfig (), project1 .getActiveBuildConfig () },
193
+ context .getAllReferencedBuildConfigs ());
190
194
assertEquals ("2.1" , 0 , context .getAllReferencingBuildConfigs ().length );
191
195
192
196
context = ContextBuilder .getBuilder (project1 .getActiveBuildConfig ()).contextForLastBuild ;
193
- assertEquals ("3.0" , new IBuildConfiguration [] {project2 .getActiveBuildConfig ()}, context .getAllReferencedBuildConfigs ());
194
- assertEquals ("3.1" , new IBuildConfiguration [] {project0 .getActiveBuildConfig ()}, context .getAllReferencingBuildConfigs ());
197
+ assertArrayEquals ("3.0" , new IBuildConfiguration [] { project2 .getActiveBuildConfig () },
198
+ context .getAllReferencedBuildConfigs ());
199
+ assertArrayEquals ("3.1" , new IBuildConfiguration [] { project0 .getActiveBuildConfig () },
200
+ context .getAllReferencingBuildConfigs ());
195
201
196
202
context = ContextBuilder .getBuilder (project2 .getActiveBuildConfig ()).contextForLastBuild ;
197
203
assertEquals ("4.0" , 0 , context .getAllReferencedBuildConfigs ().length );
198
- assertEquals ("4.1" , new IBuildConfiguration [] {project1 .getActiveBuildConfig (), project0 .getActiveBuildConfig ()}, context .getAllReferencingBuildConfigs ());
204
+ assertArrayEquals ("4.1" ,
205
+ new IBuildConfiguration [] { project1 .getActiveBuildConfig (), project0 .getActiveBuildConfig () },
206
+ context .getAllReferencingBuildConfigs ());
199
207
200
208
// Build just project0
201
209
ContextBuilder .clearStats ();
@@ -219,16 +227,22 @@ public void testWorkspaceBuildProjects() throws CoreException {
219
227
assertTrue ("1.0" , ContextBuilder .checkValid ());
220
228
221
229
IBuildContext context = ContextBuilder .getContext (project0 .getActiveBuildConfig ());
222
- assertEquals ("2.0" , new IBuildConfiguration [] {project2 .getActiveBuildConfig (), project1 .getActiveBuildConfig ()}, context .getAllReferencedBuildConfigs ());
230
+ assertArrayEquals ("2.0" ,
231
+ new IBuildConfiguration [] { project2 .getActiveBuildConfig (), project1 .getActiveBuildConfig () },
232
+ context .getAllReferencedBuildConfigs ());
223
233
assertEquals ("2.1" , 0 , context .getAllReferencingBuildConfigs ().length );
224
234
225
235
context = ContextBuilder .getBuilder (project1 .getActiveBuildConfig ()).contextForLastBuild ;
226
- assertEquals ("3.0" , new IBuildConfiguration [] {project2 .getActiveBuildConfig ()}, context .getAllReferencedBuildConfigs ());
227
- assertEquals ("3.1" , new IBuildConfiguration [] {project0 .getActiveBuildConfig ()}, context .getAllReferencingBuildConfigs ());
236
+ assertArrayEquals ("3.0" , new IBuildConfiguration [] { project2 .getActiveBuildConfig () },
237
+ context .getAllReferencedBuildConfigs ());
238
+ assertArrayEquals ("3.1" , new IBuildConfiguration [] { project0 .getActiveBuildConfig () },
239
+ context .getAllReferencingBuildConfigs ());
228
240
229
241
context = ContextBuilder .getBuilder (project2 .getActiveBuildConfig ()).contextForLastBuild ;
230
242
assertEquals ("4.0" , 0 , context .getAllReferencedBuildConfigs ().length );
231
- assertEquals ("4.1" , new IBuildConfiguration [] {project1 .getActiveBuildConfig (), project0 .getActiveBuildConfig ()}, context .getAllReferencingBuildConfigs ());
243
+ assertArrayEquals ("4.1" ,
244
+ new IBuildConfiguration [] { project1 .getActiveBuildConfig (), project0 .getActiveBuildConfig () },
245
+ context .getAllReferencingBuildConfigs ());
232
246
}
233
247
234
248
/**
@@ -245,16 +259,22 @@ public void testReferenceActiveVariant() throws CoreException {
245
259
assertTrue ("1.0" , ContextBuilder .checkValid ());
246
260
247
261
IBuildContext context = ContextBuilder .getContext (project0 .getActiveBuildConfig ());
248
- assertEquals ("2.0" , new IBuildConfiguration [] {project2 .getActiveBuildConfig (), project1 .getActiveBuildConfig ()}, context .getAllReferencedBuildConfigs ());
262
+ assertArrayEquals ("2.0" ,
263
+ new IBuildConfiguration [] { project2 .getActiveBuildConfig (), project1 .getActiveBuildConfig () },
264
+ context .getAllReferencedBuildConfigs ());
249
265
assertEquals ("2.1" , 0 , context .getAllReferencingBuildConfigs ().length );
250
266
251
267
context = ContextBuilder .getBuilder (project1 .getActiveBuildConfig ()).contextForLastBuild ;
252
- assertEquals ("3.0" , new IBuildConfiguration [] {project2 .getActiveBuildConfig ()}, context .getAllReferencedBuildConfigs ());
253
- assertEquals ("3.1" , new IBuildConfiguration [] {project0 .getActiveBuildConfig ()}, context .getAllReferencingBuildConfigs ());
268
+ assertArrayEquals ("3.0" , new IBuildConfiguration [] { project2 .getActiveBuildConfig () },
269
+ context .getAllReferencedBuildConfigs ());
270
+ assertArrayEquals ("3.1" , new IBuildConfiguration [] { project0 .getActiveBuildConfig () },
271
+ context .getAllReferencingBuildConfigs ());
254
272
255
273
context = ContextBuilder .getBuilder (project2 .getActiveBuildConfig ()).contextForLastBuild ;
256
274
assertEquals ("4.0" , 0 , context .getAllReferencedBuildConfigs ().length );
257
- assertEquals ("4.1" , new IBuildConfiguration [] {project1 .getActiveBuildConfig (), project0 .getActiveBuildConfig ()}, context .getAllReferencingBuildConfigs ());
275
+ assertArrayEquals ("4.1" ,
276
+ new IBuildConfiguration [] { project1 .getActiveBuildConfig (), project0 .getActiveBuildConfig () },
277
+ context .getAllReferencingBuildConfigs ());
258
278
}
259
279
260
280
/**
@@ -272,13 +292,16 @@ public void testReferenceVariantTwice() throws CoreException {
272
292
assertTrue ("1.0" , ContextBuilder .checkValid ());
273
293
274
294
IBuildContext context = ContextBuilder .getContext (project0 .getActiveBuildConfig ());
275
- assertEquals ("2.0" , new IBuildConfiguration [] {project1 .getActiveBuildConfig ()}, context .getAllReferencedBuildConfigs ());
295
+ assertArrayEquals ("2.0" , new IBuildConfiguration [] { project1 .getActiveBuildConfig () },
296
+ context .getAllReferencedBuildConfigs ());
276
297
assertEquals ("2.1" , 0 , context .getAllReferencingBuildConfigs ().length );
277
- assertEquals ("2.2" , new IBuildConfiguration [] {project0 .getActiveBuildConfig ()}, context .getRequestedConfigs ());
298
+ assertArrayEquals ("2.2" , new IBuildConfiguration [] { project0 .getActiveBuildConfig () },
299
+ context .getRequestedConfigs ());
278
300
279
301
context = ContextBuilder .getBuilder (project1 .getActiveBuildConfig ()).contextForLastBuild ;
280
302
assertEquals ("3.0" , 0 , context .getAllReferencedBuildConfigs ().length );
281
- assertEquals ("3.1" , new IBuildConfiguration [] {project0 .getActiveBuildConfig ()}, context .getAllReferencingBuildConfigs ());
303
+ assertArrayEquals ("3.1" , new IBuildConfiguration [] { project0 .getActiveBuildConfig () },
304
+ context .getAllReferencingBuildConfigs ());
282
305
283
306
// Change the active configuration of project1, and test that two configurations are built
284
307
ContextBuilder .clearStats ();
@@ -288,8 +311,10 @@ public void testReferenceVariantTwice() throws CoreException {
288
311
assertTrue ("4.0" , ContextBuilder .checkValid ());
289
312
290
313
context = ContextBuilder .getContext (project0 .getActiveBuildConfig ());
291
- assertEquals ("4.1" , new IBuildConfiguration [] {project1PreviousActive , project1NewActive }, context .getAllReferencedBuildConfigs ());
314
+ assertArrayEquals ("4.1" , new IBuildConfiguration [] { project1PreviousActive , project1NewActive },
315
+ context .getAllReferencedBuildConfigs ());
292
316
assertEquals ("4.2" , 0 , context .getAllReferencingBuildConfigs ().length );
293
- assertEquals ("4.3" , new IBuildConfiguration [] {project0 .getActiveBuildConfig ()}, context .getRequestedConfigs ());
317
+ assertArrayEquals ("4.3" , new IBuildConfiguration [] { project0 .getActiveBuildConfig () },
318
+ context .getRequestedConfigs ());
294
319
}
295
320
}
0 commit comments