Skip to content

Commit f8119e3

Browse files
author
olovholm
committed
Ny historikk
0 parents  commit f8119e3

File tree

651 files changed

+49327
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

651 files changed

+49327
-0
lines changed

.dockerignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*
2+
!server/target
3+
!server/lib
4+
!model
5+
!resources/pipeline
6+
!server/src/main/resources/logback.xml
7+
!server/kafkasecurity.conf
8+
!*.sh

.githooks/commit-msg

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to check the commit log message.
4+
# Called by "git commit" with one argument, the name of the file
5+
# that has the commit message. The hook should exit with non-zero
6+
# status after issuing an appropriate message if it wants to stop the
7+
# commit. The hook is allowed to edit the commit message file.
8+
#
9+
#
10+
# Tillater kun commit meldinger som starter med "PK-12345: ", "FPFEIL-12: ", "FIX: " eller "Merge "
11+
12+
regex="^(PK-[0-9]{5}|FPFEIL-[0-9]{1,}|FIX|Merge|NOJIRA|RELEASE|PFP-[0-9]{1,}|PKGYRINUS-[0-9]{1,}|PKMANTIS-[0-9]{1,}|updating poms)(:|,)? .*"
13+
commit_msg=$(cat $1)
14+
15+
error_msg="Avbryter commit. Det er kun tillat med commit meldinger som begynne med \"PK-nnnnn \", \"FPFEIL-nn \", \"FIX \", \"NOJIRA\" eller \"Merge \"."
16+
17+
if [[ ! $commit_msg =~ $regex ]]; then
18+
echo "$error_msg" >&2
19+
exit 1
20+
fi

.githooks/pre-commit

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
isMaster=$(git branch | grep \* | sed 's/* master$/1/g')
4+
5+
error_msg="Avbryter commit. Det er ikke tillat å committe til master."
6+
7+
if [[ "$isMaster" = "1" ]]; then
8+
echo "$error_msg" >&2
9+
exit 1
10+
fi

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.settings
2+
target
3+
.project
4+
.classpath
5+
*.iml
6+
.idea
7+
_*.sh
8+
*.local
9+
*.localz
10+
es.properties
11+
*.zip
12+
*.versionsBackup
13+
bin
14+
mock*.log
15+
mock.log.*
16+
.mvn/maven.config
17+
.flattened
18+
logs
19+
*.log
20+
APP_LOG_HOME_IS_UNDEFINED
21+
application-local.properties
22+
.allure
23+
.allure/*
24+
allure-results/*
25+
*-result.json
26+
server/src/main/resources/webapps
27+
resources/ssl-terminator/localhost.*

.java-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
11.0

.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>fpmock2</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.m2e.core.maven2Builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
16+
</natures>
17+
</projectDescription>

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @navikt/foreldrepenger

Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM navikt/java:11
2+
3+
ENV JAVA_OPTS="-Dscenarios.dir=/app/model/scenarios/"
4+
ENV DUMMYPROP=fraDockerfile
5+
6+
ARG JAR_FILE
7+
8+
RUN mkdir /app/lib
9+
COPY server/target/lib/*.jar /app/lib/
10+
COPY model/scenarios/ /app/model/scenarios/
11+
RUN chmod -R 777 /app/model/scenarios/
12+
13+
COPY server/kafkasecurity.conf /app/
14+
COPY server/src/main/resources/logback.xml logback.xml
15+
COPY server/target/server*.jar app.jar
16+
COPY run-java.sh /
17+
18+
EXPOSE 8636 8063 8060 8389 9093
19+
20+
RUN chmod +x /run-java.sh

Jenkinsfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@Library('vl-jenkins')_
2+
naisPipeline()

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License
2+
3+
Copyright 2019 NAV (Arbeids- og velferdsdirektoratet) - The Norwegian Labour and Welfare Administration
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the "Software"),
7+
to deal in the Software without restriction, including without limitation
8+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
9+
and/or sell copies of the Software, and to permit persons to whom the
10+
Software is furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included
13+
in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21+
USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Virtuell Tjeneste Plattform (VTP)
2+
=================================
3+
![alt text](vtp.png "Logo Title Text 1")
4+
5+
6+
VTP hjelper deg med å:
7+
- virtualisere grensesnitt rundt applikasjonene i FP-familien.
8+
- instansierer og holde testdata konsistente på tvers av grensesnittene
9+
- ha en plattform for å simulere grensesnitt over REST, SOAP, Kafka, LDAP.
10+
- sikkerhetshåndtering over OAuth2
11+
- REST-grensesnitt for å programatisk opprette testdata (for automatiske tester)
12+
- GUI for å opprette testdata for mennesker.
13+
14+
# Henvendelser
15+
16+
Team Foreldrepenger <teamforeldrepenger(at)nav.no>
17+
18+
## For NAV-ansatte
19+
20+
Interne henvendelser kan sendes via Slack i kanalen #vtp-chatten
21+
22+
23+
# Hvordan komme igang - Oppsett og konfigurasjon
24+
25+
26+
Starte server
27+
----
28+
* Start mock serveren ved å kjøre MockServer (lokalt).
29+
* Trenger parameter -Dscenarios.dir="../model/scenarios" dersom denne ikke ligger under working dir (dvs. i IDE).
30+
* Swagger UI: https://localhost:8063/swagger/ - Bruk HTTP for kall
31+
* SoapWebServiceConfig.java inneholder endepunker for virtuelle tjenester.
32+
* VTP trenger Keystore og Truststore liggende i mappe .modig på brukerens hjemme-mappe, eller konfigurert gjennom verdier angitt i avsnitt om sikkerhet.
33+
34+
Front-end
35+
---
36+
* I mappen frontend kjør yarn run serve. Når VTP bygges så pakkes det også med en statisk versjon av front-end som er tilgjengelig på rot av localhost:8060 eller https://localhost:8063.
37+
* Dersom bygg feiler på utviklerimage, forsøk å oppdater node / yarn. Oppdaterte versjoner ligger på http://a34apvl063.devillo.no:81/software/.
38+
39+
40+
Opprette testdata
41+
----
42+
* Opprett testdata ved å lage scenario i /model/scenarios. Innledende tall brukes som referanse for å få instansiert scenario fra Autotest.
43+
44+
Kjør tester
45+
----
46+
* Automatiske tester for FPSAK (og andre FP*-familieapplikasjoner) ligger i eget repo på GitHub (private): [fpsak-autotest link](https://github.com/navikt/fpsak-autotest)
47+
48+
Koble FP*-applikasjoner til VTP
49+
------
50+
51+
* Start applikasjonen med --vtp i oppstartsparameterne for å gå mot VTP istedet for testmiljø.
52+
53+
Sikkerhet
54+
----
55+
For å få VTP til å kjøre med SSL/TLS forbindelse over SOAP, REST og Kafka må keystore angitt i VTP være tilgjengelig i SUT (System under test) sin Truststore.
56+
For lokal utvikling på Team Foreldrepenger er trust- og keystore distribuert. På laptop kan disse genereres selv. Følgende systemvariabler kan defineres for å overstyre defaults i VTP.
57+
Alias for sertifikatet er localhost-ssl
58+
59+
```bash
60+
JAVAX_NET_SSL_TRUSTSTORE
61+
JAVAX_NET_SSL_TRUSTSTOREPASSWORD
62+
NO_NAV_MODIG_SECURITY_APPCERT_KEYSTORE
63+
NO_NAV_MODIG_SECURITY_APPCERT_PASSWORD
64+
```
65+
66+
67+
Utvikling, wsdl
68+
----
69+
Se SoapWebServerConfig for liste over url til genererte wsdl'er. Nye webtjenester registreres her.
70+
Se ApplicationConfig for liste over registrerte REST-tjenester. Nye REST-tjenester registreres her.
71+
72+
73+
### Kjøre via docker run / docker-compose
74+
Lagt til noen forenklinger på environment variabler når vi kjører opp VTP + Autotest i docker. Se
75+
`./resources/pipeline/readme.md` for mer info. Test certifikater er allerede lagt inn i imaget. Men man må
76+
fortsatt sette path riktig.
77+
78+
79+
Bygge fpmock lokalt. Imaget blir da tilgjengelig som fpmock2:latest
80+
```
81+
docker build -t fpmock2 .
82+
```

core/pom.xml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>no.nav.foreldrepenger.vtp</groupId>
9+
<artifactId>vtp</artifactId>
10+
<version>${revision}${sha1}${changelist}</version>
11+
</parent>
12+
13+
<artifactId>core</artifactId>
14+
<packaging>jar</packaging>
15+
<name>VTP ::Felles</name>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>no.nav.foreldrepenger.vtp</groupId>
20+
<artifactId>testmodell</artifactId>
21+
</dependency>
22+
<dependency>
23+
<groupId>io.swagger</groupId>
24+
<artifactId>swagger-jaxrs</artifactId>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.bitbucket.b_c</groupId>
28+
<artifactId>jose4j</artifactId>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.apache.cxf</groupId>
32+
<artifactId>cxf-rt-ws-security</artifactId>
33+
<exclusions>
34+
<exclusion>
35+
<groupId>javax.xml.ws</groupId>
36+
<artifactId>jaxws-api</artifactId>
37+
</exclusion>
38+
<exclusion>
39+
<groupId>com.sun.activation</groupId>
40+
<artifactId>javax.activation</artifactId>
41+
</exclusion>
42+
<exclusion>
43+
<groupId>javax.annotation</groupId>
44+
<artifactId>javax.annotation-api</artifactId>
45+
</exclusion>
46+
<exclusion>
47+
<groupId>com.sun.xml.messaging.saaj</groupId>
48+
<artifactId>saaj-impl</artifactId>
49+
</exclusion>
50+
</exclusions>
51+
</dependency>
52+
<!-- 3dje parts biblioteker -->
53+
<dependency>
54+
<groupId>com.sun.xml.ws</groupId>
55+
<artifactId>jaxws-rt</artifactId>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.junit.vintage</groupId>
59+
<artifactId>junit-vintage-engine</artifactId>
60+
<scope>test</scope>
61+
</dependency>
62+
</dependencies>
63+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package no.nav.foreldrepenger.vtp.felles;
2+
3+
import java.time.LocalDate;
4+
import java.time.LocalDateTime;
5+
import java.time.ZoneId;
6+
import java.util.Date;
7+
import java.util.GregorianCalendar;
8+
9+
import javax.xml.datatype.DatatypeConfigurationException;
10+
import javax.xml.datatype.DatatypeFactory;
11+
import javax.xml.datatype.XMLGregorianCalendar;
12+
13+
import org.slf4j.Logger;
14+
import org.slf4j.LoggerFactory;
15+
16+
public class ConversionUtils {
17+
18+
private static final Logger LOG = LoggerFactory.getLogger(ConversionUtils.class);
19+
20+
public static XMLGregorianCalendar convertToXMLGregorianCalendar(LocalDateTime localDateTime) {
21+
if(localDateTime==null) {
22+
return null;
23+
}
24+
GregorianCalendar gregorianCalendar = new GregorianCalendar();
25+
gregorianCalendar.setTime(Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()));
26+
XMLGregorianCalendar xmlGregorianCalendar = null;
27+
try {
28+
xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar);
29+
} catch (DatatypeConfigurationException e) {
30+
LOG.error("", e);
31+
}
32+
return xmlGregorianCalendar;
33+
}
34+
35+
public static XMLGregorianCalendar convertToXMLGregorianCalendar(LocalDate localDate) {
36+
37+
if (localDate == null) {
38+
return null;
39+
} else {
40+
XMLGregorianCalendar xmlGregorianCalendar = null;
41+
GregorianCalendar gregorianCalendar = GregorianCalendar.from(localDate.atStartOfDay(ZoneId.systemDefault()));
42+
try {
43+
xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar);
44+
}
45+
catch (DatatypeConfigurationException e) {
46+
LOG.error("", e);
47+
}
48+
return xmlGregorianCalendar;
49+
}
50+
}
51+
52+
public static LocalDateTime convertToLocalDateTime(XMLGregorianCalendar xmlGregorianCalendar) {
53+
if (xmlGregorianCalendar == null) {
54+
return null;
55+
}
56+
return LocalDateTime.ofInstant(xmlGregorianCalendar.toGregorianCalendar().getTime().toInstant(), ZoneId.systemDefault());
57+
}
58+
59+
public static LocalDate convertToLocalDate(XMLGregorianCalendar xmlGregorianCalendar) {
60+
if (xmlGregorianCalendar == null) {
61+
return null;
62+
}
63+
return xmlGregorianCalendar.toGregorianCalendar().toZonedDateTime().toLocalDate();
64+
}
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package no.nav.foreldrepenger.vtp.felles;
2+
3+
import java.util.HashMap;
4+
5+
public class ExpectPredicate extends HashMap<String, String>{
6+
7+
public ExpectPredicate(String key, String value) {
8+
this.put(key, value);
9+
}
10+
11+
public ExpectPredicate() {
12+
13+
}
14+
15+
@Override
16+
public boolean equals(Object o) {
17+
return super.equals(o);
18+
}
19+
20+
}

0 commit comments

Comments
 (0)