Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,8 @@ jdk_8_maven/em/external/rest/spring-batch-rest/target

/jdk_11_maven/cs/rest/http-patch-spring/target
/jdk_11_maven/em/embedded/rest/http-patch-spring/target
/jdk_11_maven/em/external/rest/http-patch-spring/target
/jdk_11_maven/em/external/rest/http-patch-spring/target

/jdk_8_maven/cs/rest/original/spring-ecommerce/target
/jdk_8_maven/em/embedded/rest/spring-ecommerce/target
/jdk_8_maven/em/external/rest/spring-ecommerce/target
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ For simplicity, all schemas are also available as JSON/YML files under the folde
> **IMPORTANT**: More details (e.g., #LOCs and used databases) on these APIs can be found [in this table](statistics/table_emb.md).


### REST: Java/Kotlin (33)
### REST: Java/Kotlin (34)

* **Bibliothek** (MIT), [jdk_17_gradle/cs/rest/bibliothek](jdk_17_gradle/cs/rest/bibliothek), from [https://github.com/PaperMC/bibliothek](https://github.com/PaperMC/bibliothek)

Expand Down Expand Up @@ -128,6 +128,8 @@ For simplicity, all schemas are also available as JSON/YML files under the folde

* **Spring Boot Restful API Example** (MIT), [jdk_17_maven/cs/rest/spring-rest-example](jdk_17_maven/cs/rest/spring-rest-example), from [https://github.com/phantasmicmeans/spring-boot-restful-api-example](https://github.com/phantasmicmeans/spring-boot-restful-api-example)

* **Spring ECommerce** (not-known license), [jdk_8_maven/cs/rest/original/spring-ecommerce](jdk_8_maven/cs/rest/original/spring-ecommerce), from [https://github.com/SaiUpadhyayula/SpringAngularEcommerce](https://github.com/SaiUpadhyayula/SpringAngularEcommerce)

* **Swagger Petstore** (Apache), [jdk_8_maven/cs/rest/original/swagger-petstore](jdk_8_maven/cs/rest/original/swagger-petstore), from [https://github.com/swagger-api/swagger-petstore](https://github.com/swagger-api/swagger-petstore)

* **Tiltaksgjennomføring** (MIT), [jdk_17_maven/cs/rest/tiltaksgjennomforing](jdk_17_maven/cs/rest/tiltaksgjennomforing), from [https://github.com/navikt/tiltaksgjennomforing-api](https://github.com/navikt/tiltaksgjennomforing-api)
Expand Down
17 changes: 17 additions & 0 deletions auth/spring-ecommerce-auth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
auth:
- name: user1
loginEndpointAuth:
payloadRaw: "{\"username\": \"user1\", \"password\": \"12345678\"}"
- name: user2
loginEndpointAuth:
payloadRaw: "{\"username\": \"user2\", \"password\": \"12345678\"}"

authTemplate:
loginEndpointAuth:
endpoint: /api/auth/login
verb: POST
contentType: application/json
token:
extractFromField: /accessToken
httpHeaderName: Authorization
headerPrefix: "Bearer "
2 changes: 2 additions & 0 deletions dockerfiles/bibliothek.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: mongo:6
tmpfs:
Expand All @@ -21,3 +22,4 @@ services:




8 changes: 6 additions & 2 deletions dockerfiles/blogapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ services:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco
depends_on:

db:
condition: service_healthy
condition: service_healthy



db:
image: mysql:8.0
tmpfs:
Expand All @@ -35,9 +38,10 @@ services:


healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
interval: 30s
timeout: 30s
retries: 3



2 changes: 2 additions & 0 deletions dockerfiles/familie-ba-sak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: postgres:13.13
tmpfs:
Expand All @@ -27,6 +28,7 @@ services:




mock-oauth2-server:
image: ghcr.io/navikt/mock-oauth2-server:2.0.1
environment:
Expand Down
2 changes: 2 additions & 0 deletions dockerfiles/genome-nexus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: mongo:3.6.2
tmpfs:
Expand All @@ -21,3 +22,4 @@ services:




2 changes: 2 additions & 0 deletions dockerfiles/gestaohospital.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: mongo:6
tmpfs:
Expand All @@ -21,3 +22,4 @@ services:




2 changes: 2 additions & 0 deletions dockerfiles/ocvn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: mongo:3.2
tmpfs:
Expand All @@ -21,3 +22,4 @@ services:




2 changes: 2 additions & 0 deletions dockerfiles/pay-publicapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: redis:7.2.3






2 changes: 2 additions & 0 deletions dockerfiles/person-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: mongo:7.0
tmpfs:
Expand All @@ -21,3 +22,4 @@ services:




2 changes: 2 additions & 0 deletions dockerfiles/reservations-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: bitnami/mongodb:4.4
tmpfs:
Expand All @@ -31,3 +32,4 @@ services:




2 changes: 2 additions & 0 deletions dockerfiles/session-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: mongo:6.0
tmpfs:
Expand All @@ -21,3 +22,4 @@ services:




17 changes: 17 additions & 0 deletions dockerfiles/spring-ecommerce.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM amazoncorretto:8-alpine-jdk

COPY ./dist/spring-ecommerce-sut.jar .
COPY ./dist/jacocoagent.jar .



#ENV TOOL="undefined"
#ENV RUN="0"

ENTRYPOINT \
java \
# unfortunately dumponexit is completely unreliable in Docker :(
# -javaagent:jacocoagent.jar=destfile=./jacoco/spring-ecommerce__${TOOL}__${RUN}__jacoco.exec,append=false,dumponexit=true \
-javaagent:jacocoagent.jar=output=tcpserver,address=*,port=6300,append=false,dumponexit=false \
-Dfile.encoding=ISO-8859-1 -jar spring-ecommerce-sut.jar \
--server.port=8080 --spring.datasource.host=mongodb --spring.datasource.port=27017 --spring.datasource.database=test --spring.data.mongodb.uri=mongodb://mongodb:27017/test --spring.redis.host=redis --spring.redis.port=6379 --spring.data.elasticsearch.cluster-name=elasticsearch --spring.data.elasticsearch.cluster-nodes=elasticsearch:9300 --spring.elasticsearch.rest.uris=elasticsearch:9200 --spring.data.elasticsearch.host=elasticsearch --spring.data.elasticsearch.port=9300 --spring.cache.type=NONE
60 changes: 60 additions & 0 deletions dockerfiles/spring-ecommerce.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
services:
sut-spring-ecommerce:
build:
dockerfile: ./dockerfiles/spring-ecommerce.dockerfile
context: ..
# environment:
# TOOL: ${TOOL:-undefined}
# RUN: ${RUN:-0}
ports:
- "${HOST_PORT:-8080}:8080"
- "${JACOCO_PORT:-6300}:6300"
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

mongodb:
image: mongo:7.0
tmpfs:
- '/data/db'


environment:
MONGODB_REPLICA_SET_MODE: primary
ALLOW_EMPTY_PASSWORD: yes



volumes:
- ../scripts/dockerize/data/additional_files/spring-ecommerce/mongo_import.sh:/docker-entrypoint-initdb.d/mongo_import.sh
- ../scripts/dockerize/data/additional_files/spring-ecommerce/init.json:/fixtures/init.json





redis:
image: redis:7.0.11






elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.23
tmpfs:
- '/usr/share/elasticsearch/data'


environment:
- discovery.type=single-node
- cluster.name=elasticsearch
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- xpack.security.enabled=false






8 changes: 6 additions & 2 deletions dockerfiles/spring-rest-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ services:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco
depends_on:

db:
condition: service_healthy
condition: service_healthy



db:
image: mysql:8.0
tmpfs:
Expand All @@ -30,9 +33,10 @@ services:


healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
interval: 30s
timeout: 30s
retries: 3



2 changes: 2 additions & 0 deletions dockerfiles/tiltaksgjennomforing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
# volumes:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco

db:
image: postgres:13.13
tmpfs:
Expand All @@ -27,6 +28,7 @@ services:




mock-oauth2-server:
image: ghcr.io/navikt/mock-oauth2-server:2.0.1
environment:
Expand Down
8 changes: 6 additions & 2 deletions dockerfiles/user-management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ services:
# default env does not work on volumes
# - ${JACOCODIR}:/jacoco
depends_on:

db:
condition: service_healthy
condition: service_healthy



db:
image: mysql:8.0
tmpfs:
Expand All @@ -30,9 +33,10 @@ services:


healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
interval: 30s
timeout: 30s
retries: 3



1 change: 1 addition & 0 deletions jdk_8_maven/cs/rest/original/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<module>spring-batch-rest</module>
<module>spring-actuator-demo</module>
<module>swagger-petstore</module>
<module>spring-ecommerce</module>
</modules>


Expand Down
18 changes: 18 additions & 0 deletions jdk_8_maven/cs/rest/original/spring-ecommerce/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,31 @@
<artifactId>mapstruct</artifactId>
<version>1.3.0.Final</version>
</dependency>
<!-- MODIFIED-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<!-- MODIFIED-->
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- MODIFIED-->
<configuration>
<finalName>spring-ecommerce</finalName>
<classifier>sut</classifier>
</configuration>
<!-- MODIFIED-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public void configure(HttpSecurity httpSecurity) throws Exception {
.authorizeRequests()
.antMatchers("/api/auth/**")
.permitAll()
.antMatchers("/api/store/catalog/**")
.antMatchers("/api/store/catalog/**",
// MODIFIED
"/v2/api-docs/**")
.permitAll()
.anyRequest().authenticated();

Expand Down
Loading
Loading