You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2015/09/01 11:08:52 UTC
[4/4] git commit: updated refs/heads/master to 22c78ed
Fixing line endings in the new file introduced in PR #762 merged through commit e8979c0e658b3e3d3c8553f865411d4ececa5f4f
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/22c78ede
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/22c78ede
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/22c78ede
Branch: refs/heads/master
Commit: 22c78ede326b7ff3b97f1c81c8b1f00fa3dc309a
Parents: e8979c0
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Tue Sep 1 14:34:54 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Tue Sep 1 14:34:54 2015 +0530
----------------------------------------------------------------------
.../utils/log/CglibThrowableRendererTest.java | 170 +++++++++----------
1 file changed, 85 insertions(+), 85 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/22c78ede/utils/src/test/java/com/cloud/utils/log/CglibThrowableRendererTest.java
----------------------------------------------------------------------
diff --git a/utils/src/test/java/com/cloud/utils/log/CglibThrowableRendererTest.java b/utils/src/test/java/com/cloud/utils/log/CglibThrowableRendererTest.java
index ae5d487..bf9cfc5 100644
--- a/utils/src/test/java/com/cloud/utils/log/CglibThrowableRendererTest.java
+++ b/utils/src/test/java/com/cloud/utils/log/CglibThrowableRendererTest.java
@@ -1,85 +1,85 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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 com.cloud.utils.log;
-
-import java.lang.reflect.Method;
-
-import org.apache.commons.lang.StringUtils;
-import org.junit.Assert;
-import org.junit.Test;
-
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-public class CglibThrowableRendererTest {
-
- CglibThrowableRenderer cglibThrowableRenderer = new CglibThrowableRenderer();
-
- @Test
- public void testDoRendere() {
- SampleClass sampleClass = (SampleClass)Enhancer.create(SampleClass.class, new MyInvocationHandler());
- try {
- sampleClass.theFirstMethodThatCapturesAnException();
- } catch (Exception e) {
- String[] exceptions = cglibThrowableRenderer.doRender(e);
- assertThatTheTraceListDoesNotContainsCgLibLogs(exceptions);
- }
- }
-
- private void assertThatTheTraceListDoesNotContainsCgLibLogs(String[] exceptions) {
- for (String s : exceptions) {
- Assert.assertEquals(false, isCgLibLogTrace(s));
- }
- }
-
- private boolean isCgLibLogTrace(String s) {
- return StringUtils.contains(s, "net.sf.cglib.proxy");
- }
-
- static class SampleClass {
- public void theFirstMethodThatCapturesAnException() {
- try {
- methodThatCapturesAndThrowsException();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private void methodThatCapturesAndThrowsException() throws Exception {
- try {
- methodThatThrowsAnError();
- } catch (Error e) {
- throw new Exception("Throws an exception", e);
- }
- }
-
- private void methodThatThrowsAnError() {
- throw new Error("Exception to test the CglibThrowableRenderer.");
- }
- }
-
- static class MyInvocationHandler implements MethodInterceptor {
- @Override
- public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
- return proxy.invoke(new SampleClass(), args);
- }
- }
-}
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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 com.cloud.utils.log;
+
+import java.lang.reflect.Method;
+
+import org.apache.commons.lang.StringUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+public class CglibThrowableRendererTest {
+
+ CglibThrowableRenderer cglibThrowableRenderer = new CglibThrowableRenderer();
+
+ @Test
+ public void testDoRendere() {
+ SampleClass sampleClass = (SampleClass)Enhancer.create(SampleClass.class, new MyInvocationHandler());
+ try {
+ sampleClass.theFirstMethodThatCapturesAnException();
+ } catch (Exception e) {
+ String[] exceptions = cglibThrowableRenderer.doRender(e);
+ assertThatTheTraceListDoesNotContainsCgLibLogs(exceptions);
+ }
+ }
+
+ private void assertThatTheTraceListDoesNotContainsCgLibLogs(String[] exceptions) {
+ for (String s : exceptions) {
+ Assert.assertEquals(false, isCgLibLogTrace(s));
+ }
+ }
+
+ private boolean isCgLibLogTrace(String s) {
+ return StringUtils.contains(s, "net.sf.cglib.proxy");
+ }
+
+ static class SampleClass {
+ public void theFirstMethodThatCapturesAnException() {
+ try {
+ methodThatCapturesAndThrowsException();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void methodThatCapturesAndThrowsException() throws Exception {
+ try {
+ methodThatThrowsAnError();
+ } catch (Error e) {
+ throw new Exception("Throws an exception", e);
+ }
+ }
+
+ private void methodThatThrowsAnError() {
+ throw new Error("Exception to test the CglibThrowableRenderer.");
+ }
+ }
+
+ static class MyInvocationHandler implements MethodInterceptor {
+ @Override
+ public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
+ return proxy.invoke(new SampleClass(), args);
+ }
+ }
+}