Compare commits

..

22 Commits

Author SHA1 Message Date
60137a437e replace fork master distributionManagement 2023-07-20 08:24:13 +02:00
1b8d1e5d1a Merge branch 'main' of https://github.com/svenkubiak/JPushover 2023-07-20 08:23:46 +02:00
42dd11678a Added release script 2023-07-19 10:41:39 +02:00
e2b041fb4b artefactid changed to 11 and revert "evil" fix 2023-07-18 22:32:49 +02:00
2e7d9127ec evil "fix" to remove snapshot 2023-07-18 22:24:16 +02:00
7e6cc8e1bb New SNAPSHOT version 2023-07-17 14:18:31 +02:00
f0effe5240 Moved release plugins to profile 2023-07-17 14:15:33 +02:00
49616e1d9d Signing is only activated on release 2023-07-17 14:13:27 +02:00
f9809e444e New snapshot version 2023-07-17 14:10:15 +02:00
8f71cf8164 Switched from maven release to sonatype staging plugin 2023-07-17 14:09:42 +02:00
772f9a590a Updates to pom.xml 2023-07-17 13:41:05 +02:00
f4aeb42e61 Version bumps 2023-07-16 19:19:36 +02:00
b5eeef426d Java 11 settings; maven enforcer removed 2023-07-14 21:07:08 +02:00
1d594097d9 [maven-release-plugin] prepare for next development iteration 2023-07-13 12:03:49 +02:00
19e36db4ed [maven-release-plugin] prepare release 7.0.3 2023-07-13 12:03:45 +02:00
f9ca3b8890 Minor refactorings 2023-07-13 12:03:11 +02:00
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
a9286162c8 Version bumps 2023-06-12 13:19:50 +02:00
c4a063ebda Version bumps 2023-05-15 10:02:24 +02:00
1e3ab9eb2f Version bumps 2023-05-12 09:18:16 +02:00
ff4bf598ba Version bumps 2023-04-28 08:39:47 +02:00
6 changed files with 118 additions and 90 deletions

1
.gitignore vendored
View File

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

161
pom.xml
View File

@ -1,8 +1,8 @@
<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/xsd/maven-4.0.0.xsd"> <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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.svenkubiak</groupId> <groupId>de.svenkubiak</groupId>
<artifactId>jpushover</artifactId> <artifactId>jpushover11</artifactId>
<version>7.0.3-SNAPSHOT</version> <version>7.0.10-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<licenses> <licenses>
<license> <license>
@ -18,7 +18,7 @@
</developer> </developer>
</developers> </developers>
<properties> <properties>
<java.version>17</java.version> <java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<scm> <scm>
@ -28,38 +28,25 @@
<tag>HEAD</tag> <tag>HEAD</tag>
</scm> </scm>
<name>JPushover</name> <name>JPushover</name>
<description>Zero-dependency convenient class for sending messages to Pushover in Java project</description> <description>Zero-dependency convenient class for sending messages to
Pushover in Java project</description>
<url>https://github.com/svenkubiak/JPushover</url> <url>https://github.com/svenkubiak/JPushover</url>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version> <version>3.11.0</version>
<configuration> <configuration>
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
<debug>false</debug> <debug>false</debug>
<optimize>true</optimize>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version> <version>3.3.0</version>
<configuration> <configuration>
<rules> <rules>
<DependencyConvergence> <DependencyConvergence>
@ -75,19 +62,6 @@
</goals> </goals>
<phase>validate</phase> <phase>validate</phase>
</execution> </execution>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.8.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
<execution> <execution>
<id>enforce-ban-circular-dependencies</id> <id>enforce-ban-circular-dependencies</id>
<goals> <goals>
@ -105,42 +79,29 @@
<dependency> <dependency>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId> <artifactId>extra-enforcer-rules</artifactId>
<version>1.6.2</version> <version>1.7.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.owasp</groupId> <groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId> <artifactId>dependency-check-maven</artifactId>
<version>7.4.1</version> <version>8.3.1</version>
<configuration> <configuration>
<cveValidForHours>12</cveValidForHours> <cveValidForHours>12</cveValidForHours>
<failBuildOnCVSS>1</failBuildOnCVSS> <failBuildOnCVSS>1</failBuildOnCVSS>
<!-- <!--
<suppressionFiles> <suppressionFiles>
<suppressionFile>${maven.multiModuleProjectDirectory}/owasp-suppression.xml</suppressionFile> <suppressionFile>${maven.multiModuleProjectDirectory}/owasp-suppression.xml</suppressionFile>
</suppressionFiles> </suppressionFiles>
--> -->
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled> <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
<composerAnalyzerEnabled>false</composerAnalyzerEnabled> <composerAnalyzerEnabled>false</composerAnalyzerEnabled>
<nodeAuditAnalyzerEnabled>false</nodeAuditAnalyzerEnabled> <nodeAuditAnalyzerEnabled>false</nodeAuditAnalyzerEnabled>
<nuspecAnalyzerEnabled>false</nuspecAnalyzerEnabled> <nuspecAnalyzerEnabled>false</nuspecAnalyzerEnabled>
<cocoapodsAnalyzerEnabled>false</cocoapodsAnalyzerEnabled> <cocoapodsAnalyzerEnabled>false</cocoapodsAnalyzerEnabled>
<golangDepEnabled>false</golangDepEnabled> <golangDepEnabled>false</golangDepEnabled>
</configuration> </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.sonarsource.scanner.maven</groupId> <groupId>org.sonarsource.scanner.maven</groupId>
@ -150,31 +111,27 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version> <version>3.0.1</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<goals>deploy</goals>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0</version> <version>3.1.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId> <artifactId>versions-maven-plugin</artifactId>
<version>2.14.0</version> <version>2.16.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId> <artifactId>maven-clean-plugin</artifactId>
<version>3.2.0</version> <version>3.3.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version> <version>3.1.2</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -184,12 +141,12 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M4</version> <version>4.0.0-M9</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId> <artifactId>maven-install-plugin</artifactId>
<version>3.1.0</version> <version>3.1.1</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -202,35 +159,35 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>5.9.2</version> <version>5.10.0-RC1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<distributionManagement> <distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository> <repository>
<id>ossrh</id> <id>source.devloop.de-damage</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> <url>https://source.devloop.de/api/packages/damage/maven</url>
</repository> </repository>
<snapshotRepository>
<id>source.devloop.de-damage</id>
<url>https://source.devloop.de/api/packages/damage/maven</url>
</snapshotRepository>
</distributionManagement> </distributionManagement>
<repositories>
<repository>
<id>source.devloop.de-damage</id>
<url>https://source.devloop.de/api/packages/damage/maven</url>
</repository>
</repositories>
<profiles> <profiles>
<profile> <profile>
<id>release-sign-artifacts</id> <id>release</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version> <version>3.1.0</version>
<executions> <executions>
<execution> <execution>
<id>sign-artifacts</id> <id>sign-artifacts</id>
@ -241,8 +198,34 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>
</profiles> </profiles>
</project> </project>

18
release.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
mvn versions:set
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "Failed to set new version!"
else
mvn clean deploy -Prelease
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "Failed to release!"
else
mvn release:update-versions
fi
fi
rm pom.xml.versionsBackup

View File

@ -224,6 +224,19 @@ public class Message implements API {
return this; 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 * Uses a given proxy for the HTTP requests to Pushover
* *

View File

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

View File

@ -58,6 +58,18 @@ public class MessageTests {
assertTrue(message.getValue(Param.USER.toString()).equals(value)); 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 @Test
void testWithRetry() { void testWithRetry() {
//given //given