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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,7 @@ jdk_8_maven/em/external/rest/spring-batch-rest/target
/jdk_8_gradle/em/embedded/rest/erc20-rest-service/build
/jdk_8_gradle/em/external/rest/erc20-rest-service/build
/jdk_8_gradle/cs/rest/erc20-rest-service/.gradle

/jdk_8_maven/cs/rest/original/spring-actuator-demo/target
/jdk_8_maven/em/embedded/rest/spring-actuator-demo/target
/jdk_8_maven/em/external/rest/spring-actuator-demo/target
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ For simplicity, all schemas are also available as JSON/YML files under the folde

* **Session Service** (not-known license), [jdk_8_maven/cs/rest/original/session-service](jdk_8_maven/cs/rest/original/session-service), from [https://github.com/cBioPortal/session-service](https://github.com/cBioPortal/session-service)

* **Spring-actuator-demo** (not-known license), [jdk_8_maven/cs/rest/original/spring-actuator-demo](jdk_8_maven/cs/rest/original/spring-actuator-demo), from [https://github.com/callicoder/spring-boot-actuator-demo](https://github.com/callicoder/spring-boot-actuator-demo)

* **Spring-batch-rest** (Apache), [jdk_8_maven/cs/rest/original/spring-batch-rest](jdk_8_maven/cs/rest/original/spring-batch-rest), from [https://github.com/chrisgleissner/spring-batch-rest](https://github.com/chrisgleissner/spring-batch-rest)

* **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)
Expand Down
5 changes: 5 additions & 0 deletions auth/spring-actuator-demo-auth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
auth:
- name: admin
fixedHeaders:
- name: Authorization
value: Basic YWN0dWF0b3I6YWN0dWF0b3I=
17 changes: 17 additions & 0 deletions dockerfiles/spring-actuator-demo.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM amazoncorretto:8-alpine-jdk

COPY ./dist/spring-actuator-demo-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-actuator-demo__${TOOL}__${RUN}__jacoco.exec,append=false,dumponexit=true \
-javaagent:jacocoagent.jar=output=tcpserver,address=*,port=6300,append=false,dumponexit=false \
-jar spring-actuator-demo-sut.jar \
--server.port=8080
15 changes: 15 additions & 0 deletions dockerfiles/spring-actuator-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
sut-spring-actuator-demo:
build:
dockerfile: ./dockerfiles/spring-actuator-demo.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

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 @@ -24,6 +24,7 @@
<module>user-management</module>
<module>blogapi</module>
<module>spring-batch-rest</module>
<module>spring-actuator-demo</module>
</modules>


Expand Down
17 changes: 17 additions & 0 deletions jdk_8_maven/cs/rest/original/spring-actuator-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,30 @@
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!-- MODIFIED-->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.15</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>spring-actuator-demo</finalName>
<classifier>sut</classifier>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
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 @@ -30,6 +30,7 @@
<module>user-management</module>
<module>blogapi</module>
<module>spring-batch-rest</module>
<module>spring-actuator-demo</module>
</modules>

</project>
25 changes: 25 additions & 0 deletions jdk_8_maven/em/embedded/rest/spring-actuator-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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-spring-actuator-demo</artifactId>
<packaging>jar</packaging>

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

<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>actuator-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package em.embedded.spring.actuator.demo;

import com.example.actuatordemo.ActuatorDemoApplication;
import org.evomaster.client.java.controller.AuthUtils;
import org.evomaster.client.java.controller.EmbeddedSutController;
import org.evomaster.client.java.controller.InstrumentedSutStarter;
import org.evomaster.client.java.sql.DbSpecification;


import org.evomaster.client.java.controller.problem.ProblemInfo;
import org.evomaster.client.java.controller.problem.RestProblem;
import org.evomaster.client.java.controller.api.dto.auth.AuthenticationDto;
import org.evomaster.client.java.controller.api.dto.SutInfoDto;

import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
* Class used to start/stop the SUT. This will be controller by the EvoMaster process
*/
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 ConfigurableApplicationContext ctx;


public EmbeddedEvoMasterController() {
this(40100);
}

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

@Override
public String startSut() {
ctx = SpringApplication.run(ActuatorDemoApplication.class, new String[]{
"--server.port=0",
});


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() {
ctx.stop();
}

@Override
public String getPackagePrefixesToCover() {
return "com.example.actuatordemo.";
}

@Override
public void resetStateOfSUT() {
}

@Override
public List<AuthenticationDto> getInfoForAuthentication() {
return Arrays.asList(
AuthUtils.getForBasic("actuator","actuator","actuator")
);
}

@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 null;
}

}
1 change: 1 addition & 0 deletions jdk_8_maven/em/external/rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<module>user-management</module>
<module>blogapi</module>
<module>spring-batch-rest</module>
<module>spring-actuator-demo</module>
</modules>

</project>
64 changes: 64 additions & 0 deletions jdk_8_maven/em/external/rest/spring-actuator-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?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-external-rest-spring-actuator-demo</artifactId>
<packaging>jar</packaging>

<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-benchmark-em-external-rest</artifactId>
<version>3.4.1-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
<version>4.11</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>spring-actuator-demo-evomaster-runner</finalName>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>em.external.spring.actuator.demo.ExternalEvoMasterController
</Main-Class>
<Premain-Class>org.evomaster.client.java.instrumentation.InstrumentingAgent
</Premain-Class>
<Agent-Class>org.evomaster.client.java.instrumentation.InstrumentingAgent
</Agent-Class>
<Can-Redefine-Classes>true</Can-Redefine-Classes>
<Can-Retransform-Classes>true</Can-Retransform-Classes>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading