Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up functional testing framework for the proxy module #6

Open
witherspore opened this issue Dec 5, 2013 · 1 comment
Open

Set up functional testing framework for the proxy module #6

witherspore opened this issue Dec 5, 2013 · 1 comment
Labels

Comments

@witherspore
Copy link
Contributor

Set up some utility classes such that JUnit can easily drive remote, functional tests through the proxy server to a real server. The real server really only needs to return a stream of data that can easily be parsed and examined - it could be http such as jetty if necessary. This should be something like the below but organized well into setup and tear down methods:

InputStream streamToReturnFromRealServer; //some stream for testing
Integer remotePort; //some port for the real server to service- the remote port
RealServer realServer = new RealServer(streamToReturnFromRealServer, remotePort);
realServer.start() //should run in its own ThreadExecutor to not block
//Now wait for startup, testing to make sure it started. maybe use futures like we do with the bootstrap

//next set up proxy
ServerBootstrap b = new ServerBootstrap()
.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ScenarioChannellInitializer(server.getScenarios(), server.getScenarioSelector()))
.option(ChannelOption.SO_BACKLOG, 128)
.option(ChannelOption.SO_KEEPALIVE, false); b.bind(server.getPort()).channel().closeFuture();

//now shut down the ports and servers by closing futures etc

@adonciu
Copy link

adonciu commented Jan 14, 2014

Test utility classes to be used for slow-light proxy functional testing have been created and place in the com.tacitknowledge.slowlight.proxyserver.systest.util package. There are two main classes TestServer and TestClient which are used by tests, as end points, to verify slow-light proxy functionality.

All classes representing functional tests should be placed in com.tacitknowledge.slowlight.proxyserver.systest and should extend from com.tacitknowledge.slowlight.proxyserver.systest.AbstractProxyServerIT which will automatically start test server and provide few convenient methods to easily create test client and slow-light proxy server.

For more information on how to write slow-light functional tests please have a look at the following test classes:
com.tacitknowledge.slowlight.proxyserver.systest.DelayProxyServerIT
com.tacitknowledge.slowlight.proxyserver.systest.DiscardProxyServerIT
com.tacitknowledge.slowlight.proxyserver.systest.CloseConnectionProxyServerIT
com.tacitknowledge.slowlight.proxyserver.systest.RandomDataProxyServerIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants