@Test public void testEngineCreation() throws Exception { NewStrategyAgentWizardFixture fixture = NewStrategyAgentWizardFixture.create(mShell, mMockService, null); fixture.assertFinishEnabled(false); fixture.setName("My Engine"); fixture.assertFinishEnabled(false); fixture.setJmsUrl("tcp://localhost:123"); fixture.assertFinishEnabled(false); fixture.setHostname("localhost"); fixture.assertFinishEnabled(false); fixture.setPort("456"); fixture.assertFinishEnabled(true); fixture.setDescription("My Strategy Agent Engine"); fixture.finish(); StrategyAgentEngineTestUtil.assertStrategyAgentEngine( fixture.waitForClose(), "My Engine", "My Strategy Agent Engine", "tcp://localhost:123", "localhost", 456, ConnectionState.DISCONNECTED); verify(mMockService).addEngine((StrategyEngine) anyObject()); }
@Test public void testSeededValues() throws Exception { StrategyAgentEngine engine = AbstractUIRunner.syncCall( new Callable<StrategyAgentEngine>() { @Override public StrategyAgentEngine call() { StrategyAgentEngine engine = StrategyAgentEngineTestUtil.createStrategyAgentEngine( "abc", "xyz", "tcp://abc", "host", 8080); engine.setConnectionState(ConnectionState.CONNECTED); return engine; } }); NewStrategyAgentWizardFixture fixture = NewStrategyAgentWizardFixture.create(mShell, mMockService, engine); fixture.finish(); StrategyAgentEngineTestUtil.assertStrategyAgentEngine( fixture.waitForClose(), "abc", "xyz", "tcp://abc", "host", 8080, ConnectionState.CONNECTED); verify(mMockService).addEngine((StrategyEngine) anyObject()); }