1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.filter.test.ui; |
21 |
|
|
22 |
|
import java.io.File; |
23 |
|
import java.io.IOException; |
24 |
|
import java.net.URL; |
25 |
|
|
26 |
|
import org.apache.commons.io.FileUtils; |
27 |
|
import org.apache.commons.io.IOUtils; |
28 |
|
import org.junit.Assert; |
29 |
|
import org.junit.Before; |
30 |
|
import org.junit.Rule; |
31 |
|
import org.junit.Test; |
32 |
|
import org.openqa.selenium.By; |
33 |
|
import org.openqa.selenium.WebElement; |
34 |
|
import org.xwiki.panels.test.po.ApplicationsPanel; |
35 |
|
import org.xwiki.test.ui.AbstractTest; |
36 |
|
import org.xwiki.test.ui.SuperAdminAuthenticationRule; |
37 |
|
import org.xwiki.test.ui.po.ViewPage; |
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@version |
43 |
|
|
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 2 |
Complexity Density: 0.12 |
|
45 |
|
public class FilterTest extends AbstractTest |
46 |
|
{ |
47 |
|
|
48 |
|
@Rule |
49 |
|
public SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil()); |
50 |
|
|
51 |
|
private ViewPage vp; |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
53 |
1 |
@Before... |
54 |
|
public void setUp() |
55 |
|
{ |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
1 |
ApplicationsPanel applicationPanel = ApplicationsPanel.gotoPage(); |
60 |
1 |
this.vp = applicationPanel.clickApplication("Filter Streams Converter"); |
61 |
|
|
62 |
|
|
63 |
1 |
Assert.assertEquals("Filter", this.vp.getMetaDataValue("space")); |
64 |
1 |
Assert.assertEquals("WebHome", this.vp.getMetaDataValue("page")); |
65 |
|
} |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
67 |
1 |
@Test... |
68 |
|
public void testConvertXMLURL() throws IOException, InterruptedException |
69 |
|
{ |
70 |
1 |
URL url = getClass().getResource("/xml/document1.xml"); |
71 |
|
|
72 |
|
|
73 |
1 |
WebElement inputType = getDriver().findElement(By.id("filter_input_type")); |
74 |
|
|
75 |
1 |
WebElement inputElement = getDriver().findElement(By.id("filter_input_properties_descriptor_source")); |
76 |
1 |
inputElement.sendKeys("url:" + url.toString()); |
77 |
|
|
78 |
|
|
79 |
1 |
WebElement outputType = getDriver().findElement(By.id("filter_output_type")); |
80 |
|
|
81 |
1 |
File tmp = File.createTempFile("result", ".xml"); |
82 |
1 |
WebElement outputElement = getDriver().findElement(By.id("filter_output_properties_descriptor_target")); |
83 |
1 |
outputElement.sendKeys("file:" + tmp.getAbsolutePath()); |
84 |
|
|
85 |
|
|
86 |
1 |
WebElement submit = getDriver().findElement(By.name("convert")); |
87 |
1 |
submit.click(); |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
1 |
Thread.sleep(30000); |
92 |
|
|
93 |
1 |
Assert.assertEquals(IOUtils.toString(getClass().getResource("/xml/document1.xml")), |
94 |
|
FileUtils.readFileToString(tmp)); |
95 |
|
} |
96 |
|
} |