Compare commits

...

10 Commits

Author SHA1 Message Date
b5eeef426d Java 11 settings; maven enforcer removed 2023-07-14 21:07:08 +02:00
Sven Kubiak
1d594097d9
[maven-release-plugin] prepare for next development iteration 2023-07-13 12:03:49 +02:00
Sven Kubiak
19e36db4ed
[maven-release-plugin] prepare release 7.0.3 2023-07-13 12:03:45 +02:00
Sven Kubiak
f9ca3b8890
Minor refactorings 2023-07-13 12:03:11 +02:00
Sven Kubiak
0cbcf27da7
Merge pull request #7 from tuxmainy/main
implemented TTL feature
2023-07-13 11:58:19 +02:00
be619b1843 implemented TTL feature 2023-07-12 22:50:46 +02:00
Sven Kubiak
a9286162c8
Version bumps 2023-06-12 13:19:50 +02:00
Sven Kubiak
c4a063ebda
Version bumps 2023-05-15 10:02:24 +02:00
Sven Kubiak
1e3ab9eb2f
Version bumps 2023-05-12 09:18:16 +02:00
Sven Kubiak
ff4bf598ba
Version bumps 2023-04-28 08:39:47 +02:00
5 changed files with 46 additions and 26 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/target
/*.versionsBackup
/bin
.vscode/

43
pom.xml
View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.svenkubiak</groupId>
<artifactId>jpushover</artifactId>
<version>7.0.3-SNAPSHOT</version>
<version>7.0.4-SNAPSHOT</version>
<packaging>jar</packaging>
<licenses>
<license>
@ -18,7 +18,7 @@
</developer>
</developers>
<properties>
<java.version>17</java.version>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
@ -35,7 +35,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.11.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
@ -75,19 +75,6 @@
</goals>
<phase>validate</phase>
</execution>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.8.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
<execution>
<id>enforce-ban-circular-dependencies</id>
<goals>
@ -105,7 +92,7 @@
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.6.2</version>
<version>1.7.0</version>
</dependency>
</dependencies>
</plugin>
@ -164,7 +151,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.14.0</version>
<version>2.15.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -202,20 +189,26 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.2</version>
<version>5.10.0-RC1</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>source.devloop.de-damage</id>
<url>https://source.devloop.de/api/packages/damage/maven</url>
</repository>
<snapshotRepository>
<id>source.devloop.de-damage</id>
<url>https://source.devloop.de/api/packages/damage/maven</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>source.devloop.de-damage</id>
<url>https://source.devloop.de/api/packages/damage/maven</url>
</repository>
</repositories>
<profiles>
<profile>
<id>release-sign-artifacts</id>

View File

@ -224,6 +224,19 @@ public class Message implements API {
return this;
}
/**
* Adds a ttl to the Pushover message
*
* @param ttl Seconds until this message should be automatically removed from the device. Needs to be positive
* @return Message instance
*/
public Message withTTL(int ttl) {
Validate.checkArgument(ttl > 0, "TTL must be a positive value");
body.put(Param.TTL.toString(), String.valueOf(ttl));
return this;
}
/**
* Uses a given proxy for the HTTP requests to Pushover
*

View File

@ -24,7 +24,8 @@ public enum Param {
TOKEN("token"),
URL("url"),
URL_TITLE("url_title"),
USER("user");
USER("user"),
TTL("ttl");
private final String value;

View File

@ -58,6 +58,18 @@ public class MessageTests {
assertTrue(message.getValue(Param.USER.toString()).equals(value));
}
@Test
void testWithTTL() {
//given
int ttl = 5;
//when
Message message = JPushover.messageAPI().withTTL(5);
//then
assertTrue(message.getValue(Param.TTL.toString()).equals(String.valueOf(ttl)));
}
@Test
void testWithRetry() {
//given