Skip to content

Package: AbstractHttpApplication

AbstractHttpApplication

nameinstructionbranchcomplexitylinemethod
AbstractHttpApplication(URL, DeployedService)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getEndpointAddress(TestEndpoint)
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%
getWSDL()
M: 30 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 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.container;
12:
13: import com.sun.istack.NotNull;
14: import com.sun.xml.ws.test.model.TestEndpoint;
15:
16: import java.net.URI;
17: import java.net.URL;
18: import java.util.List;
19: import java.util.ArrayList;
20:
21: /**
22: * Partial {@link Application} implementation for web containers.
23: *
24: * @author Kohsuke Kawaguchi
25: */
26: public abstract class AbstractHttpApplication implements Application {
27: /**
28: * URL to access this web application.
29: */
30: protected final URL warURL;
31:
32: protected final DeployedService service;
33:
34: protected AbstractHttpApplication(URL warURL, DeployedService service) {
35: this.warURL = warURL;
36: this.service = service;
37: }
38:
39: @NotNull
40: public URI getEndpointAddress(@NotNull TestEndpoint endpoint) throws Exception {
41: return new URL(warURL,endpoint.name).toURI();
42: }
43:
44: /**
45: * When deployed to HTTP service, WSDL URL can be obtained by "?wsdl".
46: */
47: @NotNull
48: public List<URL> getWSDL() throws Exception {
49: List<URL> urls = new ArrayList<URL>();
50:
51: // TODO: if those endpoints point belong to the same service,
52: // we end up returning multiple WSDLs that are really the same.
53: // this should be harmless in terms of correctness, but
54: // it's inefficient, as we'll do extra compilation.
55: // can we avoid that?
56:• for (TestEndpoint ep : service.service.endpoints) {
57: // somehow relative path computation doesn't work, so I rely on String concatanation. Ouch!
58: urls.add(new URL(getEndpointAddress(ep)+"?wsdl"));
59: }
60: return urls;
61: }
62:
63: }