From 22c78ede326b7ff3b97f1c81c8b1f00fa3dc309a Mon Sep 17 00:00:00 2001 From: Rajani Karuturi Date: Tue, 1 Sep 2015 14:34:54 +0530 Subject: [PATCH] Fixing line endings in the new file introduced in PR #762 merged through commit e8979c0e658b3e3d3c8553f865411d4ececa5f4f --- .../utils/log/CglibThrowableRendererTest.java | 170 +++++++++--------- 1 file changed, 85 insertions(+), 85 deletions(-) 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 ae5d4870432..bf9cfc525f8 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); + } + } +}