You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2013/06/11 00:37:25 UTC
git commit: Stub out additional JMX methods to avoid test-time errors
Updated Branches:
refs/heads/2.0.2-incubating e21321434 -> c676e3e2d
refs/heads/CURATOR-10 [created] c676e3e2d
Stub out additional JMX methods to avoid test-time errors
Project: http://git-wip-us.apache.org/repos/asf/incubator-curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-curator/commit/c676e3e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-curator/tree/c676e3e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-curator/diff/c676e3e2
Branch: refs/heads/2.0.2-incubating
Commit: c676e3e2d0e9fdc83f5fde1be1baeb808d00f9d7
Parents: e213214
Author: randgalt <ra...@apache.org>
Authored: Mon Jun 10 15:37:05 2013 -0700
Committer: randgalt <ra...@apache.org>
Committed: Mon Jun 10 15:37:05 2013 -0700
----------------------------------------------------------------------
.../apache/curator/test/ByteCodeRewrite.java | 26 +++++++++++++++-----
1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/c676e3e2/curator-test/src/main/java/org/apache/curator/test/ByteCodeRewrite.java
----------------------------------------------------------------------
diff --git a/curator-test/src/main/java/org/apache/curator/test/ByteCodeRewrite.java b/curator-test/src/main/java/org/apache/curator/test/ByteCodeRewrite.java
index 19d069a..eeca3d4 100644
--- a/curator-test/src/main/java/org/apache/curator/test/ByteCodeRewrite.java
+++ b/curator-test/src/main/java/org/apache/curator/test/ByteCodeRewrite.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.curator.test;
import javassist.CannotCompileException;
@@ -26,7 +27,7 @@ import javassist.NotFoundException;
public class ByteCodeRewrite
{
- public static void apply()
+ public static void apply()
{
// NOP - only needed so that static initializer is run
}
@@ -46,7 +47,7 @@ public class ByteCodeRewrite
try
{
CtClass cc = pool.get("org.apache.zookeeper.server.ZooKeeperServer");
- fixMethods(cc);
+ fixMethods(cc, "registerJMX", "unregisterJMX");
}
catch ( NotFoundException ignore )
{
@@ -56,7 +57,17 @@ public class ByteCodeRewrite
try
{
CtClass cc = pool.get("org.apache.zookeeper.server.quorum.LearnerZooKeeperServer");
- fixMethods(cc);
+ fixMethods(cc, "registerJMX", "unregisterJMX");
+ }
+ catch ( NotFoundException ignore )
+ {
+ // ignore
+ }
+
+ try
+ {
+ CtClass cc = pool.get("org.apache.zookeeper.jmx.MBeanRegistry");
+ fixMethods(cc, "register", "unregister");
}
catch ( NotFoundException ignore )
{
@@ -69,13 +80,16 @@ public class ByteCodeRewrite
}
}
- private static void fixMethods(CtClass cc) throws CannotCompileException
+ private static void fixMethods(CtClass cc, String... methodNames) throws CannotCompileException
{
for ( CtMethod method : cc.getDeclaredMethods() )
{
- if ( method.getName().equals("registerJMX") || method.getName().equals("unregisterJMX") )
+ for ( String methodName : methodNames )
{
- method.setBody(null);
+ if ( method.getName().equals(methodName) )
+ {
+ method.setBody(null);
+ }
}
}
cc.toClass();