Skip to content

Commit

Permalink
fixed errors related to retaining properties file values and slashes …
Browse files Browse the repository at this point in the history
…in log and results directory; added the retsStatus code to the test results object and the xml report
  • Loading branch information
paulaobrien committed Jan 24, 2014
1 parent 3bae989 commit 6a683ba
Show file tree
Hide file tree
Showing 32 changed files with 373 additions and 77 deletions.
8 changes: 8 additions & 0 deletions .idea/ant.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

281 changes: 275 additions & 6 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file modified classes/com/realtor/rets/compliance/PropertyManager.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/TestExecuter$1.class
Binary file not shown.
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/TestExecuter.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/TestReport.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/TestResult.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$1.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$2.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$3.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$4.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$5.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$6.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$7.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$8.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client$9.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/gui/Client.class
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/tests/BaseEvaluator.class
Binary file not shown.
Binary file not shown.
Binary file modified classes/com/realtor/rets/compliance/tests/dmql/DMQLResults.class
Binary file not shown.
Binary file not shown.
5 changes: 3 additions & 2 deletions config/TestClient.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
esults=
loginurl=http://demo.rets.interealty.com/Login.asmx/Login
password=1TR18M
resultsdirectory=C:\results
resultsdirectory=C:\projects\RESO\workspace\RESO-Server-Compliance-Tester\config\
retsVersion=RETS/1.8
transactionlogdirectory=C:\logs
transactionlogdirectory=C:\projects\RESO\workspace\RESO-Server-Compliance-Tester\config
uaPassword=
useragent=RETS-Connector/1.2
username=RESOWG
27 changes: 27 additions & 0 deletions src/com/realtor/rets/compliance/PropertiesEx.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.realtor.rets.compliance;
import java.util.*;
import java.io.*;

/**
* Created by IntelliJ IDEA.
* User: paula
* Date: 1/24/14
* Time: 5:36 AM
* To change this template use File | Settings | File Templates.
*/
public class PropertiesEx extends Properties {
public void load(InputStream fis) throws IOException {
System.out.println("in properties ex load");

Scanner in = new Scanner(fis);
ByteArrayOutputStream out = new ByteArrayOutputStream();

while(in.hasNext()) {
out.write(in.nextLine().replace("\\","\\\\").getBytes());
out.write("\n".getBytes());
}

InputStream is = new ByteArrayInputStream(out.toByteArray());
super.load(is);
}
}
16 changes: 9 additions & 7 deletions src/com/realtor/rets/compliance/PropertyManager.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.realtor.rets.compliance;

import java.io.*;
import java.util.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.*;
import java.util.*;

/**
* Created by IntelliJ IDEA.
* @author pobrien
Expand Down Expand Up @@ -69,9 +69,9 @@ public static void setConfigDirectory(String newConfigDirectory) {
PropertyManager.configDirectory = newConfigDirectory;
}

public Properties getProperties() {
public PropertiesEx getProperties() {
Object o = null;
Properties props = new Properties();
PropertiesEx props = new PropertiesEx();
if ( map == null || map.isEmpty() ) load();
Iterator iterator = map.keySet().iterator();
while ( iterator.hasNext() ) {
Expand Down Expand Up @@ -117,9 +117,10 @@ public void persist() throws IOException {


public void load() {
System.out.println("in property manager load");
if (filename != null) {
map.clear();
Properties properties = new Properties();
PropertiesEx properties = new PropertiesEx();
try {
InputStream inputStream = null;
File file = new File(filename);
Expand Down Expand Up @@ -161,10 +162,11 @@ public void fixEncodedValues() {
key = (String) iterator.next();
value = (String) map.get(key);
if ( value != null ) {
while ( value.indexOf('\\') > -1 ) {
/* while ( value.indexOf('\\') > -1 ) {
int index = value.indexOf('\\');
value = value.substring(0,index) + value.substring(index+1);
}
*/
}
map.put(key, value);
}
Expand Down
29 changes: 12 additions & 17 deletions src/com/realtor/rets/compliance/TestExecuter.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@
*/
package com.realtor.rets.compliance;

import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.realtor.rets.retsapi.RETSConnection;
Expand All @@ -29,6 +14,15 @@
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.*;

