REOC-68 For response file xml, we like to test different version
This commit is contained in:
parent
cb811d33c1
commit
3809a6fbb3
|
@ -1,92 +1,125 @@
|
||||||
package com.ossez.reoc.rets.client;
|
package com.ossez.reoc.rets.client;
|
||||||
|
|
||||||
|
|
||||||
public class LoginResponseTest extends RetsTestCase {
|
public class LoginResponseTest extends RetsTestCase {
|
||||||
/*
|
/**
|
||||||
* TODO: FIX THESE.
|
* @throws RetsException
|
||||||
*
|
*/
|
||||||
public void testValidLoginResponse15() throws RetsException {
|
public void testValidLoginResponse17() throws RetsException {
|
||||||
LoginResponse response = new LoginResponse();
|
LoginResponse response = new LoginResponse();
|
||||||
response.parse(getResource("login_valid15.xml"), RetsVersion.RETS_15);
|
response.parse(getResource("login_response_valid_1.7.xml"), RetsVersion.RETS_17);
|
||||||
assertEquals("Checking broker", "B123, BO987", response.getBroker());
|
assertEquals("Checking broker", "4935,4935", response.getBroker());
|
||||||
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
|
assertEquals("Checking member name", "BHHS Verani IDX RETS User", response.getMemberName());
|
||||||
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
|
assertEquals("Checking metadata version", "19.9.17332", response.getMetadataVersion());
|
||||||
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
|
assertEquals("Checking min metadata version", null, response.getMinMetadataVersion());
|
||||||
assertEquals("Checking user information", "A123,5678,1,A123", 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", "44.21", response.getBalance());
|
assertEquals("Checking balance", null, response.getBalance());
|
||||||
assertEquals("Checking timeout", 60, 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("http://rets.test:6103/get", urls.getActionUrl());
|
assertEquals(null, urls.getActionUrl());
|
||||||
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
|
assertEquals(null, urls.getChangePasswordUrl());
|
||||||
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
|
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/getobject", urls.getGetObjectUrl());
|
||||||
assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
|
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/login", urls.getLoginUrl());
|
||||||
assertNull(urls.getLoginCompleteUrl());
|
assertNull(urls.getLoginCompleteUrl());
|
||||||
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
|
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/logout", urls.getLogoutUrl());
|
||||||
assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
|
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/search", urls.getSearchUrl());
|
||||||
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
|
assertEquals("http://neren.rets.paragonrels.com/rets/fnisrets.aspx/NEREN/getmetadata", urls.getGetMetadataUrl());
|
||||||
assertNull(urls.getUpdateUrl());
|
assertNull(urls.getUpdateUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testValidLoginResponse10() throws RetsException {
|
|
||||||
LoginResponse response = new LoginResponse();
|
|
||||||
response.parse(getResource("login_valid10.xml"), RetsVersion.RETS_10);
|
|
||||||
assertEquals("Checking broker", "B123, BO987", response.getBroker());
|
|
||||||
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
|
|
||||||
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
|
|
||||||
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
|
|
||||||
assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation());
|
|
||||||
assertNull("Checking office list", response.getOfficeList());
|
|
||||||
assertEquals("Checking balance", "44.21", response.getBalance());
|
|
||||||
assertEquals("Checking timeout", 60, response.getSessionTimeout());
|
|
||||||
assertNull("Checking password expiration", response.getPasswordExpiration());
|
|
||||||
|
|
||||||
CapabilityUrls urls = response.getCapabilityUrls();
|
/**
|
||||||
assertEquals("http://rets.test:6103/get", urls.getActionUrl());
|
* @throws RetsException
|
||||||
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
|
*/
|
||||||
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
|
public void testValidLoginResponse15() throws RetsException {
|
||||||
assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
|
LoginResponse response = new LoginResponse();
|
||||||
assertNull(urls.getLoginCompleteUrl());
|
response.parse(getResource("login_response_valid_1.5.xml"), RetsVersion.RETS_15);
|
||||||
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
|
assertEquals("Checking broker", "B123, BO987", response.getBroker());
|
||||||
assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
|
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
|
||||||
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
|
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
|
||||||
assertNull(urls.getUpdateUrl());
|
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
|
||||||
}
|
assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation());
|
||||||
|
assertNull("Checking office list", response.getOfficeList());
|
||||||
|
assertEquals("Checking balance", "44.21", response.getBalance());
|
||||||
|
assertEquals("Checking timeout", 60, response.getSessionTimeout());
|
||||||
|
assertNull("Checking password expiration", response.getPasswordExpiration());
|
||||||
|
|
||||||
public void testLowerCaseKeys() throws RetsException {
|
CapabilityUrls urls = response.getCapabilityUrls();
|
||||||
LoginResponse response = new LoginResponse();
|
assertEquals("http://rets.test:6103/get", urls.getActionUrl());
|
||||||
response.parse(getResource("login_lower_case.xml"), RetsVersion.RETS_15);
|
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
|
||||||
assertEquals("Checking broker", "B123, BO987", response.getBroker());
|
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
|
||||||
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
|
assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
|
||||||
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
|
assertNull(urls.getLoginCompleteUrl());
|
||||||
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
|
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
|
||||||
assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation());
|
assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
|
||||||
assertNull("Checking office list", response.getOfficeList());
|
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
|
||||||
assertEquals("Checking balance", "44.21", response.getBalance());
|
assertNull(urls.getUpdateUrl());
|
||||||
assertEquals("Checking timeout", 60, response.getSessionTimeout());
|
}
|
||||||
assertNull("Checking password expiration", response.getPasswordExpiration());
|
|
||||||
|
|
||||||
CapabilityUrls urls = response.getCapabilityUrls();
|
/**
|
||||||
assertEquals("http://rets.test:6103/get", urls.getActionUrl());
|
* @throws RetsException
|
||||||
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
|
*/
|
||||||
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
|
public void testValidLoginResponse10() throws RetsException {
|
||||||
assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
|
LoginResponse response = new LoginResponse();
|
||||||
assertNull(urls.getLoginCompleteUrl());
|
response.parse(getResource("login_response_valid_1.0.xml"), RetsVersion.RETS_10);
|
||||||
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
|
assertEquals("Checking broker", "B123, BO987", response.getBroker());
|
||||||
assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
|
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
|
||||||
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
|
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
|
||||||
assertNull(urls.getUpdateUrl());
|
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
|
||||||
} */
|
assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation());
|
||||||
|
assertNull("Checking office list", response.getOfficeList());
|
||||||
|
assertEquals("Checking balance", "44.21", response.getBalance());
|
||||||
|
assertEquals("Checking timeout", 60, response.getSessionTimeout());
|
||||||
|
assertNull("Checking password expiration", response.getPasswordExpiration());
|
||||||
|
|
||||||
public void testStrictLowerCaseKeys() {
|
CapabilityUrls urls = response.getCapabilityUrls();
|
||||||
LoginResponse response = new LoginResponse();
|
assertEquals("http://rets.test:6103/get", urls.getActionUrl());
|
||||||
response.setStrict(true);
|
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
|
||||||
try {
|
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
|
||||||
response.parse(getResource("login_lower_case.xml"), RetsVersion.RETS_15);
|
assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
|
||||||
fail("Should throw exception");
|
assertNull(urls.getLoginCompleteUrl());
|
||||||
} catch (RetsException e) {
|
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
|
||||||
// Expected
|
assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
|
||||||
}
|
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
|
||||||
}
|
assertNull(urls.getUpdateUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testLowerCaseKeys() throws RetsException {
|
||||||
|
LoginResponse response = new LoginResponse();
|
||||||
|
response.parse(getResource("login_lower_case.xml"), RetsVersion.RETS_15);
|
||||||
|
assertEquals("Checking broker", "B123, BO987", response.getBroker());
|
||||||
|
assertEquals("Checking member name", "Joe T. Schmoe", response.getMemberName());
|
||||||
|
assertEquals("Checking metadata version", "1.00.000", response.getMetadataVersion());
|
||||||
|
assertEquals("Checking min metadata version", "1.00.000", response.getMinMetadataVersion());
|
||||||
|
assertEquals("Checking user information", "A123,5678,1,A123", response.getUserInformation());
|
||||||
|
assertNull("Checking office list", response.getOfficeList());
|
||||||
|
assertEquals("Checking balance", "44.21", response.getBalance());
|
||||||
|
assertEquals("Checking timeout", 60, response.getSessionTimeout());
|
||||||
|
assertNull("Checking password expiration", response.getPasswordExpiration());
|
||||||
|
|
||||||
|
CapabilityUrls urls = response.getCapabilityUrls();
|
||||||
|
assertEquals("http://rets.test:6103/get", urls.getActionUrl());
|
||||||
|
assertEquals("http://rets.test:6103/changePassword", urls.getChangePasswordUrl());
|
||||||
|
assertEquals("http://rets.test:6103/getObjectEx", urls.getGetObjectUrl());
|
||||||
|
assertEquals("http://rets.test:6103/login", urls.getLoginUrl());
|
||||||
|
assertNull(urls.getLoginCompleteUrl());
|
||||||
|
assertEquals("http://rets.test:6103/logout", urls.getLogoutUrl());
|
||||||
|
assertEquals("http://rets.test:6103/search", urls.getSearchUrl());
|
||||||
|
assertEquals("http://rets.test:6103/getMetadata", urls.getGetMetadataUrl());
|
||||||
|
assertNull(urls.getUpdateUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testStrictLowerCaseKeys() {
|
||||||
|
LoginResponse response = new LoginResponse();
|
||||||
|
response.setStrict(true);
|
||||||
|
try {
|
||||||
|
response.parse(getResource("login_lower_case.xml"), RetsVersion.RETS_15);
|
||||||
|
fail("Should throw exception");
|
||||||
|
} catch (RetsException e) {
|
||||||
|
// Expected
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue