Skip to content

Instantly share code, notes, and snippets.

View hasithaa's full-sized avatar
🏠
Working from home

Hasitha Aravinda hasithaa

🏠
Working from home
View GitHub Profile
@hasithaa
hasithaa / record_visitor.bal
Last active April 24, 2023 10:57
Record Visitor Pattern
import ballerina/io;
// Type Nodes
type Node record {
string kind;
string value;
};
type NodeA record {
@hasithaa
hasithaa / visitor_pattern.bal
Created April 24, 2023 05:15
Ballerina Object Visitor Pattern
import ballerina/io;
public type Element object {
public function accept(Visitor visitor);
};
public class ConcreteElementA {
*Element;
public function accept(Visitor visitor) {
@hasithaa
hasithaa / README.md
Last active December 19, 2019 07:56
A script to test Ballerina installers on windows.

How to run

  1. Install Ballerina using windows installer.
  2. Open cmd or powershell.
  3. Clone this scripts. git clone https://gist.github.com/e606661be03d7045be973868b9e9ed67.git wintests.
  4. cd to wintests.
  5. run test command.
package org.wso2.bpmn.helloworld.v2;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
/**
* Hello World Service Task - Version 2.
*/
public class HelloWorldServiceTaskV2 implements JavaDelegate {
package org.wso2.bpmn.helloworld.v1;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
/**
* Hello World Service Task- V1.
*/
public class HelloWorldServiceTaskV1 implements JavaDelegate {
@Override
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.deployer.bpel.carbon.wso2.org" xmlns:xsd="http://types.services.deployer.bpel.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<ser:uploadService>
<ser:fileItems>
<!--Optional:-->
<xsd:dataHandler>UEsDBAoAAAAIAEyOIkRwFzFB2gQAAKIUAAAZAAAAQ2xpZW50LXNvYXB1aS1wcm9qZWN0LnhtbNVY
bW/bNhD+3l+h6btNO0WHQLAdpGmKDliTok3XAkUxMNLZ4SaTKknFMYr9992JFCUmTmx32YZ8MGCS
c2RsUEsBAhQDCgAAAAgATI4iRBvrzEtPAQAAUgQAAAoAAAAAAAAAAAAAAKSBWBMAAGRlcGxveS54
bWxQSwUGAAAAAAYABgB3AQAAzxQAAAAA</xsd:dataHandler>
<?xml version="1.0" encoding="UTF-8"?>
<htd:humanInteractions
xmlns:htd="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/200803"
xmlns:htt="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/types/200803"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns=”http://www.example.com/simpleTask” targetNamespace="http://www.example.com/simpleTask"
xsi:schemaLocation="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/200803
http://docs.oasis-open.org/bpel4people/ws-humantask.xsd
http://docs.oasis-open.org/ns/bpel4people/ws-humantask/types/200803
http://docs.oasis-open.org/bpel4people/ws-humantask-types.xsd">
<api xmlns="http://ws.apache.org/ns/synapse" name="Transform" context="/Transform">
<resource methods="POST">
<inSequence>
<property name="messageType" value="application/json" scope="axis2"></property>
<log level="custom">
<property name="Status" expression="json-eval($.StockQuotes.Stock)"></property>
</log>
<filter source="json-eval($.StockQuotes.Stock.Symbol)" regex="null">
<then>
<payloadFactory media-type="json">
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EchoUTBasicProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="custom" separator="," description="Log">
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EchoUTDynamicProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>