Package: ClientCompileExecutor

ClientCompileExecutor

nameinstructionbranchcomplexitylinemethod
ClientCompileExecutor(DeploymentContext)
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
runTest()
M: 92 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 15 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.exec;
12:
13: import com.sun.xml.ws.test.CodeGenerator;
14: import com.sun.xml.ws.test.World;
15: import com.sun.xml.ws.test.container.DeploymentContext;
16: import com.sun.xml.ws.test.util.JavacTask;
17:
18: import java.io.File;
19: import java.net.URL;
20: import java.net.URLClassLoader;
21:
22: /**
23: * Used to compile clients when there's no server to deploy.
24: *
25: * @author Kohsuke Kawaguchi
26: */
27: public class ClientCompileExecutor extends Executor {
28: public ClientCompileExecutor(DeploymentContext context) {
29: super("Compile clients "+context.descriptor.name, context);
30: }
31:
32: public void runTest() throws Throwable {
33: CodeGenerator.testStarting(context.workDir);
34: File classDir = makeWorkDir("client-classes");
35:
36: // compile the generated source files to javac
37: JavacTask javac = new JavacTask(context.descriptor.javacOptions);
38:
39: javac.setSourceDir(
40: context.descriptor.common,
41: new File(context.descriptor.home,"client")
42: );
43: javac.setDestdir(classDir);
44: javac.setDebug(true);
45:• if(!context.wsimport.isNoop()) {
46: // if we are just reusing the existing artifacts, no need to recompile.
47: javac.execute();
48: CodeGenerator.generateJavac(javac);
49: }
50:
51: // load the generated classes and resources
52:• URL[] url = (context.getResources() == null)
53: ? new URL[] {classDir.toURL()}
54: : new URL[] {classDir.toURL(),context.getResources().toURL()};
55: ClassLoader cl = new URLClassLoader( url, World.runtime.getClassLoader() );
56:
57: context.clientClassLoader = cl;
58: }
59: }