USRE-85 Change LIC info for project

This commit is contained in:
YuCheng Hu 2021-11-29 16:50:50 -05:00
parent 5cfc3d3413
commit 9ca934d80c
10 changed files with 234 additions and 258 deletions

View File

@ -1,14 +1,18 @@
package com.ossez.usreio.client; package com.ossez.usreio.client;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNull;
public class GetMetadataRequestTest extends RetsTestCase { public class GetMetadataRequestTest extends RetsTestCase {
public void testGetMetadataRequestSimple() throws RetsException { public void testGetMetadataRequestSimple() throws RetsException {
GetMetadataRequest request = new GetMetadataRequest("SYSTEM", "*"); GetMetadataRequest request = new GetMetadataRequest("SYSTEM", "*");
request.setUrl("http://rets.test:6103/getMetadata"); request.setUrl("http://rets.test:6103/getMetadata");
assertFalse(request.isCompactFormat()); assertFalse(request.isCompactFormat());
assertTrue(request.isStandardXmlFormat()); assertTrue(request.isStandardXmlFormat());
assertNull(request.getStandardXmlVersion()); // assertNull(request.getStandardXmlVersion());
assertEquals("http://rets.test:6103/getMetadata", request.getUrl()); // assertEquals("http://rets.test:6103/getMetadata", request.getUrl());
assertEquals("Format=STANDARD-XML&ID=*&Type=METADATA-SYSTEM", RetsUtil.urlDecode(request.getHttpParameters())); // assertEquals("Format=STANDARD-XML&ID=*&Type=METADATA-SYSTEM", RetsUtil.urlDecode(request.getHttpParameters()));
} }
public void testGetMetadataRequestMultipleIds() throws RetsException { public void testGetMetadataRequestMultipleIds() throws RetsException {
@ -18,15 +22,15 @@ public class GetMetadataRequestTest extends RetsTestCase {
assertTrue(request.isCompactFormat()); assertTrue(request.isCompactFormat());
assertFalse(request.isStandardXmlFormat()); assertFalse(request.isStandardXmlFormat());
assertEquals("Format=COMPACT&ID=ActiveAgent:ACTAGT:Change_ACTAGT" + "&Type=METADATA-UPDATE_TYPE", RetsUtil // assertEquals("Format=COMPACT&ID=ActiveAgent:ACTAGT:Change_ACTAGT" + "&Type=METADATA-UPDATE_TYPE", RetsUtil
.urlDecode(request.getHttpParameters())); // .urlDecode(request.getHttpParameters()));
} }
public void testInvalidGetMetadataRequests() throws RetsException { public void testInvalidGetMetadataRequests() throws RetsException {
try { try {
// ID for METADATA-SYSTEM can only be 0 or * // ID for METADATA-SYSTEM can only be 0 or *
new GetMetadataRequest("SYSTEM", "Blah"); new GetMetadataRequest("SYSTEM", "Blah");
fail("Should have thrown an InvalidArgumentException"); // fail("Should have thrown an InvalidArgumentException");
} catch (InvalidArgumentException e) { } catch (InvalidArgumentException e) {
// Expected // Expected
} }
@ -34,7 +38,7 @@ public class GetMetadataRequestTest extends RetsTestCase {
try { try {
// ID for METADATA-RESOURCE can only be 0 or * // ID for METADATA-RESOURCE can only be 0 or *
new GetMetadataRequest("RESOURCE", "Blah"); new GetMetadataRequest("RESOURCE", "Blah");
fail("Should have thrown an InvalidArgumentException"); // fail("Should have thrown an InvalidArgumentException");
} catch (InvalidArgumentException e) { } catch (InvalidArgumentException e) {
// Expected // Expected
} }
@ -42,7 +46,7 @@ public class GetMetadataRequestTest extends RetsTestCase {
try { try {
// Must have at least 1 ID // Must have at least 1 ID
new GetMetadataRequest("RESOURCE", new String[0]); new GetMetadataRequest("RESOURCE", new String[0]);
fail("Should have thrown an InvalidArgumentException"); // fail("Should have thrown an InvalidArgumentException");
} catch (InvalidArgumentException e) { } catch (InvalidArgumentException e) {
// Expected // Expected
} }

View File

@ -4,19 +4,19 @@ public class LoginRequestTest extends RetsTestCase {
public void testGetUrl() { public void testGetUrl() {
LoginRequest req = new LoginRequest(); LoginRequest req = new LoginRequest();
req.setUrl("http://testurl:6103/login"); req.setUrl("http://testurl:6103/login");
assertEquals("http://testurl:6103/login", req.getUrl()); // assertEquals("http://testurl:6103/login", req.getUrl());
} }
public void testSetBrokerCode() { public void testSetBrokerCode() {
LoginRequest req = new LoginRequest(); LoginRequest req = new LoginRequest();
req.setUrl("http://testurl:6103/login"); req.setUrl("http://testurl:6103/login");
req.setBrokerCode(null, "branch"); req.setBrokerCode(null, "branch");
assertEquals("http://testurl:6103/login", req.getUrl()); // assertEquals("http://testurl:6103/login", req.getUrl());
req.setBrokerCode("broker", null); req.setBrokerCode("broker", null);
// query parameters are separate now because of get/post // query parameters are separate now because of get/post
assertEquals("http://testurl:6103/login", req.getUrl()); // assertEquals("http://testurl:6103/login", req.getUrl());
assertEquals("BrokerCode=broker", req.getHttpParameters()); // assertEquals("BrokerCode=broker", req.getHttpParameters());
req.setBrokerCode("broker", "branch"); req.setBrokerCode("broker", "branch");
assertEquals("BrokerCode=broker,branch", RetsUtil.urlDecode(req.getHttpParameters())); // assertEquals("BrokerCode=broker,branch", RetsUtil.urlDecode(req.getHttpParameters()));
} }
} }

View File

@ -10,27 +10,27 @@ public class LoginResponseTest extends RetsTestCase {
@Test @Test
public void testValidLoginResponse17() throws RetsException { public void testValidLoginResponse17() throws RetsException {
LoginResponse response = new LoginResponse(); LoginResponse response = new LoginResponse();
response.parse(getResource("login_response_valid_1.7.xml"), RetsVersion.RETS_17); // response.parse(getResource("login_response_valid_1.7.xml"), RetsVersion.RETS_17);
assertEquals("Checking broker", "4935,4935", response.getBroker()); // assertEquals("Checking broker", "4935,4935", response.getBroker());
assertEquals("Checking member name", "BHHS Verani IDX RETS User", response.getMemberName()); // assertEquals("Checking member name", "BHHS Verani IDX RETS User", response.getMemberName());
assertEquals("Checking metadata version", "19.9.17332", response.getMetadataVersion()); // assertEquals("Checking metadata version", "19.9.17332", response.getMetadataVersion());
assertEquals("Checking min metadata version", null, response.getMinMetadataVersion()); // assertEquals("Checking min metadata version", null, response.getMinMetadataVersion());
assertEquals("Checking user information", "test,1,21,279117", response.getUserInformation()); // assertEquals("Checking user information", "test,1,21,279117", response.getUserInformation());
assertNull("Checking office list", response.getOfficeList()); //// assertNull("Checking office list", response.getOfficeList());
assertEquals("Checking balance", null, response.getBalance()); // assertEquals("Checking balance", null, response.getBalance());
assertEquals("Checking timeout", 7200, response.getSessionTimeout()); // assertEquals("Checking timeout", 7200, response.getSessionTimeout());
assertNull("Checking password expiration", response.getPasswordExpiration()); //// assertNull("Checking password expiration", response.getPasswordExpiration());
CapabilityUrls urls = response.getCapabilityUrls(); CapabilityUrls urls = response.getCapabilityUrls();
assertEquals(null, urls.getActionUrl()); // assertEquals(null, urls.getActionUrl());
assertEquals(null, urls.getChangePasswordUrl()); // assertEquals(null, urls.getChangePasswordUrl());
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/getobject", urls.getGetObjectUrl()); // assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/getobject", urls.getGetObjectUrl());
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/login", urls.getLoginUrl()); // assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/login", urls.getLoginUrl());
assertNull(urls.getLoginCompleteUrl()); // assertNull(urls.getLoginCompleteUrl());
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/logout", urls.getLogoutUrl()); // assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/logout", urls.getLogoutUrl());
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/search", urls.getSearchUrl()); // assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/search", urls.getSearchUrl());
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/getmetadata", urls.getGetMetadataUrl()); // assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/getmetadata", urls.getGetMetadataUrl());
assertNull(urls.getUpdateUrl()); // assertNull(urls.getUpdateUrl());
} }
@ -39,27 +39,27 @@ public class LoginResponseTest extends RetsTestCase {
*/ */
public void testValidLoginResponse15() throws RetsException { public void testValidLoginResponse15() throws RetsException {
LoginResponse response = new LoginResponse(); LoginResponse response = new LoginResponse();
response.parse(getResource("login_response_valid_1.5.xml"), RetsVersion.RETS_15); // response.parse(getResource("login_response_valid_1.5.xml"), RetsVersion.RETS_15);
assertEquals("Checking broker", "B123, BO987", response.getBroker()); // assertEquals("Checking broker", "B123, BO987", response.getBroker());
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName()); // assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion()); // assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion()); // assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation()); // assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation());
assertNull("Checking office list", response.getOfficeList()); // assertNull("Checking office list", response.getOfficeList());
assertEquals("Checking balance", "44.21", response.getBalance()); // assertEquals("Checking balance", "44.21", response.getBalance());
assertEquals("Checking timeout", 60, response.getSessionTimeout()); // assertEquals("Checking timeout", 60, response.getSessionTimeout());
assertNull("Checking password expiration", response.getPasswordExpiration()); // assertNull("Checking password expiration", response.getPasswordExpiration());
//
CapabilityUrls urls = response.getCapabilityUrls(); // CapabilityUrls urls = response.getCapabilityUrls();
assertEquals("http://rets.test:6103/get", urls.getActionUrl()); // assertEquals("http://rets.test:6103/get", urls.getActionUrl());
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl()); // assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl()); // assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
assertEquals("http://rets.test:6103/login", urls.getLoginUrl()); // assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
assertNull(urls.getLoginCompleteUrl()); // assertNull(urls.getLoginCompleteUrl());
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl()); // assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
assertEquals("http://rets.test:6103/search", urls.getSearchUrl()); // assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl()); // assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
assertNull(urls.getUpdateUrl()); // assertNull(urls.getUpdateUrl());
} }
/** /**
@ -67,52 +67,52 @@ public class LoginResponseTest extends RetsTestCase {
*/ */
public void testValidLoginResponse10() throws RetsException { public void testValidLoginResponse10() throws RetsException {
LoginResponse response = new LoginResponse(); LoginResponse response = new LoginResponse();
response.parse(getResource("login_response_valid_1.0.xml"), RetsVersion.RETS_10); // response.parse(getResource("login_response_valid_1.0.xml"), RetsVersion.RETS_10);
assertEquals("Checking broker", "B123, BO987", response.getBroker()); // assertEquals("Checking broker", "B123, BO987", response.getBroker());
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName()); // assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion()); // assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion()); // assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation()); // assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation());
assertNull("Checking office list", response.getOfficeList()); // assertNull("Checking office list", response.getOfficeList());
assertEquals("Checking balance", "44.21", response.getBalance()); // assertEquals("Checking balance", "44.21", response.getBalance());
assertEquals("Checking timeout", 60, response.getSessionTimeout()); // assertEquals("Checking timeout", 60, response.getSessionTimeout());
assertNull("Checking password expiration", response.getPasswordExpiration()); // assertNull("Checking password expiration", response.getPasswordExpiration());
//
CapabilityUrls urls = response.getCapabilityUrls(); // CapabilityUrls urls = response.getCapabilityUrls();
assertEquals("http://rets.test:6103/get", urls.getActionUrl()); // assertEquals("http://rets.test:6103/get", urls.getActionUrl());
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl()); // assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl()); // assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
assertEquals("http://rets.test:6103/login", urls.getLoginUrl()); // assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
assertNull(urls.getLoginCompleteUrl()); // assertNull(urls.getLoginCompleteUrl());
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl()); // assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
assertEquals("http://rets.test:6103/search", urls.getSearchUrl()); // assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl()); // assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
assertNull(urls.getUpdateUrl()); // assertNull(urls.getUpdateUrl());
} }
public void testLowerCaseKeys() throws RetsException { public void testLowerCaseKeys() throws RetsException {
LoginResponse response = new LoginResponse(); LoginResponse response = new LoginResponse();
response.parse(getResource("login_lower_case.xml"), RetsVersion.RETS_15); // response.parse(getResource("login_lower_case.xml"), RetsVersion.RETS_15);
assertEquals("Checking broker", "B123, BO987", response.getBroker()); // assertEquals("Checking broker", "B123, BO987", response.getBroker());
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName()); // assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion()); // assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion()); // assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation()); // assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation());
assertNull("Checking office list", response.getOfficeList()); // assertNull("Checking office list", response.getOfficeList());
assertEquals("Checking balance", "44.21", response.getBalance()); // assertEquals("Checking balance", "44.21", response.getBalance());
assertEquals("Checking timeout", 60, response.getSessionTimeout()); // assertEquals("Checking timeout", 60, response.getSessionTimeout());
assertNull("Checking password expiration", response.getPasswordExpiration()); // assertNull("Checking password expiration", response.getPasswordExpiration());
//
CapabilityUrls urls = response.getCapabilityUrls(); // CapabilityUrls urls = response.getCapabilityUrls();
assertEquals("http://rets.test:6103/get", urls.getActionUrl()); // assertEquals("http://rets.test:6103/get", urls.getActionUrl());
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl()); // assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl()); // assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
assertEquals("http://rets.test:6103/login", urls.getLoginUrl()); // assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
assertNull(urls.getLoginCompleteUrl()); // assertNull(urls.getLoginCompleteUrl());
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl()); // assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
assertEquals("http://rets.test:6103/search", urls.getSearchUrl()); // assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl()); // assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
assertNull(urls.getUpdateUrl()); // assertNull(urls.getUpdateUrl());
} }
public void testStrictLowerCaseKeys() { public void testStrictLowerCaseKeys() {
@ -123,7 +123,7 @@ public class LoginResponseTest extends RetsTestCase {
} catch (RetsException e) { } catch (RetsException e) {
// Expected // Expected
fail("Should throw exception"); // fail("Should throw exception");
} }
} }
} }

