22
33import org .evomaster .client .java .controller .EmbeddedSutController ;
44import org .evomaster .client .java .controller .InstrumentedSutStarter ;
5- import org .evomaster .client .java .controller .api .dto .AuthenticationDto ;
5+ import org .evomaster .client .java .controller .api .dto .auth . AuthenticationDto ;
66import org .evomaster .client .java .controller .api .dto .SutInfoDto ;
77import org .evomaster .client .java .controller .problem .ProblemInfo ;
88import org .evomaster .client .java .controller .problem .RestProblem ;
1212import redis .clients .jedis .Jedis ;
1313import redis .clients .jedis .JedisPool ;
1414
15- import java .io .File ;
1615import java .util .List ;
1716
1817public class EmbeddedEvoMasterController extends EmbeddedSutController {
@@ -24,7 +23,9 @@ public class EmbeddedEvoMasterController extends EmbeddedSutController {
2423 private static final GenericContainer redisContainer = new GenericContainer ("redis:" + REDIS_VERSION )
2524 .withExposedPorts (REDIS_PORT );
2625
27- private static final JedisPool jedisPool = new JedisPool ("localhost" , REDIS_PORT );
26+ private static String REDIS_URL = "" ;
27+
28+ private static JedisPool jedisPool ;
2829
2930 public static void main (String [] args ) {
3031 int port = 40100 ;
@@ -70,7 +71,7 @@ public List<AuthenticationDto> getInfoForAuthentication() {
7071 @ Override
7172 public ProblemInfo getProblemInfo () {
7273 return new RestProblem (
73- "http://0.0.0.0 :" + application .getJettyPort () + "/assets/swagger.json" ,
74+ "http://localhost :" + application .getJettyPort () + "/assets/swagger.json" ,
7475 null
7576 );
7677 }
@@ -84,12 +85,16 @@ public SutInfoDto.OutputFormat getPreferredOutputFormat() {
8485 public String startSut () {
8586 redisContainer .start ();
8687
88+ REDIS_URL = redisContainer .getHost () + redisContainer .getMappedPort (REDIS_PORT );
89+
90+ jedisPool = new JedisPool (redisContainer .getHost (), redisContainer .getMappedPort (REDIS_PORT ));
91+
8792 application = new PublicApi ();
8893
8994 //Dirty hack for DW...
9095 System .setProperty ("dw.server.applicationConnectors[0].port" , "0" );
9196 System .setProperty ("dw.server.adminConnectors[0].port" , "0" );
92- System .setProperty ("dw.redis.endpoint" , "localhost:" + REDIS_PORT );
97+ System .setProperty ("dw.redis.endpoint" , REDIS_URL );
9398
9499 /*
95100 Note: When running using IntelliJ, make sure the working directory is set to the
@@ -133,7 +138,7 @@ public void stopSut() {
133138 @ Override
134139 public void resetStateOfSUT () {
135140 try (Jedis jedis = jedisPool .getResource ()) {
136- jedis .flushAll ()
141+ jedis .flushAll ();
137142 }
138143 }
139144
0 commit comments