public InstanceState unmarshall(StaxUnmarshallerContext context) throws Exception { InstanceState instanceState = new InstanceState(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return instanceState; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("code", targetDepth)) { instanceState.setCode(IntegerStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("name", targetDepth)) { instanceState.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return instanceState; } } } }
public InstanceState unmarshall(StaxUnmarshallerContext context) throws Exception { InstanceState instanceState = new InstanceState(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { int xmlEvent = context.nextEvent(); if (xmlEvent == XmlPullParser.END_DOCUMENT) return instanceState; if (xmlEvent == XmlPullParser.START_TAG) { if (context.testExpression("code", targetDepth)) { instanceState.setCode(IntegerStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("name", targetDepth)) { instanceState.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { return instanceState; } } } }
@Override public InstanceState getInstanceState(String instanceId) { while (waitForInstanceStateUpdate) FOKLogger.fine(getClass().getName(), "Waiting for an instance state update..."); if (getMockInstanceStates().containsKey(instanceId)) return getMockInstanceStates().get(instanceId); return new InstanceState().withCode(80); }
public void updateInstanceState(int statusCode) { getMockInstanceStates().put(getInstanceId(), new InstanceState().withCode(statusCode)); }
public InstanceState unmarshall(StaxUnmarshallerContext context) throws Exception { InstanceState instanceState = new InstanceState(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return instanceState; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("code", targetDepth)) { instanceState.setCode(IntegerStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("name", targetDepth)) { instanceState.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return instanceState; } } } }