package org.jibx.schema.elements;
import org.jibx.schema.SchemaTestBase;
/**
* Test handling of simple schemas with only global elements or attributes and
* no nested structure.
*/
public class SimpleGlobals extends SchemaTestBase
{
public static final String SIMPLE_ELEMENT_BLANK_SCHEMA =
"\n" +
" \n" +
"";
public static final String SIMPLE_ATTRIBUTE_BLANK_SCHEMA =
"\n" +
" \n" +
"";
public static final String SIMPLE_ELEMENT_SCHEMA =
"\n" +
" \n" +
"";
public static final String SIMPLE_ATTRIBUTE_SCHEMA =
"\n" +
" \n" +
"";
public static final String COMPLEX_ELEMENT_SCHEMA =
"\n" +
" \n" +
" \n" +
" this should mean something\n" +
" \n" +
" \n" +
"";
public static final String COMPLEX_ATTRIBUTE_SCHEMA =
"\n" +
" \n" +
" \n" +
" this should mean something\n" +
" \n" +
" \n" +
" \n" +
"";
public static final String COMPLEX_ELEMENT_ERROR_SCHEMA =
"\n" +
" \n" +
"";
public static final String COMPLEX_ATTRIBUTE_ERROR_SCHEMA =
"\n" +
" \n" +
"";
public static final String ELEMENT_TYPE_REFERENCE_ERROR_SCHEMA =
"\n" +
" \n" +
"";
public void testSimpleElementBlank() throws Exception {
runNoErrors(SIMPLE_ELEMENT_BLANK_SCHEMA);
}
public void testSimpleAttributeBlank() throws Exception {
runNoErrors(SIMPLE_ATTRIBUTE_BLANK_SCHEMA);
}
public void testSimpleElement() throws Exception {
runNoErrors(SIMPLE_ELEMENT_SCHEMA);
}
public void testSimpleAttribute() throws Exception {
runNoErrors(SIMPLE_ATTRIBUTE_SCHEMA);
}
public void testComplexElement() throws Exception {
runNoErrors(COMPLEX_ELEMENT_SCHEMA);
}
public void testComplexAttribute() throws Exception {
runNoErrors(COMPLEX_ATTRIBUTE_SCHEMA);
}
public void testComplexElementError() throws Exception {
runOneError(COMPLEX_ELEMENT_ERROR_SCHEMA,
"Invalid attributes on global not reported");
}
public void testComplexAttributeError() throws Exception {
runOneError(COMPLEX_ATTRIBUTE_ERROR_SCHEMA,
"Invalid attributes on global not reported");
}
public void testElementTypeReferenceError() throws Exception {
runOneError(ELEMENT_TYPE_REFERENCE_ERROR_SCHEMA,
"Undefined type reference on not reported");
}
}