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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ jdk_8_maven/em/external/rest/spring-batch-rest/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
/jdk_8_maven/cs/rest/original/notebook-manager/target/
/jdk_8_maven/em/embedded/rest/notebook-manager/target/
/jdk_8_maven/em/external/rest/notebook-manager/target/

/jdk_21_maven/cs/rest-gui/microcks/target
/jdk_21_maven/cs/rest-gui/microcks/commons/model/target
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ How to setup authentication information, based on the current content of the ini
Auth configuration files can found in the [auth](auth) folder.


### REST: Java/Kotlin (53)
### REST: Java/Kotlin (54)

* **AdoptMe** (not-known license), [jdk_21_maven/cs/rest/adoptme](jdk_21_maven/cs/rest/adoptme), from [https://github.com/daanimelian/Programacion3-TPO](https://github.com/daanimelian/Programacion3-TPO)

Expand Down Expand Up @@ -143,6 +143,8 @@ Auth configuration files can found in the [auth](auth) folder.

* **News** (LGPL), [jdk_8_maven/cs/rest/artificial/news](jdk_8_maven/cs/rest/artificial/news), from [https://github.com/arcuri82/testing_security_development_enterprise_systems](https://github.com/arcuri82/testing_security_development_enterprise_systems)

* **NoteBook Manager** (not-known license), [jdk_8_maven/cs/rest/original/notebook-manager](jdk_8_maven/cs/rest/original/notebook-manager), from [https://github.com/birddevelper/NoteBookManager](https://github.com/birddevelper/NoteBookManager)

* **OCVN** (MIT), [jdk_8_maven/cs/rest-gui/ocvn](jdk_8_maven/cs/rest-gui/ocvn), from [https://github.com/devgateway/ocvn](https://github.com/devgateway/ocvn)

* **Ohsome API** (AGPL-3.0), [jdk_17_maven/cs/rest/ohsome-api](jdk_17_maven/cs/rest/ohsome-api), from [https://github.com/GIScience/ohsome-api](https://github.com/GIScience/ohsome-api)
Expand Down
13 changes: 13 additions & 0 deletions dockerfiles/notebook-manager.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM amazoncorretto:8-alpine-jdk

COPY ./dist/notebook-manager-sut.jar .
COPY ./dist/jacocoagent.jar .




ENTRYPOINT \
java \
-javaagent:jacocoagent.jar=output=tcpserver,address=*,port=6300,append=false,dumponexit=false \
-jar notebook-manager-sut.jar \
--server.port=8080 --spring.datasource.url="jdbc:mysql://db:3306/notebook_manager?useSSL=false&allowPublicKeyRetrieval=true" --spring.datasource.username=root --spring.datasource.password=root
45 changes: 45 additions & 0 deletions dockerfiles/notebook-manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
services:
mitmproxy:
image: mitmproxy/mitmproxy:10.2.4
user: "0:0"
environment:
MITM_LOG_DIR: /custom-logs
MITM_LOG_FILE: ${MITM_LOG_FILE:-minlog.csv}
command: >
mitmdump
--mode reverse:http://sut-notebook-manager:8080
--listen-host 0.0.0.0
--listen-port 8080
--set keep_host_header=true
-s /addons/minlog.py
volumes:
- ${HOST_LOG_DIR:-./mitm-logs}:/custom-logs
- ./addons:/addons:ro
ports:
- "${HOST_PORT:-8080}:8080"
depends_on:
- sut-notebook-manager
sut-notebook-manager:
image: webfuzzing/wfd-notebook-manager:FINAL
# build:
# dockerfile: ./dockerfiles/notebook-manager.dockerfile
# context: ..
environment:
AUTH_PORT: ${AUTH_PORT:-8081}
ports:
- "${JACOCO_PORT:-6300}:6300"
depends_on:
db:
condition: service_healthy
db:
image: mysql:8.0
tmpfs:
- '/var/lib/mysql'
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: notebook_manager
healthcheck:
test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
interval: 30s
timeout: 30s
retries: 3
1 change: 1 addition & 0 deletions experiments/bb-exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def __init__(self, name, auth, sleep, schemaformat, classfiles):
"jdk_21_maven/cs/rest-gui/microcks/minions/async/target/classes",
"jdk_21_maven/cs/rest-gui/microcks/webapp/target/classes"]),
Sut("movies-xml",False,SLEEP,JSON,["jdk_21_maven/cs/rest/movies-xml/target/classes"]),
Sut("notebook-manager",False,SLEEP,JSON,["jdk_8_maven/cs/rest/original/notebook-manager/target/classes"]),
Sut("ocvn",True,SLEEP,JSON,["jdk_8_maven/cs/rest-gui/ocvn/persistence/target/classes",
"jdk_8_maven/cs/rest-gui/ocvn/persistence-mongodb/target/classes",
"jdk_8_maven/cs/rest-gui/ocvn/web/target/classes"]),
Expand Down
1 change: 1 addition & 0 deletions experiments/wb-exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def __init__(self, name, platform):
Sut("market", JDK_11),
Sut("microcks", JDK_21),
Sut("movies-xml", JDK_21),
Sut("notebook-manager", JDK_8),
Sut("ocvn", JDK_8),
Sut("ohsome-api", JDK_17),
Sut("pay-publicapi",JDK_11),
Expand Down
1 change: 1 addition & 0 deletions jacoco.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ COPY jdk_21_maven/cs/rest-gui/microcks/distro/uber-async-minion/target/classes
COPY jdk_21_maven/cs/rest-gui/microcks/minions/async/target/classes ${CLASS_FILES}/jdk_21_maven/cs/rest-gui/microcks/minions/async/target/classes
COPY jdk_21_maven/cs/rest-gui/microcks/webapp/target/classes ${CLASS_FILES}/jdk_21_maven/cs/rest-gui/microcks/webapp/target/classes
COPY jdk_21_maven/cs/rest/movies-xml/target/classes ${CLASS_FILES}/jdk_21_maven/cs/rest/movies-xml/target/classes
COPY jdk_8_maven/cs/rest/original/notebook-manager/target/classes ${CLASS_FILES}/jdk_8_maven/cs/rest/original/notebook-manager/target/classes
COPY jdk_8_maven/cs/rest-gui/ocvn/persistence/target/classes ${CLASS_FILES}/jdk_8_maven/cs/rest-gui/ocvn/persistence/target/classes
COPY jdk_8_maven/cs/rest-gui/ocvn/persistence-mongodb/target/classes ${CLASS_FILES}/jdk_8_maven/cs/rest-gui/ocvn/persistence-mongodb/target/classes
COPY jdk_8_maven/cs/rest-gui/ocvn/web/target/classes ${CLASS_FILES}/jdk_8_maven/cs/rest-gui/ocvn/web/target/classes
Expand Down
4 changes: 4 additions & 0 deletions jdk_21_maven/cs/rest/flight-search-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,15 @@
<version>${openapi.version}</version>
</dependency>

<!-- MODIFIED-->
<!-- Duplicate of the dependency above; newer Maven fails the build on it.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc-openapi.version}</version>
</dependency>
-->
<!-- MODIFIED-->

<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
4 changes: 4 additions & 0 deletions jdk_8_maven/cs/rest/original/notebook-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- MODIFIED-->
<finalName>notebook-manager</finalName>
<classifier>sut</classifier>
<!-- MODIFIED-->
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
Expand Down
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 @@ -27,6 +27,7 @@
<module>spring-actuator-demo</module>
<module>swagger-petstore</module>
<module>spring-ecommerce</module>
<module>notebook-manager</module>
</modules>


Expand Down
48 changes: 48 additions & 0 deletions jdk_8_maven/em/embedded/rest/notebook-manager/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>evomaster-benchmark-em-embedded-rest-notebook-manager</artifactId>
<packaging>jar</packaging>

<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-benchmark-em-embedded-rest</artifactId>
<version>4.3.1-SNAPSHOT</version>
</parent>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.6.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>bdp.sample</groupId>
<artifactId>NoteBookManagerRest</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>compile</scope>
</dependency>
</dependencies>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
package em.embedded.bdp.sample.notebookmanager;


import bdp.sample.notebookmanager.NoteBookApplication;
import org.evomaster.client.java.controller.EmbeddedSutController;
import org.evomaster.client.java.controller.InstrumentedSutStarter;
import org.evomaster.client.java.controller.api.dto.SutInfoDto;
import org.evomaster.client.java.controller.api.dto.auth.AuthenticationDto;
import org.evomaster.client.java.controller.api.dto.database.schema.DatabaseType;
import org.evomaster.client.java.controller.problem.ProblemInfo;
import org.evomaster.client.java.controller.problem.RestProblem;
import org.evomaster.client.java.sql.DbSpecification;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.testcontainers.containers.GenericContainer;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;

/**
* Class used to start/stop the SUT.
*/
public class EmbeddedEvoMasterController extends EmbeddedSutController {

public static void main(String[] args) {

int port = 40100;
if (args.length > 0) {
port = Integer.parseInt(args[0]);
}

EmbeddedEvoMasterController controller = new EmbeddedEvoMasterController(port);
InstrumentedSutStarter starter = new InstrumentedSutStarter(controller);

starter.start();
}

private static final String DB_NAME = "notebook_manager";

private static final GenericContainer mysql = new GenericContainer("mysql:8.0")
.withEnv(new HashMap<String, String>(){{
put("MYSQL_ROOT_PASSWORD", "root");
put("MYSQL_DATABASE", DB_NAME);
}})
.withExposedPorts(3306)
.withTmpFs(Collections.singletonMap("/var/lib/mysql", "rw"));

private ConfigurableApplicationContext ctx;
private Connection sqlConnection;
private List<DbSpecification> dbSpecification;

public EmbeddedEvoMasterController() {
this(40100);
}

public EmbeddedEvoMasterController(int port) {
setControllerPort(port);
}

@Override
public String startSut() {

mysql.start();

String url = "jdbc:mysql://" + mysql.getHost() + ":" + mysql.getMappedPort(3306) + "/" + DB_NAME
+ "?useSSL=false&allowPublicKeyRetrieval=true";

ctx = SpringApplication.run(NoteBookApplication.class, new String[]{
"--server.port=0",
"--spring.datasource.url=" + url,
"--spring.datasource.username=root",
"--spring.datasource.password=root"
});

closeDataBaseConnection();
JdbcTemplate jdbc = ctx.getBean(JdbcTemplate.class);
try {
sqlConnection = jdbc.getDataSource().getConnection();
} catch (SQLException e) {
throw new RuntimeException(e);
}

dbSpecification = Arrays.asList(new DbSpecification(DatabaseType.MYSQL, sqlConnection));

return "http://localhost:" + getSutPort();
}

protected int getSutPort() {
return (Integer) ((Map) ctx.getEnvironment()
.getPropertySources().get("server.ports").getSource())
.get("local.server.port");
}


@Override
public boolean isSutRunning() {
return ctx != null && ctx.isRunning();
}

@Override
public void stopSut() {
closeDataBaseConnection();
if (ctx != null) {
ctx.stop();
ctx.close();
}
mysql.stop();
}

private void closeDataBaseConnection() {
if (sqlConnection != null) {
try {
sqlConnection.close();
} catch (SQLException e) {
e.printStackTrace();
}
sqlConnection = null;
}
}

@Override
public String getPackagePrefixesToCover() {
return "bdp.sample.notebookmanager.";
}

@Override
public void resetStateOfSUT() {
}

@Override
public List<AuthenticationDto> getInfoForAuthentication() {
return null;
}


@Override
public ProblemInfo getProblemInfo() {
return new RestProblem(
"http://localhost:" + getSutPort() + "/v3/api-docs",
null
);
}

@Override
public SutInfoDto.OutputFormat getPreferredOutputFormat() {
return SutInfoDto.OutputFormat.JAVA_JUNIT_4;
}

@Override
public List<DbSpecification> getDbSpecifications() {
return dbSpecification;
}

}
1 change: 1 addition & 0 deletions jdk_8_maven/em/embedded/rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<module>spring-actuator-demo</module>
<module>swagger-petstore</module>
<module>spring-ecommerce</module>
<module>notebook-manager</module>
</modules>

</project>
Loading
Loading