public GetQueueAttributesResult unmarshall(StaxUnmarshallerContext context) throws Exception { GetQueueAttributesResult getQueueAttributesResult = new GetQueueAttributesResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return getQueueAttributesResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Attribute", targetDepth)) { Entry<String, String> entry = AttributesMapEntryUnmarshaller.getInstance().unmarshall(context); getQueueAttributesResult.addAttributesEntry(entry.getKey(), entry.getValue()); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return getQueueAttributesResult; } } } }
public GetQueueAttributesResult unmarshall(StaxUnmarshallerContext context) throws Exception { GetQueueAttributesResult getQueueAttributesResult = new GetQueueAttributesResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { int xmlEvent = context.nextEvent(); if (xmlEvent == XmlPullParser.END_DOCUMENT) break; if (xmlEvent == XmlPullParser.START_TAG) { if (context.testExpression("Attribute", targetDepth)) { Entry<String, String> entry = AttributesMapEntryUnmarshaller.getInstance() .unmarshall(context); getQueueAttributesResult.addAttributesEntry(entry.getKey(), entry.getValue()); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return getQueueAttributesResult; }
public GetQueueAttributesResult unmarshall(StaxUnmarshallerContext context) throws Exception { GetQueueAttributesResult getQueueAttributesResult = new GetQueueAttributesResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return getQueueAttributesResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Attribute", targetDepth)) { Entry<String, String> entry = AttributesMapEntryUnmarshaller.getInstance().unmarshall(context); getQueueAttributesResult.addAttributesEntry(entry.getKey(), entry.getValue()); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return getQueueAttributesResult; } } } }
public GetQueueAttributesResult unmarshall(StaxUnmarshallerContext context) throws Exception { GetQueueAttributesResult getQueueAttributesResult = new GetQueueAttributesResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { int xmlEvent = context.nextEvent(); if (xmlEvent == XmlPullParser.END_DOCUMENT) break; if (xmlEvent == XmlPullParser.START_TAG) { if (context.testExpression("Attribute", targetDepth)) { Entry<String, String> entry = AttributesMapEntryUnmarshaller.getInstance() .unmarshall(context); getQueueAttributesResult.addAttributesEntry(entry.getKey(), entry.getValue()); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return getQueueAttributesResult; }
@Bean public AmazonSQSAsync amazonSqs() { AmazonSQSAsync sqs = mock(AmazonSQSAsync.class); given(sqs.getQueueUrl(new GetQueueUrlRequest("testQueue"))) .willReturn(new GetQueueUrlResult().withQueueUrl("http://testQueue.amazonaws.com")); given(sqs.receiveMessage(new ReceiveMessageRequest("http://testQueue.amazonaws.com") .withAttributeNames("All") .withMessageAttributeNames("All") .withMaxNumberOfMessages(10) .withWaitTimeSeconds(20))) .willReturn(new ReceiveMessageResult() .withMessages(new Message().withBody("messageContent"), new Message().withBody("messageContent2"))) .willReturn(new ReceiveMessageResult()); given(sqs.getQueueAttributes(any(GetQueueAttributesRequest.class))) .willReturn(new GetQueueAttributesResult()); return sqs; }