Skip to content

Commit a9facf3

Browse files
committed
[dropwizard] initial dropwizard application skeleton
0 parents  commit a9facf3

File tree

7 files changed

+227
-0
lines changed

7 files changed

+227
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Build products and artifacts
2+
*.html
3+
.m2-repository/
4+
pom.xml.versionsBackup
5+
target/
6+
dependency-reduced-pom.xml
7+
8+
# Stuff from various IDE's and editors
9+
*.iml
10+
*~
11+
.idea/*
12+
13+
# Mac OS X Finder
14+
.DS_Store
15+

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cassandra-reaper
2+
================
3+
4+
Cassandra Reaper is a centralized, stateful, and highly configurable tool for running Cassandra
5+
repairs for multi-site clusters.
6+
7+
8+
Usage
9+
-----
10+
11+
This project is build on top of Dropwizard, and can be run as defined in:
12+
http://dropwizard.io/getting-started.html#running-your-application

pom.xml

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<name>Cassandra Reaper</name>
8+
<groupId>com.spotify</groupId>
9+
<artifactId>cassandra-reaper</artifactId>
10+
<version>0.0.1-SNAPSHOT</version>
11+
<packaging>jar</packaging>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<dropwizard.version>0.7.0</dropwizard.version>
16+
</properties>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>io.dropwizard</groupId>
21+
<artifactId>dropwizard-core</artifactId>
22+
<version>${dropwizard.version}</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>junit</groupId>
26+
<artifactId>junit</artifactId>
27+
<version>4.8.1</version>
28+
</dependency>
29+
</dependencies>
30+
31+
<build>
32+
<plugins>
33+
<plugin>
34+
<groupId>org.apache.maven.plugins</groupId>
35+
<artifactId>maven-enforcer-plugin</artifactId>
36+
<version>1.3.1</version>
37+
<executions>
38+
<execution>
39+
<id>enforce</id>
40+
<configuration>
41+
<rules>
42+
<DependencyConvergence/>
43+
</rules>
44+
</configuration>
45+
<goals>
46+
<goal>enforce</goal>
47+
</goals>
48+
</execution>
49+
</executions>
50+
</plugin>
51+
<plugin>
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-compiler-plugin</artifactId>
54+
<version>3.1</version>
55+
<configuration>
56+
<source>1.7</source>
57+
<target>1.7</target>
58+
<encoding>UTF-8</encoding>
59+
</configuration>
60+
</plugin>
61+
<plugin>
62+
<!-- To know which version of your application you have deployed on a machine -->
63+
<groupId>org.apache.maven.plugins</groupId>
64+
<artifactId>maven-jar-plugin</artifactId>
65+
<version>2.4</version>
66+
<configuration>
67+
<archive>
68+
<manifest>
69+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
70+
</manifest>
71+
</archive>
72+
</configuration>
73+
</plugin>
74+
<plugin>
75+
<!-- Creating a fat jar by including all classes required for running the app -->
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-shade-plugin</artifactId>
78+
<version>2.2</version>
79+
<configuration>
80+
<createDependencyReducedPom>true</createDependencyReducedPom>
81+
<filters>
82+
<filter>
83+
<artifact>*:*</artifact>
84+
<excludes>
85+
<exclude>META-INF/*.SF</exclude>
86+
<exclude>META-INF/*.DSA</exclude>
87+
<exclude>META-INF/*.RSA</exclude>
88+
</excludes>
89+
</filter>
90+
</filters>
91+
</configuration>
92+
<executions>
93+
<execution>
94+
<phase>package</phase>
95+
<goals>
96+
<goal>shade</goal>
97+
</goals>
98+
<configuration>
99+
<transformers>
100+
<transformer
101+
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
102+
<transformer
103+
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
104+
<mainClass>com.spotify.reaper.ReaperApplication
105+
</mainClass>
106+
</transformer>
107+
</transformers>
108+
</configuration>
109+
</execution>
110+
</executions>
111+
</plugin>
112+
</plugins>
113+
</build>
114+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.spotify.reaper;
2+
3+
import com.spotify.reaper.resources.PingResource;
4+
5+
import io.dropwizard.Application;
6+
import io.dropwizard.setup.Bootstrap;
7+
import io.dropwizard.setup.Environment;
8+
9+
public class ReaperApplication extends Application<ReaperApplicationConfiguration> {
10+
11+
public static void main(String[] args) throws Exception {
12+
new ReaperApplication().run(args);
13+
}
14+
15+
@Override
16+
public String getName() {
17+
return "cassandra-reaper";
18+
}
19+
20+
@Override
21+
public void initialize(Bootstrap<ReaperApplicationConfiguration> bootstrap) {
22+
// nothing to do yet
23+
}
24+
25+
@Override
26+
public void run(ReaperApplicationConfiguration configuration,
27+
Environment environment) {
28+
final PingResource resource = new PingResource();
29+
environment.jersey().register(resource);
30+
}
31+
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.spotify.reaper;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import org.hibernate.validator.constraints.NotEmpty;
6+
7+
import io.dropwizard.Configuration;
8+
9+
public class ReaperApplicationConfiguration extends Configuration {
10+
11+
private String testingValue;
12+
13+
@JsonProperty
14+
public String getTestingValue() {
15+
return testingValue;
16+
}
17+
18+
@JsonProperty
19+
public void setTestingValue(String testingValue) {
20+
this.testingValue = testingValue;
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.spotify.reaper.resources;
2+
3+
import com.google.common.base.Optional;
4+
5+
import javax.ws.rs.GET;
6+
import javax.ws.rs.Path;
7+
import javax.ws.rs.Produces;
8+
import javax.ws.rs.QueryParam;
9+
import javax.ws.rs.core.MediaType;
10+
11+
@Path("/ping")
12+
@Produces(MediaType.TEXT_PLAIN)
13+
public class PingResource {
14+
15+
@GET
16+
public String answerPing(@QueryParam("name") Optional<String> name) {
17+
return String.format("Ping %s", name.or("stranger"));
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.spotify.reaper;
2+
3+
import org.junit.Test;
4+
5+
public class IntegrationTest {
6+
7+
@Test
8+
public void testService() {
9+
// TODO
10+
}
11+
12+
}

0 commit comments

Comments
 (0)