| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.repository.test; |
| 21 |
|
|
| 22 |
|
import java.util.HashMap; |
| 23 |
|
import java.util.Map; |
| 24 |
|
|
| 25 |
|
import org.xwiki.model.reference.LocalDocumentReference; |
| 26 |
|
import org.xwiki.test.ui.TestUtils; |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
@version |
| 30 |
|
@since |
| 31 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 6 |
Complexity Density: 0.67 |
|
| 32 |
|
public class SolrTestUtils |
| 33 |
|
{ |
| 34 |
|
public static final String PROPERTY_KEY = "solrutils"; |
| 35 |
|
|
| 36 |
|
private static final String SOLRSERVICE_SPACE = "TestService"; |
| 37 |
|
|
| 38 |
|
private static final String SOLRSERVICE_PAGE = "Solr"; |
| 39 |
|
|
| 40 |
|
private static final LocalDocumentReference SOLRSERVICE_REFERENCE = |
| 41 |
|
new LocalDocumentReference(SOLRSERVICE_SPACE, SOLRSERVICE_PAGE); |
| 42 |
|
|
| 43 |
|
private final TestUtils testUtils; |
| 44 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 45 |
75 |
public SolrTestUtils(TestUtils testUtils) throws Exception... |
| 46 |
|
{ |
| 47 |
75 |
this.testUtils = testUtils; |
| 48 |
|
|
| 49 |
75 |
initService(); |
| 50 |
|
} |
| 51 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 52 |
75 |
private void initService() throws Exception... |
| 53 |
|
{ |
| 54 |
75 |
if (!this.testUtils.pageExists(SOLRSERVICE_SPACE, SOLRSERVICE_PAGE)) { |
| 55 |
|
|
| 56 |
4 |
this.testUtils.rest().savePage(SOLRSERVICE_REFERENCE, "{{velocity}}$services.solr.queueSize{{/velocity}}", |
| 57 |
|
null); |
| 58 |
|
} |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 64 |
21 |
public void waitEmpyQueue() throws Exception... |
| 65 |
|
{ |
| 66 |
11029 |
while (getSolrQueueSize() > 0) { |
| 67 |
11008 |
Thread.sleep(100); |
| 68 |
|
} |
| 69 |
|
} |
| 70 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 71 |
11029 |
public long getSolrQueueSize() throws Exception... |
| 72 |
|
{ |
| 73 |
11029 |
Map<String, String> parameters = new HashMap<String, String>(); |
| 74 |
11029 |
parameters.put("outputSyntax", "plain"); |
| 75 |
|
|
| 76 |
11029 |
return Long |
| 77 |
|
.valueOf(this.testUtils.getString("/bin/get/" + SOLRSERVICE_SPACE + '/' + SOLRSERVICE_PAGE, parameters)); |
| 78 |
|
} |
| 79 |
|
} |