eed3si9n/scalaxb — Issue #108: test case attached is failing
Author: deanhiller
Created: 2011-11-04 14:56:05+00:00
State: open

I ran into 3 more bugs. Our most critical one is the attached test case below is failing

Bug #2 I worked around which required I delete the default namespace(I had xmlns:ghx="http://ghx.com/tnt" xmlns="http://ghx.com/tnt" which should be allowed but didn't work)
Bug #3 was that scalaxb does not fail when I sent when ContextParm1 belongs to the epcis namespace the it should fail and force the user to send ....and I can't remember but I think when I sent it the epcis:ContextParm1, it did not read it in nor did it fail and just left it like it was not there or something. (anyways, the below test case is what we are currently blocked on...I don't think it is our code but I could be wrong). thanks, Dean

@Test def testEventSequence() {

val commissionXml =

2010-04-01T08:00:01.001-06:00
-06:00

urn:epc:id:sgtin:0111222.999888.001
urn:epc:id:sgtin:0111222.999888.002
urn:epc:id:sgtin:0111222.999888.003
urn:epc:id:sgtin:0111222.999888.004
urn:epc:id:sgtin:0111222.999888.005
urn:epc:id:sgtin:0111222.999888.006
urn:epc:id:sgtin:0111222.999888.007
urn:epc:id:sgtin:0111222.999888.008
urn:epc:id:sgtin:0111222.999888.009
urn:epc:id:sgtin:0111222.999888.010
urn:epc:id:sgtin:0111222.999888.011
urn:epc:id:sgtin:0111222.999888.012
urn:epc:id:sgtin:0111222.999888.013
urn:epc:id:sgtin:0111222.999888.014
urn:epc:id:sgtin:0111222.999888.015

ADD
urn:epcglobal:bizstep:commissioning
urn:epcglobal:disp:active

urn:epc:id:sgln:0111222.12345.40
0111222123458

urn:epc:id:sgln:0111222.12345.10
0111222123458

val fixedScope = toScope(
Some("core") -> "urn:epcglobal:hls:1",
Some("epcis") -> "urn:epcglobal:epcis:xsd:1",
Some("xs") -> "http://www.w3.org/2001/XMLSchema",
Some("xsi") -> "http://www.w3.org/2001/XMLSchema-instance")

def toXML3(event: EPCISDocumentType): NodeSeq = {
toXML[EPCISDocumentType](event, Some("urn:epcglobal:epcis:xsd:1"), Some("EPCISDocument"), fixedScope)
}

def toXML2(event: EPCISEventType): NodeSeq = {
toXML[EPCISEventType](event, Some("urn:epcglobal:epcis:xsd:1"), Some("EventObject"), fixedScope)
}
val xmlObj = fromXML[EPCISDocumentType](commissionXml)
val evtList = xmlObj.EPCISBody.EventList.get
val evtListType = evtList.eventlisttypeoption
val head = evtListType.head
val evt = head.value
val evtType = evt.asInstanceOf[EPCISEventType]
val xmlNodeSeq = toXML2(evtType)
val xmlStr = xmlNodeSeq.toString
val strippedXmlStr = EventDao.fixForBugInScalaXb(xmlStr)

val retNodeSeq = XML.loadString(strippedXmlStr)
val retObj = fromXML[EPCISEventType](retNodeSeq)
val event = translateToDataRec(retObj)
val theEvtList = Some(EventListType(event))
val body = EPCISBodyType(theEvtList, None, Nil, Map[String, scalaxb.DataRecord[Any]]())
val eventDoc = EPCISDocumentType(None, body, None, Nil, 1, retObj.eventTime, Map[String, scalaxb.DataRecord[Any]]())

val xml = toXML[EPCISDocumentType](eventDoc, Some("urn:epcglobal:epcis:xsd:1"), Some("EPCISDocument"), NewTntAPIFactory.defaultScope)
info("xml ="+xml)

}