Skip to content
Browse files

Slåfejl

  • Loading branch information...
1 parent bfdc776 commit 5e5022a1b84cc4b779cf81a255e1634ae1f840dc @jrftrifork jrftrifork committed Sep 12, 2012
View
2 README.md
@@ -5,6 +5,6 @@ Autorisationsimporteren er af typen der bruger en AuditingPersister
Læs stamdata dokumentation der ligger i SDM-Core projektet inden dette projekt bygges.
Se https://github.com/trifork/sdm4-core/tree/sdm-core-4.0/doc
-For at køre integrationstests, kræves en opsøtning som beskrevet i guide til udviklere
+For at køre integrationstests, kræves en opsætning som beskrevet i guide til udviklere
Klon repo med ```git clone https://github.com/trifork/sdm4-autorisationimporter.git```.
View
1 src/main/resources/default-config.properties
@@ -1,3 +1,4 @@
spooler.max.days.between.runs=30
jdbc.JNDIName=java:/SDMDS
sdm.dataDir=/pack/jboss/domain/data/sdm4
+spooler.autorisationimporter.max.allowed.reduction=10
View
29 src/test/java/dk/nsi/sdm4/autorisation/parser/AutParserTest.java
@@ -25,12 +25,10 @@
package dk.nsi.sdm4.autorisation.parser;
-import dk.nsi.sdm4.autorisation.config.AutorisationApplicationConfig;
import dk.nsi.sdm4.autorisation.model.Autorisation;
import dk.nsi.sdm4.core.parser.Parser;
import dk.nsi.sdm4.core.parser.ParserException;
import dk.nsi.sdm4.core.persistence.Persister;
-import dk.nsi.sdm4.testutils.TestDbConfiguration;
import dk.sdsd.nsp.slalog.api.SLALogger;
import dk.sdsd.nsp.slalog.impl.SLALoggerDummyImpl;
import org.apache.commons.io.FileUtils;
@@ -45,13 +43,11 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
-import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.IOException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
@RunWith(SpringJUnit4ClassRunner.class)
@@ -85,11 +81,13 @@ public JdbcTemplate jdbcTemplate() {
public static File valid;
public static File invalid;
+ private File validWith3Removed;
- @Before
+ @Before
public void setUp() {
valid = FileUtils.toFile(getClass().getClassLoader().getResource("data/aut/valid/20090915AutDK.csv"));
- invalid = FileUtils.toFile(getClass().getClassLoader().getResource("data/aut/invalid/20090915AutDK.csv"));
+ validWith3Removed = FileUtils.toFile(getClass().getClassLoader().getResource("data/aut/validWith3Removed/20090919AutDK.csv"));
+ invalid = FileUtils.toFile(getClass().getClassLoader().getResource("data/aut/invalid/20090915AutDK.csv"));
}
@Test
@@ -101,9 +99,20 @@ public void testParse() throws IOException {
assertEquals("0101280063", a.getCpr());
assertEquals("Tage Søgaard", a.getFornavn());
}
-
- @Test(expected = ParserException.class)
+
+ @Test
+ public void doesNotAllowNumberOfAutorisationerToDecreaseMoreThanThreshold() throws IOException {
+ try {
+ parser.parse(validWith3Removed, new DateTime());
+ fail("Expected exception from parser because number of autorisationer decreased too much");
+ } catch (ParserException e) {
+ assertTrue(e.getMessage().equals("Number of autorisationer in file was 3 lower than the number of active autorisationer in the database. " +
+ "This is more than the threshold of 1, so file is not imported"));
+ }
+ }
+
+ @Test(expected = ParserException.class)
public void testInvalid() throws IOException {
- new AutorisationParser().parse(invalid, new DateTime());
+ parser.parse(invalid, new DateTime());
}
}
View
2 src/test/resources/data/aut/validWith3Removed/20090919AutDK.csv
@@ -0,0 +1,2 @@
+0013L;0101290565;Heering;Eli;7170
+0013M;0101340074;�sterby;Ester Ruth;7170

0 comments on commit 5e5022a

Please sign in to comment.
Something went wrong with that request. Please try again.