Skip to content

Instantly share code, notes, and snippets.

@cjmamo
cjmamo / DynamicPortJunit4TestCase.java
Created May 28, 2012 16:47
Revisiting Dynamic Ports in Mule 3
import org.junit.Rule;
import org.junit.Test;
import org.mule.api.MuleMessage;
import org.mule.api.client.MuleClient;
import org.mule.tck.junit4.FunctionalTestCase;
import org.mule.tck.junit4.rule.DynamicPort;
import org.mule.transport.NullPayload;
import static org.junit.Assert.*;
@cjmamo
cjmamo / mule-config-inbound-multipart.xml
Created June 16, 2012 12:37
Mule meet ZeroMQ. ZeroMQ meet Mule.
<flow name="MultipartInboundFlow">
<zeromq:inbound-endpoint address="tcp://*:9090" socket-operation="bind"
exchange-pattern="pull"/>
<expression-transformer evaluator="groovy" expression="payload[3]"/>
...
</flow>
@cjmamo
cjmamo / index.html
Created July 6, 2012 14:26
A WebSocket Cordova plugin for Android
...
<script type="text/javascript" src="js/websocket.js"></script>
...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ricston</groupId>
<artifactId>restmoduleexample</artifactId>
<packaging>mule</packaging>
<name>Mule Restmoduleexample Application</name>
@cjmamo
cjmamo / driver.rb
Created July 31, 2012 09:52
Sharing an FTP service between un-clustered Mule instances
...
class MuleFtpProxyDriver
@@hidden_files = Hash.new
@@mutex = Mutex.new
def initialize(ip_address, port)
@ip_address = ip_address
@port = port
@id = SecureRandom.uuid
@cjmamo
cjmamo / gist:3330498
Last active October 8, 2015 12:17
Building ZeroMQ for Android
ctx.cpp:26:15: fatal error: new: No such file or directory
compilation terminated.
make[3]: *** [libzmq_la-ctx.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [/opt/android-jzmq/output-arm/lib/libzmq.a] Error 2
@cjmamo
cjmamo / CalculatorServiceTestCase.java
Created October 18, 2012 21:48
Testing Web Services from JUnit using SoapUI
...
public class CalculatorServiceTestCase {
@Test
public void testCalculatorService() throws Exception {
SoapUITestCaseRunner testCaseRunner = new SoapUITestCaseRunner();
SoapUIMockServiceRunner mockServiceRunner = new SoapUIMockServiceRunner();
testCaseRunner.setProjectFile("src/test/resources/calculator-soapui-project.xml");
...
@Test
public void testMapping() throws Exception {
// Hibernate configuration
Map<String, String> hibernateProperties = new HashMap<String, String>();
hibernateProperties.put("hibernate.dialect", "org.hibernate.dialect.DerbyTenSevenDialect");
hibernateProperties.put("hibernate.connection.driver_class", "org.apache.derby.jdbc.EmbeddedDriver");
hibernateProperties.put("hibernate.connection.url", "jdbc:derby:target/test-database/database;create=true");
hibernateProperties.put("hibernate.hbm2ddl.auto", "create");
@cjmamo
cjmamo / HelloWorldImpl(1).java
Last active December 9, 2015 17:49
Demystifying Apache CXF: A Hello World App
package org.opensourcesoftwareandme;
public class HelloWorldImpl{
public String sayHi(String text) {
return "Hello " + text;
}
}
package org.opensourcesoftwareandme;
import javax.ws.rs.core.Application;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class HelloWorldApp extends Application {
public Set<Class<?>> getClasses() {