Skip to content

Commit 98aefc1

Browse files
authored
Merge pull request 3scale-labs#29 from EricWittmann/cleanup-and-prep-for-centralRelease
cleaned up the pom.xml, updated parametermap impl and unit tests to b…
2 parents f5e7563 + 21845e7 commit 98aefc1

File tree

10 files changed

+358
-197
lines changed

10 files changed

+358
-197
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
out
22
*.iml
33
.idea
4-
5-
/target/
4+
.classpath
5+
.project
6+
.settings
7+
/target/

pom.xml

Lines changed: 180 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,189 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2-
<repositories>
3-
</repositories>
4-
<modelVersion>4.0.0</modelVersion>
5-
<groupId>net.threescale</groupId>
6-
<artifactId>threescale-api</artifactId>
7-
<name>3scale Java API</name>
8-
<url>http://http://www.3scale.net/</url>
9-
<version>3.1.0</version>
10-
<description>This API is used to encapsulate the communication with the 3scale backend server for validating and
11-
reporting transactions between the user and the provider of a service
12-
</description>
13-
<packaging>jar</packaging>
14-
<dependencies>
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>net.3scale</groupId>
5+
<artifactId>3scale-api</artifactId>
6+
<version>3.1.0-SNAPSHOT</version>
157

16-
<dependency>
17-
<groupId>joda-time</groupId>
18-
<artifactId>joda-time</artifactId>
19-
<version>2.3</version>
20-
</dependency>
8+
<name>3scale Java API</name>
9+
<description>
10+
This API is used to encapsulate the communication with the 3scale backend server for validating and
11+
reporting transactions between the user and the provider of a service
12+
</description>
13+
<url>https://www.3scale.net/</url>
2114

22-
<dependency>
23-
<groupId>xom</groupId>
24-
<artifactId>xom</artifactId>
25-
<version>1.2.5</version>
26-
</dependency>
27-
<!-- Test dep's -->
28-
<dependency>
29-
<groupId>org.jmock</groupId>
30-
<artifactId>jmock-junit4</artifactId>
31-
<version>2.6.0</version>
32-
<scope>test</scope>
33-
</dependency>
15+
<licenses>
16+
<license>
17+
<name>MIT</name>
18+
<url>http://creativecommons.org/licenses/MIT/</url>
19+
</license>
20+
</licenses>
3421

35-
<dependency>
36-
<groupId>org.hamcrest</groupId>
37-
<artifactId>hamcrest-core</artifactId>
38-
<version>1.2</version>
39-
</dependency>
22+
<developers>
23+
<developer>
24+
<name>Andrew Mackenzie</name>
25+
<email>[email protected]</email>
26+
<organization>3scale</organization>
27+
<organizationUrl>http://www.3scale.net</organizationUrl>
28+
</developer>
29+
</developers>
4030

41-
<dependency>
42-
<groupId>junit</groupId>
43-
<artifactId>junit</artifactId>
44-
<version>4.10</version>
45-
</dependency>
31+
<issueManagement>
32+
<system>GitHub</system>
33+
<url>https://github.com/3scale/3scale_ws_api_for_java/issues</url>
34+
</issueManagement>
4635

36+
<scm>
37+
<url>https://github.com/3scale/3scale_ws_api_for_java</url>
38+
<connection>scm:git:[email protected]:3scale/3scale_ws_api_for_java.git</connection>
39+
<developerConnection>scm:git:[email protected]:3scale/3scale_ws_api_for_java.git</developerConnection>
40+
</scm>
4741

48-
</dependencies>
42+
<properties>
43+
<maven.compile.source>1.6</maven.compile.source>
44+
<maven.compile.target>1.6</maven.compile.target>
45+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
46+
</properties>
4947

50-
<properties>
51-
<maven.compile.source>1.6</maven.compile.source>
52-
<maven.compile.target>1.6</maven.compile.target>
53-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
54-
</properties>
55-
<licenses>
56-
<license>
57-
<name>MIT</name>
58-
<url>http://creativecommons.org/licenses/MIT/</url>
59-
</license>
60-
</licenses>
61-
<issueManagement>
62-
<system>GitHub</system>
63-
<url>https://github.com/3scale/3scale_ws_api_for_java/issues</url>
64-
</issueManagement>
65-
<build>
66-
<plugins>
67-
<plugin>
68-
<groupId>org.apache.maven.plugins</groupId>
69-
<artifactId>maven-compiler-plugin</artifactId>
70-
<version>3.1</version>
71-
<configuration>
72-
<source>1.6</source>
73-
<target>1.6</target>
74-
</configuration>
75-
</plugin>
76-
<plugin>
77-
<groupId>org.apache.maven.plugins</groupId>
78-
<artifactId>maven-javadoc-plugin</artifactId>
79-
<version>2.9.1</version>
80-
<configuration>
81-
<debug>true</debug>
82-
<outputDirectory>${basedir}/dist/docs</outputDirectory>
83-
<reportOutputDirectory>${basedir}/dist/docs</reportOutputDirectory>
84-
<author>false</author>
85-
<excludePackageNames>org.jboss.*</excludePackageNames>
86-
<aggregate>true</aggregate>
87-
</configuration>
48+
<dependencies>
49+
<dependency>
50+
<groupId>xom</groupId>
51+
<artifactId>xom</artifactId>
52+
<version>1.2.5</version>
53+
</dependency>
8854

