public class SimpleRestrictionTest extends TestCase {
public void testSimpleAttribute() {
TestSimpleAttributeElement testSimpleAttributeElement = new TestSimpleAttributeElement();
TestSimpleAttribute testSimpleAttribute = new TestSimpleAttribute();
testSimpleAttributeElement.setTestSimpleAttributeElement(testSimpleAttribute);
testSimpleAttribute.setTestElement1(new QName("http://wso2.com", "test1"));
testSimpleAttribute.setTestElement2(new QName("http://wso2.com", "test2"));
testSimpleAttribute.setTestElement3(new QName("http://wso2.com", "test3"));
ParentSimpleType parentSimpleType1 = new ParentSimpleType();
parentSimpleType1.setChildSimpleType("test simple type 1");
ParentSimpleType parentSimpleType2 = new ParentSimpleType();
parentSimpleType2.setChildSimpleType("test simple type 2");
testSimpleAttribute.setAttrib1(parentSimpleType1);
testSimpleAttribute.setAttrib2(parentSimpleType2);
try {
OMElement omElement = testSimpleAttributeElement.getOMElement(TestSimpleAttributeElement.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("OM String ==> " + omElementString);
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
TestSimpleAttributeElement result = TestSimpleAttributeElement.Factory.parse(xmlReader);
assertEquals(result.getTestSimpleAttributeElement().getTestElement1(), testSimpleAttribute.getTestElement1());
assertEquals(result.getTestSimpleAttributeElement().getTestElement2(), testSimpleAttribute.getTestElement2());
assertEquals(result.getTestSimpleAttributeElement().getTestElement3(), testSimpleAttribute.getTestElement3());
assertEquals(result.getTestSimpleAttributeElement().getAttrib1().getChildSimpleType(), parentSimpleType1.getChildSimpleType());
assertEquals(result.getTestSimpleAttributeElement().getAttrib2().getChildSimpleType(), parentSimpleType2.getChildSimpleType());
} catch (Exception e) {
assertFalse(true);
}
}