1 package nl.tudelft.goal.ut2004.environment; 2 3 import java.util.HashMap; 4 5 import org.junit.After; 6 import org.junit.AfterClass; 7 import org.junit.Before; 8 import org.junit.BeforeClass; 9 import org.junit.Test; 10 11 import cz.cuni.amis.pogamut.base.utils.Pogamut; 12 import cz.cuni.amis.pogamut.ut2004.utils.UCCWrapper; 13 import cz.cuni.amis.pogamut.ut2004.utils.UCCWrapperConf; 14 import eis.exceptions.ManagementException; 15 import eis.iilang.Function; 16 import eis.iilang.Identifier; 17 import eis.iilang.Numeral; 18 import eis.iilang.Parameter; 19 import eis.iilang.ParameterList; 20 21 public class UT2004EnvironmentTest { 22 23 static UCCWrapper uccWrapper; 24 25 @BeforeClass 26 public static void setUpBeforeClass() throws Exception { 27 28 UCCWrapperConf configuration = new UCCWrapperConf(); 29 configuration.setGameType("BotCTFGame"); 30 configuration.setMapName("CTF-Chrome"); 31 32 uccWrapper = new UCCWrapper(configuration); 33 34 } 35 36 @AfterClass 37 public static void tearDownAfterClass() throws Exception { 38 if(uccWrapper != null)uccWrapper.stop(); 39 Pogamut.getPlatform().close(); 40 } 41 42 @Before 43 public void setUp() throws Exception { 44 } 45 46 @After 47 public void tearDown() throws Exception { 48 } 49 50 @Test 51 public void test() throws ManagementException, InterruptedException { 52 UT2004Environment environment = new UT2004Environment(); 53 HashMap<String, Parameter> map = new HashMap<String, Parameter>(); 54 map.put("visualizer", new Identifier("rmi://127.0.0.1:1099")); 55 map.put("botServer", new Identifier("ut://127.0.0.1:" + uccWrapper.getBotPort())); 56 map.put("controlServer", new Identifier("ut://127.0.0.1:" + uccWrapper.getControlPort())); 57 map.put("logLevel", new Identifier("WARNING")); 58 map.put("bots", new ParameterList( 59 new ParameterList( new ParameterList(new Identifier("name"),new Identifier("RedLeader")), 60 new ParameterList(new Identifier("team"),new Identifier("red")), 61 new ParameterList(new Identifier("skill"),new Numeral(5)), 62 new ParameterList(new Identifier("startLocation"),new Function("location", new Numeral(1),new Numeral(1),new Numeral(1))), 63 new ParameterList(new Identifier("startRotation"),new Function("rotation", new Numeral(1),new Numeral(1),new Numeral(1))), 64 new ParameterList(new Identifier("logLevel"), new Identifier("OFF"))), 65 new ParameterList( new ParameterList(new Identifier("name"),new Identifier("RedFive")), 66 new ParameterList(new Identifier("team"),new Identifier("red")), 67 new ParameterList(new Identifier("skill"),new Numeral(5)), 68 new ParameterList(new Identifier("startLocation"),new Function("location", new Numeral(1),new Numeral(1),new Numeral(1))), 69 new ParameterList(new Identifier("startRotation"),new Function("rotation", new Numeral(1),new Numeral(1),new Numeral(1))), 70 new ParameterList(new Identifier("logLevel"), new Identifier("OFF"))))); 71 72 73 environment.init(map); 74 75 76 environment.pause(); 77 78 79 environment.start(); 80 81 82 environment.kill(); 83 84 } 85 }