Skip to content

Package: EmbeddedCargoApplicationContainer

EmbeddedCargoApplicationContainer

nameinstructionbranchcomplexitylinemethod
EmbeddedCargoApplicationContainer(WsTool, WsTool, String, int, boolean)
M: 54 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%
copyRuntimeLibraries()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
needsArchive()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
toString()
M: 6 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.container.cargo;
12:
13: import com.sun.xml.ws.test.World;
14: import com.sun.xml.ws.test.container.ApplicationContainer;
15: import com.sun.xml.ws.test.tool.WsTool;
16: import org.codehaus.cargo.container.ContainerType;
17: import org.codehaus.cargo.container.EmbeddedLocalContainer;
18: import org.codehaus.cargo.container.configuration.ConfigurationType;
19: import org.codehaus.cargo.container.configuration.LocalConfiguration;
20: import org.codehaus.cargo.container.property.ServletPropertySet;
21: import org.codehaus.cargo.generic.AbstractFactoryRegistry;
22: import org.codehaus.cargo.generic.DefaultContainerFactory;
23: import org.codehaus.cargo.generic.configuration.ConfigurationFactory;
24: import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory;
25: import org.codehaus.cargo.util.log.SimpleLogger;
26:
27: /**
28: * {@link ApplicationContainer} that loads the container into the harness VM.
29: *
30: * <p>
31: * This mode still requires the local installation of the container, to load
32: * jar files from.
33: *
34: * @author Kohsuke Kawaguchi
35: */
36: public class EmbeddedCargoApplicationContainer extends AbstractRunnableCargoContainer<EmbeddedLocalContainer> {
37: public EmbeddedCargoApplicationContainer(WsTool wsimport, WsTool wsgen, String containerId, int port, boolean httpspi) {
38: super(wsimport,wsgen,port,httpspi);
39:
40: ConfigurationFactory configurationFactory =
41: new DefaultConfigurationFactory(AbstractFactoryRegistry.class.getClassLoader());
42: LocalConfiguration configuration =
43: (LocalConfiguration) configurationFactory.createConfiguration(
44: containerId, ContainerType.EMBEDDED, ConfigurationType.STANDALONE );
45:
46: configuration.setProperty(ServletPropertySet.PORT, Integer.toString(httpPort));
47: configuration.setLogger(new SimpleLogger());
48: // TODO: we should provide a mode to launch the container with debugger
49:
50:
51: container = (EmbeddedLocalContainer) new DefaultContainerFactory(AbstractFactoryRegistry.class.getClassLoader()).createContainer(
52: containerId, ContainerType.EMBEDDED, configuration);
53: container.setClassLoader(World.runtime.getClassLoader());
54: container.setTimeout(30000);
55: }
56:
57: @Override
58: protected boolean copyRuntimeLibraries() {
59: // runtime jars available in the container. no need to copy
60: return false;
61: }
62:
63: @Override
64: protected boolean needsArchive() {
65: // embedded tomcat doesn't need a war file
66: return false;
67: }
68:
69: @Override
70: public String toString() {
71: return "EmbeddedContainer:"+container.getId();
72: }
73: }