Author: fanningpj
Date: Fri Feb 11 23:58:08 2022
New Revision: 1897987

URL: http://svn.apache.org/viewvc?rev=1897987&view=rev
Log:
extend Xsd2InstTest

Added:
    xmlbeans/trunk/src/test/resources/xbean/compile/scomp/base64Binary/
    
xmlbeans/trunk/src/test/resources/xbean/compile/scomp/base64Binary/Base64BinaryElement.xsd
      - copied, changed from r1897985, 
xmlbeans/trunk/src/test/resources/xbean/compile/scomp/pricequote/PriceQuote.xsd
Modified:
    xmlbeans/trunk/src/test/java/tools/xsd2inst/checkin/Xsd2InstTest.java

Modified: xmlbeans/trunk/src/test/java/tools/xsd2inst/checkin/Xsd2InstTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/tools/xsd2inst/checkin/Xsd2InstTest.java?rev=1897987&r1=1897986&r2=1897987&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/tools/xsd2inst/checkin/Xsd2InstTest.java 
(original)
+++ xmlbeans/trunk/src/test/java/tools/xsd2inst/checkin/Xsd2InstTest.java Fri 
Feb 11 23:58:08 2022
@@ -29,6 +29,7 @@ import static org.junit.jupiter.api.Asse
 
 public class Xsd2InstTest {
     private static final String PRICEQ = 
"/xbean/compile/scomp/pricequote/PriceQuote.xsd";
+    private static final String BASE64BIN = 
"/xbean/compile/scomp/base64Binary/Base64BinaryElement.xsd";
 
     @Test
     void testPriceQuote() throws Exception {
@@ -44,6 +45,21 @@ public class Xsd2InstTest {
         try (InputStream docStream = new 
ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8))) {
             assertNotNull(DocumentHelper.readDocument(new XmlOptions(), 
docStream));
         }
+    }
+
+    @Test
+    void testBase64Binary() throws Exception {
+        XmlObject xobj;
+        try (InputStream xsdStream = 
Xsd2InstTest.class.getResourceAsStream(BASE64BIN)) {
+            xobj = XmlObject.Factory.parse(xsdStream, (new 
XmlOptions()).setLoadLineNumbers().setLoadMessageDigest());
+        }
+        SchemaInstanceGenerator.Xsd2InstOptions options = new 
SchemaInstanceGenerator.Xsd2InstOptions();
+        String result = SchemaInstanceGenerator.xsd2inst(new 
XmlObject[]{xobj}, "echoBase64BinaryElement", options);
+        assertTrue(result.contains("<ns:echoBase64BinaryElement"), 
"echoBase64BinaryElement element found?");
+        assertTrue(result.contains("<ns:base64BinaryElement>"), 
"base64BinaryElement element found?");
+        try (InputStream docStream = new 
ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8))) {
+            assertNotNull(DocumentHelper.readDocument(new XmlOptions(), 
docStream));
+        }
     }
 
     @Test

Copied: 
xmlbeans/trunk/src/test/resources/xbean/compile/scomp/base64Binary/Base64BinaryElement.xsd
 (from r1897985, 
xmlbeans/trunk/src/test/resources/xbean/compile/scomp/pricequote/PriceQuote.xsd)
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/resources/xbean/compile/scomp/base64Binary/Base64BinaryElement.xsd?p2=xmlbeans/trunk/src/test/resources/xbean/compile/scomp/base64Binary/Base64BinaryElement.xsd&p1=xmlbeans/trunk/src/test/resources/xbean/compile/scomp/pricequote/PriceQuote.xsd&r1=1897985&r2=1897987&rev=1897987&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/resources/xbean/compile/scomp/pricequote/PriceQuote.xsd 
(original)
+++ 
xmlbeans/trunk/src/test/resources/xbean/compile/scomp/base64Binary/Base64BinaryElement.xsd
 Fri Feb 11 23:58:08 2022
@@ -13,17 +13,13 @@
      See the License for the specific language governing permissions and
      limitations under the License. -->
 
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
elementFormDefault="qualified">
-    <xsd:element name="price-quote">
-        <xsd:complexType>
-            <xsd:sequence>
-                <xsd:element ref="stock-symbol" minOccurs="1" maxOccurs="1"/>
-                <xsd:element ref="stock-price" minOccurs="1" maxOccurs="1"/>
-            </xsd:sequence>
-        </xsd:complexType>
-    </xsd:element>
-    <!-- XXXSJM change following to use refined datatypes -->
-    <xsd:element name="stock-symbol" type="xsd:string"/>
-    <xsd:element name="stock-price" type="xsd:string"/>
-</xsd:schema>
-
+<xs:schema xmlns="http://www.w3.org/2002/ws/databinding/examples/6/09/"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:p="http://www.w3.org/2002/ws/databinding/patterns/6/09/"; 
xmlns:ex="http://www.w3.org/2002/ws/databinding/examples/6/09/"; 
targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/09/"; 
elementFormDefault="qualified">
+    <xs:element xmlns:wsdl11="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:soap11enc="http://schemas.xmlsoap.org/soap/encoding/"; 
name="base64BinaryElement" type="xs:base64Binary"/>
+    <xs:element name="echoBase64BinaryElement">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="ex:base64BinaryElement"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to