... | ... | @@ -231,3 +231,86 @@ Volley supports getting a Future<> object which can be used to inline a network |
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
### Separate Request testing from Response testing
|
|
|
```java
|
|
|
public void testSoapRequest() throws Exception {
|
|
|
|
|
|
GetTabletConfigurationRequest gtcr = new GetTabletConfigurationRequest(
|
|
|
"{340A98F5-F71E-4625-81BC-0A38371213A7}",
|
|
|
"0000211600069",//serialNumber
|
|
|
"5ab6b64123925dc", //deviceSerialNumber
|
|
|
"5ab6b64123925dc", //deviceIdentifier
|
|
|
"1.0.1.1036 release-keys", //fw disp
|
|
|
"Buzztime", // fw manu
|
|
|
"BZT-T101", // fw model
|
|
|
"5.1.1", // fw os
|
|
|
22, //fw sdk
|
|
|
"1.40.00", // sw version
|
|
|
3560206336l, // data free
|
|
|
6199967744l // data total
|
|
|
);
|
|
|
assertEquals("http://services.buzztime.com/2011/01/ISiteService/GetTabletConfiguration", gtcr.getAction());
|
|
|
assertEquals("urn:uuid:a6058e8e-279a-4313-a210-58f8deb3d015", gtcr.getMessageId());
|
|
|
|
|
|
Uri uri = Uri.parse("https://services.dev.buzztime.com/Operations/Constituent/Site/SiteService/SiteService.svc");
|
|
|
|
|
|
SoapRequest soapRequest = new SoapRequest<>(
|
|
|
uri.toString(),
|
|
|
gtcr, GetTabletConfigurationResponse.class, null, null );
|
|
|
|
|
|
InputStream expectedXmlIn = new BufferedInputStream( mTestContext.getAssets()
|
|
|
.open("soap_GetTabletConfigurationRequest.xml") );
|
|
|
String expectedXmlOutline = getXmlTransformed( expectedXmlIn, "xslt_outline.xml");
|
|
|
|
|
|
String actualXml = new String(soapRequest.getBody());//.replaceAll("\'","\"");
|
|
|
String actualXmlOutline = getXmlTransformed(actualXml, "xslt_outline.xml");
|
|
|
|
|
|
System.out.println("ExpectedXML:");
|
|
|
System.out.println(expectedXmlOutline);
|
|
|
System.out.println("SerializedXML:");
|
|
|
System.out.println(actualXmlOutline);
|
|
|
|
|
|
assertEquals(expectedXmlOutline, actualXmlOutline);
|
|
|
|
|
|
}
|
|
|
```
|
|
|
|
|
|
```java
|
|
|
public void testSoapResponse() throws Exception {
|
|
|
|
|
|
GetTabletConfigurationResponse response = new GetTabletConfigurationResponse();
|
|
|
InputStream expectedXmlIn = new BufferedInputStream( mTestContext.getAssets()
|
|
|
.open("soap_GetTabletConfigurationResponse.xml") );
|
|
|
|
|
|
XmlPullParser xpp = Xml.newPullParser();
|
|
|
xpp.setInput(new InputStreamReader( expectedXmlIn ));
|
|
|
|
|
|
response.deserialize(xpp, response.getClass(), new SoapEnvelopeFilter() );
|
|
|
|
|
|
|
|
|
assertNotNull(response.mTabletConfiguration);
|
|
|
TabletConfiguration tc = response.mTabletConfiguration;
|
|
|
System.out.println("TabletConfiguration:"+tc);
|
|
|
|
|
|
assertEquals("GMTOffset", "-0800", tc.mGMTOffset);
|
|
|
assertEquals("RouterSSID", "Buzztime161594909190", tc.mRouterSSID);
|
|
|
assertEquals("SiteChain", "NONE", tc.mSiteChain);
|
|
|
assertEquals("SiteLocation.City", "CARLSBAD", tc.mSiteLocation.mAddress.getLocality());
|
|
|
assertEquals("SiteLocation.Country", "US", tc.mSiteLocation.mAddress.getCountryName());
|
|
|
assertEquals("SiteLocation.State", "CA", tc.mSiteLocation.mAddress.getAdminArea());
|
|
|
assertEquals("SiteLocation.Address1", "5966 La Place Court, Suite 100", tc.mSiteLocation.mAddress.getAddressLine(0));
|
|
|
assertEquals("SiteLocation.Address2", "", tc.mSiteLocation.mAddress.getAddressLine(1));
|
|
|
assertEquals("SiteLocation.ZipCode", "92008", tc.mSiteLocation.mAddress.getPostalCode());
|
|
|
assertEquals("SiteLocation.Id", "1097", tc.mSiteLocation.mSiteId);
|
|
|
assertEquals("SiteLocation.Name", "NTN BUZZTIME 1097", tc.mSiteLocation.mSiteName);
|
|
|
assertEquals("SitePhone", "(123) 438-7400", tc.mSitePhone);
|
|
|
assertTrue(tc.mProperties.size() > 0);
|
|
|
assertEquals("SitePCIPAddress", "172.23.59.193", tc.mSitePCIPAddress);
|
|
|
assertEquals("SpreadPort", "4803", tc.mSpreadPort);
|
|
|
assertEquals("StoreNumber", "-1", tc.mStoreNumber);
|
|
|
assertEquals("NcrAlohaOnlineSiteId", "-1", tc.mNcrAlohaOnlineSiteId);
|
|
|
assertEquals("NcrCloudConnectCompanyCode", "", tc.mNcrCloudConnectCompanyCode);
|
|
|
assertEquals("PointOfSaleProvider", "EmptyString", tc.mPointOfSaleProvider);
|
|
|
}
|
|
|
``` |