Skip to content

Instantly share code, notes, and snippets.

View fjunior87's full-sized avatar

Francisco Ribeiro Junior fjunior87

View GitHub Profile
@fjunior87
fjunior87 / SybaseTest.dbs.xml
Last active October 28, 2019 17:59
Sample WSO2 Dataservices with Sybase
<data name="SybaseTest" transports="http https local">
<config enableOData="false" id="Sybase">
<property name="carbon_datasource_name">Sybase</property>
</config>
<query id="Query_All_Products" useConfig="Sybase">
<sql>Select ID,name ,description, price from testdb.dbo.product</sql>
<result element="Products" rowName="Product">
<element column="id" name="id" xsdType="string"/>
<element column="name" name="name" xsdType="string"/>
<element column="description" name="description" xsdType="string"/>
@fjunior87
fjunior87 / CustomTokenGenerator.java
Last active October 9, 2019 07:55
API Manager Custom JWT Generator
package org.wso2.carbon.test;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.impl.APIConstants;
import org.wso2.carbon.apimgt.keymgt.service.TokenValidationContext;
@fjunior87
fjunior87 / UnitTestExample_Validation_Sequence.xml
Created May 20, 2019 00:17
WSo2 Unit Test Example Calculator Validation Sequence
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="UnitTestExample_Validation_Sequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property description="Get Number1 Value" expression="$ctx:uri.var.number1" name="number1_value" scope="default" type="STRING"/>
<property description="Get Number2 value" expression="$ctx:uri.var.number2" name="number2_value" scope="default" type="STRING"/>
<property name="VALIDATION_RESULT" scope="default" type="STRING" value="SUCCESS"/>
<filter regex="NaN" source="string(number($ctx:number1_value))">
<then>
<property name="VALIDATION_RESULT" scope="default" type="STRING" value="FAILURE"/>
<property name="VAL_ERROR_MESSAGE" scope="default" type="STRING" value="number1 parameter is not a number"/>
</then>
@fjunior87
fjunior87 / CalculatorAPI.xml
Created May 19, 2019 23:45
WSO2 Calculator API for Unit Text Example
<?xml version="1.0" encoding="UTF-8"?>
<api context="/calculator" name="CalculatorAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/add/{number1}/{number2}">
<inSequence>
<!-- Build Request -->
<sequence description="Validating the input data" key="UnitTestExample_Validation_Sequence"/>
<filter regex="FAILURE" source="get-property('VALIDATION_RESULT')">
<then>
<sequence key="UnitTestExample_BuildFailureResponse_Sequence"/>
</then>
@fjunior87
fjunior87 / swagger.json
Last active February 24, 2018 15:52
Swagger definition file used in the blog post
{
"swagger": "2.0",
"info" : {
"title": "ScoresAPI",
"description": "API to manage Test Scores",
"version": "v1",
"basePath": "/scores"
},
"paths": {
"/scores/{testId}": {
@fjunior87
fjunior87 / my-datasources.xml
Last active February 4, 2018 17:17
Carbon WSO2 Datasource config file
<datasources-configuration>
<datasources>
<datasource>
<name>MySQL</name>
<description>My DataSource</description>
<jndiConfig>
<name>jdbc/MySQL</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
@fjunior87
fjunior87 / create_datasource_admin_service.xml
Created February 4, 2018 01:24
SOAP Request to add a new datasource to WSO2
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://services.core.ndatasource.carbon.wso2.org/xsd" xmlns:xsd2="http://core.ndatasource.carbon.wso2.org/xsd">
<soap:Header/>
<soap:Body>
<xsd:addDataSource>
<!--Optional:-->
<xsd:dsmInfo>
<!--Optional:-->
<xsd1:definition>
<!--Optional:-->
<xsd1:dsXMLConfiguration>
@fjunior87
fjunior87 / ImageAPI.xml
Last active October 23, 2019 16:27
Image API Creation
<?xml version="1.0" encoding="UTF-8"?>
<api context="/image" name="ImageAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/add">
<inSequence>
<log level="full" />
<!--
1. Reading the JSON attributes from the request payload;
-->
<property expression="json-eval($.fileName)" name="fileName" scope="default" type="STRING"/>
<property expression="json-eval($.fileContent)" name="fileContent" scope="default" type="STRING"/>
@fjunior87
fjunior87 / WSo2 Download
Last active April 24, 2023 07:59
WGET Command Download WSO2 Products
API MGR
wget --user-agent="testuser" --referer="http://connect.wso2.com/wso2/getform/reg/new_product_download" http://dist.wso2.org/products/api-manager/2.1.0/wso2am-2.1.0.zip
API-MGR-ANALYTICS
wget --user-agent="testuser" --referer="http://connect.wso2.com/wso2/getform/reg/new_product_download" http://dist.wso2.org/products/api-manager/2.1.0/wso2am-analytics-2.1.0.zip
ESB
wget --user-agent="testuser" --referer="http://connect.wso2.com/wso2/getform/reg/new_product_download" http://dist.wso2.org/products/enterprise-integrator/6.1.1/wso2ei-6.1.1.zip
@fjunior87
fjunior87 / AQProxyService.xml
Created April 11, 2017 04:32
Sample Proxy Service that consumes messages from OracleAQ Queue
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="AQProxyService"
transports="oracleaq"
startOnLoad="true">
<description/>
<target>
<inSequence>
<log level="full"/>
</inSequence>