DataStrategy extends AbstractTagStrategy { @Override public void execute(final VoiceXmlInterpreterContext context, final VoiceXmlInterpreter interpreter, final FormInterpretationAlgorithm fia, final FormItem item, final VoiceXmlNode node) throws JVoiceXMLEvent { final DocumentServer server = context.getDocumentServer(); final Session session = context.getSession(); final Application application = context.getApplication(); final URI uri; if (application == null) { uri = src; } else { uri = application.resolve(src); } LOGGER.info("obtaining data from '" + uri + "'"); final DocumentDescriptor descriptor = new DocumentDescriptor(uri, method); try { appendVariables(context, descriptor); final FetchAttributes attributes = getFetchAttributes(); descriptor.setAttributes(attributes); final String sessionId = session.getSessionId(); final Document document = (Document) server.getObject(sessionId, descriptor, DocumentServer.TEXT_XML); final String name = (String) getAttribute(Data.ATTRIBUTE_NAME); if (name == null) { return; } final DataModel model = context.getDataModel(); model.updateVariable(name, document); } catch (BadFetchError e) { throw new BadFetchError("error reading data from '" + uri + "': " + e.getMessage(), e); } } DataStrategy(); Collection<String> getEvalAttributes(); @Override void validateAttributes(final DataModel model); @Override void execute(final VoiceXmlInterpreterContext context,
            final VoiceXmlInterpreter interpreter,
            final FormInterpretationAlgorithm fia, final FormItem item,
            final VoiceXmlNode node);  }
@Test public void testExecute() throws JVoiceXMLEvent, Exception { final VoiceXmlDocument doc = createDocument(); final Vxml vxml = doc.getVxml(); final Var var = vxml.appendChild(Var.class); final String name = "quote"; var.setName(name); final Block block = createBlock(doc); final Data data = block.appendChild(Data.class); data.setSrc(uri); data.setName(name); final DataStrategy strategy = new DataStrategy(); executeTagStrategy(data, strategy); final DataModel model = getDataModel(); Mockito.verify(model).updateVariable(Mockito.eq(name), Mockito.isA(Document.class)); }