Hi Rajith,

Please find the attached svn diff for dss 3.2.2, including Integration
tests for JIRA issues [1].

[1] https://wso2.org/jira/browse/DS-1058

On Wed, Jun 24, 2015 at 10:30 AM, Niranjan Karunanandham <[email protected]>
wrote:

> Hi Madhawa,
>
> Committed the diff to Kernel 4.2.0 patch0012 and the svn revision #
> is 212928.
>
> Regards,
> Nira
>
> On Wed, Jun 24, 2015 at 9:36 AM, Niranjan Karunanandham <[email protected]
> > wrote:
>
>> Hi Madhawa,
>>
>> I will look into patch for kernel 4.2.0. Please note that patch0011 has
>> been closed and I will be committing your patch to patch0012.
>>
>> Please let me know when you have sent the PR for the integration test for
>> Kernel 4.4.0 (if it is possible).
>>
>> Regards,
>> Nira
>>
>> On Tue, Jun 23, 2015 at 10:12 AM, Madhawa Gunasekara <[email protected]>
>> wrote:
>>
>>> Please find the pull request for this issue [1]. Can we write the
>>> integration tests for this issue in kernel ? I have already wrote
>>> integration tests for this issue in dss.
>>>
>>> [1] https://github.com/wso2/wso2-axis2/pull/52
>>>
>>> Thanks,
>>> Madhawa
>>>
>>> On Tue, Jun 23, 2015 at 9:15 AM, Madhawa Gunasekara <[email protected]>
>>> wrote:
>>>
>>>> This svn diff should apply to kernel patch0011.
>>>>
>>>> Thanks,
>>>> Madhawa
>>>>
>>>> On Mon, Jun 22, 2015 at 6:43 PM, Madhawa Gunasekara <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Devs,
>>>>>
>>>>> Please find the attached patch for the jira issue [1].
>>>>>
>>>>> [1] https://wso2.org/jira/browse/CARBON-15280
>>>>>
>>>>> Thanks,
>>>>> Madhawa.
>>>>> --
>>>>> *Madhawa Gunasekara*
>>>>> Software Engineer
>>>>> WSO2 Inc.; http://wso2.com
>>>>> lean.enterprise.middleware
>>>>>
>>>>> mobile: +94 719411002 <+94+719411002>
>>>>> blog: *http://madhawa-gunasekara.blogspot.com
>>>>> <http://madhawa-gunasekara.blogspot.com>*
>>>>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>>>>> <http://lk.linkedin.com/in/mgunasekara>*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Madhawa Gunasekara*
>>>> Software Engineer
>>>> WSO2 Inc.; http://wso2.com
>>>> lean.enterprise.middleware
>>>>
>>>> mobile: +94 719411002 <+94+719411002>
>>>> blog: *http://madhawa-gunasekara.blogspot.com
>>>> <http://madhawa-gunasekara.blogspot.com>*
>>>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>>>> <http://lk.linkedin.com/in/mgunasekara>*
>>>>
>>>
>>>
>>>
>>> --
>>> *Madhawa Gunasekara*
>>> Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: +94 719411002 <+94+719411002>
>>> blog: *http://madhawa-gunasekara.blogspot.com
>>> <http://madhawa-gunasekara.blogspot.com>*
>>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>>> <http://lk.linkedin.com/in/mgunasekara>*
>>>
>>
>>
>>
>> --
>>
>> *Niranjan Karunanandham*
>> Senior Software Engineer - WSO2 Inc.
>> WSO2 Inc.: http://www.wso2.com
>>
>
>
>
> --
>
> *Niranjan Karunanandham*
> Senior Software Engineer - WSO2 Inc.
> WSO2 Inc.: http://www.wso2.com
>



