@Test public void testGetOperationElementQName() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl")); QName operationQName = parser.getOperationQname("run_eInfo"); assertEquals("element name is wrong", "eInfoRequest", operationQName .getLocalPart()); assertEquals("operation namespace is wrong", "http://www.ncbi.nlm.nih.gov/soap/eutils/einfo", operationQName .getNamespaceURI()); }
@Test public void testBaseTypes() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl")); List<TypeDescriptor> inputs = parser .getOperationInputParameters("BIVGetRecord"); assertEquals("wrong number of inputs", 1, inputs.size()); assertTrue("should not be base type", inputs.get(0) instanceof BaseTypeDescriptor); assertEquals("wrong name", "bid", (inputs.get(0)) .getName()); assertEquals("wrong type", "int", (inputs.get(0)) .getType()); }
@Test public void testGetUseEncoded() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl")); String use = parser.getUse("BIVGetRecords"); assertEquals("use should be encoded", "encoded", use); }
@Test public void testGetOperationNamespace2() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl")); String operationNamespace = parser .getOperationNamespaceURI("run_eInfo"); assertEquals("operation namespace is wrong", "http://www.ncbi.nlm.nih.gov/soap/eutils/einfo", operationNamespace); }
@Test public void testGetActionURI() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl")); String actionURI = parser.getSOAPActionURI("run_eInfo"); assertEquals("action uri is wrong", "einfo", actionURI); }
@Test public void testMissingStyleInBinding() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("SBWReader.wsdl")); assertEquals("Style should default to document if missing", "document", parser.getStyle()); }
@Test public void testGetUseLiteral() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl")); String use = parser.getUse("run_eInfo"); assertEquals("use should be literal", "literal", use); }
@Test public void testGetOperationNamespace() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("CurrencyExchangeService.wsdl")); String operationNamespace = parser.getOperationNamespaceURI("getRate"); assertEquals("operation namespace is wrong", "urn:xmethods-CurrencyExchange", operationNamespace); }
@Test public void testGetOperations() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl")); List<Operation> operations = parser.getOperations(); assertEquals( "wrong number of operations found (wsdl may have changed)", 12, operations.size()); Operation op = operations.get(0); assertEquals("wrong name for first operation", "run_eGquery", op .getName()); assertEquals("wrong style", "document", parser.getStyle()); }
@Test public void testGoVizNoOutputs() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("GoViz.wsdl")); List<TypeDescriptor> inputs = parser .getOperationInputParameters("destroySession"); List<TypeDescriptor> outputs = parser .getOperationOutputParameters("destroySession"); assertEquals("wrong number of inputs", 1, inputs.size()); assertEquals("wrong number of outputs", 0, outputs.size()); TypeDescriptor typeDesc = inputs.get(0); assertTrue("input should be BaseType", typeDesc instanceof BaseTypeDescriptor); assertEquals("wrong name", "sessionID", typeDesc.getName()); assertEquals("wrong type", "string", typeDesc.getType()); }
@Test public void testArrayType() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl")); List<TypeDescriptor> inputs = parser .getOperationInputParameters("BIVGetRecords"); List<TypeDescriptor> outputs = parser .getOperationOutputParameters("BIVGetRecords"); assertEquals("wrong number of inputs", 1, inputs.size()); assertTrue("input should be of AArrayTypeDescriptor", inputs.get(0) instanceof ArrayTypeDescriptor); ArrayTypeDescriptor arrayTypeDesc = (ArrayTypeDescriptor) inputs.get(0); assertEquals("wrong name", "ids", arrayTypeDesc.getName()); assertEquals("wrong type", "ArrayOf_xsd_int", arrayTypeDesc.getType()); TypeDescriptor typeDesc = arrayTypeDesc.getElementType(); assertTrue("element should be of type BaseTypeDescriptor", typeDesc instanceof BaseTypeDescriptor); assertEquals("wrong type", "int", typeDesc.getType()); assertEquals("wrong number of outputs", 1, outputs.size()); assertTrue("output should be of ArrayTypeDescriptor", outputs.get(0) instanceof ArrayTypeDescriptor); arrayTypeDesc = (ArrayTypeDescriptor) outputs.get(0); assertEquals("wrong name", "BIVRecords", arrayTypeDesc.getName()); assertEquals("wrong type", "ArrayOfBIVRecord", arrayTypeDesc.getType()); typeDesc = arrayTypeDesc.getElementType(); assertEquals("wrong type", "BIVRecord", typeDesc.getType()); }
@Test public void testNestedComplexTypes() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("bind.wsdl"));
@Test public void testComplexTypeFromImport() throws Exception { WSDLParser parser = new WSDLParser(wsdlResourcePath("eutils/eutils_lite.wsdl"));