/
MinimalConfigurationParsingTest.java
51 lines (43 loc) · 1.69 KB
/
MinimalConfigurationParsingTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package org.infinispan.config;
import org.infinispan.test.TestingUtil;
import org.testng.annotations.Test;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import static org.infinispan.test.TestingUtil.INFINISPAN_END_TAG;
import static org.infinispan.test.TestingUtil.INFINISPAN_START_TAG;
@Test(groups = "unit", testName = "config.MinimalConfigurationParsingTest")
public class MinimalConfigurationParsingTest {
public void testGlobalAndDefaultSection() throws IOException {
String xml = INFINISPAN_START_TAG +
" <global />\n" +
" <default>\n" +
" <locking concurrencyLevel=\"10000\" isolationLevel=\"READ_COMMITTED\" />\n" +
" </default>\n" +
INFINISPAN_END_TAG;
testXml(xml);
}
public void testNoGlobalSection() throws IOException {
String xml = INFINISPAN_START_TAG +
" <default>\n" +
" <locking concurrencyLevel=\"10000\" isolationLevel=\"READ_COMMITTED\" />\n" +
" </default>\n" +
INFINISPAN_END_TAG;
testXml(xml);
}
public void testNoDefaultSection() throws IOException {
String xml = INFINISPAN_START_TAG +
" <global />\n" +
INFINISPAN_END_TAG;
testXml(xml);
}
public void testNoSections() throws IOException {
String xml = INFINISPAN_START_TAG + INFINISPAN_END_TAG;
testXml(xml);
}
private void testXml(String xml) throws IOException {
InputStream stream = new ByteArrayInputStream(xml.getBytes());
InfinispanConfiguration ic = InfinispanConfiguration.newInfinispanConfiguration(stream);
assert ic != null;
}
}