Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Remote" argument support for weblogic.Deployer #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class CommandBuilder
private boolean ignoreHostNameVerification;
private String hostnameVerifierClass;
private boolean useURandom;
private boolean remoteMachine;

public CommandBuilder setClassPath(String classPath)
{
Expand Down Expand Up @@ -135,6 +136,11 @@ public CommandBuilder setUseURandom(boolean useURandom)
return this;
}

public CommandBuilder setRemoteMachine(boolean remoteMachine) {
this.remoteMachine = remoteMachine;
return this;
}

/**
* Constructs the commandline to be used for launching weblogic.Deployer
* to deploy an app.
Expand Down Expand Up @@ -200,6 +206,9 @@ public List<String> buildDeployCommand()
cmd.add(targets);
cmd.add("-upload");
cmd.add("-debug");
if (remoteMachine) {
cmd.add("-remote");
}
return cmd;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public class CommonWebLogicConfiguration implements ContainerConfiguration

private boolean deployExplodedArchive;

protected boolean remoteMachine;

public void validate() throws ConfigurationException
{
// Verify the mandatory properties
Expand Down Expand Up @@ -527,4 +529,15 @@ public boolean isDeployExplodedArchive() {
public void setDeployExplodedArchive(boolean deployExplodedArchive) {
this.deployExplodedArchive = deployExplodedArchive;
}

/**
* Remote machine configuration flag. Specify whether the target server is located on another machine (ie. if the
* target server do not share the same file system as the test server).
*
* @return {@code true} if executing test on a remote machine, {@code false} otherwise.
*/
// Note: getter-only, setter must be implemented in child classes.
public boolean isRemoteMachine() {
return remoteMachine;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we not assume remoteMachine when adminUrl != localhost|12.7.0.0.1 ?

What harm does it do to use remote even if it's not 100% remote, e.g. some other local ip interface used then 127.0.0.1?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, I do not see what could possibly go wrong with using -remote also for local deployments (maybe deploying will takes a little while longer)... So yes, this seems a relatively safe assumption to make regarding the adminUrl.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, testing the adminUrl may not always provide a satisfying result if the server is running on the local host but is somehow on a isolated filesystem (eg. if the target server is in a Docker container). In such case, you may want to force the remoteMachine flag as well.

If we want to make the handling of this flag more transparent to the end-user, I would suggest that we either:

  • Test for the adminUrl first and then fallback to the remoteMachine property.
  • Always enable the "-remote" argument for the remote adapters...

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public void deploy(String deploymentName, File deploymentArchive) throws Deploym
.setUseJavaStandardTrust(configuration.isUseJavaStandardTrust())
.setIgnoreHostNameVerification(configuration.isIgnoreHostNameVerification())
.setHostnameVerifierClass(configuration.getHostnameVerifierClass())
.setUseURandom(configuration.isUseURandom());
.setUseURandom(configuration.isUseURandom())
.setRemoteMachine(configuration.isRemoteMachine());

logger.log(Level.INFO, "Starting weblogic.Deployer to deploy the test artifact.");
forkWebLogicDeployer(builder.buildDeployCommand());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@
*/
public class WebLogicRemoteConfiguration extends CommonWebLogicConfiguration
{

/**
* @param remoteMachine Specify whether the target server is located on another machine (ie. if the target server
* do not share the same file system as the test server)
*/
public void setRemoteMachine(boolean remoteMachine) {
this.remoteMachine = remoteMachine;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@
*
*/
public class WebLogicRemoteConfiguration extends CommonWebLogicConfiguration {

/**
* @param remoteMachine Specify whether the target server is located on another machine (ie. if the target server
* do not share the same file system as the test server)
*/
public void setRemoteMachine(boolean remoteMachine) {
this.remoteMachine = remoteMachine;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@
*/
public class WebLogicRemoteConfiguration extends CommonWebLogicConfiguration
{

/**
* @param remoteMachine Specify whether the target server is located on another machine (ie. if the target server
* do not share the same file system as the test server)
*/
public void setRemoteMachine(boolean remoteMachine) {
this.remoteMachine = remoteMachine;
}
}