diff --git a/betamax-jetty/betamax-jetty.gradle b/betamax-jetty/betamax-jetty.gradle deleted file mode 100644 index 537aca4b..00000000 --- a/betamax-jetty/betamax-jetty.gradle +++ /dev/null @@ -1,14 +0,0 @@ -apply from: "$rootDir/gradle/groovyModule.gradle" -apply from: "$rootDir/gradle/publishedModule.gradle" - -dependencies { - compile project(":betamax-core") - compile commonDependencies.jetty -} - -modifyPom { - project { - name "Betamax Jetty" - description "The base Jetty support classes for Betamax." - } -} \ No newline at end of file diff --git a/betamax-jetty/src/main/groovy/co/freeside/betamax/proxy/jetty/SimpleServer.groovy b/betamax-jetty/src/main/groovy/co/freeside/betamax/proxy/jetty/SimpleServer.groovy deleted file mode 100644 index 78a7c901..00000000 --- a/betamax-jetty/src/main/groovy/co/freeside/betamax/proxy/jetty/SimpleServer.groovy +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2011 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package co.freeside.betamax.proxy.jetty - -import java.util.concurrent.CountDownLatch -import java.util.logging.Logger -import org.eclipse.jetty.server.* -import org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener -import org.eclipse.jetty.util.component.LifeCycle - -class SimpleServer extends AbstractLifeCycleListener { - - static final int DEFAULT_PORT = 5000 - - final String host - protected int port - private Server server - private CountDownLatch startedLatch - private CountDownLatch stoppedLatch - - private static final log = Logger.getLogger(getClass().name) - - SimpleServer() { - this(DEFAULT_PORT) - } - - SimpleServer(int port) { - // if there is no network connection we need to connect to the server via hostname rather than IP. At least this - // is true on a Mac. Suspect it may be OS dependent. I should really make an effort to understand this but this - // workaround means the proxy seems to operate correctly with or without a network connection. The weird thing - // is that the hostName _doesn't_ work when there _is_ a network connection. - def localAddress = InetAddress.localHost - if (localAddress.loopbackAddress) { - log.info "local address is loopback, using hostname $localAddress.hostName" - host = localAddress.hostName - } else { - host = localAddress.hostAddress - } - this.port = port - } - - String getUrl() { - "http://$host:$port/" - } - - void start(Class handlerClass) { - start handlerClass.newInstance() - } - - void start(Handler handler) { - startedLatch = new CountDownLatch(1) - stoppedLatch = new CountDownLatch(1) - - server = createServer(port) - server.handler = handler - server.addLifeCycleListener(this) - server.start() - - startedLatch.await() - } - - void stop() { - if (server) { - server.stop() - stoppedLatch.await() - } - } - - void setPort(int port) { - if (running) { - throw new IllegalStateException('Cannot set port once the server is already started') - } - this.port = port - } - - int getPort() { - port - } - - boolean isRunning() { - startedLatch?.count == 0 && stoppedLatch?.count > 0 - } - - @Override - void lifeCycleStarted(LifeCycle event) { - log.fine 'started...' - startedLatch.countDown() - } - - @Override - void lifeCycleStopped(LifeCycle event) { - log.fine 'stopped...' - stoppedLatch.countDown() - } - - protected Server createServer(int port) { - new Server(port) - } - -} diff --git a/betamax.gradle b/betamax.gradle index dcadc0bc..b1e882f1 100644 --- a/betamax.gradle +++ b/betamax.gradle @@ -27,7 +27,6 @@ allprojects { exclude module: "httpclient" }), httpClient: dependencies.create("org.apache.httpcomponents:httpclient:4.2.2"), - jetty: dependencies.create("org.eclipse.jetty:jetty-server:7.3.1.v20110307"), junit: dependencies.create("junit:junit:4.10"), netty: dependencies.create("io.netty:netty-all:4.0.7.Final"), spock: dependencies.create("org.spockframework:spock-core:0.7-groovy-2.0", { diff --git a/settings.gradle b/settings.gradle index f0af953a..c543f861 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,5 @@ include "betamax-core", "betamax-httpclient", - "betamax-jetty", "betamax-proxy", "betamax-manual", "betamax-test-support"