@Test(dataProvider = "SchemaValidationEnabled") public void doTest(boolean schemaValidationEnabled) throws Exception { CougarHelpers helpers = new CougarHelpers(); try { CougarManager cougarManager = CougarManager.getInstance(); helpers.setSOAPSchemaValidationEnabled(schemaValidationEnabled); // Create the SOAP request as an XML Document (with a complex map parameter with complex entry // missing mandatory fields) XMLHelpers xMLHelpers1 = new XMLHelpers(); Document createAsDocument1 = xMLHelpers1.getXMLObjectFromString( "<MapOfComplexOperationRequest><inputMap><entry key=\"aaa\"><ComplexObject/></entry></inputMap></MapOfComplexOperationRequest>"); // Set up the Http Call Bean to make the request CougarManager cougarManager2 = CougarManager.getInstance(); HttpCallBean getNewHttpCallBean5 = cougarManager2.getNewHttpCallBean("87.248.113.14"); CougarManager cougarManager5 = cougarManager2; getNewHttpCallBean5.setServiceName("Baseline"); getNewHttpCallBean5.setVersion("v2"); // Set the created SOAP request as the PostObject getNewHttpCallBean5.setPostObjectForRequestType(createAsDocument1, "SOAP"); // Get current time for getting log entries later Timestamp getTimeAsTimeStamp10 = new Timestamp(System.currentTimeMillis()); // Make the SOAP call to the operation cougarManager5.makeSoapCougarHTTPCalls(getNewHttpCallBean5); // Create the expected response object as an XML document (fault) XMLHelpers xMLHelpers4 = new XMLHelpers(); Document createAsDocument11 = xMLHelpers4.getXMLObjectFromString( "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0018</faultstring><detail/></soapenv:Fault>"); // Convert the expected response to SOAP for comparison with the actual response Map<String, Object> convertResponseToSOAP12 = cougarManager5.convertResponseToSOAP(createAsDocument11, getNewHttpCallBean5); // Check the response is as expected HttpResponseBean response5 = getNewHttpCallBean5.getResponseObjectsByEnum( com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP); AssertionUtils.multiAssertEquals( convertResponseToSOAP12.get("SOAP"), response5.getResponseObject()); // generalHelpers.pauseTest(2000L); // Check the log entries are as expected cougarManager5.verifyAccessLogEntriesAfterDate( getTimeAsTimeStamp10, new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest")); } finally { helpers.setSOAPSchemaValidationEnabled(true); } }
@Test public void doTest() throws Exception { // Create the SOAP request as an XML Document (with a dateTimeSet parameter containing a date // with a time set to 24:00:00) XMLHelpers xMLHelpers1 = new XMLHelpers(); Document createAsDocument1 = xMLHelpers1.getXMLObjectFromString( "<DateTimeSetOperationRequest><message><dateTimeSet><Date>2009-06-02T24:00:00.000Z</Date><Date>2009-06-03T24:00:00.000Z</Date></dateTimeSet></message></DateTimeSetOperationRequest>"); // Set up the Http Call Bean to make the request CougarManager cougarManager2 = CougarManager.getInstance(); HttpCallBean hbean = cougarManager2.getNewHttpCallBean("87.248.113.14"); CougarManager hinstance = cougarManager2; hbean.setServiceName("Baseline"); hbean.setVersion("v2"); // Set the created SOAP request as the PostObject hbean.setPostObjectForRequestType(createAsDocument1, "SOAP"); // Get current time for getting log entries later Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis()); // Make the SOAP call to the operation hinstance.makeSoapCougarHTTPCalls(hbean); // Create the expected response object as an XML document (fault) XMLHelpers xMLHelpers4 = new XMLHelpers(); Document createAsDocument9 = xMLHelpers4.getXMLObjectFromString( "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0044</faultstring><detail/></soapenv:Fault>"); // Convert the expected response to SOAP for comparison with actual response Map<String, Object> convertResponseToSOAP10 = hinstance.convertResponseToSOAP(createAsDocument9, hbean); // Check the response is as expected HttpResponseBean response5 = hbean.getResponseObjectsByEnum( com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP); AssertionUtils.multiAssertEquals( convertResponseToSOAP10.get("SOAP"), response5.getResponseObject()); // generalHelpers.pauseTest(3000L); // Check the log entries are as expected CougarManager cougarManager8 = CougarManager.getInstance(); cougarManager8.verifyAccessLogEntriesAfterDate( getTimeAsTimeStamp7, new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest")); }
// ERROR: 'org.xml.sax.SAXParseException; cvc-complex-type.2.4.b: The content of element // 'bas:objects' is not complete. One of // '{"http://www.betfair.com/servicetypes/v2/Baseline/":ComplexObject}' is expected.' @Test public void doTest() throws Exception { // Create the SOAP request as an XML Document XMLHelpers xMLHelpers1 = new XMLHelpers(); Document createAsDocument1 = xMLHelpers1.getXMLObjectFromString( "<TestLargePostRequest><largeRequest><size>2</size><objects><ComplexObject><value1>34</value1></ComplexObject></objects><oddOrEven>ODD</oddOrEven></largeRequest></TestLargePostRequest>"); // Set up the Http Call Bean to make the request CougarManager cougarManager2 = CougarManager.getInstance(); HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14"); cougarManager2 = cougarManager2; cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false"); getNewHttpCallBean2.setServiceName("Baseline"); getNewHttpCallBean2.setVersion("v2"); // Set the created SOAP request as the PostObject getNewHttpCallBean2.setPostObjectForRequestType(createAsDocument1, "SOAP"); // Get current time for getting log entries later Timestamp getTimeAsTimeStamp8 = new Timestamp(System.currentTimeMillis()); // Make the SOAP call to the operation cougarManager2.makeSoapCougarHTTPCalls(getNewHttpCallBean2); // Create the expected response object as an XML document (A message stating if the number of // items in the list was correct) XMLHelpers xMLHelpers4 = new XMLHelpers(); Document createAsDocument10 = xMLHelpers4.getXMLObjectFromString( "<response><message>There were 2 items specified in the list, 1 actually</message></response>"); // Convert the expected response to SOAP for comparison with actual response Map<String, Object> convertResponseToSOAP11 = cougarManager2.convertResponseToSOAP(createAsDocument10, getNewHttpCallBean2); // Check the response is as expected HttpResponseBean response5 = getNewHttpCallBean2.getResponseObjectsByEnum( com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP); AssertionUtils.multiAssertEquals( convertResponseToSOAP11.get("SOAP"), response5.getResponseObject()); // generalHelpers.pauseTest(500L); // Check the log entries are as expected cougarManager2.verifyRequestLogEntriesAfterDate( getTimeAsTimeStamp8, new RequestLogRequirement("2.8", "testLargePost")); }
@Test public void doTest() throws Exception { // Create a soap request structure as a Document object XMLHelpers xMLHelpers1 = new XMLHelpers(); Document requestDocument = xMLHelpers1.getXMLObjectFromString( "<I64SimpleTypeEchoRequest><msg>-9223372036854775809</msg></I64SimpleTypeEchoRequest>"); // Get an HTTPCallBean CougarManager cougarManager2 = CougarManager.getInstance(); HttpCallBean HTTPCallBean = cougarManager2.getNewHttpCallBean("87.248.113.14"); CougarManager CougarManager = cougarManager2; // Get LogManager JMX Attribute // Set Cougar Fault Controller attributes CougarManager.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false"); // Set service name to call HTTPCallBean.setServiceName("Baseline"); // Set service version to call HTTPCallBean.setVersion("v2"); // Set post object and request type HTTPCallBean.setPostObjectForRequestType(requestDocument, "SOAP"); // Get current time Timestamp timestamp = new Timestamp(System.currentTimeMillis()); // Make Cougar SOAP call CougarManager.makeSoapCougarHTTPCalls(HTTPCallBean); // Create a soap response structure as a Document object XMLHelpers xMLHelpers4 = new XMLHelpers(); Document responseDocument = xMLHelpers4.getXMLObjectFromString( "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0006</faultstring><detail/></soapenv:Fault>"); // Convert the Document to SOAP Map<String, Object> response5 = CougarManager.convertResponseToSOAP(responseDocument, HTTPCallBean); Object responseSoap = response5.get("SOAP"); // Get the actual SOAP response and compare it to the expected response HttpResponseBean response6 = HTTPCallBean.getResponseObjectsByEnum( com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP); AssertionUtils.multiAssertEquals(responseSoap, response6.getResponseObject()); // Pause test // generalHelpers.pauseTest(500L); // Get access log entries after the time recorded earlier in the test CougarManager.verifyAccessLogEntriesAfterDate( timestamp, new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest")); }
@Test public void doTest() throws Exception { // Create the SOAP request as an XML Document (with a missing mandatory parameter) XMLHelpers xMLHelpers1 = new XMLHelpers(); Document createAsDocument1 = xMLHelpers1.getXMLObjectFromString( "<VoidResponseOperationRequest></VoidResponseOperationRequest>"); // Set up the Http Call Bean to make the request CougarManager cougarManager2 = CougarManager.getInstance(); HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14"); cougarManager2 = cougarManager2; cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false"); getNewHttpCallBean2.setServiceName("Baseline"); getNewHttpCallBean2.setVersion("v2"); // Set the created SOAP request as the PostObject getNewHttpCallBean2.setPostObjectForRequestType(createAsDocument1, "SOAP"); // Get current time for getting log entries later Timestamp getTimeAsTimeStamp8 = new Timestamp(System.currentTimeMillis()); // Make the SOAP call to the operation cougarManager2.makeSoapCougarHTTPCalls(getNewHttpCallBean2); // Create the expected response object as an XML document (fault) XMLHelpers xMLHelpers4 = new XMLHelpers(); Document createAsDocument10 = xMLHelpers4.getXMLObjectFromString( "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0018</faultstring><detail/></soapenv:Fault>"); // Convert the expected response to SOAP for comparison with actual response Map<String, Object> convertResponseToSOAP11 = cougarManager2.convertResponseToSOAP(createAsDocument10, getNewHttpCallBean2); // Check the responses are as expected (fault) HttpResponseBean response5 = getNewHttpCallBean2.getResponseObjectsByEnum( com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP); AssertionUtils.multiAssertEquals( convertResponseToSOAP11.get("SOAP"), response5.getResponseObject()); // Check the log entries are as expected CougarManager cougarManager7 = CougarManager.getInstance(); cougarManager7.verifyAccessLogEntriesAfterDate( getTimeAsTimeStamp8, new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest")); }
@Test public void doTest() throws Exception { // Create the SOAP request as an XML Document (with byte parameters) XMLHelpers xMLHelpers1 = new XMLHelpers(); Document createAsDocument1 = xMLHelpers1.getXMLObjectFromString( "<ByteOperationRequest><headerParam>0</headerParam><queryParam>0</queryParam><message><bodyParameter>AAAA</bodyParameter></message></ByteOperationRequest>"); // Set up the Http Call Bean to make the request CougarManager cougarManager2 = CougarManager.getInstance(); HttpCallBean hbean = cougarManager2.getNewHttpCallBean("87.248.113.14"); CougarManager hinstance = cougarManager2; hbean.setServiceName("Baseline"); hbean.setVersion("v2"); // Set the created SOAP request as the PostObject hbean.setPostObjectForRequestType(createAsDocument1, "SOAP"); // Get current time for getting log entries later Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis()); // Make the SOAP call to the operation hinstance.makeSoapCougarHTTPCalls(hbean); // Create the expected response object as an XML document XMLHelpers xMLHelpers4 = new XMLHelpers(); Document createAsDocument9 = xMLHelpers4.getXMLObjectFromString( "<response><queryParameter>0</queryParameter><headerParameter>0</headerParameter><bodyParameter>AAAA</bodyParameter></response>"); // Convert the expected response to SOAP for comparison with actual response Map<String, Object> convertResponseToSOAP10 = hinstance.convertResponseToSOAP(createAsDocument9, hbean); // Check the response is as expected HttpResponseBean response5 = hbean.getResponseObjectsByEnum( com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP); AssertionUtils.multiAssertEquals( convertResponseToSOAP10.get("SOAP"), response5.getResponseObject()); // generalHelpers.pauseTest(500L); // Check the log entries are as expected hinstance.verifyRequestLogEntriesAfterDate( getTimeAsTimeStamp7, new RequestLogRequirement("2.8", "byteOperation")); }
@Test(dataProvider = "SchemaValidationEnabled") public void doTest(boolean schemaValidationEnabled) throws Exception { CougarHelpers helpers = new CougarHelpers(); try { CougarManager cougarManager = CougarManager.getInstance(); helpers.setSOAPSchemaValidationEnabled(schemaValidationEnabled); // Create the HttpCallBean CougarManager cougarManager1 = CougarManager.getInstance(); HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean(); CougarManager cougarManagerBaseline = cougarManager1; // Get the cougar logging attribute for getting log entries later // Point the created HttpCallBean at the correct service httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline"); httpCallBeanBaseline.setVersion("v2"); // Create the SOAP request as an XML Document (with a missing mandatory boolean parameter) XMLHelpers xMLHelpers2 = new XMLHelpers(); Document createAsDocument2 = xMLHelpers2.getXMLObjectFromString( "<BoolOperationRequest><headerParam>true</headerParam><message><bodyParameter>true</bodyParameter></message></BoolOperationRequest>"); // Set up the Http Call Bean to make the request CougarManager cougarManager3 = CougarManager.getInstance(); HttpCallBean getNewHttpCallBean3 = cougarManager3.getNewHttpCallBean("87.248.113.14"); cougarManager3 = cougarManager3; cougarManager3.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false"); getNewHttpCallBean3.setServiceName("Baseline"); getNewHttpCallBean3.setVersion("v2"); // Set the created SOAP request as the PostObject getNewHttpCallBean3.setPostObjectForRequestType(createAsDocument2, "SOAP"); // Get current time for getting log entries later Timestamp getTimeAsTimeStamp9 = new Timestamp(System.currentTimeMillis()); // Make the SOAP call to the operation cougarManager3.makeSoapCougarHTTPCalls(getNewHttpCallBean3); // Create the expected response object as an XML document (fault) XMLHelpers xMLHelpers5 = new XMLHelpers(); Document createAsDocument11 = xMLHelpers5.getXMLObjectFromString( "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0018</faultstring><detail/></soapenv:Fault>"); // Check the response is as expected HttpResponseBean response6 = getNewHttpCallBean3.getResponseObjectsByEnum( com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP); AssertionUtils.multiAssertEquals(createAsDocument11, response6.getResponseObject()); // generalHelpers.pauseTest(500L); // Check the log entries are as expected CougarHelpers cougarHelpers10 = new CougarHelpers(); String JavaVersion = cougarHelpers10.getJavaVersion(); CougarManager cougarManager11 = CougarManager.getInstance(); cougarManager11.verifyAccessLogEntriesAfterDate( getTimeAsTimeStamp9, new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest")); } finally { helpers.setSOAPSchemaValidationEnabled(true); } }
@Test(dataProvider = "SchemaValidationEnabled") public void doTest(boolean schemaValidationEnabled) throws Exception { CougarHelpers helpers = new CougarHelpers(); try { CougarManager cougarManager = CougarManager.getInstance(); helpers.setJMXMBeanAttributeValue( "com.betfair.cougar.transport:type=soapCommandProcessor", "SchemaValidationEnabled", schemaValidationEnabled); // Create the HttpCallBean CougarManager cougarManager1 = CougarManager.getInstance(); HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean(); CougarManager cougarManagerBaseline = cougarManager1; // Get the cougar logging attribute for getting log entries later // Point the created HttpCallBean at the correct service httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline"); httpCallBeanBaseline.setVersion("v2"); // Create the SOAP request as an XML Document (with missing required query parameter) XMLHelpers xMLHelpers2 = new XMLHelpers(); Document createAsDocument2 = xMLHelpers2.getXMLObjectFromString( "<TestParameterStylesRequest><HeaderParam>Foo</HeaderParam></TestParameterStylesRequest>"); // Set up the Http Call Bean to make the request CougarManager cougarManager3 = CougarManager.getInstance(); HttpCallBean getNewHttpCallBean3 = cougarManager3.getNewHttpCallBean(); cougarManager3 = cougarManager3; cougarManager3.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false"); getNewHttpCallBean3.setServiceName("Baseline"); getNewHttpCallBean3.setVersion("v2"); // Set the created SOAP request as the PostObject getNewHttpCallBean3.setPostObjectForRequestType(createAsDocument2, "SOAP"); // Get current time for getting log entries later Timestamp getTimeAsTimeStamp9 = new Timestamp(System.currentTimeMillis()); // Make the SOAP call to the operation cougarManager3.makeSoapCougarHTTPCalls(getNewHttpCallBean3); // Create the expected response object as an XML document XMLHelpers xMLHelpers5 = new XMLHelpers(); Document createAsDocument11 = xMLHelpers5.getXMLObjectFromString( "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0018</faultstring><detail/></soapenv:Fault>"); // Convert the expected response to SOAP for comparison with the actual response Map<String, Object> convertResponseToSOAP12 = cougarManager3.convertResponseToSOAP(createAsDocument11, getNewHttpCallBean3); // Check the response is as expected HttpResponseBean response6 = getNewHttpCallBean3.getResponseObjectsByEnum( com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP); AssertionUtils.multiAssertEquals( convertResponseToSOAP12.get("SOAP"), response6.getResponseObject()); // Check the log entries are as expected CougarHelpers cougarHelpers8 = new CougarHelpers(); String JavaVersion = cougarHelpers8.getJavaVersion(); CougarManager cougarManager9 = CougarManager.getInstance(); cougarManager9.verifyAccessLogEntriesAfterDate( getTimeAsTimeStamp9, new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest")); } finally { helpers.setJMXMBeanAttributeValue( "com.betfair.cougar.transport:type=soapCommandProcessor", "SchemaValidationEnabled", true); } }