Skip to content

Commit

Permalink
Merge pull request #3428 from ChinthakaJ98/samples
Browse files Browse the repository at this point in the history
Fix integration samples by updating folder structure
  • Loading branch information
GDLMadushanka authored Jul 18, 2024
2 parents b060d7e + eaa28ee commit 15bd395
Show file tree
Hide file tree
Showing 81 changed files with 3,295 additions and 168 deletions.
Binary file not shown.
Binary file not shown.
14 changes: 7 additions & 7 deletions samples/APITesting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.microintegrator.projects</groupId>
<groupId>wso2.sampleAPITest</groupId>
<artifactId>APITesting</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
Expand Down Expand Up @@ -104,7 +104,7 @@
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>vscode-car-plugin</artifactId>
<version>5.2.54</version>
<version>5.2.60</version>
<extensions>true</extensions>
<executions>
<execution>
Expand Down Expand Up @@ -148,7 +148,7 @@
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>synapse-unit-test-maven-plugin</artifactId>
<version>5.2.54</version>
<version>5.2.60</version>
<executions>
<execution>
<id>synapse-unit-test</id>
Expand Down Expand Up @@ -211,7 +211,7 @@
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>vscode-car-plugin</artifactId>
<version>5.2.54</version>
<version>5.2.60</version>
<extensions>true</extensions>
<executions>
<execution>
Expand Down Expand Up @@ -247,7 +247,7 @@
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>mi-container-config-mapper</artifactId>
<version>5.2.54</version>
<version>5.2.60</version>
<extensions>true</extensions>
<executions>
<execution>
Expand Down Expand Up @@ -316,7 +316,7 @@
<configuration>
<images>
<image>
<name>${project.artifactId}:${project.version}</name>
<name>api-testing:${project.version}</name>
<build>
<from>${dockerfile.base.image}</from>
<dockerFile>${basedir}/target/tmp_docker/Dockerfile</dockerFile>
Expand All @@ -342,7 +342,7 @@
</profiles>
<properties>
<projectType>integration-project</projectType>
<uuid>c5229856-1781-4fda-ac89-b26d852f2352</uuid>
<uuid>88b2d690-62bb-41c2-80ed-c6849319c55f</uuid>
<!-- <archiveLocation>configure a custom target directory for CAPP</archiveLocation> -->
<keystore.type>JKS</keystore.type>
<keystore.name>wso2carbon.jks</keystore.name>
Expand Down
102 changes: 49 additions & 53 deletions samples/APITesting/src/main/wso2mi/artifacts/apis/RESTApi.xml
Original file line number Diff line number Diff line change
@@ -1,55 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<api context="/api" name="RESTApi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" url-mapping="/unittest">
<inSequence>
<property name="HTTP_SC" scope="transport" type="STRING" value="200"/>
<payloadFactory media-type="text" template-type="default">
<format>GET RESPONSE</format>
<args>
</args>
</payloadFactory>
<respond/>
</inSequence>
<faultSequence>
</faultSequence>
</resource>
<resource methods="POST" url-mapping="/unittest">
<inSequence>
<property name="HTTP_SC" scope="axis2" type="STRING" value="201"/>
<payloadFactory media-type="text" template-type="default">
<format>POST RESPONSE</format>
<args>
</args>
</payloadFactory>
<respond/>
</inSequence>
<faultSequence>
</faultSequence>
</resource>
<resource methods="PUT" url-mapping="/unittest">
<inSequence>
<property name="HTTP_SC" scope="axis2" type="STRING" value="201"/>
<payloadFactory media-type="text" template-type="default">
<format>PUT RESPONSE</format>
<args>
</args>
</payloadFactory>
<respond/>
</inSequence>
<faultSequence>
</faultSequence>
</resource>
<resource methods="DELETE" url-mapping="/unittest">
<inSequence>
<property name="HTTP_SC" scope="transport" type="STRING" value="200"/>
<payloadFactory media-type="text" template-type="default">
<format>DELETE RESPONSE</format>
<args>
</args>
</payloadFactory>
<respond/>
</inSequence>
<faultSequence>
</faultSequence>
</resource>
</api>
<resource methods="GET" url-mapping="/unittest">
<inSequence>
<property name="HTTP_SC" scope="transport" type="STRING" value="200"/>
<payloadFactory media-type="text">
<format>GET RESPONSE</format>
<args/>
</payloadFactory>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
<resource methods="POST" url-mapping="/unittest">
<inSequence>
<property name="HTTP_SC" scope="axis2" type="STRING" value="201"/>
<payloadFactory media-type="text">
<format>POST RESPONSE</format>
<args/>
</payloadFactory>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
<resource methods="PUT" url-mapping="/unittest">
<inSequence>
<property name="HTTP_SC" scope="axis2" type="STRING" value="201"/>
<payloadFactory media-type="text">
<format>PUT RESPONSE</format>
<args/>
</payloadFactory>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
<resource methods="DELETE" url-mapping="/unittest">
<inSequence>
<property name="HTTP_SC" scope="transport" type="STRING" value="200"/>
<payloadFactory media-type="text">
<format>DELETE RESPONSE</format>
<args/>
</payloadFactory>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
key: "RESTApi-1.0.0"
name : "RESTApi"
displayName : "RESTApi"
description: "Sample API"
version: "1.0.0"
serviceUrl: "https://{host}:{port}/api"
definitionType: "OAS3"
securityType: "BASIC"
mutualSSLEnabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
openapi: 3.0.1
info:
title: RESTApi
description: API Definition of RESTApi
version: 1.0.0
servers:
- url: http://localhost:8290/api
paths:
/unittest:
get:
responses:
default:
description: Default response
put:
requestBody:
description: Sample Payload
content:
application/json:
schema:
type: object
properties:
payload:
type: object
required: false
responses:
default:
description: Default response
post:
requestBody:
description: Sample Payload
content:
application/json:
schema:
type: object
properties:
payload:
type: object
required: false
responses:
default:
description: Default response
delete:
responses:
default:
description: Default response
85 changes: 85 additions & 0 deletions samples/APITesting/src/test/wso2mi/ApiTestSuite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<unit-test>
<artifacts>
<test-artifact>
<artifact>src/main/wso2mi/artifacts/apis/RESTApi.xml</artifact>
</test-artifact>
<supportive-artifacts></supportive-artifacts>
<registry-resources></registry-resources>
<connector-resources></connector-resources>
</artifacts>
<test-cases>
<test-case name="TestCaseForResource_GET">
<input>
<request-path>/unittest</request-path>
<request-method>GET</request-method>
</input>
<assertions>
<assertEquals>
<actual>$body</actual>
<expected>GET RESPONSE</expected>
<message>The response payload is not correct!</message>
</assertEquals>
<assertEquals>
<actual>$statusCode</actual>
<expected>200</expected>
<message>The HTTP Status code is not correct!</message>
</assertEquals>
</assertions>
</test-case>
<test-case name="TestCaseForResource_POST">
<input>
<request-path>/unittest</request-path>
<request-method>POST</request-method>
</input>
<assertions>
<assertEquals>
<actual>$body</actual>
<expected>POST RESPONSE</expected>
<message>The response payload is not correct!</message>
</assertEquals>
<assertEquals>
<actual>$statusCode</actual>
<expected>201</expected>
<message>The HTTP Status code is not correct!</message>
</assertEquals>
</assertions>
</test-case>
<test-case name="TestCaseForResource_PUT">
<input>
<request-path>/unittest</request-path>
<request-method>PUT</request-method>
</input>
<assertions>
<assertEquals>
<actual>$body</actual>
<expected>PUT RESPONSE</expected>
<message>The response payload is not correct!</message>
</assertEquals>
<assertEquals>
<actual>$statusCode</actual>
<expected>201</expected>
<message>The HTTP Status code is not correct!</message>
</assertEquals>
</assertions>
</test-case>
<test-case name="TestCaseForResource_DELETE">
<input>
<request-path>/unittest</request-path>
<request-method>DELETE</request-method>
</input>
<assertions>
<assertEquals>
<actual>$body</actual>
<expected>DELETE RESPONSE</expected>
<message>The response payload is not correct!</message>
</assertEquals>
<assertEquals>
<actual>$statusCode</actual>
<expected>200</expected>
<message>The HTTP Status code is not correct!</message>
</assertEquals>
</assertions>
</test-case>
</test-cases>
<mock-services></mock-services>
</unit-test>
9 changes: 8 additions & 1 deletion samples/DatabasePolling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,14 @@
</plugins>
</build>
</profile>
</profiles>
</profiles>
<dependencies>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.0.32</version>
</dependency>
</dependencies>
<properties>
<projectType>integration-project</projectType>
<uuid>2acf9d9c-5705-4d6b-90cf-39beac852b38</uuid>
Expand Down
Loading

0 comments on commit 15bd395

Please sign in to comment.