aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-04-18 14:52:34 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-04-18 14:52:34 +0200
commit91e6adb606382f10985777d225e4f62f0b624ceb (patch)
treeb14cd7037097f82451a929e00da71c161ad2dde9 /src/test/java
parentaed1250912476f47fd772b0cedd20c850cdcff6e (diff)
downloadmoa-zs-91e6adb606382f10985777d225e4f62f0b624ceb.tar.gz
moa-zs-91e6adb606382f10985777d225e4f62f0b624ceb.tar.bz2
moa-zs-91e6adb606382f10985777d225e4f62f0b624ceb.zip
Mock Pipeline in App2MzsServiceTests
- Reason: App2MzsServiceTests only run through the app2mzs front end without doing any pipeline work.
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
index 78dafdc..01b7745 100644
--- a/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
+++ b/src/test/java/at/gv/egiz/moazs/App2MzsServiceTest.java
@@ -1,11 +1,18 @@
package at.gv.egiz.moazs;
+import at.gv.e_government.reference.namespace.zustellung.msg.phase2._20181206_.ObjectFactory;
+import at.gv.egiz.moazs.pipeline.DeliveryPipeline;
+import at.gv.egiz.moazs.repository.DeliveryRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.context.TestConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Primary;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.IOException;
@@ -27,7 +34,29 @@ public class App2MzsServiceTest {
private final String basePath = "src/test/resources/at/gv/egiz/moazs/App2MzsServiceTest/";
- Logger logger = LoggerFactory.getLogger(App2MzsServiceTest.class);
+ private final static Logger logger = LoggerFactory.getLogger(App2MzsServiceTest.class);
+
+ @TestConfiguration
+ public static class TestConfig {
+
+ @Autowired
+ private DeliveryRepository repository;
+
+ private final ObjectFactory factory = new ObjectFactory();
+
+ @Bean
+ @Primary
+ public DeliveryPipeline deliveryPipelineThatAlwaysSucceeds() {
+ return appDeliveryId -> {
+ var status = factory.createDeliveryRequestStatusType();
+ var success = factory.createDeliveryRequestStatusTypeSuccess();
+ success.setAppDeliveryID(appDeliveryId);
+ status.setSuccess(success);
+ repository.add(status);
+ };
+ }
+ }
+
@Test
public void acceptValidDeliveryRequest() throws IOException, InterruptedException {