-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/fleming' into feature/eds-revolution
- Loading branch information
Showing
16 changed files
with
455 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/IDateValidationSRV.java
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/DateValidationSRV.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/test/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/AccreditamentoSimulationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package it.finanze.sanita.fse2.ms.gtw.dispatcher; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.mock.mockito.MockBean; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.config.Constants; | ||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.EventTypeEnum; | ||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.exceptions.ConnectionRefusedException; | ||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.service.IAccreditamentoSimulationSRV; | ||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.service.IEngineSRV; | ||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.utility.FileUtility; | ||
|
||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
@ActiveProfiles(Constants.Profile.TEST) | ||
public class AccreditamentoSimulationTest { | ||
|
||
@Autowired | ||
private IAccreditamentoSimulationSRV service; | ||
|
||
@MockBean | ||
private IEngineSRV engines; | ||
|
||
@Test | ||
void simulationCrashTimeoutTest() { | ||
byte[] pdfAttachment = FileUtility.getFileFromInternalResources("Files/accreditamento/SIGNED_LDO1.pdf"); | ||
assertThrows(ConnectionRefusedException.class, () -> service.runSimulation("CRASH_TIMEOUT_id", pdfAttachment, EventTypeEnum.GENERIC_ERROR)); | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/test/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/EngineRepoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package it.finanze.sanita.fse2.ms.gtw.dispatcher; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.Date; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.data.mongodb.core.MongoTemplate; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.config.Constants; | ||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.repository.entity.engine.EngineETY; | ||
import it.finanze.sanita.fse2.ms.gtw.dispatcher.repository.mongo.IEngineRepo; | ||
|
||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
@ActiveProfiles(Constants.Profile.TEST) | ||
public class EngineRepoTest { | ||
|
||
@Autowired | ||
private MongoTemplate mongoTemplate; | ||
|
||
@Autowired | ||
private IEngineRepo repository; | ||
|
||
@BeforeEach | ||
void init() { | ||
mongoTemplate.dropCollection(EngineETY.class); | ||
} | ||
|
||
@Test | ||
void getLatestEngineTest() { | ||
// Data preparation | ||
EngineETY engine = new EngineETY(); | ||
engine.setId("id_test"); | ||
engine.setLastSync(new Date()); | ||
engine.setAvailable(true); | ||
// Insert engine on DB | ||
mongoTemplate.insert(engine); | ||
// Perform getLatestEngine() | ||
EngineETY response = repository.getLatestEngine(); | ||
// Assertions | ||
assertEquals(engine.getId(), response.getId()); | ||
assertEquals(engine.getLastSync(), response.getLastSync()); | ||
assertTrue(response.isAvailable()); | ||
} | ||
|
||
} |
Oops, something went wrong.