Your question, your audience. Choose who sees your identity—and your question—with question security.
package com.mywork.tools.GQual;
import com.mywork.tools.GQual.ws.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebTable;
import com.meterware.httpunit.HttpUnitOptions;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.7</version>
</dependency>
try
{
DataInputStream in = new DataInputStream(new FileInputStream(args[3]));
java.lang.String buff = null;
while((buff= in.readline()) != null){
if(buff.indexOf( "<a href='http://") > -1 && buff.indexOf( "myruntests") > -1){
java.lang.String SbPathInMyFile = buff;
}
}
in.close();
}catch(Exception ex){
ex.printStackTrace();
}
Scanner in = null;
try {
in = new Scanner(new File(args[3]));
String buff = null;
while (in.hasNextLine()) {
buff = in.nextLine();
if ((buff.indexOf("<a href='http://") > -1) &&
(buff.indexOf("myruntests") > -1)) {
String SbPathInMyFile = buff;
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
in.close();
} catch (Exception e) { /* ignore */
}
}
in = new Scanner(new File(args[3]));
if((ix =SbPathInMyFile.indexOf("/mytest")) > -1) {
package com.mywork.tools.GPrequal;
import com.mywork.tools.GPrequal.ws.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebTable;
import com.meterware.httpunit.HttpUnitOptions;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
//java -jar GPrequal-1.0.jar abcd "681416, 756455" "148050 at A" "/dev/A/"
public class bLogData2G
{
// SEND EMAIL
public static void sendEmail(java.lang.String arg)
{
// Recipient's email ID needs to be mentioned.
java.lang.String to = arg + "@mywork.com";
// Sender's email ID needs to be mentioned
java.lang.String from = "myserve@mywork.com";
// Assuming you are sending email from localhost
java.lang.String host = "localhost";
// Get system properties
Properties properties = System.getProperties();
// Setup mail server
properties.setProperty("mail.smtp.host", host);
// Get the default Session object
Session session = Session.getDefaultInstance(properties);
try{
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress(from));
// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
// Set Subject: header field
message.setSubject("Logging to G Failed");
// Now set the actual message
message.setText("Logging to G Failed due to the size limit in the text fields");
// Send message
Transport.send(message);
}
catch (MessagingException mex) {
mex.printStackTrace();
}
}
// END OF SEND EMAIL
// args[] = login, gecIDList, myID@cluster, pathToJobfile
public static void main(java.lang.String args[])
{
java.lang.String soapEndpointURL="http://Gwebtest-00-blr.mywork.com/main/services/gecWebService";
// Add g as a prefix to each gec to make them as a link in the solution field
// java.lang.String gecIDList = "g" + args[1] + args[1].replaceAll(",", ",g");
java.lang.String gecIDList = args[1].replaceAll("(\\d+)", "g$1");
// Find the location of the mycheck report using the path to myruntests report in submit file.
/* try
{
DataInputStream in = new DataInputStream(new FileInputStream(args[3]));
java.lang.String buff = null;
while((buff= in.readline()) != null){
if(buff.indexOf( "<a href='http://") > -1 && buff.indexOf( "myruntests") > -1){
java.lang.String SbPathInSubmitFile = buff;
}
}
in.close();
}catch(Exception ex){
ex.printStackTrace();
}
*/
try {
in = new Scanner(new File(args[3]));
java.lang.String buff = null;
while (in.hasNextLine()) {
buff = in.nextLine();
if ((buff.indexOf("<a href='http://") > -1) && (buff.indexOf("myruntests") > -1)) {
java.lang.String SbPathInSubmitFile = buff;
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
int ix = 0;
if((ix =SbPathInSubmitFile.indexOf("/sbtest")) > -1) {
SbPathInSubmitFile = SbPathInSubmitFile.substring(0, ix);
}
java.lang.String mycheckReportPath = SbPathInSubmitFile + "mycheck/report.html";
try {
HttpUnitOptions.setScriptingEnabled(false);
WebConversation wc = new WebConversation();
WebResponse wr = wc.getResponse(mycheckReportPath);
WebTable table = wr.getTables()[0];
java.lang.String[][] cells = table.asText();
java.lang.String mycheckActivity = "";
for(java.lang.String[] row : cells) {
for(java.lang.String cell : row) {
mycheckActivity += cell;
}
mycheckActivity += System.getProperty("line.separator");
}
}
catch(Exception e) {
e.printStackTrace();
}
try {
gecWebServiceSoapBindingStub stub = new gecWebServiceSoapBindingStub(new java.net.URL(soapEndpointURL), new org.apache.axis.client.Service());
//find the submitted files in the job file
java.lang.String myFiles = "";
try{
DataInputStream in = new DataInputStream(new FileInputStream(args[3]));
java.lang.String jobFile = null;
while((jobFile=in.readLine() )!= null){
if(jobFile.startsWith("s") || jobFile.startsWith("S") || jobFile.startsWith("D")){
myFiles += jobFile + System.getProperty("line.separator");
}
}
in.close();
}
catch(Exception e){
e.printStackTrace();
}
// Get the number of records (gecs)
java.lang.String[] gecs = args[1].split(",");
int [] gecList = new int[gecs.length];
for(int j=0; j<gecList.length; j++){
java.lang.String myservemsg = "The information below is logged into this field by myserve";
// Get the jth gecID
java.lang.Integer gecID = java.lang.Integer.parseInt(gecs[j]);
// Lock the gec and get the gec object. Arguments: gecID, login
gec g = stub.lockgec(gecID,args[0]);
// Get the date and time of the G logging
java.lang.String gecUpdateDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm zzz").format(new java.util.Date());
// UNCOMMENT THIS PART ONCE NEW WSDL IS READY WITH Qualification Actitivities FIELD
//Get the current Qualification Actitivities;
////////////// java.lang.String qActivities = g.getQualificationActivities();
java.lang.String qActivities = g.getSolution();
// Stop logging files to qActivities field if qActivities field does not have enough space (KB).
// Each char in a java string is *two* bytes - it uses UTF16 encoding
java.lang.String totalqActivitiesData= args[0] + " - " + gecUpdateDate + "\n\n" + myservemsg + "\n\n" + mycheckActivity + "\n\n\n" + qActivities + "\n";
java.lang.Double totalqActivitiesSize = totalqActivitiesData.length() * 2 / 1024.0;
// Qualification Actitivities field size is 64 kb. However I put a buffer in case someone needs to put a few more lines later on.
// That's why I use 60 instead of 64.
if (totalqActivitiesSize < 60){
qActivities = args[0] + " - " + gecUpdateDate + "\n\n" + myservemsg + "\n\n" + "mycheck STATUS" + "\n\n" + mycheckActivity + "\n\n\n" + qActivities + "\n";
}
else{
//sendEmail(args[0]);
qActivities = args[0] + " - " + gecUpdateDate + "\n\n" + myservemsg + "\n\n" + "mycheck report cannot be logged in because text field size was exceeded." + "\n\n\n" + qActivities + "\n";
}
//END OF UNCOMMENT */
/*
//Get the current Solution;
java.lang.String solution = g.getSolution();
// Stop logging files to solution field if Solution field does not have enough space (KB).
// Each char in a java string is *two* bytes - it uses UTF16 encoding
java.lang.String totalSolutionData= args[0] + " - " + gecUpdateDate + "\n\n" + myservemsg + "\n\n" + "myID: " + args[2] + "\n" + "Related Records: " + gecIDList + "\n\n" + myFiles + "\n\n\n" + solution + "\n";
java.lang.Double totalsolutionSize = totalSolutionData.length() * 2 / 1024.0;
// Solution field size is 64 kb. However I put a buffer in case someone needs to put a few more lines later on.
// That's why I use 60 instead of 64.
if (totalsolutionSize < 60){
solution = args[0] + " - " + gecUpdateDate + "\n\n" + myservemsg + "\n\n" + "myID: " + args[2] + "\n" + "Related Records: " + gecIDList + "\n\n" + myFiles + "\n\n\n" + solution + "\n";
// }
// else{
// sendEmail(args[0]);
// solution = args[0] + " - " + gecUpdateDate + "\n\n" + myservemsg + "\n\n" + "myID: " + args[2] + "\n" + "Related Records: " + gecIDList + "\n\n" + "Submitted files cannot be logged in because text field size was exceeded." + "\n\n\n" + solution + "\n";
// }
//set the solution
//g.setSolution(solution);
g.setSolution(qActitivities);
//set the qualification activities
// g.setQaulificationActivities(mycheckActivity);
//save the gec
stub.savegec(g,args[0]);
}
}
catch(Exception e) {
e.printStackTrace();
}
}
}
import com.mywork.tools.GPrequal.ws.*;
import java.util.*;
import java.io.*;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebTable;
import com.meterware.httpunit.HttpUnitOptions;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
//java -jar GPrequal-1.0.jar abcd "681416, 756455" "148050 at A" "/dev/A/"
public class bLogData2G {
// SEND EMAIL
public static void sendEmail(java.lang.String arg) {
// Recipient's email ID needs to be mentioned.
java.lang.String to = arg + "@mywork.com";
// Sender's email ID needs to be mentioned
java.lang.String from = "myserve@mywork.com";
// Assuming you are sending email from localhost
java.lang.String host = "localhost";
// Get system properties
Properties properties = System.getProperties();
// Setup mail server
properties.setProperty("mail.smtp.host", host);
// Get the default Session object
Session session = Session.getDefaultInstance(properties);
try {
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress(from));
// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO, new InternetAddress(
to));
// Set Subject: header field
message.setSubject("Logging to G Failed");
// Now set the actual message
message.setText("Logging to G Failed due to the size limit in the text fields");
// Send message
Transport.send(message);
} catch (MessagingException mex) {
mex.printStackTrace();
}
}
// END OF SEND EMAIL
// args[] = login, gecIDList, myID@cluster, pathToJobfile
public static void main(java.lang.String args[]) {
java.lang.String soapEndpointURL = "http://Gwebtest-00-blr.mywork.com/main/services/gecWebService";
// Add g as a prefix to each gec to make them as a link in the solution
// field
// java.lang.String gecIDList = "g" + args[1] + args[1].replaceAll(",",
// ",g");
java.lang.String gecIDList = args[1].replaceAll("(\\d+)", "g$1");
// Find the location of the mycheck report using the path to myruntests
// report in submit file.
/*
* try { DataInputStream in = new DataInputStream(new
* FileInputStream(args[3])); java.lang.String buff = null; while((buff=
* in.readline()) != null){ if(buff.indexOf( "<a href='http://") > -1 &&
* buff.indexOf( "myruntests") > -1){ java.lang.String
* SbPathInSubmitFile = buff; } } in.close(); }catch(Exception ex){
* ex.printStackTrace(); }
*/
java.lang.String SbPathInSubmitFile = null;
try {
Scanner in = new Scanner(new File(args[3]));
java.lang.String buff = null;
while (in.hasNextLine()) {
buff = in.nextLine();
if ((buff.indexOf("<a href='http://") > -1)
&& (buff.indexOf("myruntests") > -1)) {
SbPathInSubmitFile = buff;
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
int ix = 0;
if ((ix = SbPathInSubmitFile.indexOf("/sbtest")) > -1) {
SbPathInSubmitFile = SbPathInSubmitFile.substring(0, ix);
}
java.lang.String mycheckReportPath = SbPathInSubmitFile
+ "mycheck/report.html";
java.lang.String mycheckActivity = "";
try {
HttpUnitOptions.setScriptingEnabled(false);
WebConversation wc = new WebConversation();
WebResponse wr = wc.getResponse(mycheckReportPath);
WebTable table = wr.getTables()[0];
java.lang.String[][] cells = table.asText();
for (java.lang.String[] row : cells) {
for (java.lang.String cell : row) {
mycheckActivity += cell;
}
mycheckActivity += System.getProperty("line.separator");
}
} catch (Exception e) {
e.printStackTrace();
}
try {
gecWebServiceSoapBindingStub stub = new gecWebServiceSoapBindingStub(
new java.net.URL(soapEndpointURL),
new org.apache.axis.client.Service());
// find the submitted files in the job file
java.lang.String myFiles = "";
try {
DataInputStream in = new DataInputStream(new FileInputStream(
args[3]));
java.lang.String jobFile = null;
while ((jobFile = in.readLine()) != null) {
if (jobFile.startsWith("s") || jobFile.startsWith("S")
|| jobFile.startsWith("D")) {
myFiles += jobFile
+ System.getProperty("line.separator");
}
}
in.close();
} catch (Exception e) {
e.printStackTrace();
}
// Get the number of records (gecs)
java.lang.String[] gecs = args[1].split(",");
int[] gecList = new int[gecs.length];
for (int j = 0; j < gecList.length; j++) {
java.lang.String myservemsg = "The information below is logged into this field by myserve";
// Get the jth gecID
java.lang.Integer gecID = java.lang.Integer.parseInt(gecs[j]);
// Lock the gec and get the gec object. Arguments: gecID, login
gec g = stub.lockgec(gecID, args[0]);
// Get the date and time of the G logging
java.lang.String gecUpdateDate = new java.text.SimpleDateFormat(
"yyyy-MM-dd HH:mm zzz").format(new java.util.Date());
// UNCOMMENT THIS PART ONCE NEW WSDL IS READY WITH Qualification
// Actitivities FIELD
// Get the current Qualification Actitivities;
// //////////// java.lang.String qActivities =
// g.getQualificationActivities();
java.lang.String qActivities = g.getSolution();
// Stop logging files to qActivities field if qActivities field
// does not have enough space (KB).
// Each char in a java string is *two* bytes - it uses UTF16
// encoding
java.lang.String totalqActivitiesData = args[0] + " - "
+ gecUpdateDate + "\n\n" + myservemsg + "\n\n"
+ mycheckActivity + "\n\n\n" + qActivities + "\n";
java.lang.Double totalqActivitiesSize = totalqActivitiesData
.length() * 2 / 1024.0;
// Qualification Actitivities field size is 64 kb. However I put
// a buffer in case someone needs to put a few more lines later
// on.
// That's why I use 60 instead of 64.
if (totalqActivitiesSize < 60) {
qActivities = args[0] + " - " + gecUpdateDate + "\n\n"
+ myservemsg + "\n\n" + "mycheck STATUS" + "\n\n"
+ mycheckActivity + "\n\n\n" + qActivities + "\n";
} else {
// sendEmail(args[0]);
qActivities = args[0]
+ " - "
+ gecUpdateDate
+ "\n\n"
+ myservemsg
+ "\n\n"
+ "mycheck report cannot be logged in because text field size was exceeded."
+ "\n\n\n" + qActivities + "\n";
}
// END OF UNCOMMENT */
// Get the current Solution;
java.lang.String solution = g.getSolution();
// Stop logging files to solution field if Solution field does
// not have enough space (KB).
// Each char in a java string is *two* bytes - it uses UTF16
// encoding
java.lang.String totalSolutionData = args[0] + " - "
+ gecUpdateDate + "\n\n" + myservemsg + "\n\n"
+ "myID: " + args[2] + "\n" + "Related Records: "
+ gecIDList + "\n\n" + myFiles + "\n\n\n" + solution
+ "\n";
java.lang.Double totalsolutionSize = totalSolutionData.length() * 2 / 1024.0;
// Solution field size is 64 kb. However I put a buffer in case
// someone needs to put a few more lines later on.
// That's why I use 60 instead of 64.
if (totalsolutionSize < 60) {
solution = args[0] + " - " + gecUpdateDate + "\n\n"
+ myservemsg + "\n\n" + "myID: " + args[2] + "\n"
+ "Related Records: " + gecIDList + "\n\n"
+ myFiles + "\n\n\n" + solution + "\n";
// }
// else{
// sendEmail(args[0]);
// solution = args[0] + " - " + gecUpdateDate + "\n\n" +
// myservemsg + "\n\n" + "myID: " + args[2] + "\n" +
// "Related Records: " + gecIDList + "\n\n" +
// "Submitted files cannot be logged in because text field size was exceeded."
// + "\n\n\n" + solution + "\n";
// }
// set the solution
// g.setSolution(solution);
g.setSolution(qActivities);
// set the qualification activities
// g.setQaulificationActivities(mycheckActivity);
// save the gec
stub.savegec(g, args[0]);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
Perhaps this could help
http://stackoverflow.com/questions/1510071/maven-how-can-i-add-an-arbitrary-classpath-entry-to-a-jar
http://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them