Package org.mockserver.integration

Examples of org.mockserver.integration.ClientAndServer


    private Statement statement(final Statement base) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                ClientAndServer clientAndServer;
                if (perTestSuite) {
                    if (perTestSuiteClientAndServer == null) {
                        perTestSuiteClientAndServer = clientAndServerFactory.newClientAndServer();
                        Runtime.getRuntime().addShutdownHook(new Thread() {
                            @Override
                            public void run() {
                                perTestSuiteClientAndServer.stop();
                            }
                        });
                    }
                    clientAndServer = perTestSuiteClientAndServer;
                } else {
                    clientAndServer = clientAndServerFactory.newClientAndServer();
                }
                setMockServerClient(target, clientAndServer);
                try {
                    base.evaluate();
                } finally {
                    if (!perTestSuite) {
                        clientAndServer.stop();
                    }
                }
            }
        };
    }
View Full Code Here


            server.stop();
        }
    }

    public Configure symbol(String serviceSymbol) {
        ClientAndServer server = mockServers.get(serviceSymbol);
        if (server == null) {
            int port = PortFactory.findFreePort();
            server = new ClientAndServer(port);
            mockServers.put(serviceSymbol, server);
            for (MockRestServiceDirectory directory : mockRestServiceDirectories) {
                directory.publish(serviceSymbol, "http://localhost:" + port);
            }
        }
View Full Code Here

TOP

Related Classes of org.mockserver.integration.ClientAndServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.