/**
* The test Executer executes RETS Compliance tests defined in XML documents
* Calls RETSTransactions defined in the XML documents and evaluates the
Expand Down Expand Up @@ -333,7 +327,7 @@ public TestReport execute(RETSConnection conn, String xmlFileName) {
* @param conn An active connection to a RETS server (login transaction
* already performed)
* @param xmlFileName name of the xml file to load
* @param props TestParametersproperties fileName to load
* @param propertiesFile TestParametersproperties fileName to load
* @return test report for the tests defined in xmlFileName
*/
public TestReport execute(RETSConnection conn, String xmlFileName, String propertiesFile) {
Expand Down Expand Up @@ -526,6 +520,7 @@ private boolean executeTransaction(RETSConnection conn, RETSTransaction trans,
}

if (trans.getResponseStatus() != null)

if (!trans.getResponseStatus().equalsIgnoreCase("0")) {
TestResult testResult = new TestResult("Response Status " +
trans.getResponseStatus(),
Expand All @@ -534,6 +529,7 @@ private boolean executeTransaction(RETSConnection conn, RETSTransaction trans,
trans.getResponseStatus());
testResult.setJavaException("");
testResult.setStatus("Info");
testResult.setRetsReplyCode(trans.getResponseStatus());

StringBuffer sb = new StringBuffer();
sb.append("Transaction Name : " + trans.getClass().getName());
Expand Down Expand Up @@ -737,7 +733,6 @@ public static TestResult reportException(Exception e, String message) {
* Reports an excepption in a testResult object
*
* @param e Exception to report
* @param message Additional message used for notes
* @return test Result object
*/
public static TestResult reportTransactionException(Exception e, RETSTransaction trans) {
Expand Down
5 changes: 3 additions & 2 deletions src/com/realtor/rets/compliance/TestReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*/
package com.realtor.rets.compliance;

import org.realtor.rets.retsapi.RETSConnection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import org.realtor.rets.retsapi.RETSConnection;


/**
* The TestReport object is intended to contain a collection of related TestResult
Expand Down Expand Up @@ -156,6 +156,7 @@ public String generateXML() {
test = (TestResult) iterator.next();
stringBuffer.append(" <Test>\n");
stringBuffer.append(" <name>" + test.getName() + "</name>\n");
stringBuffer.append(" <retsStatus>" + test.getRetsReplyCode() + "</retsStatus>\n");
stringBuffer.append(" <description><![CDATA[" + test.getDescription() + "]]></description>\n");
stringBuffer.append(" <status>" + test.getStatus()+ "</status>\n");
stringBuffer.append(" <notes>\n");
Expand Down
10 changes: 10 additions & 0 deletions src/com/realtor/rets/compliance/TestResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ public class TestResult {
private String status = null;
private String responseBody = null;

public String getRetsReplyCode() {
return retsReplyCode;
}

public void setRetsReplyCode(String retsReplyCode) {
this.retsReplyCode = retsReplyCode;
}

private String retsReplyCode="0";

/**
* Creates a new TestResult object.
*/
Expand Down
43 changes: 8 additions & 35 deletions src/com/realtor/rets/compliance/gui/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,19 @@
*
*/

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import com.realtor.rets.compliance.*;

import javax.swing.*;
import javax.swing.border.CompoundBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.net.URL;
import java.util.Enumeration;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.CompoundBorder;

import com.realtor.rets.compliance.DMQLTestConfigurer;
import com.realtor.rets.compliance.ExampleFileFilter;
import com.realtor.rets.compliance.PropertyManager;
import com.realtor.rets.compliance.ResourceManager;
import com.realtor.rets.compliance.TestExecuter;

/**
* This is a GUI client for the RETS Compliance Platform. This class provides
* a GUI interface for executing and evaluating Compliance Test Scripts
Expand Down Expand Up @@ -487,13 +459,14 @@ private void loadProperties()
{
PropertyManager pm = PropertyManager.getClientPropertyManager();
pm.load();

textUsername.setText(pm.getProperty("username"));
textPassword.setText(pm.getProperty("password"));
textServerURL.setText(pm.getProperty("loginurl"));
textUserAgent.setText(pm.getProperty("useragent"));
textUserAgentPassword.setText(pm.getProperty("uaPassword"));
textLogDir.setText(pm.getProperty("transactionlogdirectory"));
textLogDir.setText(pm.getProperty("resultsdirectory"));
textResultsDir.setText(pm.getProperty("resultsdirectory"));
String versionString = pm.getProperty("retsVersion");
if (versionString == null) {
retsVersion.setSelectedItem(DEFAULT_RETS_VERSION);
Expand Down
15 changes: 11 additions & 4 deletions src/com/realtor/rets/compliance/tests/BaseEvaluator.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
*/
package com.realtor.rets.compliance.tests;

import com.realtor.rets.compliance.*;

import java.util.*;

import com.realtor.rets.compliance.TestEvaluator;
import com.realtor.rets.compliance.TestReport;
import com.realtor.rets.compliance.TestResult;
import org.realtor.rets.retsapi.RETSTransaction;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
* Base class that can be extended -- adds methods that could be used often by
* TestEvaluators
Expand Down Expand Up @@ -150,6 +153,10 @@ protected TestResult reportResult(RETSTransaction trans, String name,
TestResult testResult = new TestResult(name, description);
testResult.setJavaException("");
testResult.setStatus(status);
if (trans.getResponseStatus() != null) {

testResult.setRetsReplyCode(trans.getResponseStatus());
}

StringBuffer sb = new StringBuffer();
sb.append("Transaction Name : " + trans.getClass().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
*/
package com.realtor.rets.compliance.tests;

import java.util.Map;

import com.realtor.rets.compliance.TestResult;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.realtor.rets.retsapi.RETSTransaction;

import com.realtor.rets.compliance.TestResult;
import java.util.Map;

/**
* Base class for Negative Tests Result Evaluator classes will evaluate each of the
Expand All @@ -23,6 +22,7 @@ public abstract class NegativeBaseEvaluator extends BaseEvaluator {
protected String testResultStatus = null;
protected String testResultDesc = null; //testResult Description
protected String testResultNotes = null;


protected String correctResponseStatus = null;

Expand Down Expand Up @@ -58,7 +58,7 @@ protected TestResult processResults(String transName, RETSTransaction transactio
transRespStatus);
}
}

testResult.setRetsReplyCode(transRespStatus);
return testResult;
}

Expand Down

0 comments on commit 6a683ba

Please sign in to comment.