Skip to content

Instantly share code, notes, and snippets.

@trevershick
trevershick / RailincDeploymentManager.java
Created July 2, 2011 20:06
Fixes a deployment but in Activiti 3.3-3.6 whereby the deployer looks at the 'oldest' instead of the 'latest' deployment and compares the bar 'to be deployed'.
package com.railinc.activiti.sso;
import java.util.List;
import org.activiti.engine.impl.persistence.entity.DeploymentEntity;
import org.activiti.engine.repository.Deployment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RailincDeploymentManager extends
@trevershick
trevershick / StatementExecutingDataSource.java
Created July 2, 2011 20:35
DataSource wrapper that executes statements on getConnection to fix an issue with Activiti not supporting fully qualified table names.
package com.railinc.spring.jdbc;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.sql.DataSource;
@trevershick
trevershick / h2_spring-test-database-config.xml
Created July 2, 2011 20:56
A simple gist that shows how to switch test resource folders based on a profile which allows switching between h2 and oracle for unit and functional tests.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">
package com.railinc.sso.zuul.legacy;
// imports removed
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("com.netegrity.policyserver.smapi.ActiveExpressionContext")
public class GetAccessCookieActiveExpressionTest {
public ActiveExpressionContext build_nice_ae_context(UserContext uc, APIContext ac) {
EquipmentIdRange = jook.eqp.EquipmentIdRange;
EquipmentParser = jook.eqp.EquipmentParser;
ExampleTest = TestCase("ExampleTest");
ExampleTest.prototype.testAdjacent_T1 = function() {
var r1 = new EquipmentIdRange("BNSF",1,10);
var r2 = new EquipmentIdRange("BNSF",11,12);
var r3 = new EquipmentIdRange("BNSF", 20,21);
assertTrue(r1.isAdjacentTo(r2));
@trevershick
trevershick / maven3cobertura.gist
Created December 20, 2011 13:53
Maven 3 Cobertura Plugin Log File
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
Results :
Tests run: 66, Failures: 0, Errors: 0, Skipped: 0
Cobertura: Error reading file E:\hudson\workspace\tankcarcoc-dev\source\core\target\cobertura\cobertura.ser: null
Cobertura: Loaded information on 54 classes.
Cobertura: Coverage data file E:\hudson\workspace\tankcarcoc-dev\source\core\target\cobertura\cobertura.ser either does not exist or is not readable. Creating a new data file.
Cobertura: Saved information on 1 classes.
sdtxs01@sdtxs01-MS-7366:~/Dropbox/Strayer/CIS328/chapter_9_1$ src/chapter_9_1
Please enter the name of the file
COPYING
Results for COPYING
===============================================
Characters :35148
Words :5644
Lines :675
@trevershick
trevershick / search.groovy
Created March 30, 2012 02:40
A simple groovy script that will allow a command line search of search.maven.org
#!/usr/bin/env groovy
import groovy.json.*
/**
* calculate the maximum value returned from the closure
* for the given collection.
*/
def maxLength(collection, closure) {
collection.inject(0) { acc,val -> Math.max(acc, closure(val)) }
@trevershick
trevershick / .muttrc
Created April 12, 2012 12:16
Setting up Mutt and Apache James
set smtp_url="smtp://localhost:25"
set pop_host="pop://localhost:110"
set pop_user=me
set pop_pass=me
on run {input, parameters}
set thePrefix to ""
set defectTitle to "Default Defect Title"
set theIcon to note
repeat
display dialog thePrefix & "Please enter a defect title for " & input & " : " default answer defectTitle with icon theIcon