11package em .external .uk .gov .pay .api .app ;
22
3- import org .evomaster .client .java .controller .AuthUtils ;
43import org .evomaster .client .java .controller .ExternalSutController ;
54import org .evomaster .client .java .controller .InstrumentedSutStarter ;
65import org .evomaster .client .java .controller .api .dto .SutInfoDto ;
76import org .evomaster .client .java .controller .api .dto .auth .AuthenticationDto ;
8- import org .evomaster .client .java .controller .api .dto .database .schema .DatabaseType ;
97import org .evomaster .client .java .controller .problem .ProblemInfo ;
108import org .evomaster .client .java .controller .problem .RestProblem ;
11- import org .evomaster .client .java .sql .DbCleaner ;
129import org .evomaster .client .java .sql .DbSpecification ;
13- import org .h2 .tools .Server ;
1410import org .testcontainers .containers .GenericContainer ;
1511import redis .clients .jedis .Jedis ;
1612import redis .clients .jedis .JedisPool ;
1713
18- import java .io .File ;
1914import java .io .InputStream ;
2015import java .nio .file .Files ;
2116import java .nio .file .Path ;
2217import java .nio .file .Paths ;
2318import java .nio .file .StandardCopyOption ;
24- import java .sql .Connection ;
25- import java .sql .DriverManager ;
26- import java .sql .SQLException ;
27- import java .util .Arrays ;
2819import java .util .List ;
2920
3021public class ExternalEvoMasterController extends ExternalSutController {
@@ -40,23 +31,22 @@ public static void main(String[] args) {
4031 sutPort = Integer .parseInt (args [1 ]);
4132 }
4233 String jarLocation = "cs/rest/pay-publicapi/target" ;
43- if (args .length > 2 ){
34+ if (args .length > 2 ) {
4435 jarLocation = args [2 ];
4536 }
46- if (! jarLocation .endsWith (".jar" )) {
37+ if (! jarLocation .endsWith (".jar" )) {
4738 jarLocation += "/pay-publicapi-sut.jar" ;
4839 }
4940 int timeoutSeconds = 120 ;
50- if (args .length > 3 ){
41+ if (args .length > 3 ) {
5142 timeoutSeconds = Integer .parseInt (args [3 ]);
5243 }
5344 String command = "java" ;
54- if (args .length > 4 ){
45+ if (args .length > 4 ) {
5546 command = args [4 ];
5647 }
5748
5849
59-
6050 ExternalEvoMasterController controller =
6151 new ExternalEvoMasterController (controllerPort , jarLocation , sutPort , timeoutSeconds , command );
6252 InstrumentedSutStarter starter = new InstrumentedSutStarter (controller );
@@ -68,7 +58,7 @@ public static void main(String[] args) {
6858 private final int timeoutSeconds ;
6959 private final int sutPort ;
7060
71- private String jarLocation ;
61+ private String jarLocation ;
7262 private final String CONFIG_FILE = "em_config.yaml" ;
7363
7464 private static final int REDIS_PORT = 6379 ;
@@ -82,7 +72,7 @@ public static void main(String[] args) {
8272
8373 private static JedisPool jedisPool ;
8474
85- public ExternalEvoMasterController (){
75+ public ExternalEvoMasterController () {
8676 this (40100 , "../api/target" , 12345 , 120 , "java" );
8777 }
8878
@@ -106,22 +96,22 @@ public ExternalEvoMasterController(int controllerPort,
10696
10797
10898 /**
109- Unfortunately, it seems like Dropwizard is buggy, and has
110- problems with overriding params without a YML file :(
99+ * Unfortunately, it seems like Dropwizard is buggy, and has
100+ * problems with overriding params without a YML file :(
111101 */
112102 private void createConfigurationFile () {
113103
114104 //save config to same folder of JAR file
115105 Path path = getConfigPath ();
116106
117- try (InputStream is = this .getClass ().getResourceAsStream ("/" + CONFIG_FILE )) {
107+ try (InputStream is = this .getClass ().getResourceAsStream ("/" + CONFIG_FILE )) {
118108 Files .copy (is , path , StandardCopyOption .REPLACE_EXISTING );
119- } catch (Exception e ){
109+ } catch (Exception e ) {
120110 throw new RuntimeException (e );
121111 }
122112 }
123113
124- private Path getConfigPath (){
114+ private Path getConfigPath () {
125115 return Paths .get (jarLocation )
126116 .toAbsolutePath ()
127117 .getParent ()
@@ -138,15 +128,15 @@ public String[] getInputParameters() {
138128 public String [] getJVMParameters () {
139129
140130 return new String []{
141- "-Ddw.server.applicationConnectors[0].port=" + sutPort ,
131+ "-Ddw.server.applicationConnectors[0].port=" + sutPort ,
142132 "-Ddw.server.adminConnectors[0].port=0" ,
143- "-Ddw.redis.endpoint=" + REDIS_URL
133+ "-Ddw.redis.endpoint=" + REDIS_URL
144134 };
145135 }
146136
147137 @ Override
148138 public String getBaseURL () {
149- return "http://localhost:" + sutPort ;
139+ return "http://localhost:" + sutPort ;
150140 }
151141
152142 @ Override
@@ -156,7 +146,7 @@ public String getPathToExecutableJar() {
156146
157147 @ Override
158148 public String getLogMessageOfInitializedServer () {
159- return "Server: Started" ;
149+ return "Started application " ;
160150 }
161151
162152 @ Override
@@ -204,7 +194,7 @@ public void resetStateOfSUT() {
204194 @ Override
205195 public ProblemInfo getProblemInfo () {
206196 return new RestProblem (
207- getBaseURL () + "/assets/swagger.json" ,
197+ getBaseURL () + "/assets/swagger.json" ,
208198 null
209199 );
210200 }
0 commit comments