Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Aug 12, 2024
1 parent b525715 commit 4ae8c54
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
46 changes: 23 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,57 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.16.0</version>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.34</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.0</version>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.3.32</version>
<version>5.3.37</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.32</version>
<version>5.3.37</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>2.7.17</version>
<version>2.7.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<version>2.7.17</version>
<version>2.7.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.5.2</version>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.5.2</version>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>com.eatthepath</groupId>
Expand All @@ -77,31 +77,31 @@
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>8.2.0</version>
<version>9.2.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.1</version>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>4.8.1</version>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.7.17</version>
<version>2.7.18</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.wiremock/wiremock -->
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>3.3.1</version>
<artifactId>wiremock-standalone</artifactId>
<version>3.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -116,27 +116,27 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.9.0</version>
<version>3.13.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.2.5</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<version>5.10.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<version>0.8.12</version>
<executions>
<execution>
<goals>
Expand All @@ -155,7 +155,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<version>3.5.0</version>
<executions>
<execution>
<id>enforce-versions</id>
Expand All @@ -178,7 +178,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -193,7 +193,7 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>3.5.1</version>
<version>3.5.3</version>
</extension>
</extensions>
</build>
Expand Down
14 changes: 8 additions & 6 deletions src/test/java/tiqr/org/push/APNSTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package tiqr.org.push;

import com.eatthepath.pushy.apns.server.*;
import com.eatthepath.pushy.apns.server.AcceptAllPushNotificationHandlerFactory;
import com.eatthepath.pushy.apns.server.MockApnsServer;
import com.eatthepath.pushy.apns.server.MockApnsServerBuilder;
import com.eatthepath.pushy.apns.server.PushNotificationHandlerFactory;
import io.netty.channel.nio.NioEventLoopGroup;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
Expand All @@ -17,11 +20,11 @@ class APNSTest {

@Test
void push() throws IOException, NoSuchAlgorithmException, InvalidKeyException, InterruptedException, ExecutionException, PushNotificationException {
MockApnsServer server = buildServer(new AcceptAllPushNotificationHandlerFactory(), null);
server.start(8099).get();
MockApnsServer server = buildServer(new AcceptAllPushNotificationHandlerFactory());
Integer port = server.start(8099).get();
APNS apns = new APNS(new APNSConfiguration(
"localhost",
8099,
port,
"classpath:/token-auth-private-key.p8",
"classpath:/ca.pem",
"topic",
Expand All @@ -35,7 +38,7 @@ void push() throws IOException, NoSuchAlgorithmException, InvalidKeyException, I
server.shutdown().get();
}

protected MockApnsServer buildServer(final PushNotificationHandlerFactory handlerFactory, final MockApnsServerListener listener) throws IOException {
protected MockApnsServer buildServer(final PushNotificationHandlerFactory handlerFactory) throws IOException {
return new MockApnsServerBuilder()
.setServerCredentials(
new ClassPathResource("server-certs.pem").getInputStream(),
Expand All @@ -44,7 +47,6 @@ protected MockApnsServer buildServer(final PushNotificationHandlerFactory handle
.setTrustedClientCertificateChain(new ClassPathResource("ca.pem").getInputStream())
.setEventLoopGroup(new NioEventLoopGroup(2))
.setHandlerFactory(handlerFactory)
.setListener(listener)
.build();
}

Expand Down

0 comments on commit 4ae8c54

Please sign in to comment.