1 4 package com.tc.simulator.distrunner; 5 6 import com.tcsimulator.ClientSpec; 7 import com.tcsimulator.distrunner.ServerSpec; 8 9 import java.net.InetAddress ; 10 import java.net.UnknownHostException ; 11 12 import junit.framework.TestCase; 13 14 public class ArgParserTest extends TestCase { 15 30 42 public void testJvmOptParsing() throws UnknownHostException { 43 InetAddress host = InetAddress.getLocalHost(); 44 String hostName = host.getHostName(); 45 46 String clientInfo = "client://" + hostName 47 + "/test?vm.count=3&execution.count=5&jvm.args=-server,-Xms256m,-Xmx256m,-Xss128k"; 48 SpecFactory specFactory = new SpecFactoryImpl(); 49 ArgParser parser; 50 try { 51 parser = new ArgParser(new String [] { clientInfo }, specFactory, false, false); 52 } catch (ArgException e) { 53 throw new AssertionError (e); 54 } 55 assertEquals(clientInfo, ArgParser.getArgumentForClientSpec((ClientSpec) parser.getClientSpecs().iterator().next())); 56 } 57 58 public void testServerParsing() throws ArgException { 59 String [] cmdLine = new String [] { "server://cfisherpc.terracotta.lan/tmp/dso-sandbox?" 60 + "config.dso.http.port=3333&config.dso.jmx.port=2222&config.dso.dso.port=5555;" 61 + "control://cfisherpc.terracotta.lan/tmp/dso-sandbox" }; 62 63 ArgParser parser = new ArgParser(cmdLine, new SpecFactoryImpl(), true, true); 64 ServerSpec controlServer = parser.getControlServerSpec(); 65 System.out.println(controlServer.toString()); 66 ServerSpec testServer = parser.getServerSpec(); 67 System.out.println(testServer.toString()); 68 } 69 70 } 71 | Popular Tags |