Skip to content

Instantly share code, notes, and snippets.

@mcantrell
mcantrell / zuulDiff.sh
Created February 18, 2014 21:13
Compare two zuul environments
!/bin/bash
# Compare two zuul environments
# adapted from https://gist.github.com/thetristan/6169113
NAME=`basename $0`
ZUUL_BASE_URL="http://127.0.0.1:8080/zuul/settings"
ZUUL_LEFT_URL="$ZUUL_BASE_URL/$2/$1.properties"
ZUUL_RIGHT_URL="$ZUUL_BASE_URL/$3/$1.properties"
COMMAND="diff <(curl -is '$ZUUL_LEFT_URL') <(curl -is '$ZUUL_RIGHT_URL')"
@mcantrell
mcantrell / mule-config.xml
Last active December 20, 2015 13:49
Example swarm agent config
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
">
<spring:beans>
<spring:import resource="classpath:swarm-agent.xml"/>
@mcantrell
mcantrell / wget-jdk.sh
Created July 28, 2013 19:08
wget oracle jdk
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" $1
@mcantrell
mcantrell / mule-config.xml
Created July 23, 2013 20:40
Stop/Start mule flow via web service
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
">
<flow name="StartWidgetFlow">
<inbound-endpoint ref="startWidgetEndpoint"/>
<logger level="INFO" category="StartWidgetFlow" message="Starting app Widget Services..."/>
@mcantrell
mcantrell / context.xml
Created July 12, 2013 13:26
Spring string from a text file
<bean id="userByUserNameQuery" class="org.apache.commons.io.IOUtils" factory-method="toString">
<constructor-arg type="java.io.InputStream">
<bean class="java.io.FileInputStream" destroy-method="close">
<constructor-arg type="java.io.File" value="classpath:/jdbc/userByName.sql"/>
</bean>
</constructor-arg>
</bean>
@mcantrell
mcantrell / EmbeddedDatabaseServerFunctionalTest.groovy
Last active December 8, 2020 10:48
Blog Post: Mocking JDBC Endpoints in Mule Function Tests
package com.confluex.cookbook.jdbc
import org.junit.BeforeClass
import org.junit.Test
import org.mule.tck.junit4.FunctionalTestCase
class EmbeddedDatabaseServerFunctionalTest extends FunctionalTestCase {
@BeforeClass
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc"
xmlns:imaps="http://www.mulesoft.org/schema/mule/imaps" xmlns:context="http://www.springframework.org/schema/context"
xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/imaps http://www.mulesoft.org/schema/mule/imaps/current/mule-imaps.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
@mcantrell
mcantrell / HttpMockFunctionalTest.groovy
Last active December 17, 2015 00:59
Blog Post: Mocking HTTP Endpoints in Mule Functional Tests These are simplified examples of code for embedding within the following Confluex blog post: http://www.confluex.com/blog/mocking-http-endpoints-in-mule-functional-tests/
package com.confluex.mule.test.functional
import com.confluex.mule.test.http.MockHttpRequestHandler
import com.confluex.mule.test.http.expectations.HeaderExpectation
import com.confluex.mule.test.http.expectations.MediaTypeExpectation
import com.confluex.mule.test.http.expectations.MethodExpectation
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.mortbay.jetty.Server
@mcantrell
mcantrell / jmx-admin.xml
Created April 22, 2013 18:39
JMX Manager for Mule
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:management="http://www.mulesoft.org/schema/mule/management"
xmlns:spring="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/current/mule-management.xsd
">
<management:jmx-default-config port="1098" registerMx4jAdapter="true">
package com.confluex.training.hello;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import junit.framework.Assert;
import org.junit.Test;
import org.mule.DefaultMuleMessage;
import org.mule.api.MuleException;
import org.mule.api.MuleMessage;
import org.mule.api.client.LocalMuleClient;
import org.mule.tck.junit4.FunctionalTestCase;