| 1 |
package com.thaiopensource.relaxng.jaxp; |
| 2 |
|
| 3 |
import org.testng.Assert; |
| 4 |
import org.testng.annotations.Test; |
| 5 |
|
| 6 |
/** |
| 7 |
* Tests CompactSyntaxSchemaFactory. |
| 8 |
*/ |
| 9 |
public class CompactSyntaxSchemaFactoryTest extends SchemaFactoryImplTest { |
| 10 |
public CompactSyntaxSchemaFactoryTest() { |
| 11 |
super(CompactSyntaxSchemaFactory.class); |
| 12 |
} |
| 13 |
|
| 14 |
@Test |
| 15 |
public void testIsSchemaLanguageSupported() { |
| 16 |
Assert.assertFalse(factory().isSchemaLanguageSupported(XMLSyntaxSchemaFactory.SCHEMA_LANGUAGE)); |
| 17 |
Assert.assertTrue(factory().isSchemaLanguageSupported(CompactSyntaxSchemaFactory.SCHEMA_LANGUAGE)); |
| 18 |
} |
| 19 |
|
| 20 |
protected String element(String name, String[] contentPatterns) { |
| 21 |
StringBuilder builder = new StringBuilder(); |
| 22 |
builder.append("element ") |
| 23 |
.append(name) |
| 24 |
.append(" {"); |
| 25 |
for (int i = 0; i < contentPatterns.length; i++) { |
| 26 |
if (i > 0) |
| 27 |
builder.append(", "); |
| 28 |
builder.append(contentPatterns[i]); |
| 29 |
} |
| 30 |
if (contentPatterns.length == 0) |
| 31 |
builder.append("empty"); |
| 32 |
builder.append("}"); |
| 33 |
return builder.toString(); |
| 34 |
} |
| 35 |
|
| 36 |
protected String attribute(String name) { |
| 37 |
return "attribute " + name + " { text }"; |
| 38 |
} |
| 39 |
|
| 40 |
protected String externalRef(String uri) { |
| 41 |
return "external \"" + uri + "\""; |
| 42 |
} |
| 43 |
|
| 44 |
protected String getLSType() { |
| 45 |
return CompactSyntaxSchemaFactory.SCHEMA_LANGUAGE; |
| 46 |
} |
| 47 |
} |