Update of /cvsroot/jaxme/JaxMe2/src/net/sf/jaxme/junit
In directory sc8-pr-cvs1:/tmp/cvs-serv3549/src/net/sf/jaxme/junit
Modified Files:
BaseTestCase.java MarshallerTest.java ParserTest.java
Log Message:
Made the test suite working again. Bugfix by Marty Kube.
Index: BaseTestCase.java
===================================================================
RCS file: /cvsroot/jaxme/JaxMe2/src/net/sf/jaxme/junit/BaseTestCase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- BaseTestCase.java 28 Jan 2003 21:36:01 -0000 1.6
+++ BaseTestCase.java 12 Feb 2003 18:55:45 -0000 1.7
@@ -97,4 +97,18 @@
fail("Expected <" + pExpect + "> (length " + l1 + "), got <" + pGot +
"> (length " + l2 + "), difference at offset " + offset);
}
+
+ // Asserts equality of the two given byte arrays.
+ protected void assertEquals(byte[] pExpect, byte[] pGot) {
+ if (pExpect.length != pGot.length) {
+ fail("Expected " + pExpect.length + " bytes, got " + pGot.length);
+ } else {
+ for (int i = 0; i < pExpect.length; i++) {
+ if (pExpect[i] != pGot[i]) {
+ fail("Expected byte " + ((int) pExpect[i]) + " at offset " + i +
+ ", got byte " + ((int) pGot[i]));
+ }
+ }
+ }
+ }
}
Index: MarshallerTest.java
===================================================================
RCS file: /cvsroot/jaxme/JaxMe2/src/net/sf/jaxme/junit/MarshallerTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- MarshallerTest.java 10 Feb 2003 21:07:46 -0000 1.5
+++ MarshallerTest.java 12 Feb 2003 18:55:45 -0000 1.6
@@ -88,7 +88,7 @@
return d;
}
public byte[] getHexBytes() {
- return new byte[]{1, 17, 35, 78, 115, -99, -69, -1 };
+ return new byte[]{1, 17, 35, 78, 115, -99, -69, -1};
}
public AllSimpleTypesElement getAllSimpleTypesElement() {
@@ -104,6 +104,7 @@
element.setTimeElem(getTime());
element.setDurationElem(getDuration());
element.setHexBinaryElem(getHexBytes());
+ element.setBase64BinaryElem(getHexBytes());
return element;
}
@@ -131,8 +132,9 @@
"<ex:DateTimeElem>" +
DateFormat.getDateTimeInstance().format(getDateTime().getTime()) +
"</ex:DateTimeElem>" +
"<ex:DateElem>" + DateFormat.getDateInstance().format(getDate().getTime()) +
"</ex:DateElem>" +
"<ex:TimeElem>" + DateFormat.getTimeInstance().format(getTime().getTime()) +
"</ex:TimeElem>" +
- "<ex:DurationElem>P1Y2M3DT4H4M" + NumberFormat.getInstance().format(6.7) +
"S</ex:DurationElem>" +
+ "<ex:DurationElem>P1Y2M3DT4H5M" + NumberFormat.getInstance().format(6.7) +
+"S</ex:DurationElem>" +
"<ex:HexBinaryElem>0111234E739DBBFF</ex:HexBinaryElem>" +
+ "<ex:Base64BinaryElem>AREjTnOdu/8=</ex:Base64BinaryElem>" +
"</ex:AllSimpleTypesElement>";
}
@@ -149,8 +151,9 @@
" <ex:DateTimeElem>" +
DateFormat.getDateTimeInstance().format(getDateTime().getTime()) +
"</ex:DateTimeElem>\n" +
" <ex:DateElem>" + DateFormat.getDateInstance().format(getDate().getTime())
+ "</ex:DateElem>\n" +
" <ex:TimeElem>" + DateFormat.getTimeInstance().format(getTime().getTime())
+ "</ex:TimeElem>\n" +
- " <ex:DurationElem>P1Y2M3DT4H4M" + NumberFormat.getInstance().format(6.7) +
"S</ex:DurationElem>\n" +
+ " <ex:DurationElem>P1Y2M3DT4H5M" + NumberFormat.getInstance().format(6.7) +
+"S</ex:DurationElem>\n" +
" <ex:HexBinaryElem>0111234E739DBBFF</ex:HexBinaryElem>\n" +
+ " <ex:Base64BinaryElem>AREjTnOdu/8=</ex:Base64BinaryElem>\n" +
" </ex:AllSimpleTypesElement>\n" +
" <ex:ListTypeElement>7 -3 0</ex:ListTypeElement>\n" +
" <ex:UnionTypeElement>" +
DateFormat.getDateTimeInstance().format(getDateTime().getTime()) +
"</ex:UnionTypeElement>\n" +
@@ -187,6 +190,7 @@
assertEquals(time1, time2);
assertEquals(getDuration(), pElement.getDurationElem());
assertEquals(getHexBytes(), pElement.getHexBinaryElem());
+ assertEquals(getHexBytes(), pElement.getBase64BinaryElem());
}
public void verifyAllTypesElement(AllTypesElement pElement) {
Index: ParserTest.java
===================================================================
RCS file: /cvsroot/jaxme/JaxMe2/src/net/sf/jaxme/junit/ParserTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ParserTest.java 31 Jan 2003 20:16:11 -0000 1.10
+++ ParserTest.java 12 Feb 2003 18:55:45 -0000 1.11
@@ -581,4 +581,26 @@
JavaQName qName = typeSG.getClassName(st, SchemaClass.CLASS_TYPE_XML_INTERFACE);
assertEquals(myPackageName, qName.getPackageName());
}
+
+ public void testABug() throws Exception {
+ final String mName = "testABug";
+ log.debug(mName + ": ->");
+ final String schema =
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> \n" +
+ " <xsd:element name='quantity'> \n" +
+ " <xsd:simpleType> \n" +
+ " <xsd:restriction base='xsd:decimal'> \n" +
+ " <xsd:maxExclusive value='100'/> \n" +
+ " </xsd:restriction> \n" +
+ " </xsd:simpleType> \n" +
+ " </xsd:element> \n" +
+ "</xsd:schema> \n";
+
+ JAXBSchemaReader r = new JAXBSchemaReader();
+ InputSource isource = new InputSource(new StringReader(schema));
+ isource.setSystemId("testABug.xsd");
+ JAXBSchema jschema = (JAXBSchema) r.parse(isource);
+
+ log.debug(mName + ": <-");
+ }
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jaxme-jaxb-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxme-jaxb-dev