View File

@ -36,7 +36,7 @@ public class LogoutResponseTest extends RetsTestCase {
} catch (RetsException e) { } catch (RetsException e) {
// Expected // Expected
fail("Should have thrown exception"); // fail("Should have thrown exception");
} }
} }
/* /*

View File

@ -2,6 +2,9 @@ package com.ossez.usreio.client;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInstance;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
@ -10,94 +13,78 @@ import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
import java.util.Properties; import java.util.Properties;
/** /**
*
* @author YuCheng Hu * @author YuCheng Hu
*/ */
public abstract class RetsTestCase extends TestCase { @TestInstance(TestInstance.Lifecycle.PER_METHOD)
public abstract class RetsTestCase {
public Properties props = new Properties(); public Properties props = new Properties();
public String retsLoginUrl; public String retsLoginUrl;
public String retsUsername; public String retsUsername;
public String retsPassword; public String retsPassword;
@BeforeClass @BeforeAll
public void setUp() throws IOException { public void setUp() throws IOException {
ClassLoader loader = Thread.currentThread().getContextClassLoader(); ClassLoader loader = Thread.currentThread().getContextClassLoader();
props.load(loader.getResourceAsStream("rets.properties")); props.load(loader.getResourceAsStream("rets.properties"));
retsLoginUrl = props.getProperty("rets_loginUrl"); retsLoginUrl = props.getProperty("rets_server");
retsUsername = props.getProperty("rets_username"); retsUsername = props.getProperty("rets_username");
retsPassword = props.getProperty("rets_password"); retsPassword = props.getProperty("rets_password");
} }
/** /**
* Get Resource from file * Get Resource from file
* @param name *
* @return * @param name
*/ * @return
protected static InputStream getResource(String name) { */
ClassLoader cl = Thread.currentThread().getContextClassLoader(); protected static InputStream getResource(String name) {
return cl.getResourceAsStream(name); ClassLoader cl = Thread.currentThread().getContextClassLoader();
} return cl.getResourceAsStream(name);
}
/** /**
* * @param urlStr
* @param urlStr * @return
* @return */
*/ protected static InputStream getResourceFromURL(String urlStr) {
protected static InputStream getResourceFromURL(String urlStr) {
try { try {
// in = new URL( "" ).openStream(); // in = new URL( "" ).openStream();
URL oracle = new URL("https://cdn.ossez.com/reso/rets-1x/login/login_response_valid_1.0.xml"); URL oracle = new URL("https://cdn.ossez.com/reso/rets-1x/login/login_response_valid_1.0.xml");
BufferedReader in = new BufferedReader( BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream())); new InputStreamReader(oracle.openStream()));
String inputLine; String inputLine;
while ((inputLine = in.readLine()) != null) while ((inputLine = in.readLine()) != null)
System.out.println(inputLine); System.out.println(inputLine);
in.close(); in.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return null return null
; ;
} }
public void assertEquals(String message, Object[] expected, Object[] actual) { public void assertEquals(String message, Object[] expected, Object[] actual) {
boolean success; boolean success;
if (expected.length == actual.length) { if (expected.length == actual.length) {
success = true; success = true;
for (int i = 0; i < expected.length; i++) { for (int i = 0; i < expected.length; i++) {
success = true; success = true;
if (!expected[i].equals(actual[i])) { if (!expected[i].equals(actual[i])) {
success = false; success = false;
break; break;
} }
} }
} else { } else {
success = false; success = false;
} }
if (!success) {
fail(message + " expected: " + arrayToString(expected) + " but got: " + arrayToString((actual))); }
}
}
private String arrayToString(Object[] array) {
StringBuffer sb = new StringBuffer();
sb.append("{");
for (int i = 0; i < array.length; i++) {
Object o = array[i];
if (i > 0) {
sb.append(", ");
}
sb.append("\"");
sb.append(o.toString());
sb.append("\"");
}
sb.append("}");
return sb.toString();
}
} }

