From 2f2155351cc9172ee52dccf28b98a8f85856c5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Maa=C3=9Fen?= Date: Mon, 26 Aug 2024 08:09:43 +0200 Subject: [PATCH] Initial import for issue 28 --- .gitignore | 7 ++ .../soaptorest/SOAPToRESTConverterTest.java | 81 +++++++++------- src/test/resources/issue-28/failing.wsdl | 92 +++++++++++++++++++ target/test-classes/issue-28/failing.wsdl | 92 +++++++++++++++++++ 4 files changed, 238 insertions(+), 34 deletions(-) create mode 100644 src/test/resources/issue-28/failing.wsdl create mode 100644 target/test-classes/issue-28/failing.wsdl diff --git a/.gitignore b/.gitignore index 4c1a033..cf734ca 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,10 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* .idea/ + +target/ + +# files from jdtls +.settings/ +.classpath +.project diff --git a/src/test/java/org/wso2/soaptorest/SOAPToRESTConverterTest.java b/src/test/java/org/wso2/soaptorest/SOAPToRESTConverterTest.java index 5d01cf8..4d4f4a2 100644 --- a/src/test/java/org/wso2/soaptorest/SOAPToRESTConverterTest.java +++ b/src/test/java/org/wso2/soaptorest/SOAPToRESTConverterTest.java @@ -1,57 +1,70 @@ /* * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at + * WSO2 Inc. licenses this file to you under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. You may obtain a copy of the License + * at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.wso2.soaptorest; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import java.net.MalformedURLException; +import java.net.URL; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; import org.wso2.soaptorest.exceptions.SOAPToRESTException; import org.wso2.soaptorest.models.SOAPtoRESTConversionData; -import java.net.MalformedURLException; -import java.net.URL; +class SOAPToRESTConverterTest { -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; + @Test + void testFileGetSOAPtoRESTConversionData() throws SOAPToRESTException { -class SOAPToRESTConverterTest { + SOAPtoRESTConversionData soaPtoRESTConversionData = + SOAPToRESTConverter.getSOAPtoRESTConversionData( + "src/test/resources" + "/calculator/calculator.wsdl", "Test API", "1.0.0"); + assertTrue(StringUtils.isNotBlank(soaPtoRESTConversionData.getOASString())); + assertEquals(soaPtoRESTConversionData.getAllSOAPRequestBodies().size(), 4); + assertEquals(soaPtoRESTConversionData.getSoapService(), "CalculatorService"); + assertEquals(soaPtoRESTConversionData.getSoapPort(), "CalculatorPort"); + + } + + @Test + void testURLGetSOAPtoRESTConversionData() throws MalformedURLException, SOAPToRESTException { - @Test - void testFileGetSOAPtoRESTConversionData() throws SOAPToRESTException { + URL url = new URL( + "https://raw.githubusercontent.com/wso2/soap-to-rest/main/src/test/resources/calculator-remote/calculator.wsdl"); + SOAPtoRESTConversionData soaPtoRESTConversionData = + SOAPToRESTConverter.getSOAPtoRESTConversionData(url, "Test API", "1.0.0"); + assertTrue(StringUtils.isNotBlank(soaPtoRESTConversionData.getOASString())); + assertEquals(soaPtoRESTConversionData.getAllSOAPRequestBodies().size(), 4); + assertEquals(soaPtoRESTConversionData.getSoapService(), "CalculatorService"); + assertEquals(soaPtoRESTConversionData.getSoapPort(), "CalculatorPort"); - SOAPtoRESTConversionData soaPtoRESTConversionData = SOAPToRESTConverter.getSOAPtoRESTConversionData("src/test/resources" + - "/calculator/calculator.wsdl", "Test API", "1.0.0"); - assertTrue(StringUtils.isNotBlank(soaPtoRESTConversionData.getOASString())); - assertEquals(soaPtoRESTConversionData.getAllSOAPRequestBodies().size(), 4); - assertEquals(soaPtoRESTConversionData.getSoapService(), "CalculatorService"); - assertEquals(soaPtoRESTConversionData.getSoapPort(), "CalculatorPort"); + } - } + @Test + void testIssue28() throws MalformedURLException, SOAPToRESTException { - @Test - void testURLGetSOAPtoRESTConversionData() throws MalformedURLException, SOAPToRESTException { + URL url = new URL( + "https://raw.githubusercontent.com/wso2/soap-to-rest/main/src/test/resources/issue-28/failing.wsdl"); + SOAPtoRESTConversionData soaPtoRESTConversionData = + SOAPToRESTConverter.getSOAPtoRESTConversionData(url, "Test API", "1.0.0"); + assertTrue(StringUtils.isNotBlank(soaPtoRESTConversionData.getOASString())); + assertEquals(soaPtoRESTConversionData.getAllSOAPRequestBodies().size(), 4); + assertEquals(soaPtoRESTConversionData.getSoapService(), "CalculatorService"); + assertEquals(soaPtoRESTConversionData.getSoapPort(), "CalculatorPort"); - URL url = new URL("https://raw.githubusercontent.com/wso2/soap-to-rest/main/src/test/resources/calculator-remote/calculator.wsdl"); - SOAPtoRESTConversionData soaPtoRESTConversionData = SOAPToRESTConverter.getSOAPtoRESTConversionData(url, "Test API", "1.0.0"); - assertTrue(StringUtils.isNotBlank(soaPtoRESTConversionData.getOASString())); - assertEquals(soaPtoRESTConversionData.getAllSOAPRequestBodies().size(), 4); - assertEquals(soaPtoRESTConversionData.getSoapService(), "CalculatorService"); - assertEquals(soaPtoRESTConversionData.getSoapPort(), "CalculatorPort"); + } - } +} -} \ No newline at end of file diff --git a/src/test/resources/issue-28/failing.wsdl b/src/test/resources/issue-28/failing.wsdl new file mode 100644 index 0000000..76fd15c --- /dev/null +++ b/src/test/resources/issue-28/failing.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/target/test-classes/issue-28/failing.wsdl b/target/test-classes/issue-28/failing.wsdl new file mode 100644 index 0000000..76fd15c --- /dev/null +++ b/target/test-classes/issue-28/failing.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +