Skip to content
This repository was archived by the owner on Jul 10, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
01b642c
Add Rejects and Whitelists
wienczny Jul 31, 2014
0869d3a
Remove unused import
wienczny Jul 31, 2014
1844947
Fix reject list url
wienczny Jul 31, 2014
a3fa77e
Add Tests for RejectsService and WhitelistsService
wienczny Aug 6, 2014
f8ef56a
Add MessageServiceTest
wienczny Aug 6, 2014
3b4ad40
Fix environment variable name for second try
wienczny Aug 6, 2014
32f290c
Fix url form MessageService.sendTemplate
wienczny Aug 6, 2014
d1c39a2
Update Tests
wienczny Aug 7, 2014
f31e996
Fix apiKey resolving. Properties were missing
wienczny Aug 12, 2014
eee42a6
Fix responses with List.class
wienczny Aug 19, 2014
298cb52
Add Rejects and Whitelists
wienczny Jul 31, 2014
39ba82e
Remove unused import
wienczny Jul 31, 2014
5f0a0ee
Fix reject list url
wienczny Jul 31, 2014
c382994
Add Tests for RejectsService and WhitelistsService
wienczny Aug 6, 2014
34d0e17
Add MessageServiceTest
wienczny Aug 6, 2014
5cca8dc
Fix environment variable name for second try
wienczny Aug 6, 2014
7232282
Fix url form MessageService.sendTemplate
wienczny Aug 6, 2014
dbbb80c
Update Tests
wienczny Aug 7, 2014
dad1345
Fix apiKey resolving. Properties were missing
wienczny Aug 12, 2014
45d2bc4
Fix responses with List.class
wienczny Aug 19, 2014
57c09cb
Merge branch 'master' of https://github.com/wienczny/mandrill-java-ap…
wienczny Dec 17, 2014
ecdeae5
Fix pom.xml
wienczny Dec 17, 2014
dbd8049
Use variables instead of values in pom.xml
wienczny Dec 17, 2014
fb4d816
Add ServiceFactory that is responsible for storing configuration valu…
wienczny Dec 20, 2014
c04f6ab
Fix failing tests
wienczny Dec 20, 2014
19a8a62
Rename ServiceFactory to MandrillServiceFactory to be less ambiguous …
wienczny Dec 20, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ target
.classpath
.project
*.iml
.idea
.idea
atlassian-ide-plugin.xml
177 changes: 139 additions & 38 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,48 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.maven-compiler}</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${version.maven-source}</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -61,24 +94,51 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<systemProperties>
<property>
<name>mandrill.apikey</name>
<value>${mandrill.apikey}</value>
</property>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -110,59 +170,100 @@

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.maven-compiler>3.1</version.maven-compiler>
<version.maven-source>2.2.1</version.maven-source>
<version.maven-javadoc>2.9.1</version.maven-javadoc>
<version.jackson>2.0.2</version.jackson>
<version.maven-source>2.3</version.maven-source>
<version.spock>0.6-groovy-1.8</version.spock>
<version.httpclient>4.2.1</version.httpclient>
<version.slf4j>1.6.4</version.slf4j>
<version.jersey>2.11</version.jersey>
<version.slf4j>1.7.7</version.slf4j>
<version.junit>4.11</version.junit>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${version.jackson}</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${version.spock}</version>
<scope>test</scope>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${version.jersey}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${version.httpclient}</version>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${version.jersey}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

<reporting>
<plugins>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.12</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.3</version>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</reporting>

</project>
23 changes: 11 additions & 12 deletions src/main/java/io/sprucehill/mandrill/data/error/Error.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,31 @@ protected static abstract class Init<T extends Init<T, U>, U extends Error> {

protected U object;

protected Init(U object) {
protected Init(final U object) {
this.object = object;
}

protected abstract T self();


protected void postInit() {
}

protected void preBuild() {
}

public T withStatus(String status) {
public T withStatus(final String status) {
object.status = status;
return self();
}

public T withCode(Integer code) {
protected abstract T self();

public T withCode(final Integer code) {
object.code = code;
return self();
}

public T withName(String name) {
public T withName(final String name) {
object.name = name;
return self();
}

public T withMessage(String message) {
public T withMessage(final String message) {
object.message = message;
return self();
}
Expand All @@ -105,9 +101,12 @@ public U build() {
preBuild();
return object;
}

protected void preBuild() {
}
}

public static class Builder extends Init<Builder,Error> {
public static class Builder extends Init<Builder, Error> {

public Builder() {
super(new Error());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public class MessageError extends Error {

protected static abstract class Init<T extends Init<T,U>, U extends MessageError> extends Error.Init<T,U> {
protected static abstract class Init<T extends Init<T, U>, U extends MessageError> extends Error.Init<T, U> {

private static final Set<String> names;

Expand All @@ -37,7 +37,7 @@ protected static abstract class Init<T extends Init<T,U>, U extends MessageError
names = Collections.unmodifiableSet(namesTmp);
}

protected Init(U object) {
protected Init(final U object) {
super(object);
}

Expand All @@ -50,7 +50,7 @@ public T withName(String name) {
}
}

public static class Builder extends Init<Builder,MessageError> {
public static class Builder extends Init<Builder, MessageError> {

public Builder() {
super(new MessageError());
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/io/sprucehill/mandrill/data/error/PreBuildError.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,27 @@
*/
public class PreBuildError extends Exception {

private Map<String,String> preBuildErrors;
private Map<String, String> preBuildErrors;

public PreBuildError(Map<String,String> preBuildErrors) {
public PreBuildError(final Map<String, String> preBuildErrors) {
super(concatPreBuildErrors(preBuildErrors));
this.preBuildErrors = Collections.unmodifiableMap(preBuildErrors);
}

public Map<String,String> getPreBuildErrors() {
return preBuildErrors;
}

private static String concatPreBuildErrors(Map<String,String> preBuildErrors) {
private static String concatPreBuildErrors(final Map<String, String> preBuildErrors) {
StringBuilder builder = null;
for (Map.Entry<String,String> preBuildError : preBuildErrors.entrySet()) {
for (final Map.Entry<String, String> preBuildError : preBuildErrors.entrySet()) {
if (null == builder) {
builder = new StringBuilder();
}
else {
} else {
builder.append(", ");
}
builder.append(preBuildError.getKey());
}
return null == builder ? "" : builder.toString();
}

public Map<String, String> getPreBuildErrors() {
return preBuildErrors;
}
}
Loading