Package com.eviware.soapui.impl.wsdl

Examples of com.eviware.soapui.impl.wsdl.WsdlSubmitContext


public class PropertyExpansionTest {

    @Test
    public void testExpansion() throws Exception {
        WsdlSubmitContext context = new WsdlSubmitContext(null);

        context.setProperty("test", "value");

        assertEquals("${test}", PropertyExpander.expandProperties(context, "$${test}"));
        assertEquals("value${test}", PropertyExpander.expandProperties(context, "${test}$${test}"));
        assertEquals("${value", PropertyExpander.expandProperties(context, "$${${test}"));
        assertEquals("value", PropertyExpander.expandProperties(context, "${test}"));
        assertEquals("value", PropertyExpander.expandProperties(context, "${#test}"));
        assertEquals(" value ", PropertyExpander.expandProperties(context, " ${test} "));
        assertEquals("", PropertyExpander.expandProperties(context, "${testa}"));
        assertEquals("valuevalue", PropertyExpander.expandProperties(context, "${test}${test}"));

        context.setProperty("testa", "");
        assertEquals("", PropertyExpander.expandProperties(context, "${testa}"));
    }
View Full Code Here


        assertEquals("", PropertyExpander.expandProperties(context, "${testa}"));
    }

    @Test
    public void testRecursiveExpansion() throws Exception {
        WsdlSubmitContext context = new WsdlSubmitContext(null);

        context.setProperty("test", "value");
        context.setProperty("testexp", "${test}");

        assertEquals("value", PropertyExpander.expandProperties(context, "${testexp}"));

        context.setProperty("exp", "${exp}");
        assertEquals("${exp}", PropertyExpander.expandProperties(context, "${exp}"));
    }
View Full Code Here

        assertEquals("${exp}", PropertyExpander.expandProperties(context, "${exp}"));
    }

    @Test
    public void testNestedExpansion() throws Exception {
        WsdlSubmitContext context = new WsdlSubmitContext(null);

        context.setProperty("test", "value");
        context.setProperty("testexp", "${test}");
        context.setProperty("exp", "exp");

        assertEquals("value", PropertyExpander.expandProperties(context, "${test${exp}}"));

        context.setProperty("id", "123");
        context.setProperty("testxml", "<test><value id=\"123\">hello</value></test>");
        assertEquals("hello", PropertyExpander.expandProperties(context, "${#testxml#//value[@id=${id}]/text()}"));

        context.setProperty("testxpath", "//value[@id=${id}]/text()");
        assertEquals("hello", PropertyExpander.expandProperties(context, "${#testxml#${testxpath}}"));
    }
View Full Code Here

        assertEquals("hello", PropertyExpander.expandProperties(context, "${#testxml#${testxpath}}"));
    }

    @Test
    public void testXPathExpansion() throws Exception {
        WsdlSubmitContext context = new WsdlSubmitContext(null);

        context.setProperty("test", "<test><value>hello</value></test>");
        assertEquals("hello", PropertyExpander.expandProperties(context, "${#test#//value/text()}"));
    }
View Full Code Here

  public void testValidateSimpleContent() throws Exception {
    File xsdFile = new File(getClass().getResource("xsd/simple.xsd").toURI());
    assertion.setDefinitionPaths(new String[] {xsdFile.getAbsolutePath()});
    String responseText = readResource("response/simple.xml");
   
    assertNotNull(assertion.validateXMLContent(new WsdlSubmitContext(null), responseText));
  }
View Full Code Here

    File xsdFile = new File("xsd/simple.xsd");
    assertion.setDefinitionPaths(new String[] {xsdFile.getAbsolutePath()});
    String responseText = readResource("response/simple.xml");
   
    try {
      assertion.validateXMLContent(new WsdlSubmitContext(null), responseText);
      fail("File [" + xsdFile.getAbsolutePath() + "] does not exist. Assertion must fail.");
    } catch (Exception e) {}
  }
View Full Code Here

    File xsdFile = new File(getClass().getResource("xsd/complex.xsd").toURI());
    assertion.setDefinitionPaths(new String[] {xsdFile.getAbsolutePath()});
    String responseText = readResource("response/simple.xml");
   
    try {
      assertion.validateXMLContent(new WsdlSubmitContext(null), responseText);
      fail("Validating XML with non-matching XSD must fail");
    } catch (AssertionException e) {
    }
  }
View Full Code Here

    assertion.setRootElementXPath("/shiporder/shipto");
   
    String responseText = readResource("response/simple.xml");
   
    try {
      assertion.validateXMLContent(new WsdlSubmitContext(null), responseText);
      fail("Validation should fail for selected root element '/shiporder/shipto'");
    } catch (AssertionException e) {
    }
  }
View Full Code Here

    assertion.setRootElementXPath("/shiporder/unknownNode");
   
    String responseText = readResource("response/simple.xml");
   
    try {
      assertion.validateXMLContent(new WsdlSubmitContext(null), responseText);
      fail("XPath '/shiporder/unknownNode' should not return any nodes, validation should fail");
    } catch (AssertionException e) {
    }
  }
View Full Code Here

  public void testValidateComplexContent() throws Exception {
    File xsdFile = new File(getClass().getResource("xsd/complex.xsd").toURI());
    assertion.setDefinitionPaths(new String[] {xsdFile.getAbsolutePath()});
    String responseText = readResource("response/complex.xml");
   
    assertNotNull(assertion.validateXMLContent(new WsdlSubmitContext(null), responseText));
  }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.WsdlSubmitContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.