1 4 package com.tc.simulator.app; 5 6 import com.tc.config.schema.SettableConfigItem; 7 import com.tc.config.schema.setup.L1TVSConfigurationSetupManager; 8 import com.tc.config.schema.setup.L2TVSConfigurationSetupManager; 9 import com.tc.config.schema.setup.TestTVSConfigurationSetupManagerFactory; 10 import com.tc.object.BaseDSOTestCase; 11 import com.tc.object.bytecode.hook.impl.PreparedComponentsFromL2Connection; 12 import com.tc.object.config.DSOClientConfigHelper; 13 import com.tc.server.TCServerImpl; 14 import com.tc.simulator.listener.MockListenerProvider; 15 import com.tcsimulator.SimpleApplicationConfig; 16 17 public class DSOApplicationBuilderTest extends BaseDSOTestCase { 18 19 private DSOApplicationBuilder builder; 20 private SimpleApplicationConfig applicationConfig; 21 private TCServerImpl server; 22 23 public void setUp() throws Exception { 24 TestTVSConfigurationSetupManagerFactory factory = super.configFactory(); 25 L2TVSConfigurationSetupManager manager = factory.createL2TVSConfigurationSetupManager(null); 26 27 ((SettableConfigItem) factory.l2DSOConfig().listenPort()).setValue(0); 29 30 server = new TCServerImpl(manager); 31 server.start(); 32 33 DSOClientConfigHelper configHelper = configHelper(); 34 35 configHelper.addExcludePattern(SimpleApplicationConfig.class.getName()); 36 37 makeClientUsePort(server.getDSOListenPort()); 38 39 this.applicationConfig = new SimpleApplicationConfig(); 40 41 L1TVSConfigurationSetupManager configManager = factory.createL1TVSConfigurationSetupManager(); 42 PreparedComponentsFromL2Connection components = new PreparedComponentsFromL2Connection(configManager); 43 44 this.builder = new DSOApplicationBuilder(configHelper, this.applicationConfig, components); 45 } 46 47 public void testNewApplication() throws Exception { 48 Application application = this.builder.newApplication("test", new MockListenerProvider()); 49 assertEquals(this.applicationConfig.getApplicationClassname(), application.getClass().getName()); 50 } 51 52 } 53 | Popular Tags |