aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevi...@apache.org
Subject incubator-aurora git commit: Don't intercept methods on thrift that don't return Response.
Date Tue, 02 Dec 2014 19:36:58 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master d476e2a68 -> cf61e8a39


Don't intercept methods on thrift that don't return Response.

Testing Done:
./gradlew -Pq build

Bugs closed: AURORA-952

Reviewed at https://reviews.apache.org/r/28605/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/cf61e8a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/cf61e8a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/cf61e8a3

Branch: refs/heads/master
Commit: cf61e8a3980280720243221f3fbf925a5ccb25ee
Parents: d476e2a
Author: Kevin Sweeney <kevints@apache.org>
Authored: Tue Dec 2 11:36:36 2014 -0800
Committer: Kevin Sweeney <kevints@apache.org>
Committed: Tue Dec 2 11:36:53 2014 -0800

----------------------------------------------------------------------
 .../org/apache/aurora/scheduler/thrift/aop/AopModule.java   | 6 +++++-
 .../apache/aurora/scheduler/thrift/aop/AopModuleTest.java   | 9 +++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cf61e8a3/src/main/java/org/apache/aurora/scheduler/thrift/aop/AopModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/thrift/aop/AopModule.java b/src/main/java/org/apache/aurora/scheduler/thrift/aop/AopModule.java
index 83b8f39..bdd2185 100644
--- a/src/main/java/org/apache/aurora/scheduler/thrift/aop/AopModule.java
+++ b/src/main/java/org/apache/aurora/scheduler/thrift/aop/AopModule.java
@@ -43,6 +43,7 @@ import org.apache.aurora.GuiceUtils;
 import org.apache.aurora.auth.CapabilityValidator;
 import org.apache.aurora.gen.AuroraAdmin;
 import org.apache.aurora.gen.AuroraSchedulerManager;
+import org.apache.aurora.gen.Response;
 import org.apache.aurora.scheduler.thrift.auth.DecoratedThrift;
 
 /**
@@ -142,7 +143,10 @@ public class AopModule extends AbstractModule {
       Matcher<? super Class<?>> classMatcher,
       MethodInterceptor interceptor) {
 
-    binder.bindInterceptor(classMatcher, Matchers.any(), interceptor);
+    binder.bindInterceptor(
+        classMatcher,
+        Matchers.returns(Matchers.subclassesOf(Response.class)),
+        interceptor);
     binder.requestInjection(interceptor);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cf61e8a3/src/test/java/org/apache/aurora/scheduler/thrift/aop/AopModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/thrift/aop/AopModuleTest.java b/src/test/java/org/apache/aurora/scheduler/thrift/aop/AopModuleTest.java
index 801f3e0..df6b53a 100644
--- a/src/test/java/org/apache/aurora/scheduler/thrift/aop/AopModuleTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/thrift/aop/AopModuleTest.java
@@ -35,6 +35,7 @@ import org.junit.Test;
 
 import static org.easymock.EasyMock.expect;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 
 public class AopModuleTest extends EasyMockTest {
@@ -109,4 +110,12 @@ public class AopModuleTest extends EasyMockTest {
     Iface thrift = getIface(toggledMethods);
     assertSame(response, thrift.createJob(job, null, SESSION_KEY));
   }
+
+  @Test
+  public void assertToStringNotIntercepted() {
+    control.replay();
+
+    Iface thrift = getIface(ImmutableMap.<String, Boolean>of());
+    assertNotNull(thrift.toString());
+  }
 }


Mime
View raw message