Issue #18 - jvm argument names are no longer used when re-configuring setup.env; renamed variables that referenced jettyPort.

Former-commit-id: 94b327d00f [formerly 1c18ec39ea8a1bf1867ee96d6a33a9c595951d1f]
Former-commit-id: 2386dd5890
This commit is contained in:
Bryan Kowal 2012-04-09 13:15:50 -05:00
parent 24148c19a9
commit 5395b66d6e
3 changed files with 68 additions and 39 deletions

View file

@ -19,7 +19,7 @@ import org.apache.commons.configuration.XMLConfiguration;
* <databasePort>int</databasePort>
* <edexHttpPort>int</edexHttpPort>
* <jmsPort>int</jmsPort>
* <jettyPort>int</jettyPort>
* <webPort>int</webPort>
* <confidentialPort></confidentialPort>
* </Wes2BridgeCase>
*/
@ -32,7 +32,7 @@ public class Wes2BridgeConfiguration
private int databasePort = -1;
private int edexHttpPort = -1;
private int jmsPort = -1;
private int jettyPort = -1;
private int webPort = -1;
private int confidentialPort = -1;
/**
@ -47,7 +47,7 @@ public class Wes2BridgeConfiguration
this.databasePort = -1;
this.edexHttpPort = -1;
this.jmsPort = -1;
this.jettyPort = -1;
this.webPort = -1;
this.confidentialPort = -1;
}
@ -80,8 +80,8 @@ public class Wes2BridgeConfiguration
xmlConfiguration.getInt("edexHttpPort");
this.jmsPort =
xmlConfiguration.getInt("jmsPort");
this.jettyPort =
xmlConfiguration.getInt("jettyPort");
this.webPort =
xmlConfiguration.getInt("webPort");
this.confidentialPort =
xmlConfiguration.getInt("confidentialPort");
}
@ -136,14 +136,14 @@ public class Wes2BridgeConfiguration
this.jmsPort = jmsPort;
}
public int getJettyPort()
public int getWebPort()
{
return jettyPort;
return webPort;
}
public void setJettyPort(int jettyPort)
public void setWebPort(int webPort)
{
this.jettyPort = jettyPort;
this.webPort = webPort;
}
public int getConfidentialPort()

View file

@ -18,8 +18,8 @@ public class ConfigurationUtility
private static final String FIELD_DBPORT = "-databasePort";
private static final String FIELD_HTTPPORT = "-httpPort";
private static final String FIELD_JMSPORT = "-jmsPort";
private static final String FIELD_JETTYPORT =
"-jettyPort";
private static final String FIELD_WEBPORT =
"-webPort";
private static final String FIELD_CONFPORT =
"-confidentialPort";
@ -67,9 +67,9 @@ public class ConfigurationUtility
{
System.out.print(configuration.getJmsPort());
}
else if (field.equals(FIELD_JETTYPORT))
else if (field.equals(FIELD_WEBPORT))
{
System.out.println(configuration.getJettyPort());
System.out.println(configuration.getWebPort());
}
else if (field.equals(FIELD_CONFPORT))
{

View file

@ -200,41 +200,52 @@ public class Wes2BridgeManager
BufferedWriter bw =
new BufferedWriter(new FileWriter(destFile));
final String line1 = "wrapper.java.additional.5=";
final String line2 = "wrapper.java.additional.23=";
final String line3 = "wrapper.java.additional.24=";
final String line4 = "wrapper.java.additional.25=";
final String line5 = "wrapper.java.additional.42=";
final String line6 = "wrapper.java.additional.43=";
/*
* We want to replace at least one of the jmx jvm arguments
* with the wes2bridge.instance argument.
*/
boolean wes2BridgeInstanceAdded = false;
/*
* Disable JMX Remote and add a new wes2bridge.instance
* JVM argument so that it will be possible to determine
* which edex instance belongs to which test case.
*/
/*
* This may apply to multiple jvm arguments including:
* 1) -Dcom.sun.management.jmxremote.port
* 2) -Dcom.sun.management.jmxremote.authenticate
* 3) -Dcom.sun.management.jmxremote.ssl
*/
final String line1 = "-Dcom.sun.management.jmxremote";
/* Set the web port; used by uengine spring. */
final String line2 = "-Dweb.port";
/* Set the confidential port; used by uengine spring. */
final String line3 = "-Dconfidential.port";
String line = "";
while ((line = br.readLine()) != null)
{
if (line.startsWith(line1))
if (line.contains(line1))
{
line = line1;
line = this.getJVMArgumentName(line);
if (wes2BridgeInstanceAdded == false)
{
line += "-Dwes2bridge.instance=" +
this.configuration.getTestCaseName();
wes2BridgeInstanceAdded = true;
}
}
else if (line.startsWith(line2))
else if (line.contains(line2))
{
line = line2 + "-Dwes2bridge.instance=" +
this.configuration.getTestCaseName();
line = this.getJVMArgumentName(line);
line += line2 + "=" +
this.configuration.getWebPort();
}
else if (line.startsWith(line3))
else if (line.contains(line3))
{
line = line3;
}
else if (line.startsWith(line4))
{
line = line4;
}
else if (line.startsWith(line5))
{
line = line5 + "-Dweb.port=" +
this.configuration.getJettyPort();
}
else if (line.startsWith(line6))
{
line = line6 + "-Dconfidential.port=" +
line = this.getJVMArgumentName(line);
line += line3 + "=" +
this.configuration.getConfidentialPort();
}
@ -244,6 +255,24 @@ public class Wes2BridgeManager
bw.close();
}
private String getJVMArgumentName(String jvmArgument)
{
if (jvmArgument == null)
{
System.out.println("ERROR: Invalid wrapper.conf file.");
System.exit(-1);
}
String[] splitJVMArg = jvmArgument.split("=");
if (splitJVMArg.length <= 0)
{
System.out.println("ERROR: Invalid wrapper.conf file.");
System.exit(-1);
}
return splitJVMArg[0] + "=";
}
private void updateEdexCamel(String edexDirectory)
throws FileNotFoundException, IOException
{