use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class WSDLSOAPOperationExtractorImplTestCase method testGetSwaggerModelForCompositeComplexType.
@Test
public void testGetSwaggerModelForCompositeComplexType() throws Exception {
APIMWSDLReader wsdlReader = new APIMWSDLReader(Thread.currentThread().getContextClassLoader().getResource("wsdls/sample-service.wsdl").toExternalForm());
byte[] wsdlContent = wsdlReader.getWSDL();
WSDL11SOAPOperationExtractor processor = SOAPOperationBindingUtils.getWSDL11SOAPOperationExtractor(wsdlContent, wsdlReader);
Map<String, ModelImpl> parameterModelMap = processor.getWsdlInfo().getParameterModelMap();
Assert.assertNotNull(parameterModelMap);
Assert.assertTrue("wsdl complex types has not been properly parsed", parameterModelMap.size() == 12);
// composite complex type
Assert.assertNotNull(parameterModelMap.get("ItemSearchRequest"));
Assert.assertEquals(7, parameterModelMap.get("ItemSearchRequest").getProperties().size());
Assert.assertNotNull(parameterModelMap.get("ItemSearchRequest").getProperties().get("Tracks"));
Assert.assertNotNull(parameterModelMap.get("ItemSearchRequest").getProperties().get("Tracks"));
Assert.assertEquals(ArrayProperty.TYPE, parameterModelMap.get("ItemSearchRequest").getProperties().get("Tracks").getType());
Assert.assertNotNull(((ArrayProperty) parameterModelMap.get("ItemSearchRequest").getProperties().get("Tracks")).getItems());
}
use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class WSDLSOAPOperationExtractorImplTestCase method testGetSwaggerModelForImportedSchemas.
@Test
public void testGetSwaggerModelForImportedSchemas() throws Exception {
APIMWSDLReader wsdlReader = new APIMWSDLReader(Thread.currentThread().getContextClassLoader().getResource("wsdls/import-schemas/sampleservice.wsdl").toExternalForm());
byte[] wsdlContent = wsdlReader.getWSDL();
WSDL11SOAPOperationExtractor processor = SOAPOperationBindingUtils.getWSDL11SOAPOperationExtractor(wsdlContent, wsdlReader);
Set<WSDLSOAPOperation> operations = processor.getWsdlInfo().getSoapBindingOperations();
Assert.assertNotNull(operations);
Map<String, ModelImpl> parameterModelMap = processor.getWsdlInfo().getParameterModelMap();
Assert.assertNotNull(parameterModelMap);
}
use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class WSDLSOAPOperationExtractorImplTestCase method setup.
@Before
public void setup() throws Exception {
APIMWSDLReader wsdlReader = new APIMWSDLReader(Thread.currentThread().getContextClassLoader().getResource("wsdls/phoneverify.wsdl").toExternalForm());
byte[] wsdlContent = wsdlReader.getWSDL();
WSDL11SOAPOperationExtractor processor = SOAPOperationBindingUtils.getWSDL11SOAPOperationExtractor(wsdlContent, wsdlReader);
operations = processor.getWsdlInfo().getSoapBindingOperations();
}
use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class APIMWSDLReader method getWSDLSOAPOperationExtractor.
/**
* Returns a WSDL11SOAPOperationExtractor for the url {@code url}. Only WSDL 1.1 is supported.
*
* @param wsdlPath File path containing WSDL files and dependant files
* @return WSDL11SOAPOperationExtractor for the provided URL
* @throws APIManagementException If an error occurs while determining the processor
*/
public static WSDL11SOAPOperationExtractor getWSDLSOAPOperationExtractor(String wsdlPath, APIMWSDLReader wsdlReader) throws APIManagementException {
WSDL11SOAPOperationExtractor processor = new WSDL11SOAPOperationExtractor();
processor.loadXSDs(wsdlReader, wsdlPath);
processor.initPath(wsdlPath);
return processor;
}
Aggregations