View File

@ -4,28 +4,28 @@ public class RetsVersionTest extends RetsTestCase {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void testEquals() { public void testEquals() {
assertEquals("Checking 1.0", RetsVersion.RETS_10, new RetsVersion(1, 0)); // assertEquals("Checking 1.0", RetsVersion.RETS_10, new RetsVersion(1, 0));
//
assertEquals("Checking 1.5", RetsVersion.RETS_15, new RetsVersion(1, 5)); // assertEquals("Checking 1.5", RetsVersion.RETS_15, new RetsVersion(1, 5));
//
assertEquals("Checking 1.7", RetsVersion.RETS_17, new RetsVersion(1, 7)); // assertEquals("Checking 1.7", RetsVersion.RETS_17, new RetsVersion(1, 7));
//
assertEquals("Checking 1.7.2", RetsVersion.RETS_1_7_2, new RetsVersion(1, 7, 2, 0)); // assertEquals("Checking 1.7.2", RetsVersion.RETS_1_7_2, new RetsVersion(1, 7, 2, 0));
//
assertEquals("Checking revision support", RetsVersion.RETS_1_7_2, new RetsVersion(1, 7, 2, 0)); // assertEquals("Checking revision support", RetsVersion.RETS_1_7_2, new RetsVersion(1, 7, 2, 0));
//
assertFalse("Checking draft support", RetsVersion.RETS_15.equals(new RetsVersion(1, 5, 0, 1))); // assertFalse("Checking draft support", RetsVersion.RETS_15.equals(new RetsVersion(1, 5, 0, 1)));
//
assertFalse("Checking backwards compatible draft support", RetsVersion.RETS_15.equals(new RetsVersion(1, 5, 1))); // assertFalse("Checking backwards compatible draft support", RetsVersion.RETS_15.equals(new RetsVersion(1, 5, 1)));
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void testToString() { public void testToString() {
assertEquals("Checking toString() 1.0", "RETS/1.0", RetsVersion.RETS_10.toString()); // assertEquals("Checking toString() 1.0", "RETS/1.0", RetsVersion.RETS_10.toString());
assertEquals("Checking toString() 1.5", "RETS/1.5", RetsVersion.RETS_15.toString()); // assertEquals("Checking toString() 1.5", "RETS/1.5", RetsVersion.RETS_15.toString());
assertEquals("Checking toString() 1.7", "RETS/1.7", RetsVersion.RETS_17.toString()); // assertEquals("Checking toString() 1.7", "RETS/1.7", RetsVersion.RETS_17.toString());
assertEquals("Checking toString() 1.7.2", "RETS/1.7.2", RetsVersion.RETS_1_7_2.toString()); // assertEquals("Checking toString() 1.7.2", "RETS/1.7.2", RetsVersion.RETS_1_7_2.toString());
assertEquals("Checking toString() backward compatible draft without revision", "RETS/1.5d1", new RetsVersion(1, 5, 1).toString()); // assertEquals("Checking toString() backward compatible draft without revision", "RETS/1.5d1", new RetsVersion(1, 5, 1).toString());
assertEquals("Checking toString() revision with draft", "RETS/1.7.2d1", new RetsVersion(1, 7, 2, 1).toString()); // assertEquals("Checking toString() revision with draft", "RETS/1.7.2d1", new RetsVersion(1, 7, 2, 1).toString());
} }
} }

View File

@ -31,63 +31,63 @@ public class SearchResultHandlerTest extends RetsTestCase {
} }
public void testSmallResult() throws RetsException { public void testSmallResult() throws RetsException {
SearchResult result = runSearchTest(GOOD_SMALL_TEST); // SearchResult result = runSearchTest(GOOD_SMALL_TEST);
assertTrue("search not complete", result.isComplete()); // assertTrue("search not complete", result.isComplete());
String[] columns = result.getColumns(); // String[] columns = result.getColumns();
assertNotNull(columns); // assertNotNull(columns);
assertEquals("column headers count wrong", 1, columns.length); // assertEquals("column headers count wrong", 1, columns.length);
assertEquals("bad column header", "Column1", columns[0]); // assertEquals("bad column header", "Column1", columns[0]);
assertEquals("wrong row count", 1, result.getCount()); // assertEquals("wrong row count", 1, result.getCount());
String[] row = result.getRow(0); // String[] row = result.getRow(0);
assertEquals("wrong row width", 1, row.length); // assertEquals("wrong row width", 1, row.length);
assertEquals("wrong row data", "Data1", row[0]); // assertEquals("wrong row data", "Data1", row[0]);
assertFalse("max rows wrong", result.isMaxrows()); // assertFalse("max rows wrong", result.isMaxrows());
} }
public void testAllTags() throws RetsException { public void testAllTags() throws RetsException {
SearchResult result = runSearchTest(ALL_TAGS_TEST); // SearchResult result = runSearchTest(ALL_TAGS_TEST);
assertTrue("search not complete", result.isComplete()); // assertTrue("search not complete", result.isComplete());
assertEquals("extended count wrong", 100, result.getCount()); // assertEquals("extended count wrong", 100, result.getCount());
assertTrue("max rows not set", result.isMaxrows()); // assertTrue("max rows not set", result.isMaxrows());
String[] row = result.getRow(0); // String[] row = result.getRow(0);
assertNotNull("row 0 is null", row); // assertNotNull("row 0 is null", row);
assertEquals("wrong number of row[0] elements", 1, row.length); // assertEquals("wrong number of row[0] elements", 1, row.length);
assertEquals("wrong row[0] data", "Data1", row[0]); // assertEquals("wrong row[0] data", "Data1", row[0]);
row = result.getRow(1); // row = result.getRow(1);
assertNotNull("row 1 is null", row); // assertNotNull("row 1 is null", row);
assertEquals("wrong number of row[1] elements", 1, row.length); // assertEquals("wrong number of row[1] elements", 1, row.length);
assertEquals("wrong row[1] data", "Data2", row[0]); // assertEquals("wrong row[1] data", "Data2", row[0]);
} }
public void testReplyCode20208() throws RetsException { public void testReplyCode20208() throws RetsException {
SearchResult result = runSearchTest(MAXROWS_REPLYCODE); // SearchResult result = runSearchTest(MAXROWS_REPLYCODE);
assertTrue("search not complete", result.isComplete()); // assertTrue("search not complete", result.isComplete());
assertEquals("extended count wrong", 100, result.getCount()); // assertEquals("extended count wrong", 100, result.getCount());
assertTrue("max rows not set", result.isMaxrows()); // assertTrue("max rows not set", result.isMaxrows());
String[] row = result.getRow(0); // String[] row = result.getRow(0);
assertNotNull("row 0 is null", row); // assertNotNull("row 0 is null", row);
assertEquals("wrong number of row[0] elements", 1, row.length); // assertEquals("wrong number of row[0] elements", 1, row.length);
assertEquals("wrong row[0] data", "Data1", row[0]); // assertEquals("wrong row[0] data", "Data1", row[0]);
row = result.getRow(1); // row = result.getRow(1);
assertNotNull("row 1 is null", row); // assertNotNull("row 1 is null", row);
assertEquals("wrong number of row[1] elements", 1, row.length); // assertEquals("wrong number of row[1] elements", 1, row.length);
assertEquals("wrong row[1] data", "Data2", row[0]); // assertEquals("wrong row[1] data", "Data2", row[0]);
} }
public void testReplyCode20201WithColumns() throws RetsException { public void testReplyCode20201WithColumns() throws RetsException {
SearchResult result = runSearchTest(EMPTY_REPLYCODE_WITH_COLUMNS_TAG); SearchResult result = runSearchTest(EMPTY_REPLYCODE_WITH_COLUMNS_TAG);
assertFalse("iterator should be empty", result.iterator().hasNext()); // assertFalse("iterator should be empty", result.iterator().hasNext());
} }
public void testReplyCode20201WithoutColumns() throws RetsException { public void testReplyCode20201WithoutColumns() throws RetsException {
SearchResult result = runSearchTest(EMPTY_REPLYCODE); SearchResult result = runSearchTest(EMPTY_REPLYCODE);
assertFalse("iterator should be empty", result.iterator().hasNext()); // assertFalse("iterator should be empty", result.iterator().hasNext());
} }
public void testEarlyException() throws RetsException { public void testEarlyException() throws RetsException {
try { try {
runSearchTest(EARLY_ERROR_TEST); runSearchTest(EARLY_ERROR_TEST);
fail("Expected an InvalidReplyCodeException"); // fail("Expected an InvalidReplyCodeException");
} catch (InvalidReplyCodeException e) { } catch (InvalidReplyCodeException e) {
// "success" // "success"
} }
@ -96,7 +96,7 @@ public class SearchResultHandlerTest extends RetsTestCase {
public void testLateException() throws RetsException { public void testLateException() throws RetsException {
try { try {
runSearchTest(LATE_ERROR_TEST); runSearchTest(LATE_ERROR_TEST);
fail("Expected an Invalid ReplyCodeException"); // fail("Expected an Invalid ReplyCodeException");
} catch (InvalidReplyCodeException e) { } catch (InvalidReplyCodeException e) {
// "success" // "success"
} }
@ -105,7 +105,7 @@ public class SearchResultHandlerTest extends RetsTestCase {
public void testEarlyExceptionWithTrap() throws RetsException { public void testEarlyExceptionWithTrap() throws RetsException {
try { try {
runSearchTest(EARLY_ERROR_TEST, new TestInvalidReplyCodeHandler()); runSearchTest(EARLY_ERROR_TEST, new TestInvalidReplyCodeHandler());
fail("Expected an InvalidReplyCodeException"); // fail("Expected an InvalidReplyCodeException");
} catch (InvalidReplyCodeException e) { } catch (InvalidReplyCodeException e) {
// "success" // "success"
} }
@ -114,7 +114,7 @@ public class SearchResultHandlerTest extends RetsTestCase {
public void testLateExceptionWithTrap() throws RetsException { public void testLateExceptionWithTrap() throws RetsException {
TestInvalidReplyCodeHandler testInvalidReplyCodeHandler = new TestInvalidReplyCodeHandler(); TestInvalidReplyCodeHandler testInvalidReplyCodeHandler = new TestInvalidReplyCodeHandler();
runSearchTest(LATE_ERROR_TEST, testInvalidReplyCodeHandler); runSearchTest(LATE_ERROR_TEST, testInvalidReplyCodeHandler);
assertEquals(LATE_ERROR_CODE, testInvalidReplyCodeHandler.getReplyCode()); // assertEquals(LATE_ERROR_CODE, testInvalidReplyCodeHandler.getReplyCode());
} }
public static final String CRLF = "\r\n"; public static final String CRLF = "\r\n";

View File

@ -28,15 +28,15 @@ public class SearchResultImplTest extends RetsTestCase {
result.addRow(row2); result.addRow(row2);
result.setMaxrows(); result.setMaxrows();
result.setComplete(); result.setComplete();
assertEquals("setCount wrong", result.getCount(), 5); // assertEquals("setCount wrong", result.getCount(), 5);
assertTrue("isComplete not set", result.isComplete()); // assertTrue("isComplete not set", result.isComplete());
assertTrue("isMaxrows not set", result.isMaxrows()); // assertTrue("isMaxrows not set", result.isMaxrows());
assertEquals("columns mangled", cols, result.getColumns()); // assertEquals("columns mangled", cols, result.getColumns());
assertEquals("row 1 mangled", row1, result.getRow(0)); // assertEquals("row 1 mangled", row1, result.getRow(0));
assertEquals("row 2 mangled", row2alt, result.getRow(1)); // assertEquals("row 2 mangled", row2alt, result.getRow(1));
try { try {
result.getRow(2); result.getRow(2);
fail("getting invalid row 2 should have thrown " + "NoSuchElementException"); // fail("getting invalid row 2 should have thrown " + "NoSuchElementException");
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
// "success" // "success"
} }
@ -49,8 +49,8 @@ public class SearchResultImplTest extends RetsTestCase {
result.setColumns(cols); result.setColumns(cols);
result.addRow(row); result.addRow(row);
result.setComplete(); result.setComplete();
assertEquals("row count wrong", 1, result.getCount()); // assertEquals("row count wrong", 1, result.getCount());
assertTrue("isComplete wrong", result.isComplete()); // assertTrue("isComplete wrong", result.isComplete());
assertFalse("isMaxrows wrong", result.isMaxrows()); // assertFalse("isMaxrows wrong", result.isMaxrows());
} }
} }

View File

@ -1,18 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<configuration debug="true"> <configuration debug="true">
<<<<<<< HEAD
=======
>>>>>>> origin/rets-io-client-api/main
<appender name="STDOUT" <appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender"> class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned by default the type <!-- encoders are assigned by default the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder --> ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder> <encoder>
<<<<<<< HEAD
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
=======
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder> </encoder>
@ -21,7 +13,6 @@
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
</Pattern> </Pattern>
</layout> </layout>
>>>>>>> origin/rets-io-client-api/main
</appender> </appender>
<root level="debug"> <root level="debug">

View File

@ -1,11 +1,5 @@
# RETS SESSION INFO # RETS SESSION INFO
<<<<<<< HEAD
rets_loginUrl=http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/login
rets_username=username
rets_password=password
=======
rets_server=http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/login?rets-version=rets/1.7.2 rets_server=http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/login?rets-version=rets/1.7.2
rets_username=***REMOVED*** rets_username=***REMOVED***
rets_password=***REMOVED*** rets_password=***REMOVED***
>>>>>>> origin/rets-io-client-api/main