89-
</plugin>
90-
<plugin>
91-
<groupId>org.apache.maven.plugins</groupId>
92-
<artifactId>maven-surefire-plugin</artifactId>
93-
<version>2.16</version>
94-
</plugin>
95-
<plugin>
96-
<groupId>org.apache.maven.plugins</groupId>
97-
<artifactId>maven-surefire-report-plugin</artifactId>
98-
<version>2.16</version>
99-
</plugin>
100-
</plugins>
101-
<resources>
102-
<resource>
103-
<filtering>true</filtering>
104-
<directory>src/main/resources</directory>
105-
</resource>
106-
</resources>
107-
</build>
108-
<reporting>
109-
<plugins>
110-
</plugins>
111-
</reporting>
112-
<scm>
113-
<url>https://github.com/3scale/3scale_ws_api_for_java</url>
114-
<connection>scm:git:[email protected]:3scale/3scale_ws_api_for_java.git</connection>
115-
<tag>HEAD</tag>
116-
</scm>
55+
<!-- Test only -->
56+
<dependency>
57+
<groupId>joda-time</groupId>
58+
<artifactId>joda-time</artifactId>
59+
<version>2.3</version>
60+
<scope>test</scope>
61+
</dependency>
62+
<dependency>
63+
<groupId>org.hamcrest</groupId>
64+
<artifactId>hamcrest-core</artifactId>
65+
<version>1.2</version>
66+
<scope>test</scope>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.jmock</groupId>
70+
<artifactId>jmock-junit4</artifactId>
71+
<version>2.6.0</version>
72+
<scope>test</scope>
73+
</dependency>
74+
<dependency>
75+
<groupId>junit</groupId>
76+
<artifactId>junit</artifactId>
77+
<version>4.10</version>
78+
<scope>test</scope>
79+
</dependency>
80+
</dependencies>
81+
82+
<build>
83+
<resources>
84+
<resource>
85+
<filtering>true</filtering>
86+
<directory>src/main/resources</directory>
87+
</resource>
88+
</resources>
89+
<plugins>
90+
<plugin>
91+
<groupId>org.apache.maven.plugins</groupId>
92+
<artifactId>maven-compiler-plugin</artifactId>
93+
<version>3.1</version>
94+
<configuration>
95+
<source>${maven.compile.source}</source>
96+
<target>${maven.compile.source}</target>
97+
</configuration>
98+
</plugin>
99+
<plugin>
100+
<groupId>org.apache.maven.plugins</groupId>
101+
<artifactId>maven-javadoc-plugin</artifactId>
102+
<version>2.9.1</version>
103+
<executions>
104+
<execution>
105+
<id>attach-javadocs</id>
106+
<goals>
107+
<goal>jar</goal>
108+
</goals>
109+
</execution>
110+
</executions>
111+
</plugin>
112+
<plugin>
113+
<groupId>org.apache.maven.plugins</groupId>
114+
<artifactId>maven-source-plugin</artifactId>
115+
<version>3.0.1</version>
116+
<executions>
117+
<execution>
118+
<id>attach-sources</id>
119+
<goals>
120+
<goal>jar-no-fork</goal>
121+
</goals>
122+
</execution>
123+
</executions>
124+
</plugin>
125+
<plugin>
126+
<groupId>org.apache.maven.plugins</groupId>
127+
<artifactId>maven-surefire-plugin</artifactId>
128+
<version>2.16</version>
129+
</plugin>
130+
<plugin>
131+
<groupId>org.apache.maven.plugins</groupId>
132+
<artifactId>maven-surefire-report-plugin</artifactId>
133+
<version>2.16</version>
134+
</plugin>
135+
</plugins>
136+
</build>
137+
138+
<profiles>
139+
<profile>
140+
<id>release</id>
141+
<build>
142+
<plugins>
143+
<plugin>
144+
<groupId>org.sonatype.plugins</groupId>
145+
<artifactId>nexus-staging-maven-plugin</artifactId>
146+
<version>1.6.7</version>
147+
<extensions>true</extensions>
148+
<configuration>
149+
<serverId>ossrh</serverId>
150+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
151+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
152+
</configuration>
153+
</plugin>
154+
<plugin>
155+
<groupId>org.apache.maven.plugins</groupId>
156+
<artifactId>maven-gpg-plugin</artifactId>
157+
<version>1.6</version>
158+
<executions>
159+
<execution>
160+
<id>sign-artifacts</id>
161+
<phase>verify</phase>
162+
<goals>
163+
<goal>sign</goal>
164+
</goals>
165+
</execution>
166+
</executions>
167+
</plugin>
168+
</plugins>
169+
</build>
170+
</profile>
171+
<profile>
172+
<id>java8</id>
173+
<activation>
174+
<jdk>[1.8,)</jdk>
175+
</activation>
176+
<build>
177+
<plugins>
178+
<plugin>
179+
<groupId>org.apache.maven.plugins</groupId>
180+
<artifactId>maven-javadoc-plugin</artifactId>
181+
<configuration>
182+
<additionalparam>-Xdoclint:none</additionalparam>
183+
</configuration>
184+
</plugin>
185+
</plugins>
186+
</build>
187+
</profile>
188+
</profiles>
117189
</project>

src/main/java/threescale/v3/api/ParameterMap.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
11
package threescale.v3.api;
22

33
import java.util.HashMap;
4+
import java.util.LinkedHashMap;
45
import java.util.Set;
56

67
/**
78
* Hold a set of parameter and metrics for an AuthRep, Authorize, OAuth Authorize or Report.
89
* <p/>
910
* Each item consists of a name/value pair, where the value can be a String, An Array of ParameterMaps or another Parameter Map.
1011
* <p/>
12+
* <p>
1113
* E.g. For an AuthRep:
14+
* </p>
1215
* <code>
13-
* ParameterMap params = new ParameterMap();
14-
* params.add("app_id", "app_1234");
15-
* <p/>
16-
* ParameterMap usage = new ParameterMap();
17-
* usage.add("hits", "3");
18-
* <p/>
19-
* params.add("usage", usage);
20-
* <p/>
21-
* AuthorizeResponse response = serviceApi.authrep(params);
16+
* ParameterMap params = new ParameterMap();<br/>
17+
* params.add("app_id", "app_1234");<br/>
18+
* ParameterMap usage = new ParameterMap();<br/>
19+
* usage.add("hits", "3");<br/>
20+
* params.add("usage", usage);<br/>
21+
* AuthorizeResponse response = serviceApi.authrep(params);<br/>
2222
* </code>
23-
* <p/>
23+
* <p>
2424
* An example for a report might be:
25-
* <code>
26-
* ParameterMap params = new ParameterMap();
27-
* params.add("app_id", "foo");
28-
* params.add("timestamp", fmt.print(new DateTime(2010, 4, 27, 15, 0)));
29-
* <p/>
30-
* ParameterMap usage = new ParameterMap();
31-
* usage.add("hits", "1");
32-
* params.add("usage", usage);
3325
* <p/>
34-
* ReportResponse response = serviceApi.report(params);
26+
* <code>
27+
* ParameterMap params = new ParameterMap();<br/>
28+
* params.add("app_id", "foo");<br/>
29+
* params.add("timestamp", fmt.print(new DateTime(2010, 4, 27, 15, 0)));<br/>
30+
* ParameterMap usage = new ParameterMap();<br/>
31+
* usage.add("hits", "1");<br/>
32+
* params.add("usage", usage);<br/>
33+
* ReportResponse response = serviceApi.report(params);<br/>
3534
* </code>
3635
*/
3736
public class ParameterMap {
@@ -42,7 +41,8 @@ public class ParameterMap {
4241
* Construct and empty ParameterMap
4342
*/
4443
public ParameterMap() {
45-
data = new HashMap<String, Object>();
44+
// Note: use a linked hash map for more predictable serialization of the parameters (mostly for testing)
45+
data = new LinkedHashMap<String, Object>();
4646
}
4747

4848
/**

src/main/java/threescale/v3/api/ServerError.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
public class ServerError extends Exception {
77

8+
private static final long serialVersionUID = -5900004126517852322L;
9+
810
public ServerError(String reason) {
911
super(reason);
1012
}

0 commit comments

Comments
 (0)