-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Opetushallitus/OK-365-raportointikali
OK-365 raportointikäyttöliittymä
- Loading branch information
Showing
62 changed files
with
9,242 additions
and
184 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,21 @@ package fi.oph.viestinvalitys | |
|
||
import fi.oph.viestinvalitys.vastaanotto.resource.LahetysAPIConstants | ||
import fi.oph.viestinvalitys.migraatio.LambdaHandler | ||
import fi.oph.viestinvalitys.util.{AwsUtil, ConfigurationUtil} | ||
import fi.oph.viestinvalitys.util.{AwsUtil, ConfigurationUtil, DbUtil} | ||
import org.apache.commons.io.IOUtils | ||
import software.amazon.awssdk.core.sync.RequestBody | ||
import software.amazon.awssdk.services.s3.model.{CreateBucketRequest, ListObjectsRequest, PutObjectRequest} | ||
import software.amazon.awssdk.services.ses.model.{ConfigurationSet, CreateConfigurationSetEventDestinationRequest, CreateConfigurationSetRequest, EventDestination, EventType, SNSDestination, VerifyDomainIdentityRequest} | ||
import software.amazon.awssdk.services.sns.model.{CreateTopicRequest, SubscribeRequest} | ||
import software.amazon.awssdk.services.sqs.model.{CreateQueueRequest, ListQueuesRequest} | ||
import com.amazonaws.services.lambda.runtime.{ClientContext, CognitoIdentity, Context, LambdaLogger} | ||
import fi.oph.viestinvalitys.business.{KantaOperaatiot, Kieli, Kontakti, Prioriteetti, SisallonTyyppi} | ||
import fi.oph.viestinvalitys.vastaanotto.security.SecurityConstants | ||
|
||
import java.util.UUID | ||
import scala.Range | ||
import scala.beans.BeanProperty | ||
import scala.collection.immutable.Range | ||
|
||
case class TestAwsContext( | ||
@BeanProperty awsRequestId: String, | ||
|
@@ -154,6 +158,103 @@ object LocalUtil { | |
|
||
// ajetaan migraatiolambdan koodi | ||
new LambdaHandler().handleRequest(null, new TestAwsContext("migraatio")) | ||
|
||
// alustetaan data | ||
val kantaOperaatiot = new KantaOperaatiot(DbUtil.database) | ||
val lahetyksia = kantaOperaatiot.getLahetykset(Option.empty, Option.apply(20), Set(SecurityConstants.SECURITY_ROOLI_KATSELU_FULL)) | ||
if(lahetyksia.isEmpty || lahetyksia.length < 3) { | ||
// lähetyksiä joissa räätälöity viesti useilla vastaanottajilla | ||
Range(0, 25).map(counter => { | ||
val lahetys = kantaOperaatiot.tallennaLahetys( | ||
"Testiotsikko "+counter, | ||
"omistaja", | ||
"hakemuspalvelu", | ||
Option.apply("0.1.2.3"), | ||
Kontakti(Option.apply("Testi Virkailija"+counter), "[email protected]"+counter), | ||
Option.apply("[email protected]"), | ||
Prioriteetti.NORMAALI, | ||
365 | ||
) | ||
// viestit lähetystunnuksella | ||
Range(0, 25).map(viestinro => { | ||
kantaOperaatiot.tallennaViesti("Viestin testiotsikko " + viestinro, | ||
"Viestin sisältö " + viestinro, | ||
SisallonTyyppi.TEXT, | ||
Set(Kieli.FI), | ||
Map.empty, | ||
Option.empty, | ||
Option.empty, | ||
Option.empty, | ||
Seq(Kontakti(Option.apply("Vastaanottaja " + viestinro), "vastaanottaja" + viestinro + "@example.com")), | ||
Seq.empty, | ||
Option.empty, | ||
Option.apply(lahetys.tunniste), | ||
Option.empty, | ||
Option.apply(365), | ||
Set(SecurityConstants.SECURITY_ROOLI_KATSELU_FULL), | ||
Map("avain" -> Seq("arvo")), | ||
"omistaja") | ||
}) | ||
}) | ||
// lähetys jossa samalla viestillä useita vastaanottajia | ||
val lahetys2 = kantaOperaatiot.tallennaLahetys( | ||
"Testiotsikko2", | ||
"omistaja", | ||
"hakemuspalvelu", | ||
Option.apply("0.1.2.3"), | ||
Kontakti(Option.apply("Joku Virkailija"), "[email protected]"), | ||
Option.apply("[email protected]"), | ||
Prioriteetti.NORMAALI, | ||
365 | ||
) | ||
kantaOperaatiot.tallennaViesti("Massaviestin testiotsikko", | ||
"Massaviestin sisältö", | ||
SisallonTyyppi.TEXT, | ||
Set(Kieli.FI), | ||
Map.empty, // maskit | ||
Option.empty, // läh. oid | ||
Option.empty, // lähettäjä | ||
Option.empty, // replyto | ||
Range(0, 20).map(suffix => Kontakti(Option.apply("Vastaanottaja" + suffix), "vastaanottaja" + suffix + "@example.com")), | ||
Seq.empty, | ||
Option.empty, | ||
Option.apply(lahetys2.tunniste), | ||
Option.apply(Prioriteetti.NORMAALI), | ||
Option.apply(365), | ||
Set(SecurityConstants.SECURITY_ROOLI_KATSELU_FULL), | ||
Map("avain" -> Seq("arvo")), | ||
"omistaja") | ||
// tyhjä lähetys | ||
val lahetys3 = kantaOperaatiot.tallennaLahetys( | ||
"Orpo lähetys", | ||
"omistaja", | ||
"osoitepalvelu", | ||
Option.apply("0.1.2.3"), | ||
Kontakti(Option.apply("Testi Virkailija"), "[email protected]"), | ||
Option.apply("[email protected]"), | ||
Prioriteetti.NORMAALI, | ||
365 | ||
) | ||
// viesti ilman lähetystunnusta | ||
kantaOperaatiot.tallennaViesti("Tärkeää asiaa", | ||
"Tärkeä sisältö", | ||
SisallonTyyppi.TEXT, | ||
Set(Kieli.FI), | ||
Map.empty, | ||
Option.apply("0.1.2.3"), | ||
Option.apply(Kontakti(Option.apply("Testi Virkailija"), "[email protected]")), | ||
Option.apply("[email protected]"), | ||
Range(0, 3).map(suffix => Kontakti(Option.apply("Vastaanottaja" + suffix), "vastaanottaja" + suffix + "@example.com")), | ||
Seq.empty, | ||
Option.apply("testipalvelu"), | ||
Option.empty, | ||
Option.apply(Prioriteetti.NORMAALI), | ||
Option.apply(365), | ||
Set(SecurityConstants.SECURITY_ROOLI_KATSELU_FULL), | ||
Map("avain" -> Seq("arvo")), | ||
"omistaja") | ||
} | ||
|
||
} | ||
|
||
class LocalUtil {} |
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
Oops, something went wrong.