Skip to content

Package: AbstractXmlResource

AbstractXmlResource

nameinstructionbranchcomplexitylinemethod
AbstractXmlResource()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
asSOAP11Message()
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
asStreamSource()
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Distribution License v. 1.0, which is available at
6: * http://www.eclipse.org/org/documents/edl-v10.php.
7: *
8: * SPDX-License-Identifier: BSD-3-Clause
9: */
10:
11: package com.sun.xml.ws.test.client;
12:
13: import javax.xml.transform.stream.StreamSource;
14: import java.io.StringReader;
15:
16: /**
17: * Partial default implementation.
18: *
19: * @author Kohsuke Kawaguchi
20: */
21: public abstract class AbstractXmlResource implements XmlResource {
22: public StreamSource asStreamSource() throws Exception {
23: return new StreamSource(new StringReader(asString()));
24: }
25:
26: public Object asSOAP11Message() throws Exception {
27: InterpreterEx i = new InterpreterEx(Thread.currentThread().getContextClassLoader());
28: i.set("res",this);
29: return i.eval(
30: "factory = MessageFactory.newInstance();\n" +
31: "message = factory.createMessage();\n" +
32: "message.getSOAPPart().setContent(res.asStreamSource());\n" +
33: "message.saveChanges();\n" +
34: "return message;");
35: }
36: }