Skip to content

Instantly share code, notes, and snippets.

@mcantrell
mcantrell / launchd.conf
Last active December 14, 2015 18:29
Mac Laptop Configuration
# Set environment variables here so they are available globally to all apps
# (and Terminal), including those launched via Spotlight.
#
# After editing this file run the following command from the terminal to update
# environment variables globally without needing to reboot.
# NOTE: You will still need to restart the relevant application (including
# Terminal) to pick up the changes!
# grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl
#
# See http://www.digitaledgesw.com/node/31
@mcantrell
mcantrell / tomcat.sh
Last active December 15, 2015 08:39
Tomcat init.d script slightly tweaked from here: https://gist.github.com/valotas/1000094
#!/bin/bash
#
# tomcat7 This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
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;
@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">
@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
<?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 / 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
@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 / 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 / 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