Forum Discussion

cdunne's avatar
cdunne
Contributor
16 years ago

Script Library - StringBuffer not reconised

Hi,

I'm having some issues with using a StringBuffer in my script library, when call the following in a method (soapUIXmlUtils is custom jar package we have developed),

SoapUIXmlUtils soapUIXmlUtils = new SoapUIXmlUtils(getCurrentResponse(messageExchange))
soapUIXmlUtils.excelDocumentAndSheetNames(filePath, datasheet)
def errors = new StringBuffer()
succeed = soapUIXmlUtils.validateResponseAgainstFile(parentNode, errors, rangeStart, rangeEnd)

I get this exception -

Wed May 21 11:51:21 BST 2008:INFO:groovy.lang.MissingMethodException: No signature of method: com.tmcn.xmlutilities.SoapUIXmlUtils.validateResponseAgainstFile() is applicable for argument types: (java.lang.String, java.lang.StringBuffer, java.lang.String, java.lang.String) values: {"//ref:ReferenceDataResponse/ref:DataItem", , "1", "2"}


I can call the exact same code from a script assertion and groovy step and I do not get the exception.

Anyone got any ideas? This one has me completely scratching my head :-(

Cheers

Cormac

5 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Cormac,

    strange indeed. Can you show the declaration/signature of the validateResponseAgainstFile method? Have you tried

    soapUIXmlUtils.validateResponseAgainstFile(parentNode, errors.toString(), rangeStart.t, rangeEnd)

    ?

    regards!

    /Ole
    eviware.com
  • Hi Ole,


    Here is the method declaration,

    public def validateChildren(MessageExchange messageExchange, def currentTestName, def filePath, String datasheet, def parentNode, def rangeStart, def rangeEnd)

    it returns a boolean.

    I tried using errors.toString() and even declaring a new string buffer as part of the validateResponseAgainstFile method. None of them worked.

    cheers

    Cormac
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Cormac,

    that seems to be the definition for validateChildren, not validateResponseAgainstFile!?

    regards!

    /Ole
    eviware.com
  • Oops, sorry here is the right one.

    public boolean validateResponseAgainstFile(String xpath,
                StringBuffer errors, int fileStartRow, int fileEndRow)
                throws Exception {

    Cormac
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Cormac,

    it seems to me that the fileStartRow and fileEndRow are passed as strings instead of ints, how are you creating these? Maybe you could cast them to int with

    soapUIXmlUtils.validateResponseAgainstFile(parentNode, errors,
    Integer.parseInt(rangeStart), Integer.parseInt(rangeEnd))

    ?

    regards,

    /Ole
    eviware.com