Skip to content

Instantly share code, notes, and snippets.

@mismatch
mismatch / pom.xml
Created July 12, 2013 18:22
Wiser vs Dumbster
<dependency>
<groupId>org.subethamail</groupId>
<artifactId>subethasmtp</artifactId>
<version>3.1.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>dumbster</groupId>
<artifactId>dumbster</artifactId>
@mismatch
mismatch / EmailerViaWiserTest.java
Created July 12, 2013 18:24
Wiser vs Dumbster. Test 1
public class EmailerViaWiserTest {
private Wiser wiser;
private Emailer emailer;
@Before
public void setUp() throws Exception {
emailer = new Emailer(config);
wiser = new Wiser(smtpPort);
@mismatch
mismatch / EmailerViaDumbsterTest.java
Created July 12, 2013 18:26
Wiser vs Dumbster. Test 2
public class EmailerViaDumbsterTest extends EmailerTest {
private SimpleSmtpServer dumbster;
private Emailer emailer;
@Before
public void setUp() throws Exception {
emailer = new Emailer(config);
dumbster = SimpleSmtpServer.start(smtpPort);
@mismatch
mismatch / testrest
Created July 21, 2013 09:48
Simple shell script to run Java app
#!/bin/sh
java -server -jar /usr/local/bin/dropwizard-test-rest.jar server /usr/local/etc/RestServiceConfig.yml &
@mismatch
mismatch / testrest.service
Created July 21, 2013 09:50
systemd service file for java app
[Unit]
Description=Test REST Service
After=network.target
[Service]
Type=forking
MemoryLimit=512M
ExecStart=/usr/lib/systemd/scripts/testrest
[Install]
@mismatch
mismatch / pom.xml
Last active December 20, 2015 01:19
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-3</version>
<executions>
<execution>
<id>generate-rpm</id>
<goals>
<goal>rpm</goal>
</goals>
#!/bin/sh
systemctl enable testrest.service
appName.dbOne.datasource.driverClassName=org.postgresql.Driver
appName.dbOne.datasource.url=jdbc:postgresql://localhost/dbOne
appName.dbOne.datasource.username=test
appName.dbOne.datasource.password=test
appName.dbTwo.datasource.driverClassName=org.postgresql.Driver
appName.dbTwo.datasource.url=jdbc:postgresql://localhost/dbTwo
appName.dbTwo.datasource.username=test
appName.dbTwo.datasource.password=test
@mismatch
mismatch / DatabasesConfig.java
Created August 10, 2014 06:41
Spring Boot. Multiple datasources configuration example
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@mismatch
mismatch / JpaRepositoriesConfig.java
Created August 10, 2014 06:45
Spring Boot. Multiple DB repositories configuration example
import java.util.Map;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan.Filter;