Rework push server so it holds the subscriptions in a DB
This commit is contained in:
@@ -4,11 +4,13 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* This whole application is basically just a thin layer around the webpush-java lib
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
public class PushServiceApplication extends SpringBootServletInitializer {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PushServiceApplication.class);
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package de.pushservice.server.controller;
|
||||
|
||||
import de.pushservice.client.ResponseReason;
|
||||
import de.pushservice.client.dto.NotificationRequestDto;
|
||||
import de.pushservice.server.decorator.MessageDecorator;
|
||||
import de.pushservice.server.decorator.SubscriptionDecorator;
|
||||
import nl.martijndwars.webpush.Notification;
|
||||
import nl.martijndwars.webpush.PushService;
|
||||
import de.pushservice.client.dto.SubscriptionDto;
|
||||
import de.pushservice.server.service.PushService;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -20,27 +18,20 @@ import java.security.Security;
|
||||
public class PushServiceController {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PushServiceController.class);
|
||||
|
||||
@Autowired
|
||||
private PushService pushService;
|
||||
|
||||
static {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@PostMapping("/notify")
|
||||
public ResponseEntity notify(@RequestBody NotificationRequestDto notificationRequestDto) {
|
||||
try {
|
||||
final SubscriptionDecorator subscription = SubscriptionDecorator
|
||||
.fromDto(notificationRequestDto.getSubscriptionDto());
|
||||
final Notification notification = MessageDecorator.fromDto(notificationRequestDto.getMessageDto())
|
||||
.toNotification(subscription);
|
||||
final PushService extPushService = new PushService();
|
||||
return this.pushService.notify(notificationRequestDto).toResponseEntity();
|
||||
}
|
||||
|
||||
extPushService.send(notification);
|
||||
|
||||
return ResponseReason.OK.toResponseEntity();
|
||||
}
|
||||
catch(Exception e) {
|
||||
LOGGER.error("Error while sending notification!", e);
|
||||
|
||||
return ResponseReason.UNKNOWN_ERROR.toResponseEntity();
|
||||
}
|
||||
@PostMapping("/subscribe")
|
||||
public ResponseEntity subscribe(@RequestBody SubscriptionDto subscriptionDto) {
|
||||
return this.pushService.subscribe(subscriptionDto).toResponseEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package de.pushservice.server.dba;
|
||||
|
||||
import de.pushservice.server.model.Subscription;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public interface SubscriptionRepository extends CrudRepository<Subscription, Long> {
|
||||
@Query("SELECT s FROM Subscription s WHERE s.scope = :scope")
|
||||
Iterable<Subscription> getAllForScope(String scope);
|
||||
|
||||
@Query("SELECT s FROM Subscription s WHERE s.scope = :scope AND s.endpoint = :endpoint")
|
||||
Optional<Subscription> getForScopeAndEndpoint(String scope, String endpoint);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package de.pushservice.server.decorator;
|
||||
|
||||
import de.pushservice.client.dto.MessageDto;
|
||||
import nl.martijndwars.webpush.Notification;
|
||||
import nl.martijndwars.webpush.Urgency;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
|
||||
public class MessageDecorator {
|
||||
private MessageDto dto;
|
||||
|
||||
private MessageDecorator(MessageDto dto) {
|
||||
this.dto = dto;
|
||||
}
|
||||
|
||||
public static final MessageDecorator fromDto(MessageDto dto) {
|
||||
return new MessageDecorator(dto);
|
||||
}
|
||||
|
||||
public Notification toNotification(SubscriptionDecorator subscription) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException {
|
||||
return Notification.builder()
|
||||
.endpoint(subscription.getEndpoint())
|
||||
.userPublicKey(subscription.getUserPublicKey())
|
||||
.userAuth(subscription.getAuthAsBytes())
|
||||
.payload(dto.getPayload())
|
||||
.urgency(getExtUrgency())
|
||||
.topic(dto.getTopic())
|
||||
.build();
|
||||
}
|
||||
|
||||
private Urgency getExtUrgency() {
|
||||
return Urgency.valueOf(dto.getUrgency().name());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.pushservice.server.decorator;
|
||||
|
||||
import de.pushservice.client.dto.SubscriptionDto;
|
||||
import de.pushservice.server.model.Subscription;
|
||||
import org.bouncycastle.jce.ECNamedCurveTable;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
|
||||
@@ -15,17 +15,17 @@ import java.security.spec.InvalidKeySpecException;
|
||||
import java.util.Base64;
|
||||
|
||||
public class SubscriptionDecorator {
|
||||
private SubscriptionDto dto;
|
||||
private Subscription dto;
|
||||
|
||||
private SubscriptionDecorator(SubscriptionDto dto) {
|
||||
private SubscriptionDecorator(Subscription dto) {
|
||||
this.dto = dto;
|
||||
}
|
||||
|
||||
public static final SubscriptionDecorator fromDto(SubscriptionDto dto) {
|
||||
public static final SubscriptionDecorator from(Subscription dto) {
|
||||
return new SubscriptionDecorator(dto);
|
||||
}
|
||||
|
||||
byte[] getAuthAsBytes() {
|
||||
public byte[] getAuthAsBytes() {
|
||||
return Base64.getDecoder().decode(dto.getAuth());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SubscriptionDecorator {
|
||||
return Base64.getDecoder().decode(dto.getKey());
|
||||
}
|
||||
|
||||
PublicKey getUserPublicKey() throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException {
|
||||
public PublicKey getUserPublicKey() throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException {
|
||||
KeyFactory kf = KeyFactory.getInstance("ECDH", BouncyCastleProvider.PROVIDER_NAME);
|
||||
ECNamedCurveParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("secp256r1");
|
||||
ECPoint point = ecSpec.getCurve().decodePoint(getKeyAsBytes());
|
||||
@@ -42,7 +42,7 @@ public class SubscriptionDecorator {
|
||||
return kf.generatePublic(pubSpec);
|
||||
}
|
||||
|
||||
String getEndpoint() {
|
||||
public String getEndpoint() {
|
||||
return dto.getEndpoint();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package de.pushservice.server.model;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
public class Subscription {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String scope;
|
||||
private String auth;
|
||||
private String key;
|
||||
private String endpoint;
|
||||
private LocalDateTime insertDate;
|
||||
private LocalDateTime lastSeen;
|
||||
private int errorCount;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
public void setAuth(String auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getEndpoint() {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
public void setEndpoint(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
public LocalDateTime getInsertDate() {
|
||||
return insertDate;
|
||||
}
|
||||
|
||||
public void setInsertDate(LocalDateTime insertDate) {
|
||||
this.insertDate = insertDate;
|
||||
}
|
||||
|
||||
public LocalDateTime getLastSeen() {
|
||||
return lastSeen;
|
||||
}
|
||||
|
||||
public void setLastSeen(LocalDateTime lastSeen) {
|
||||
this.lastSeen = lastSeen;
|
||||
}
|
||||
|
||||
public int getErrorCount() {
|
||||
return errorCount;
|
||||
}
|
||||
|
||||
public void setErrorCount(int errorCount) {
|
||||
this.errorCount = errorCount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package de.pushservice.server.service;
|
||||
|
||||
import de.pushservice.server.dba.SubscriptionRepository;
|
||||
import de.pushservice.server.model.Subscription;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
@Async
|
||||
@Component
|
||||
public class ExternalPushServiceResponseHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ExternalPushServiceResponseHandler.class);
|
||||
|
||||
@Autowired
|
||||
private SubscriptionRepository subscriptionRepository;
|
||||
|
||||
/**
|
||||
* @param asyncResponse - the response from the third party service
|
||||
* @param subscription - the subscription the notification was sent for
|
||||
*
|
||||
* @see <a href="https://developers.google.com/web/fundamentals/push-notifications/web-push-protocol#response_from_push_service">Google
|
||||
* developer documentation on response codes from third party push service</a>
|
||||
*/
|
||||
public void handleResponse(Future<HttpResponse> asyncResponse, Subscription subscription) {
|
||||
try {
|
||||
// First, wait for the task to complete - get() blocks execution
|
||||
final HttpResponse response = asyncResponse.get();
|
||||
|
||||
// Then handle the return code
|
||||
switch (response.getStatusLine().getStatusCode()) {
|
||||
case 201: // Created
|
||||
// Happy path, third party service received the notification and processed it
|
||||
LOGGER.debug(String.format("Received 201 for endpoint %s", subscription.getEndpoint()));
|
||||
|
||||
subscription.setErrorCount(0); // reset error count after we get a success response
|
||||
|
||||
updateSubscription(subscription);
|
||||
break;
|
||||
case 429: // Too many requests
|
||||
// We spammed the third party service, no particular handling required
|
||||
LOGGER.warn(String.format("Received 429 for endpoint %s", subscription.getEndpoint()));
|
||||
|
||||
subscription.setErrorCount(subscription.getErrorCount() + 1);
|
||||
|
||||
updateSubscription(subscription);
|
||||
break;
|
||||
case 400: // Invalid request
|
||||
// The request sent to the third party service is malformed
|
||||
LOGGER.error(String.format("Received 400 for endpoint %s", subscription.getEndpoint()));
|
||||
|
||||
subscription.setErrorCount(subscription.getErrorCount() + 1);
|
||||
|
||||
updateSubscription(subscription);
|
||||
break;
|
||||
case 404: // Not found
|
||||
// Subscription expired or endpoint is wrong -> subscription needs to be removed
|
||||
LOGGER.info(String.format("Received 404 for endpoint %s", subscription.getEndpoint()));
|
||||
|
||||
deleteSubscription(subscription);
|
||||
break;
|
||||
case 410: // Gone
|
||||
// Subscription expired or endpoint is wrong -> subscription needs to be removed
|
||||
LOGGER.info(String.format("Received 410 for endpoint %s", subscription.getEndpoint()));
|
||||
|
||||
deleteSubscription(subscription);
|
||||
break;
|
||||
case 413: // Payload too large
|
||||
// The notification created by the client app is too large
|
||||
LOGGER.warn(String.format("Received 413 for endpoint %s", subscription.getEndpoint()));
|
||||
|
||||
subscription.setErrorCount(subscription.getErrorCount() + 1);
|
||||
|
||||
updateSubscription(subscription);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
} catch (InterruptedException ire) {
|
||||
LOGGER.error(String.format("Thread interrupted for endpoint %s", subscription.getEndpoint()));
|
||||
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (ExecutionException ee) {
|
||||
LOGGER.error(String.format("Execution failed for endpoint %s", subscription.getEndpoint()), ee);
|
||||
|
||||
this.handleError(ee.getCause(), subscription);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleError(Throwable t, Subscription subscription) {
|
||||
// logging done at call sites
|
||||
|
||||
subscription.setErrorCount(subscription.getErrorCount() + 1);
|
||||
|
||||
updateSubscription(subscription);
|
||||
}
|
||||
|
||||
private void deleteSubscription(Subscription subscription) {
|
||||
this.subscriptionRepository.delete(subscription);
|
||||
}
|
||||
|
||||
private void updateSubscription(Subscription subscription) {
|
||||
subscription.setLastSeen(LocalDateTime.now());
|
||||
|
||||
this.subscriptionRepository.save(subscription);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package de.pushservice.server.service;
|
||||
|
||||
import de.pushservice.client.ResponseReason;
|
||||
import de.pushservice.client.dto.MessageDto;
|
||||
import de.pushservice.client.dto.NotificationRequestDto;
|
||||
import de.pushservice.client.dto.SubscriptionDto;
|
||||
import de.pushservice.server.dba.SubscriptionRepository;
|
||||
import de.pushservice.server.decorator.SubscriptionDecorator;
|
||||
import de.pushservice.server.model.Subscription;
|
||||
import nl.martijndwars.webpush.Notification;
|
||||
import nl.martijndwars.webpush.Urgency;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Service
|
||||
public class PushService {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PushService.class);
|
||||
|
||||
@Autowired
|
||||
private SubscriptionRepository subscriptionRepository;
|
||||
|
||||
@Autowired
|
||||
private ExternalPushServiceResponseHandler handler;
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public ResponseReason subscribe(SubscriptionDto subscriptionDto) {
|
||||
if (this.subscriptionRepository
|
||||
.getForScopeAndEndpoint(subscriptionDto.getScope(), subscriptionDto.getEndpoint()).isPresent()) {
|
||||
return ResponseReason.OK;
|
||||
}
|
||||
|
||||
Subscription subscription = new Subscription();
|
||||
|
||||
subscription.setAuth(subscriptionDto.getAuth());
|
||||
subscription.setEndpoint(subscriptionDto.getEndpoint());
|
||||
subscription.setKey(subscriptionDto.getKey());
|
||||
subscription.setErrorCount(0);
|
||||
subscription.setScope(subscriptionDto.getScope());
|
||||
subscription.setInsertDate(LocalDateTime.now());
|
||||
subscription.setLastSeen(LocalDateTime.now());
|
||||
|
||||
this.subscriptionRepository.save(subscription);
|
||||
|
||||
return ResponseReason.OK;
|
||||
}
|
||||
|
||||
public ResponseReason notify(NotificationRequestDto notificationRequestDto) {
|
||||
if (StringUtils.isEmpty(notificationRequestDto.getScope())) {
|
||||
return ResponseReason.EMPTY_SCOPE;
|
||||
}
|
||||
|
||||
final Iterable<Subscription> subscriptions = this.subscriptionRepository
|
||||
.getAllForScope(notificationRequestDto.getScope());
|
||||
final nl.martijndwars.webpush.PushService extPushService = new nl.martijndwars.webpush.PushService();
|
||||
|
||||
for (Subscription subscription : subscriptions) {
|
||||
try {
|
||||
SubscriptionDecorator subscriptionDecorator = SubscriptionDecorator.from(subscription);
|
||||
Notification notification = Notification.builder()
|
||||
.endpoint(subscriptionDecorator.getEndpoint())
|
||||
.userPublicKey(subscriptionDecorator.getUserPublicKey())
|
||||
.userAuth(subscriptionDecorator.getAuthAsBytes())
|
||||
.payload(notificationRequestDto.getMessageDto().getPayload())
|
||||
.urgency(getExtUrgency(notificationRequestDto.getMessageDto()))
|
||||
.topic(notificationRequestDto.getMessageDto().getTopic())
|
||||
.build();
|
||||
|
||||
this.handler.handleResponse(extPushService.sendAsync(notification), subscription); // Async
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(String.format("Error while sending push notification for endpoint %s", subscription
|
||||
.getEndpoint()), e);
|
||||
|
||||
this.handler.handleError(e, subscription); // Async
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseReason.OK;
|
||||
}
|
||||
|
||||
private Urgency getExtUrgency(MessageDto messageDto) {
|
||||
return Urgency.valueOf(messageDto.getUrgency().name());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
spring.flyway.locations=classpath:/database/hsqldb
|
||||
|
||||
# DataSource
|
||||
#spring.datasource.url=jdbc:hsqldb:file:/tmp/push_service
|
||||
spring.datasource.url=jdbc:hsqldb:mem:.
|
||||
spring.datasource.username=sa
|
||||
@@ -0,0 +1,3 @@
|
||||
spring.datasource.url=jdbc:postgresql://localhost/push_service_mk
|
||||
spring.datasource.username=push_service_mk
|
||||
spring.datasource.password=push_service_mk
|
||||
@@ -0,0 +1,8 @@
|
||||
spring.flyway.locations=classpath:/database/postgres
|
||||
|
||||
spring.datasource.url=jdbc:postgresql://localhost/push_service
|
||||
spring.datasource.username=push_service
|
||||
spring.datasource.password=push_service
|
||||
|
||||
# See https://github.com/spring-projects/spring-boot/issues/12007
|
||||
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
|
||||
@@ -1,3 +1,5 @@
|
||||
spring.profiles.active=@activeProfiles@
|
||||
|
||||
server.servlet.context-path=/push-service-server
|
||||
server.port=8077
|
||||
|
||||
@@ -10,4 +12,10 @@ info.build.version=@project.version@
|
||||
logging.level.de.pushservice=DEBUG
|
||||
logging.file=push-service-server.log
|
||||
logging.file.max-history=7
|
||||
logging.file.max-size=50MB
|
||||
logging.file.max-size=50MB
|
||||
|
||||
# Disable JMX as we don't need it and it blocks parallel deployment on Tomcat
|
||||
# because the connection pool cannot shutdown properly
|
||||
spring.jmx.enabled=false
|
||||
|
||||
spring.jpa.hibernate.ddl-auto=validate
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE subscription (
|
||||
id BIGINT NOT NULL PRIMARY KEY IDENTITY,
|
||||
scope VARCHAR(2000) NOT NULL,
|
||||
auth VARCHAR(255) NOT NULL,
|
||||
"key" VARCHAR(255) NOT NULL,
|
||||
endpoint VARCHAR(2000) NOT NULL,
|
||||
insert_date DATETIME NOT NULL,
|
||||
last_seen DATETIME NOT NULL,
|
||||
error_count INTEGER NOT NULL,
|
||||
|
||||
CONSTRAINT un_subscription_scope_endpoint UNIQUE (scope, endpoint)
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE subscription (
|
||||
id BIGINT NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||
scope VARCHAR(2000) NOT NULL,
|
||||
auth VARCHAR(255) NOT NULL,
|
||||
"key" VARCHAR(255) NOT NULL,
|
||||
endpoint VARCHAR(2000) NOT NULL,
|
||||
insert_date TIMESTAMP NOT NULL,
|
||||
last_seen TIMESTAMP NOT NULL,
|
||||
error_count INTEGER NOT NULL,
|
||||
|
||||
CONSTRAINT un_subscription_scope_endpoint UNIQUE (scope, endpoint)
|
||||
);
|
||||
@@ -0,0 +1,31 @@
|
||||
package de.pushservice.server;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = PushServiceApplication.class)
|
||||
@AutoConfigureMockMvc
|
||||
@TestPropertySource(
|
||||
locations = "classpath:application-integrationtest.properties")
|
||||
public class PushServiceServerApplicationBootTest {
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@Test
|
||||
public void test_appBoots() {
|
||||
// Nothing to do in this test as we just want to startup the app
|
||||
// to make sure that spring, flyway and hibernate all work
|
||||
// as expected even after changes
|
||||
// While this slightly increases build time it's an easy and safe
|
||||
// way to ensure that the app can start
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
spring.profiles.active=hsqldb
|
||||
|
||||
spring.datasource.url=jdbc:hsqldb:mem:.
|
||||
spring.datasource.username=sa
|
||||
spring.flyway.locations=classpath:/database/hsqldb
|
||||
Reference in New Issue
Block a user