1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.test.ui.repository; |
21 |
|
|
22 |
|
import java.net.URL; |
23 |
|
import java.util.Arrays; |
24 |
|
import java.util.HashMap; |
25 |
|
import java.util.Map; |
26 |
|
|
27 |
|
import org.apache.commons.httpclient.UsernamePasswordCredentials; |
28 |
|
import org.apache.commons.io.FileUtils; |
29 |
|
import org.junit.Assert; |
30 |
|
import org.junit.Before; |
31 |
|
import org.junit.Test; |
32 |
|
import org.openqa.selenium.By; |
33 |
|
import org.xwiki.extension.DefaultExtensionAuthor; |
34 |
|
import org.xwiki.extension.DefaultExtensionDependency; |
35 |
|
import org.xwiki.extension.ExtensionId; |
36 |
|
import org.xwiki.extension.ExtensionLicense; |
37 |
|
import org.xwiki.extension.repository.xwiki.model.jaxb.ExtensionDependency; |
38 |
|
import org.xwiki.extension.repository.xwiki.model.jaxb.ExtensionVersion; |
39 |
|
import org.xwiki.extension.repository.xwiki.model.jaxb.ExtensionsSearchResult; |
40 |
|
import org.xwiki.extension.version.internal.DefaultVersionConstraint; |
41 |
|
import org.xwiki.repository.Resources; |
42 |
|
import org.xwiki.repository.test.TestExtension; |
43 |
|
import org.xwiki.repository.test.po.ExtensionImportPage; |
44 |
|
import org.xwiki.repository.test.po.ExtensionPage; |
45 |
|
import org.xwiki.repository.test.po.ExtensionsLiveTableElement; |
46 |
|
import org.xwiki.repository.test.po.ExtensionsPage; |
47 |
|
import org.xwiki.repository.test.po.RepositoryAdminPage; |
48 |
|
import org.xwiki.repository.test.po.editor.ExtensionInlinePage; |
49 |
|
import org.xwiki.test.ui.AbstractExtensionAdminAuthenticatedTest; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@version |
55 |
|
|
|
|
| 98.5% |
Uncovered Elements: 3 (203) |
Complexity: 8 |
Complexity Density: 0.04 |
|
56 |
|
public class RepositoryTest extends AbstractExtensionAdminAuthenticatedTest |
57 |
|
{ |
58 |
|
public static final UsernamePasswordCredentials USER_CREDENTIALS = new UsernamePasswordCredentials("Author", |
59 |
|
"password"); |
60 |
|
|
61 |
|
private static final String IDPREFIX = "prefix-"; |
62 |
|
|
63 |
|
private TestExtension baseExtension; |
64 |
|
|
65 |
|
private ExtensionLicense baseLicense; |
66 |
|
|
67 |
|
private DefaultExtensionAuthor baseAuthor; |
68 |
|
|
69 |
|
private long sizeOfFile; |
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
71 |
1 |
@Before... |
72 |
|
@Override |
73 |
|
public void setUp() throws Exception |
74 |
|
{ |
75 |
1 |
super.setUp(); |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
1 |
this.baseExtension = |
80 |
|
getRepositoryTestUtils().getTestExtension(new ExtensionId(IDPREFIX + "macro-jar-extension", "1.0"), "jar"); |
81 |
|
|
82 |
1 |
this.baseExtension.setName("Macro JAR extension"); |
83 |
1 |
this.baseExtension.setDescription("extension description"); |
84 |
1 |
this.baseExtension.setSummary("extension summary, **not bold**"); |
85 |
|
|
86 |
1 |
this.baseLicense = new ExtensionLicense("Do What The Fuck You Want To Public License 2", null); |
87 |
1 |
this.baseExtension.addLicense(this.baseLicense); |
88 |
|
|
89 |
1 |
this.baseAuthor = |
90 |
|
new DefaultExtensionAuthor("User Name", new URL(getUtil().getURL("XWiki", USER_CREDENTIALS.getUserName()))); |
91 |
1 |
this.baseExtension.addAuthor(this.baseAuthor); |
92 |
|
|
93 |
1 |
this.baseExtension.addDependency(new DefaultExtensionDependency("dependencyid1", new DefaultVersionConstraint( |
94 |
|
"1.0"))); |
95 |
1 |
this.baseExtension.addDependency(new DefaultExtensionDependency("dependencyid2", new DefaultVersionConstraint( |
96 |
|
"2.0"))); |
97 |
|
|
98 |
1 |
this.sizeOfFile = FileUtils.sizeOf(this.baseExtension.getFile().getFile()); |
99 |
|
} |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
101 |
1 |
@Test... |
102 |
|
public void validateAllFeatures() throws Exception |
103 |
|
{ |
104 |
1 |
addExtension(); |
105 |
1 |
importExtension(); |
106 |
1 |
validateRecommendations(); |
107 |
|
} |
108 |
|
|
|
|
| 98.1% |
Uncovered Elements: 2 (107) |
Complexity: 2 |
Complexity Density: 0.02 |
|
109 |
1 |
private void addExtension() throws Exception... |
110 |
|
{ |
111 |
|
|
112 |
|
|
113 |
1 |
RepositoryAdminPage repositoryAdminPage = RepositoryAdminPage.gotoPage(); |
114 |
|
|
115 |
1 |
repositoryAdminPage.setDefaultIdPrefix(IDPREFIX); |
116 |
1 |
repositoryAdminPage.clickUpdateButton(); |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
1 |
getUtil().createUserAndLogin(USER_CREDENTIALS.getUserName(), USER_CREDENTIALS.getPassword(), "first_name", |
121 |
|
"User", "last_name", "Name"); |
122 |
|
|
123 |
1 |
ExtensionsPage extensionsPage = ExtensionsPage.gotoPage(); |
124 |
|
|
125 |
1 |
ExtensionInlinePage extensionInline = extensionsPage.contributeExtension(this.baseExtension.getName()); |
126 |
|
|
127 |
1 |
Assert.assertEquals(this.baseExtension.getName(), extensionInline.getName()); |
128 |
|
|
129 |
1 |
extensionInline.setDescription(this.baseExtension.getDescription()); |
130 |
1 |
extensionInline.setInstallation("extension installation"); |
131 |
1 |
extensionInline.setLicenseName(this.baseLicense.getName()); |
132 |
1 |
extensionInline.setSource("http://source"); |
133 |
1 |
extensionInline.setSummary(this.baseExtension.getSummary()); |
134 |
1 |
extensionInline.setType(this.baseExtension.getType()); |
135 |
|
|
136 |
1 |
ExtensionPage extensionPage = extensionInline.clickSaveAndView(); |
137 |
|
|
138 |
|
|
139 |
1 |
getDriver().findElementsWithoutWaiting(By.xpath("//tt[text()=\"" + this.baseExtension.getSummary() + "\"]")); |
140 |
|
|
141 |
1 |
Assert.assertFalse(extensionPage.isValidExtension()); |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
1 |
getRepositoryTestUtils().addVersionObject(this.baseExtension); |
146 |
1 |
getRepositoryTestUtils().addVersionObject( |
147 |
|
this.baseExtension, |
148 |
|
"10.0", |
149 |
|
getUtil().getAttachmentURL("Extension", this.baseExtension.getName(), |
150 |
|
this.baseExtension.getFile().getName())); |
151 |
1 |
getRepositoryTestUtils().addVersionObject(this.baseExtension, "2.0", |
152 |
|
"attach:" + this.baseExtension.getFile().getName()); |
153 |
|
|
154 |
|
|
155 |
|
|
156 |
1 |
getRepositoryTestUtils().addDependencies(this.baseExtension, "10.0"); |
157 |
|
|
158 |
|
|
159 |
1 |
getRepositoryTestUtils().attachFile(this.baseExtension); |
160 |
|
|
161 |
|
|
162 |
1 |
getRepositoryTestUtils().waitUntilReady(); |
163 |
|
|
164 |
|
|
165 |
|
|
166 |
1 |
extensionsPage = ExtensionsPage.gotoPage(); |
167 |
|
|
168 |
1 |
ExtensionsLiveTableElement livetable = extensionsPage.getLiveTable(); |
169 |
|
|
170 |
1 |
livetable.filterName(this.baseExtension.getName()); |
171 |
|
|
172 |
1 |
extensionPage = livetable.clickExtensionName(this.baseExtension.getName()); |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
1 |
Assert.assertTrue(extensionPage.isValidExtension()); |
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
|
188 |
1 |
ExtensionVersion extension = |
189 |
|
getUtil().rest().getResource(Resources.EXTENSION_VERSION, null, this.baseExtension.getId().getId(), "1.0"); |
190 |
|
|
191 |
1 |
Assert.assertEquals(this.baseExtension.getId().getId(), extension.getId()); |
192 |
1 |
Assert.assertEquals(this.baseExtension.getType(), extension.getType()); |
193 |
1 |
Assert.assertEquals(this.baseExtension.getSummary(), extension.getSummary()); |
194 |
1 |
Assert.assertEquals(this.baseLicense.getName(), extension.getLicenses().get(0).getName()); |
195 |
1 |
Assert.assertEquals(this.baseExtension.getDescription(), extension.getDescription()); |
196 |
1 |
Assert.assertEquals(this.baseAuthor.getName(), extension.getAuthors().get(0).getName()); |
197 |
1 |
Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl()); |
198 |
1 |
Assert.assertEquals("1.0", extension.getVersion()); |
199 |
|
|
200 |
1 |
Assert.assertEquals(getUtil().getURL(Arrays.asList("Extension", this.baseExtension.getName()), ""), |
201 |
|
extension.getWebsite()); |
202 |
|
|
203 |
|
|
204 |
|
|
205 |
1 |
Assert.assertEquals( |
206 |
|
this.sizeOfFile, |
207 |
|
getUtil().rest().getBuffer(Resources.EXTENSION_VERSION_FILE, null, this.baseExtension.getId().getId(), |
208 |
|
"1.0").length); |
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
1 |
extension = |
217 |
|
getUtil().rest().getResource(Resources.EXTENSION_VERSION, null, this.baseExtension.getId().getId(), "2.0"); |
218 |
|
|
219 |
1 |
Assert.assertEquals(this.baseExtension.getId().getId(), extension.getId()); |
220 |
1 |
Assert.assertEquals(this.baseExtension.getType(), extension.getType()); |
221 |
1 |
Assert.assertEquals(this.baseExtension.getSummary(), extension.getSummary()); |
222 |
1 |
Assert.assertEquals(this.baseLicense.getName(), extension.getLicenses().get(0).getName()); |
223 |
1 |
Assert.assertEquals(this.baseExtension.getDescription(), extension.getDescription()); |
224 |
1 |
Assert.assertEquals(this.baseAuthor.getName(), extension.getAuthors().get(0).getName()); |
225 |
1 |
Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl()); |
226 |
1 |
Assert.assertEquals("2.0", extension.getVersion()); |
227 |
|
|
228 |
1 |
Assert.assertEquals(getUtil().getURL(Arrays.asList("Extension", this.baseExtension.getName()), ""), |
229 |
|
extension.getWebsite()); |
230 |
|
|
231 |
|
|
232 |
|
|
233 |
1 |
Assert.assertEquals( |
234 |
|
this.sizeOfFile, |
235 |
|
getUtil().rest().getBuffer(Resources.EXTENSION_VERSION_FILE, null, this.baseExtension.getId().getId(), |
236 |
|
"2.0").length); |
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
|
244 |
1 |
extension = |
245 |
|
getUtil().rest().getResource(Resources.EXTENSION_VERSION, null, this.baseExtension.getId().getId(), "10.0"); |
246 |
|
|
247 |
1 |
Assert.assertEquals(this.baseExtension.getId().getId(), extension.getId()); |
248 |
1 |
Assert.assertEquals(this.baseExtension.getType(), extension.getType()); |
249 |
1 |
Assert.assertEquals(this.baseExtension.getSummary(), extension.getSummary()); |
250 |
1 |
Assert.assertEquals(this.baseLicense.getName(), extension.getLicenses().get(0).getName()); |
251 |
1 |
Assert.assertEquals(this.baseAuthor.getName(), extension.getAuthors().get(0).getName()); |
252 |
1 |
Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl()); |
253 |
1 |
Assert.assertEquals("10.0", extension.getVersion()); |
254 |
|
|
255 |
1 |
Assert.assertEquals(getUtil().getURL(Arrays.asList("Extension", this.baseExtension.getName()), ""), |
256 |
|
extension.getWebsite()); |
257 |
|
|
258 |
1 |
ExtensionDependency dependency1 = extension.getDependencies().get(0); |
259 |
1 |
Assert.assertEquals("dependencyid1", dependency1.getId()); |
260 |
1 |
Assert.assertEquals("1.0", dependency1.getConstraint()); |
261 |
1 |
ExtensionDependency dependency2 = extension.getDependencies().get(1); |
262 |
1 |
Assert.assertEquals("dependencyid2", dependency2.getId()); |
263 |
1 |
Assert.assertEquals("2.0", dependency2.getConstraint()); |
264 |
|
|
265 |
|
|
266 |
|
|
267 |
1 |
Assert.assertEquals( |
268 |
|
this.sizeOfFile, |
269 |
|
getUtil().rest().getBuffer(Resources.EXTENSION_VERSION_FILE, null, this.baseExtension.getId().getId(), |
270 |
|
this.baseExtension.getId().getVersion().getValue()).length); |
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
1 |
extension = searchExtension(this.baseExtension.getId().getId()); |
278 |
|
|
279 |
1 |
if (extension == null) { |
280 |
0 |
Assert.fail("Could not find extension [" + this.baseExtension.getId().getId() + "]"); |
281 |
|
} |
282 |
|
|
283 |
1 |
Assert.assertEquals(this.baseExtension.getId().getId(), extension.getId()); |
284 |
1 |
Assert.assertEquals(this.baseExtension.getType(), extension.getType()); |
285 |
1 |
Assert.assertEquals(this.baseExtension.getSummary(), extension.getSummary()); |
286 |
1 |
Assert.assertEquals(this.baseLicense.getName(), extension.getLicenses().get(0).getName()); |
287 |
1 |
Assert.assertEquals(this.baseAuthor.getName(), extension.getAuthors().get(0).getName()); |
288 |
1 |
Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl()); |
289 |
1 |
Assert.assertEquals("10.0", extension.getVersion()); |
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
1 |
Map<String, Object[]> queryParams = new HashMap<String, Object[]>(); |
296 |
1 |
queryParams.put(Resources.QPARAM_SEARCH_QUERY, new Object[] {"macro"}); |
297 |
|
|
298 |
1 |
ExtensionsSearchResult result = getUtil().rest().getResource(Resources.SEARCH, queryParams); |
299 |
|
|
300 |
1 |
Assert.assertEquals(1, result.getTotalHits()); |
301 |
1 |
Assert.assertEquals(0, result.getOffset()); |
302 |
1 |
extension = result.getExtensions().get(0); |
303 |
|
|
304 |
1 |
Assert.assertEquals(this.baseExtension.getId().getId(), extension.getId()); |
305 |
1 |
Assert.assertEquals(this.baseExtension.getType(), extension.getType()); |
306 |
1 |
Assert.assertEquals(this.baseExtension.getSummary(), extension.getSummary()); |
307 |
1 |
Assert.assertEquals(this.baseLicense.getName(), extension.getLicenses().get(0).getName()); |
308 |
1 |
Assert.assertEquals(this.baseAuthor.getName(), extension.getAuthors().get(0).getName()); |
309 |
1 |
Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl()); |
310 |
1 |
Assert.assertEquals("10.0", extension.getVersion()); |
311 |
|
|
312 |
|
|
313 |
|
|
314 |
1 |
queryParams.clear(); |
315 |
1 |
queryParams.put(Resources.QPARAM_SEARCH_QUERY, new Object[] {"notexisting"}); |
316 |
|
|
317 |
1 |
result = getUtil().rest().getResource(Resources.SEARCH, queryParams); |
318 |
|
|
319 |
1 |
Assert.assertEquals(0, result.getTotalHits()); |
320 |
1 |
Assert.assertEquals(0, result.getOffset()); |
321 |
1 |
Assert.assertEquals(0, result.getExtensions().size()); |
322 |
|
|
323 |
|
|
324 |
|
|
325 |
1 |
queryParams.clear(); |
326 |
1 |
queryParams.put(Resources.QPARAM_LIST_START, new Object[] {1}); |
327 |
|
|
328 |
1 |
result = getUtil().rest().getResource(Resources.SEARCH, queryParams); |
329 |
|
|
330 |
1 |
Assert.assertEquals(1, result.getOffset()); |
331 |
1 |
Assert.assertEquals(result.getTotalHits() - 1, result.getExtensions().size()); |
332 |
|
|
333 |
|
|
334 |
|
|
335 |
1 |
queryParams.clear(); |
336 |
1 |
queryParams.put(Resources.QPARAM_LIST_NUMBER, new Object[] {0}); |
337 |
|
|
338 |
1 |
result = getUtil().rest().getResource(Resources.SEARCH, queryParams); |
339 |
|
|
340 |
1 |
Assert.assertTrue(result.getTotalHits() >= 1); |
341 |
1 |
Assert.assertEquals(0, result.getOffset()); |
342 |
1 |
Assert.assertEquals(0, result.getExtensions().size()); |
343 |
|
} |
344 |
|
|
|
|
| 91.7% |
Uncovered Elements: 1 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
345 |
1 |
private ExtensionVersion searchExtension(String id) throws Exception... |
346 |
|
{ |
347 |
1 |
Map<String, Object[]> queryParams = new HashMap<String, Object[]>(); |
348 |
1 |
ExtensionsSearchResult result = getUtil().rest().getResource(Resources.SEARCH, queryParams); |
349 |
|
|
350 |
1 |
Assert.assertTrue(result.getTotalHits() >= 0); |
351 |
1 |
Assert.assertEquals(0, result.getOffset()); |
352 |
|
|
353 |
1 |
ExtensionVersion extension = null; |
354 |
1 |
for (ExtensionVersion extensionVersion : result.getExtensions()) { |
355 |
1 |
if (extensionVersion.getId().equals(id)) { |
356 |
1 |
extension = extensionVersion; |
357 |
1 |
break; |
358 |
|
} |
359 |
|
} |
360 |
|
|
361 |
1 |
return extension; |
362 |
|
} |
363 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (47) |
Complexity: 1 |
Complexity Density: 0.02 |
|
364 |
1 |
private void importExtension() throws Exception... |
365 |
|
{ |
366 |
1 |
ExtensionsPage extensionsPage = ExtensionsPage.gotoPage(); |
367 |
|
|
368 |
1 |
ExtensionImportPage importPage = extensionsPage.clickImport(); |
369 |
|
|
370 |
1 |
importPage.setExtensionId("maven:extension"); |
371 |
1 |
importPage.setSourceRepository("maven-test"); |
372 |
1 |
ExtensionPage extensionPage = importPage.clickImport(); |
373 |
|
|
374 |
|
|
375 |
|
|
376 |
1 |
Assert.assertEquals("1.1", extensionPage.getMetaDataValue("version")); |
377 |
1 |
Assert.assertTrue(extensionPage.isValidExtension()); |
378 |
|
|
379 |
|
|
380 |
|
|
381 |
1 |
TestExtension emptyExtension = |
382 |
|
getRepositoryTestUtils().getTestExtension(new ExtensionId("emptyjar", "1.0"), "jar"); |
383 |
|
|
384 |
1 |
long fileSize = FileUtils.sizeOf(emptyExtension.getFile().getFile()); |
385 |
|
|
386 |
1 |
ExtensionVersion extension = |
387 |
|
getUtil().rest().getResource(Resources.EXTENSION_VERSION, null, "maven:extension", "2.0"); |
388 |
|
|
389 |
1 |
Assert.assertEquals("maven:extension", extension.getId()); |
390 |
1 |
Assert.assertEquals("jar", extension.getType()); |
391 |
1 |
Assert.assertEquals("2.0", extension.getVersion()); |
392 |
1 |
Assert.assertEquals("name", extension.getName()); |
393 |
1 |
Assert.assertEquals("summary2", extension.getSummary()); |
394 |
1 |
Assert.assertEquals("summary2\n some more details", extension.getDescription()); |
395 |
1 |
Assert.assertEquals(this.baseAuthor.getName(), extension.getAuthors().get(0).getName()); |
396 |
1 |
Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl()); |
397 |
1 |
Assert.assertEquals(Arrays.asList("maven:oldextension/2.0"), extension.getFeatures()); |
398 |
1 |
Assert.assertEquals("GNU Lesser General Public License 2.1", extension.getLicenses().get(0).getName()); |
399 |
|
|
400 |
1 |
Assert.assertEquals(fileSize, |
401 |
|
getUtil().rest().getBuffer(Resources.EXTENSION_VERSION_FILE, null, "maven:extension", "2.0").length); |
402 |
|
|
403 |
|
|
404 |
|
|
405 |
1 |
extension = getUtil().rest().getResource(Resources.EXTENSION_VERSION, null, "maven:extension", "1.0"); |
406 |
|
|
407 |
1 |
Assert.assertEquals("maven:extension", extension.getId()); |
408 |
1 |
Assert.assertEquals("jar", extension.getType()); |
409 |
1 |
Assert.assertEquals("1.0", extension.getVersion()); |
410 |
1 |
Assert.assertEquals("name", extension.getName()); |
411 |
1 |
Assert.assertEquals("summary2", extension.getSummary()); |
412 |
1 |
Assert.assertEquals("summary2\n some more details", extension.getDescription()); |
413 |
1 |
Assert.assertEquals(this.baseAuthor.getName(), extension.getAuthors().get(0).getName()); |
414 |
1 |
Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl()); |
415 |
1 |
Assert.assertEquals(Arrays.asList("maven:oldextension/1.0"), extension.getFeatures()); |
416 |
1 |
Assert.assertEquals("GNU Lesser General Public License 2.1", extension.getLicenses().get(0).getName()); |
417 |
|
|
418 |
1 |
Assert.assertEquals(FileUtils.sizeOf(emptyExtension.getFile().getFile()), |
419 |
|
getUtil().rest().getBuffer(Resources.EXTENSION_VERSION_FILE, null, "maven:extension", "1.0").length); |
420 |
|
|
421 |
|
|
422 |
|
|
423 |
1 |
extension = getUtil().rest().getResource(Resources.EXTENSION_VERSION, null, "maven:extension", "0.9"); |
424 |
|
|
425 |
1 |
Assert.assertEquals("maven:extension", extension.getId()); |
426 |
1 |
Assert.assertEquals("jar", extension.getType()); |
427 |
1 |
Assert.assertEquals("0.9", extension.getVersion()); |
428 |
1 |
Assert.assertEquals("name", extension.getName()); |
429 |
1 |
Assert.assertEquals("summary2", extension.getSummary()); |
430 |
1 |
Assert.assertEquals("summary2\n some more details", extension.getDescription()); |
431 |
1 |
Assert.assertEquals(this.baseAuthor.getName(), extension.getAuthors().get(0).getName()); |
432 |
1 |
Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl()); |
433 |
1 |
Assert.assertEquals(Arrays.asList(), extension.getFeatures()); |
434 |
1 |
Assert.assertEquals("GNU Lesser General Public License 2.1", extension.getLicenses().get(0).getName()); |
435 |
|
|
436 |
1 |
Assert.assertEquals(fileSize, |
437 |
|
getUtil().rest().getBuffer(Resources.EXTENSION_VERSION_FILE, null, "maven:extension", "0.9").length); |
438 |
|
|
439 |
|
|
440 |
|
|
441 |
1 |
extensionPage = extensionPage.updateExtension(); |
442 |
|
|
443 |
1 |
Assert.assertEquals("1.1", extensionPage.getMetaDataValue("version")); |
444 |
|
} |
445 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
|
446 |
1 |
private void validateRecommendations() throws Exception... |
447 |
|
{ |
448 |
|
|
449 |
|
|
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
|
|
455 |
|
|
456 |
|
|
457 |
|
|
458 |
1 |
getUtil().updateObject(Arrays.asList("Extension", "Macro JAR extension"), "WebHome", |
459 |
|
"ExtensionCode.ExtensionClass", 0, "recommended", 1); |
460 |
|
|
461 |
|
|
462 |
1 |
getUtil().updateObject("ExtensionCode", "RepositoryConfig", "ExtensionCode.RepositoryConfigClass", 0, |
463 |
|
"useRecommendations", 1); |
464 |
|
|
465 |
|
|
466 |
1 |
ExtensionsPage extensionsPage = ExtensionsPage.gotoPage(); |
467 |
1 |
ExtensionsLiveTableElement livetable = extensionsPage.getLiveTable(); |
468 |
1 |
Assert.assertEquals(1, livetable.getRowCount()); |
469 |
|
|
470 |
|
|
471 |
1 |
extensionsPage = extensionsPage.clickBrowse(); |
472 |
|
|
473 |
|
|
474 |
1 |
livetable = extensionsPage.getLiveTable(); |
475 |
1 |
Assert.assertEquals(2, livetable.getRowCount()); |
476 |
|
|
477 |
|
|
478 |
1 |
extensionsPage = extensionsPage.clickBrowse(); |
479 |
|
|
480 |
|
|
481 |
1 |
livetable = extensionsPage.getLiveTable(); |
482 |
1 |
Assert.assertEquals(1, livetable.getRowCount()); |
483 |
|
|
484 |
|
|
485 |
1 |
ExtensionPage extensionPage = livetable.clickExtensionName("Macro JAR extension"); |
486 |
1 |
extensionPage.clickBreadcrumbLink("Extensions"); |
487 |
1 |
extensionsPage = new ExtensionsPage(); |
488 |
1 |
livetable = extensionsPage.getLiveTable(); |
489 |
1 |
Assert.assertEquals(1, livetable.getRowCount()); |
490 |
|
} |
491 |
|
} |