*
* @return
* @throws Exception
*/
public MessageContext build() throws Exception {
SynapseConfiguration testConfig = new SynapseConfiguration();
// TODO: check whether we need a SynapseEnvironment in all cases
SynapseEnvironment synEnv
= new Axis2SynapseEnvironment(new ConfigurationContext(new AxisConfiguration()),
testConfig);
MessageContext synCtx;
if (requireAxis2MessageContext) {
synCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(),
testConfig, synEnv);
} else {
synCtx = new TestMessageContext();
synCtx.setEnvironment(synEnv);
synCtx.setConfiguration(testConfig);
}
for (Map.Entry<String,Entry> mapEntry : entries.entrySet()) {
testConfig.addEntry(mapEntry.getKey(), mapEntry.getValue());
}
XMLStreamReader parser = null;
if (contentString != null) {
parser = StAXUtils.createXMLStreamReader(new StringReader(contentString));