Skip to content

Commit 93dbdd4

Browse files
authored
Merge pull request #67 from EMResearch/signal_registration_service
Signal registration service
2 parents 9b41603 + 0a029ef commit 93dbdd4

File tree

7 files changed

+484
-105
lines changed

7 files changed

+484
-105
lines changed

jdk_11_maven/cs/graphql/timbuctoo/timbuctoo-instancev4/pom.xml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -954,8 +954,16 @@
954954
<goal>run</goal>
955955
</goals>
956956
<configuration>
957-
<tasks>
958-
<echo>
957+
<!-- fix a maven build error
958+
959+
You are using 'tasks' which has been removed from the maven-antrun-plugin.
960+
Please use 'target' and refer to the >>Major Version Upgrade to version 3.0.0<< on the plugin site.
961+
962+
see https://maven.apache.org/plugins/maven-antrun-plugin/
963+
-->
964+
<!-- <tasks>-->
965+
<target>
966+
<echo>
959967
======================================================================================================
960968
Done! now run
961969

@@ -964,7 +972,8 @@
964972
to get a debug server up and running then go to http://localhost:8080
965973
======================================================================================================
966974
</echo>
967-
</tasks>
975+
<!-- </tasks>-->
976+
</target>
968977
</configuration>
969978
</execution>
970979
</executions>

jdk_17_maven/cs/grpc/signal-registration/pom.xml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<modelVersion>4.0.0</modelVersion>
1010
<groupId>org.signal.registration</groupId>
1111
<artifactId>registration-service</artifactId>
12-
<version>JGITVER</version>
12+
<version>1.0.0-SNAPSHOT</version>
1313
<packaging>${packaging}</packaging>
1414

1515
<parent>
@@ -259,7 +259,7 @@
259259
<groupId>io.micronaut.build</groupId>
260260
<artifactId>micronaut-maven-plugin</artifactId>
261261
</plugin>
262-
262+
263263
<plugin>
264264
<groupId>org.apache.maven.plugins</groupId>
265265
<artifactId>maven-compiler-plugin</artifactId>
@@ -354,6 +354,46 @@
354354
</container>
355355
</configuration>
356356
</plugin>
357+
358+
<!-- <plugin>-->
359+
<!-- <groupId>org.springframework.boot</groupId>-->
360+
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
361+
<!-- <version>2.5.4</version>-->
362+
<!-- <executions>-->
363+
<!-- <execution>-->
364+
<!-- <goals>-->
365+
<!-- <goal>repackage</goal>-->
366+
<!-- </goals>-->
367+
<!-- <configuration>-->
368+
<!-- <finalName>rpc-grpc-signal-registration</finalName>-->
369+
<!-- <classifier>sut</classifier>-->
370+
<!-- </configuration>-->
371+
<!-- </execution>-->
372+
<!-- </executions>-->
373+
<!-- </plugin>-->
374+
375+
<!-- build with maven-shade-plugin based on (see io.micronaut:micronaut-parent POM)
376+
https://micronaut-projects.github.io/micronaut-maven-plugin/latest/examples/package.html-->
377+
<plugin>
378+
<groupId>org.apache.maven.plugins</groupId>
379+
<artifactId>maven-shade-plugin</artifactId>
380+
<version>${maven-shade-plugin.version}</version>
381+
<executions>
382+
<execution>
383+
<id>default-shade</id>
384+
<configuration>
385+
<finalName>signal-registration-sut</finalName>
386+
<createDependencyReducedPom>false</createDependencyReducedPom>
387+
<transformers>
388+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
389+
<mainClass>org.signal.registration.Application</mainClass>
390+
</transformer>
391+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
392+
</transformers>
393+
</configuration>
394+
</execution>
395+
</executions>
396+
</plugin>
357397
</plugins>
358398
</build>
359399
</project>

jdk_17_maven/em/embedded/grpc/signal-registration/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616

1717
<dependencies>
1818

19+
<dependency>
20+
<groupId>org.signal.registration</groupId>
21+
<artifactId>registration-service</artifactId>
22+
<version>1.0.0-SNAPSHOT</version>
23+
</dependency>
24+
1925
<dependency>
2026
<groupId>org.evomaster</groupId>
2127
<artifactId>evomaster-client-java-dependencies</artifactId>
@@ -27,4 +33,4 @@
2733

2834

2935

30-
</project>
36+
</project>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,118 @@
11
package em.embedded.org.signal.registration;
22

