Skip to content

Commit c752d4c

Browse files
author
Raju Uppalapati
committed
Refactor workspace to prepare for next release.
Removing scripts module. Relocating some of the netflix specific plugins to the zuul-netflix module
1 parent 6ee3d46 commit c752d4c

32 files changed

+147
-230
lines changed

build.gradle

+1-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ext.githubProjectName = rootProject.name
22

33
buildscript {
44
repositories { mavenCentral() }
5-
apply from: file('gradle/buildscript.gradle'), to: buildscript
5+
apply from: file('gradle/buildscript.gradle'), to: buildscript
66
}
77

88
allprojects {
@@ -12,7 +12,6 @@ allprojects {
1212
apply plugin: 'idea'
1313
apply from: file('gradle/convention.gradle')
1414
apply from: file('gradle/maven.gradle')
15-
//apply from: file('gradle/check.gradle')
1615
apply from: file('gradle/license.gradle')
1716
apply from: file('gradle/release.gradle')
1817

@@ -25,21 +24,4 @@ subprojects {
2524
tasks.withType(Javadoc).each {
2625
it.classpath = sourceSets.main.compileClasspath
2726
}
28-
29-
30-
31-
idea {
32-
module {
33-
languageLevel = '1.7'
34-
}
35-
}
3627
}
37-
38-
39-
40-
41-
42-
43-
44-
// Prevent contrib project from being published
45-
// project('hystrix-contrib').task('uploadMavenCentral', overwrite:true) { }

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=1.0.19
1+
version=1.0.20

settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
rootProject.name='zuul'
22

3-
include 'zuul-core', 'zuul-simple-webapp', 'zuul-netflix', 'zuul-scripts', 'zuul-netflix-webapp'
3+
include 'zuul-core', 'zuul-simple-webapp', 'zuul-netflix', 'zuul-netflix-webapp'

zuul-core/build.gradle

+11-22
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,31 @@ apply plugin: 'eclipse'
44
apply plugin: 'idea'
55

66
dependencies {
7-
compile 'commons-io:commons-io:2.4'
8-
compile 'org.codehaus.groovy:groovy-all:2.0.2'
9-
compile 'org.mockito:mockito-all:1.8.5'
10-
compile 'org.slf4j:slf4j-api:1.7.5'
11-
12-
compile 'com.netflix.archaius:archaius-core:0.5.11'
13-
compile 'com.netflix.servo:servo-core:0.4.44'
14-
compile 'com.netflix.netflix-commons:netflix-commons-util:0.1.1'
15-
16-
provided 'junit:junit-dep:4.10'
17-
provided 'javax.servlet:servlet-api:2.5'
18-
19-
// would be nice to only reference the version in one place
20-
groovy "org.codehaus.groovy:groovy-all:2.0.2"
7+
compile 'commons-io:commons-io:2.4+'
8+
compile 'org.codehaus.groovy:groovy-all:2.2.2'
9+
compile 'org.mockito:mockito-all:1.8+'
10+
compile 'org.slf4j:slf4j-api:+'
11+
provided 'junit:junit-dep:4+'
12+
provided 'javax.servlet:servlet-api:+'
13+
groovy "org.codehaus.groovy:groovy-all:2.2.2"
14+
15+
compile 'com.netflix.archaius:archaius-core:+'
16+
compile 'com.netflix.servo:servo-core:+'
17+
compile 'com.netflix.netflix-commons:netflix-commons-util:+'
2118
}
2219

2320

2421
javadoc {
25-
// the exclude isn't working, nor is there a subPackages options as docs suggest there should be
26-
// we do not want the com.netflix.hystrix.util package include
27-
// exclude '**/util/**'
28-
2922
options {
3023
doclet = "org.benjchristensen.doclet.DocletExclude"
3124
docletpath = [rootProject.file('./gradle/doclet-exclude.jar')]
3225
stylesheetFile = rootProject.file('./gradle/javadocStyleSheet.css')
3326
windowTitle = "Zuul Javadoc ${project.version}"
3427
}
35-
//todo add Zuul logo
36-
// options.addStringOption('top').value = '<a href="https://github.com/Netflix/Hystrix"><img width="92" height="79" border="0" align="left" src="http://netflix.github.com/Hystrix/images/hystrix-logo-small.png"></a><h2 class="title" style="padding-top:40px">Hystrix: Latency and Fault Tolerance for Distributed Systems</h2>'
3728
}
3829

3930
eclipse {
4031
classpath {
41-
// include 'provided' dependencies on the classpath
4232
plusConfigurations += configurations.provided
4333
downloadSources = true
4434
downloadJavadoc = true
@@ -48,7 +38,6 @@ eclipse {
4838

4939
idea {
5040
module {
51-
// include 'provided' dependencies on the classpath
5241
scopes.PROVIDED.plus += configurations.provided
5342
}
5443
}

zuul-core/src/main/java/com/netflix/zuul/FilterProcessor.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,10 @@ public Object processZuulFilter(ZuulFilter filter) throws ZuulException {
190190
case FAILED:
191191
t = result.getException();
192192
ctx.addFilterExecutionSummary(filterName, ExecutionStatus.FAILED.name(), execTime);
193-
194193
DynamicCounter.increment(metricPrefix + filterName, "status","fail", "filtertype",filter.filterType());
195194
break;
196195
case SUCCESS:
197-
DynamicCounter.increment(metricPrefix + filterName, "status","success", "filtertype", filter.filterType());
196+
DynamicCounter.increment(metricPrefix + filterName, "status","success", "filtertype", filter.filterType());
198197
o = result.getResult();
199198
ctx.addFilterExecutionSummary(filterName, ExecutionStatus.SUCCESS.name(), execTime);
200199
if (bDebug) {
@@ -203,7 +202,7 @@ public Object processZuulFilter(ZuulFilter filter) throws ZuulException {
203202
}
204203
break;
205204
default:
206-
DynamicCounter.increment(metricPrefix + filterName, "status", "skip", "filtertype", filter.filterType());
205+
DynamicCounter.increment(metricPrefix + filterName, "status", "skip", "filtertype", filter.filterType());
207206
break;
208207
}
209208

@@ -224,7 +223,6 @@ public Object processZuulFilter(ZuulFilter filter) throws ZuulException {
224223
}
225224
}
226225

227-
228226
@RunWith(MockitoJUnitRunner.class)
229227
public static class UnitTest {
230228

@@ -485,10 +483,5 @@ public void testErrorHttpException() {
485483
}
486484

487485
}
488-
489-
490486
}
491487
}
492-
493-
494-

zuul-core/src/main/java/com/netflix/zuul/context/RequestContext.java

+20-17
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,34 @@
1515
*/
1616
package com.netflix.zuul.context;
1717

18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertNotNull;
20+
import static org.mockito.Mockito.mock;
21+
22+
import java.io.InputStream;
23+
import java.io.NotSerializableException;
24+
import java.net.MalformedURLException;
25+
import java.net.URL;
26+
import java.util.ArrayList;
27+
import java.util.HashMap;
28+
import java.util.Iterator;
29+
import java.util.List;
30+
import java.util.Map;
31+
import java.util.concurrent.ConcurrentHashMap;
32+
33+
import javax.servlet.http.HttpServletRequest;
34+
import javax.servlet.http.HttpServletResponse;
1835

19-
import com.netflix.util.Pair;
20-
import com.netflix.zuul.constants.ZuulHeaders;
21-
import com.netflix.zuul.util.DeepCopy;
2236
import org.junit.Test;
2337
import org.junit.runner.RunWith;
2438
import org.mockito.Mock;
2539
import org.mockito.runners.MockitoJUnitRunner;
2640
import org.slf4j.Logger;
2741
import org.slf4j.LoggerFactory;
2842

29-
import javax.servlet.http.HttpServletRequest;
30-
import javax.servlet.http.HttpServletResponse;
31-
import java.io.InputStream;
32-
import java.io.NotSerializableException;
33-
import java.net.MalformedURLException;
34-
import java.net.URL;
35-
import java.util.*;
36-
import java.util.concurrent.ConcurrentHashMap;
37-
38-
import static org.junit.Assert.assertEquals;
39-
import static org.junit.Assert.assertNotNull;
40-
import static org.mockito.Mockito.mock;
43+
import com.netflix.util.Pair;
44+
import com.netflix.zuul.constants.ZuulHeaders;
45+
import com.netflix.zuul.util.DeepCopy;
4146

4247
/**
4348
* The Request Context holds request, response, state information and data for ZuulFilters to access and share.
@@ -63,7 +68,6 @@ protected RequestContext initialValue() {
6368
try {
6469
return contextClass.newInstance();
6570
} catch (Throwable e) {
66-
e.printStackTrace();
6771
throw new RuntimeException(e);
6872
}
6973
}
@@ -72,7 +76,6 @@ protected RequestContext initialValue() {
7276

7377
public RequestContext() {
7478
super();
75-
7679
}
7780

7881
/**

zuul-core/src/main/java/com/netflix/zuul/http/ZuulServlet.java

+23-16
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,20 @@
1515
*/
1616
package com.netflix.zuul.http;
1717

18+
import static org.junit.Assert.assertTrue;
19+
import static org.mockito.Mockito.spy;
20+
import static org.mockito.Mockito.times;
21+
import static org.mockito.Mockito.verify;
22+
import static org.mockito.Mockito.when;
23+
24+
import java.io.IOException;
25+
import java.io.PrintWriter;
26+
27+
import javax.servlet.ServletException;
28+
import javax.servlet.http.HttpServlet;
29+
import javax.servlet.http.HttpServletRequest;
30+
import javax.servlet.http.HttpServletResponse;
1831

19-
import com.netflix.zuul.FilterProcessor;
20-
import com.netflix.zuul.ZuulRunner;
21-
import com.netflix.zuul.context.RequestContext;
22-
import com.netflix.zuul.exception.ZuulException;
2332
import org.junit.Before;
2433
import org.junit.Test;
2534
import org.junit.runner.RunWith;
@@ -29,14 +38,10 @@
2938
import org.slf4j.Logger;
3039
import org.slf4j.LoggerFactory;
3140

32-
import javax.servlet.http.HttpServlet;
33-
import javax.servlet.http.HttpServletRequest;
34-
import javax.servlet.http.HttpServletResponse;
35-
import java.io.PrintWriter;
36-
37-
import static org.junit.Assert.assertEquals;
38-
import static org.junit.Assert.assertTrue;
39-
import static org.mockito.Mockito.*;
41+
import com.netflix.zuul.FilterProcessor;
42+
import com.netflix.zuul.ZuulRunner;
43+
import com.netflix.zuul.context.RequestContext;
44+
import com.netflix.zuul.exception.ZuulException;
4045

4146
/**
4247
* Core Zuul servlet which intializes and orchestrates zuulFilter execution
@@ -46,17 +51,20 @@
4651
* Time: 10:44 AM
4752
*/
4853
public class ZuulServlet extends HttpServlet {
54+
55+
private static final long serialVersionUID = -3374242278843351500L;
4956
private ZuulRunner zuulRunner = new ZuulRunner();
5057
private static Logger LOG = LoggerFactory.getLogger(ZuulServlet.class);
5158

5259
@Override
53-
public void service(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws javax.servlet.ServletException, java.io.IOException {
60+
public void service(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws ServletException, IOException {
5461
try {
5562
init((HttpServletRequest) servletRequest, (HttpServletResponse) servletResponse);
5663

57-
// marks this request as having passed through the "Zuul engine", as opposed to servlets
64+
// Marks this request as having passed through the "Zuul engine", as opposed to servlets
5865
// explicitly bound in web.xml, for which requests will not have the same data attached
59-
RequestContext.getCurrentContext().setZuulEngineRan();
66+
RequestContext context = RequestContext.getCurrentContext();
67+
context.setZuulEngineRan();
6068

6169
try {
6270
preRoute();
@@ -82,7 +90,6 @@ public void service(javax.servlet.ServletRequest servletRequest, javax.servlet.S
8290
} catch (Throwable e) {
8391
error(new ZuulException(e, 500, "UNHANDLED_EXCEPTION_" + e.getClass().getName()));
8492
} finally {
85-
// RequestContext.getCurrentContext().unset();
8693
}
8794
}
8895

zuul-netflix-webapp/build.gradle

+13-27
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ dependencies {
99

1010
compile project(':zuul-core')
1111
compile project(':zuul-netflix')
12-
compile project(':zuul-scripts')
1312

14-
runtime project(':zuul-scripts')
15-
16-
compile 'com.netflix.karyon:karyon-core:2.0.02'
17-
compile 'com.netflix.karyon:karyon-admin:2.0.02'
18-
compile 'com.netflix.karyon:karyon-admin-web:2.0.02'
19-
compile 'com.netflix.karyon:karyon-extensions:2.0.02'
20-
compile 'com.netflix.blitz4j:blitz4j:1.31'
13+
compile 'com.netflix.karyon:karyon-core:+'
14+
compile 'com.netflix.karyon:karyon-admin:+'
15+
compile 'com.netflix.karyon:karyon-admin-web:+'
16+
compile 'com.netflix.karyon:karyon-extensions:+'
17+
compile 'com.netflix.blitz4j:blitz4j:+'
18+
compile 'com.sun.jersey:jersey-bundle:+'
19+
groovy "org.codehaus.groovy:groovy-all:2.2.2"
2120
}
2221

2322
javadoc {
@@ -31,7 +30,6 @@ javadoc {
3130

3231
eclipse {
3332
classpath {
34-
// include 'provided' dependencies on the classpath
3533
plusConfigurations += configurations.provided
3634
downloadSources = true
3735
downloadJavadoc = true
@@ -41,34 +39,22 @@ eclipse {
4139

4240
idea {
4341
module {
44-
// include 'provided' dependencies on the classpath
4542
languageLevel = '1.7'
4643
scopes.PROVIDED.plus += configurations.provided
4744
}
4845
}
4946

50-
def findJar(prefix) {
51-
def name = ""
52-
configurations.runtime.each {
53-
if (it.name.startsWith(prefix)) {
54-
name = it
55-
}
56-
}
57-
return name;
58-
}
59-
60-
tasks.war.doFirst {
61-
webInf {
62-
def jar = findJar('zuul-scripts')
63-
from(zipTree(jar)) {
64-
include '**/*.groovy'
47+
war {
48+
webXml = file('src/main/webapp/WEB-INF/web.xml')
49+
webInf{
50+
from('src/main/groovy/scripts') {
51+
into('classes')
6552
}
6653
}
6754
}
6855

69-
// runs webapp at root context
7056
jettyRun.contextPath = '/'
7157

7258
jettyRun.doFirst {
7359
System.setProperty("archaius.deployment.applicationId", "zuul")
74-
}
60+
}

zuul-scripts/src/main/groovy/scripts/pre/Debug.groovy zuul-netflix-webapp/src/main/groovy/scripts/pre/Debug.groovy

+1-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import com.netflix.config.DynamicPropertyFactory
2020
import com.netflix.config.DynamicStringProperty
2121
import com.netflix.zuul.ZuulFilter
2222
import com.netflix.zuul.constants.ZuulConstants
23-
import com.netflix.zuul.context.NFRequestContext
2423
import com.netflix.zuul.context.RequestContext
2524

2625
class DebugFilter extends ZuulFilter {
@@ -40,7 +39,7 @@ class DebugFilter extends ZuulFilter {
4039

4140
boolean shouldFilter() {
4241

43-
if ("true".equals(NFRequestContext.currentContext.getRequest().getParameter(debugParameter.get()))) return true;
42+
if ("true".equals(RequestContext.currentContext.getRequest().getParameter(debugParameter.get()))) return true;
4443
return routingDebug.get();
4544

4645
}
@@ -49,11 +48,6 @@ class DebugFilter extends ZuulFilter {
4948
RequestContext.getCurrentContext().setDebugRequest(true)
5049
RequestContext.getCurrentContext().setDebugRouting(true)
5150
return null;
52-
5351
}
5452

55-
5653
}
57-
58-
59-

0 commit comments

Comments
 (0)