X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fspring%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fconcurrency%2Fspring%2FLockAdviceTest.java;h=ab4e7ad611996bc3259071170cf778fd4912af0c;hb=8de36ff0206c996baf3ee4adc3e2293b12ff5f39;hp=9257f7d7054aebe2931c0b324e8e46c96505c708;hpb=0d8d8f24656e585ee75558cfd6a4c661f8f14985;p=utils diff --git a/support/spring/src/test/java/org/wamblee/concurrency/spring/LockAdviceTest.java b/support/spring/src/test/java/org/wamblee/concurrency/spring/LockAdviceTest.java index 9257f7d7..ab4e7ad6 100644 --- a/support/spring/src/test/java/org/wamblee/concurrency/spring/LockAdviceTest.java +++ b/support/spring/src/test/java/org/wamblee/concurrency/spring/LockAdviceTest.java @@ -1,41 +1,33 @@ /* * Copyright 2005 the original author or authors. - * + * * Licensed 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 org.wamblee.concurrency.spring; import org.springframework.aop.framework.ProxyFactoryBean; + import org.wamblee.concurrency.AbstractLockTestCase; import org.wamblee.concurrency.JvmLock; import org.wamblee.concurrency.spring.LockAdvice; + import org.wamblee.test.TimingUtils; /** * - * * @author Erik Brakkee */ public class LockAdviceTest extends AbstractLockTestCase { - - private class Runner implements Runnable { - public void run() { - LockAdviceTest.this.getTracker().eventOccurred(ACQUIRED); - TimingUtils.sleep(SLEEP_TIME); - } - } - private Runnable target; /* @@ -46,16 +38,15 @@ public class LockAdviceTest extends AbstractLockTestCase { @Override protected void setUp() throws Exception { super.setUp(); - + Runner runner = new Runner(); LockAdvice advice = new LockAdvice(new JvmLock()); - + ProxyFactoryBean support = new ProxyFactoryBean(); - support.setInterfaces(new Class[]{ Runnable.class }); + support.setInterfaces(new Class[] { Runnable.class }); support.setTarget(runner); support.addAdvice(advice); - target = (Runnable)support.getObject(); - + target = (Runnable) support.getObject(); } /* @@ -77,7 +68,14 @@ public class LockAdviceTest extends AbstractLockTestCase { }; }); t.start(); + return t; } + private class Runner implements Runnable { + public void run() { + LockAdviceTest.this.getTracker().eventOccurred(ACQUIRED); + TimingUtils.sleep(SLEEP_TIME); + } + } }