-- 
*Madhawa Gunasekara*
Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94 719411002 <+94+719411002>
blog: *http://madhawa-gunasekara.blogspot.com
<http://madhawa-gunasekara.blogspot.com>*
linkedin: *http://lk.linkedin.com/in/mgunasekara
<http://lk.linkedin.com/in/mgunasekara>*
Index: modules/integration/tests-patches/src/test/java/org/wso2/carbon/dss/operation/test/CARBON1391RepeatServiceNameInURLTest.java
===================================================================
--- modules/integration/tests-patches/src/test/java/org/wso2/carbon/dss/operation/test/CARBON1391RepeatServiceNameInURLTest.java	(revision 0)
+++ modules/integration/tests-patches/src/test/java/org/wso2/carbon/dss/operation/test/CARBON1391RepeatServiceNameInURLTest.java	(working copy)
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed 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.
+ */
+
+package org.wso2.carbon.dss.operation.test;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.wso2.carbon.automation.core.ProductConstant;
+import org.wso2.carbon.dss.DSSIntegrationTest;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This test is to verify the fix for https://wso2.org/jira/browse/DS-1058
+ * Retrieving JSON objects in all All request methods
+ *
+ * Carbon Kernel Patch0011 is required
+ */
+public class CARBON1391RepeatServiceNameInURLTest extends DSSIntegrationTest {
+    private final String serviceName = "H2ServiceNameTest";
+    private String serviceEndPoint;
+
+    private static final Log log = LogFactory.getLog(CARBON1391RepeatServiceNameInURLTest.class);
+
+
+    @BeforeClass(alwaysRun = true)
+    public void serviceDeployment() throws Exception {
+        super.init(0);
+        List<File> sqlFileLis = new ArrayList<File>();
+        sqlFileLis.add(selectSqlFile("Offices.sql"));
+        deployService(serviceName, createArtifact(
+                ProductConstant.SYSTEM_TEST_RESOURCE_LOCATION + "artifacts" + File.separator + "DSS" +
+                File.separator + "samples" + File.separator + "dbs" + File.separator + "rdbms" + File.separator +
+                "H2ServiceNameTest.dbs", sqlFileLis));
+        serviceEndPoint = getServiceUrl(serviceName) + "/";
+
+    }
+
+    @AfterClass(alwaysRun = true) public void destroy() throws Exception {
+        deleteService(serviceName);
+        cleanup();
+    }
+
+    @Test(groups = "wso2.dss", description = "Invoking a GET Request with repeating the SerivceName in URL")
+    public void performJsonPutMethodTest() {
+        String endpoint = serviceEndPoint + "insert/OfficeCode/Colombo/telephone/address1/address2/H2SimpleJsonTes/LK/postalCode/Western";
+        String response = getHttpResponse(endpoint, "GET", null);
+        Assert.assertTrue(response.contains("SUCCESSFUL"), "GET method failed with repeating the SerivceName in URL");
+    }
+
+    private String getHttpResponse(String endpoint, String requestMethod, String payload) {
+        StringBuilder jsonString = new StringBuilder();
+        BufferedReader br= null;
+        try {
+            String line;
+            URL url = new URL(endpoint);
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            connection.setDoInput(true);
+            connection.setDoOutput(true);
+            connection.setRequestProperty("charset", "UTF-8");
+            connection.setReadTimeout(10000);
+            connection.setRequestMethod(requestMethod);
+            connection.setRequestProperty("Accept", "application/json");
+            if (null != payload) {
+                connection.setRequestProperty("Content-Type", "application/json");
+                connection.setRequestProperty("Content-Length", String.valueOf(payload.length()));
+                OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+                writer.write(payload);
+                writer.close();
+            }
+            br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+            while (null != (line = br.readLine())) {
+                jsonString.append(line);
+            }
+            connection.disconnect();
+        } catch (IOException e) {
+            log.error("IO exception occurred, " + e.getMessage());
+        } finally {
+            try {
+                if (null != br) {
+                    br.close();
+                }
+            } catch (IOException e) {
+                log.error("IO exception occurred while closing the reader, " + e.getMessage());
+            }
+        }
+        return jsonString.toString();
+    }
+}
Index: modules/integration/tests-patches/src/test/resources/artifacts/DSS/samples/dbs/rdbms/H2ServiceNameTest.dbs
===================================================================
--- modules/integration/tests-patches/src/test/resources/artifacts/DSS/samples/dbs/rdbms/H2ServiceNameTest.dbs	(revision 0)
+++ modules/integration/tests-patches/src/test/resources/artifacts/DSS/samples/dbs/rdbms/H2ServiceNameTest.dbs	(working copy)
@@ -0,0 +1,58 @@
+<!--
+  ~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+  ~
+  ~ Licensed 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.
+  -->
+
+<data name="H2ServiceNameTest" transports="http https local">
+    <config id="default">
+        <property name="org.wso2.ws.dataservice.driver">org.h2.Driver</property>
+        <property name="org.wso2.ws.dataservice.protocol">jdbc:h2:file:./samples/database/DATA_SERV_SAMP</property>
+        <property name="org.wso2.ws.dataservice.user">wso2ds</property>
+        <property name="org.wso2.ws.dataservice.password">wso2ds</property>
+        <property name="org.wso2.ws.dataservice.minpoolsize">1</property>
+        <property name="org.wso2.ws.dataservice.maxpoolsize">10</property>
+        <property name="org.wso2.ws.dataservice.validation_query"/>
+    </config>
+
+    <query id="insertQuery" useConfig="default">
+        <sql>insert into Offices values (:officeCode,:city, :telephone,:address1, :address2, :state,
+            :country,:postalcode,:territory);
+        </sql>
+        <param name="officeCode" sqlType="STRING"/>
+        <param name="city" sqlType="STRING"/>
+        <param name="telephone" sqlType="STRING"/>
+        <param name="address1" sqlType="STRING"/>
+        <param name="address2" sqlType="STRING"/>
+        <param name="state" sqlType="STRING"/>
+        <param name="country" sqlType="STRING"/>
+        <param name="postalcode" sqlType="STRING"/>
+        <param name="territory" sqlType="STRING"/>
+    </query>
+    <resource method="GET"
+              path="/insert/{officeCode}/{city}/{telephone}/{address1}/{address2}/{state}/{country}/{postalcode}/{territory}"
+              returnRequestStatus="true">
+        <call-query href="insertQuery">
+            <with-param name="officeCode" query-param="officeCode"/>
+            <with-param name="city" query-param="city"/>
+            <with-param name="telephone" query-param="telephone"/>
+            <with-param name="address1" query-param="address1"/>
+            <with-param name="address2" query-param="address2"/>
+            <with-param name="state" query-param="state"/>
+            <with-param name="country" query-param="country"/>
+            <with-param name="postalcode" query-param="postalcode"/>
+            <with-param name="territory" query-param="territory"/>
+        </call-query>
+    </resource>
+
+</data>
\ No newline at end of file
Index: modules/integration/tests-patches/src/test/resources/testng.xml
===================================================================
--- modules/integration/tests-patches/src/test/resources/testng.xml	(revision 33030)
+++ modules/integration/tests-patches/src/test/resources/testng.xml	(working copy)
@@ -23,4 +23,10 @@
             <class name="org.wso2.carbon.dss.json.test.CARBON1336JsonFormatterGsonTenantmodeTest"/>
         </classes>
     </test>-->
+
+<!--    <test name="Service-Test" preserve-order="true" verbose="2" parallel="false">
+        <classes>
+            <class name="org.wso2.carbon.dss.operation.test.CARBON1391RepeatServiceNameInURLTest"/>
+        </classes>
+    </test>-->
 </suite>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to