3-
public class EmbeddedEvoMasterController {
3+
import io.grpc.ManagedChannel;
4+
import io.grpc.ManagedChannelBuilder;
5+
import io.micronaut.context.ApplicationContext;
6+
import io.micronaut.core.util.CollectionUtils;
7+
import io.micronaut.runtime.server.EmbeddedServer;
8+
import org.evomaster.client.java.controller.EmbeddedSutController;
9+
import org.evomaster.client.java.controller.InstrumentedSutStarter;
10+
import org.evomaster.client.java.controller.api.dto.AuthenticationDto;
11+
import org.evomaster.client.java.controller.api.dto.SutInfoDto;
12+
import org.evomaster.client.java.controller.api.dto.problem.rpc.RPCType;
13+
import org.evomaster.client.java.controller.internal.db.DbSpecification;
14+
import org.evomaster.client.java.controller.problem.ProblemInfo;
15+
import org.evomaster.client.java.controller.problem.RPCProblem;
16+
import org.signal.registration.rpc.RegistrationServiceGrpc;
17+
import java.util.List;
418

5-
//TODO
19+
public class EmbeddedEvoMasterController extends EmbeddedSutController {
20+
21+
public static void main(String[] args) {
22+
23+
int port = 40100;
24+
if (args.length > 0) {
25+
port = Integer.parseInt(args[0]);
26+
}
27+
28+
EmbeddedEvoMasterController controller = new EmbeddedEvoMasterController(port);
29+
InstrumentedSutStarter starter = new InstrumentedSutStarter(controller);
30+
31+
starter.start();
32+
}
33+
34+
public EmbeddedEvoMasterController() {
35+
this(40100);
36+
}
37+
38+
public EmbeddedEvoMasterController(int port) {
39+
setControllerPort(port);
40+
}
41+
42+
protected ManagedChannel channel;
43+
private RegistrationServiceGrpc.RegistrationServiceBlockingStub stub;
44+
45+
private EmbeddedServer server;
46+
private ApplicationContext ctx;
47+
48+
@Override
49+
public boolean isSutRunning() {
50+
return ctx != null && ctx.isRunning();
51+
}
52+
53+
@Override
54+
public String getPackagePrefixesToCover() {
55+
return "org.signal.registration.";
56+
}
57+
58+
@Override
59+
public List<AuthenticationDto> getInfoForAuthentication() {
60+
return null;
61+
}
62+
63+
@Override
64+
public ProblemInfo getProblemInfo() {
65+
return new RPCProblem(RegistrationServiceGrpc.RegistrationServiceBlockingStub.class, stub, RPCType.gRPC);
66+
}
67+
68+
@Override
69+
public SutInfoDto.OutputFormat getPreferredOutputFormat() {
70+
return SutInfoDto.OutputFormat.JAVA_JUNIT_4;
71+
}
72+
73+
@Override
74+
public String startSut() {
75+
76+
try {
77+
server = ApplicationContext.run(EmbeddedServer.class,CollectionUtils.mapOf(
78+
"micronaut.environments","dev",
79+
"grpc.server.port", "${random.port}"
80+
), "dev");
81+
ctx = server.getApplicationContext();
82+
83+
startClient();
84+
return "http://localhost:"+server.getPort();
85+
86+
} catch (Exception e) {
87+
throw new RuntimeException(e);
88+
}
89+
}
90+
91+
private String startClient() {
92+
channel = ManagedChannelBuilder.forAddress("localhost", getSutPort()).usePlaintext().build();
93+
stub = RegistrationServiceGrpc.newBlockingStub(channel);
94+
95+
96+
return "started:"+!(channel.isShutdown() || channel.isTerminated());
97+
}
98+
99+
protected int getSutPort() {
100+
return server.getPort();
101+
}
102+
103+
@Override
104+
public void stopSut() {
105+
server.stop();
106+
ctx.stop();
107+
}
108+
109+
@Override
110+
public void resetStateOfSUT() {
111+
112+
}
113+
114+
@Override
115+
public List<DbSpecification> getDbSpecifications() {
116+
return null;
117+
}
6118
}

jdk_17_maven/em/external/grpc/signal-registration/pom.xml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313
<version>1.6.2-SNAPSHOT</version>
1414
</parent>
1515

16-
17-
<dependencies>
18-
19-
</dependencies>
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.signal.registration</groupId>
19+
<artifactId>registration-service</artifactId>
20+
<version>1.0.0-SNAPSHOT</version>
21+
</dependency>
22+
</dependencies>
2023

2124
<build>
2225
<plugins>
@@ -31,6 +34,17 @@
3134
</goals>
3235
<configuration>
3336
<finalName>signal-registration-evomaster-runner</finalName>
37+
<!-- to fix JNI problem when running fatjar-->
38+
<filters>
39+
<filter>
40+
<artifact>*:*</artifact>
41+
<excludes>
42+
<exclude>META-INF/*.SF</exclude>
43+
<exclude>META-INF/*.DSA</exclude>
44+
<exclude>META-INF/*.RSA</exclude>
45+
</excludes>
46+
</filter>
47+
</filters>
3448
<transformers>
3549
<transformer
3650
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
@@ -54,4 +68,4 @@
5468
</build>
5569

5670

57-
</project>
71+
</project>

0 commit comments

Comments
 (0)