亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tigeraspectjexpressionpointcuttests.java

?? struts+spring 源碼 希望能給大家帶來幫助
?? JAVA
字號:
/*
 * Copyright 2002-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.springframework.aop.aspectj;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import junit.framework.TestCase;

import org.springframework.beans.TestBean;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.transaction.annotation.AnnotationTransactionAttributeSourceTests;
import org.springframework.transaction.annotation.AnnotationTransactionAttributeSourceTests.TestBean3;
import org.springframework.transaction.annotation.AnnotationTransactionAttributeSourceTests.TestBean4;
import org.springframework.transaction.annotation.Transactional;

/** 
 * Java5-specific AspectJExpressionPointcutTests.
 *
 * @author Rod Johnson
 */
public class TigerAspectJExpressionPointcutTests extends TestCase {

	// TODO factor into static in AspectJExpressionPointcut
	private Method getAge;

	private Map<String,Method> methodsOnHasGeneric = new HashMap<String,Method>();


	public void setUp() throws NoSuchMethodException {
		getAge = TestBean.class.getMethod("getAge", (Class[]) null);
		// Assumes no overloading
		for (Method m : HasGeneric.class.getMethods()) {
			methodsOnHasGeneric.put(m.getName(), m);
		}
	}
	

	public static class HasGeneric {
		
		public void setFriends(List<TestBean> friends) {
		}
		public void setEnemies(List<TestBean> enemies) {
		}
		public void setPartners(List partners) {
		}
		public void setPhoneNumbers(List<String> numbers) {
		}
	}

	public void testMatchGenericArgument() {
		String expression = "execution(* set*(java.util.List<org.springframework.beans.TestBean>) )";
		AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
		ajexp.setExpression(expression);
		
		// TODO this will currently map, would be nice for optimization
		//assertTrue(ajexp.matches(HasGeneric.class));
		//assertFalse(ajexp.matches(TestBean.class));
		
		Method takesGenericList = methodsOnHasGeneric.get("setFriends");
		assertTrue(ajexp.matches(takesGenericList, HasGeneric.class));
		assertTrue(ajexp.matches(methodsOnHasGeneric.get("setEnemies"), HasGeneric.class));
		assertFalse(ajexp.matches(methodsOnHasGeneric.get("setPartners"), HasGeneric.class));
		assertFalse(ajexp.matches(methodsOnHasGeneric.get("setPhoneNumbers"), HasGeneric.class));
		
		assertFalse(ajexp.matches(getAge, TestBean.class));
	}
	
	public void testMatchVarargs() throws SecurityException, NoSuchMethodException {
		String expression = "execution(int *.*(String, Object...) )";
		AspectJExpressionPointcut jdbcVarArgs = new AspectJExpressionPointcut();
		jdbcVarArgs.setExpression(expression);
		
		assertFalse(jdbcVarArgs.matches(
				JdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class),
				JdbcTemplate.class));
		
		assertTrue(jdbcVarArgs.matches(
				SimpleJdbcTemplate.class.getMethod("queryForInt", String.class, Object[].class),
				SimpleJdbcTemplate.class));
		
		Method takesGenericList = methodsOnHasGeneric.get("setFriends");
		assertFalse(jdbcVarArgs.matches(takesGenericList, HasGeneric.class));
		assertFalse(jdbcVarArgs.matches(methodsOnHasGeneric.get("setEnemies"), HasGeneric.class));
		assertFalse(jdbcVarArgs.matches(methodsOnHasGeneric.get("setPartners"), HasGeneric.class));
		assertFalse(jdbcVarArgs.matches(methodsOnHasGeneric.get("setPhoneNumbers"), HasGeneric.class));
		assertFalse(jdbcVarArgs.matches(getAge, TestBean.class));
	}
	
	public void testMatchAnnotationOnClassWithAtWithin() throws SecurityException, NoSuchMethodException {
		String expression = "@within(org.springframework.transaction.annotation.Transactional)";
		testMatchAnnotationOnClass(expression);
	}
	
	public void testMatchAnnotationOnClassWithoutBinding() throws SecurityException, NoSuchMethodException {
		String expression = "within(@org.springframework.transaction.annotation.Transactional *)";
		testMatchAnnotationOnClass(expression);
	}
	
	public void testMatchAnnotationOnClassWithSubpackageWildcard() throws SecurityException, NoSuchMethodException {
		String expression = "within(@(org.springframework..*) *)";
		AspectJExpressionPointcut springAnnotatedPc = testMatchAnnotationOnClass(expression);
		assertFalse(springAnnotatedPc.matches(TestBean.class.getMethod("setName", String.class), 
				TestBean.class));
		assertTrue(springAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null), 
				SpringAnnotated.class));
		
		expression = "within(@(org.springframework.transaction..*) *)";
		AspectJExpressionPointcut springTxAnnotatedPc = testMatchAnnotationOnClass(expression);
		assertFalse(springTxAnnotatedPc.matches(SpringAnnotated.class.getMethod("foo", (Class[]) null), 
				SpringAnnotated.class));
	}
	
	public void testMatchAnnotationOnClassWithExactPackageWildcard() throws SecurityException, NoSuchMethodException {
		String expression = "within(@(org.springframework.transaction.annotation.*) *)";
		testMatchAnnotationOnClass(expression);
	}
	
	private AspectJExpressionPointcut testMatchAnnotationOnClass(String expression) throws SecurityException, NoSuchMethodException {
		AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
		ajexp.setExpression(expression);
		
		assertFalse(ajexp.matches(getAge, TestBean.class));
		assertTrue(ajexp.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
		assertTrue(ajexp.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
		assertTrue(ajexp.matches(AnnotationTransactionAttributeSourceTests.TestBean4.class.getMethod("setName", String.class), TestBean4.class));
		assertFalse(ajexp.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
		return ajexp;
	}
	
	public void testAnnotationOnMethodWithFQN() throws SecurityException, NoSuchMethodException {
		String expression = "@annotation(org.springframework.transaction.annotation.Transactional)";
		AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
		ajexp.setExpression(expression);
		
		assertFalse(ajexp.matches(getAge, TestBean.class));
		assertFalse(ajexp.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
		assertFalse(ajexp.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
		assertFalse(ajexp.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
		assertTrue(ajexp.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("getAge", (Class[]) null), TestBean3.class));
		assertFalse(ajexp.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
	}
	
	public void testAnnotationOnMethodWithWildcard() throws SecurityException, NoSuchMethodException {
		String expression = "execution(@(org.springframework..*) * *(..))";
		AspectJExpressionPointcut anySpringMethodAnnotation = new AspectJExpressionPointcut();
		anySpringMethodAnnotation.setExpression(expression);
		
		assertFalse(anySpringMethodAnnotation.matches(getAge, TestBean.class));
		assertFalse(anySpringMethodAnnotation.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
		assertFalse(anySpringMethodAnnotation.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
		assertFalse(anySpringMethodAnnotation.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
		assertTrue(anySpringMethodAnnotation.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("getAge", (Class[]) null), TestBean3.class));
		assertFalse(anySpringMethodAnnotation.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
	}

	public void testAnnotationOnMethodArgumentsWithFQN() throws SecurityException, NoSuchMethodException {
		String expression = "@args(*, org.springframework.aop.aspectj.TigerAspectJExpressionPointcutTests.EmptySpringAnnotation))";
		AspectJExpressionPointcut takesSpringAnnotatedArgument2 = new AspectJExpressionPointcut();
		takesSpringAnnotatedArgument2.setExpression(expression);
		
		assertFalse(takesSpringAnnotatedArgument2.matches(getAge, TestBean.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("getAge", (Class[]) null), TestBean3.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
		
		assertTrue(takesSpringAnnotatedArgument2.matches(
				ProcessesSpringAnnotatedParameters.class.getMethod("takesAnnotatedParameters", TestBean.class, SpringAnnotated.class),
				ProcessesSpringAnnotatedParameters.class));
		
		// True because it maybeMatches with potential argument subtypes
		assertTrue(takesSpringAnnotatedArgument2.matches(
				ProcessesSpringAnnotatedParameters.class.getMethod("takesNoAnnotatedParameters", TestBean.class, TestBean3.class),
				ProcessesSpringAnnotatedParameters.class));
		
		assertFalse(takesSpringAnnotatedArgument2.matches(
				ProcessesSpringAnnotatedParameters.class.getMethod("takesNoAnnotatedParameters", TestBean.class, TestBean3.class),
				ProcessesSpringAnnotatedParameters.class,
				new Object[] { new TestBean(), new TestBean3()})
		);
	}
	
	public void testAnnotationOnMethodArgumentsWithWildcards() throws SecurityException, NoSuchMethodException {
		String expression = "execution(* *(*, @(org.springframework..*) *))";
		AspectJExpressionPointcut takesSpringAnnotatedArgument2 = new AspectJExpressionPointcut();
		takesSpringAnnotatedArgument2.setExpression(expression);
		
		assertFalse(takesSpringAnnotatedArgument2.matches(getAge, TestBean.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("foo", (Class[]) null), HasTransactionalAnnotation.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(HasTransactionalAnnotation.class.getMethod("bar", String.class), HasTransactionalAnnotation.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("getAge", (Class[]) null), TestBean3.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(AnnotationTransactionAttributeSourceTests.TestBean3.class.getMethod("setName", String.class), TestBean3.class));
		
		assertTrue(takesSpringAnnotatedArgument2.matches(
				ProcessesSpringAnnotatedParameters.class.getMethod("takesAnnotatedParameters", TestBean.class, SpringAnnotated.class),
				ProcessesSpringAnnotatedParameters.class));
		assertFalse(takesSpringAnnotatedArgument2.matches(
				ProcessesSpringAnnotatedParameters.class.getMethod("takesNoAnnotatedParameters", TestBean.class, TestBean3.class),
				ProcessesSpringAnnotatedParameters.class));
	}


	public static class ProcessesSpringAnnotatedParameters {

		public void takesAnnotatedParameters(TestBean tb, SpringAnnotated sa) {
		}

		public void takesNoAnnotatedParameters(TestBean tb, TestBean3 tb3) {
		}
	}


	@Transactional
	public static class HasTransactionalAnnotation {

		public void foo() {
		}
		public Object bar(String foo) {
			throw new UnsupportedOperationException();
		}
	}


	@Retention(RetentionPolicy.RUNTIME)
	@Target(ElementType.TYPE)
	public @interface EmptySpringAnnotation {

	}


	@EmptySpringAnnotation
	public static class SpringAnnotated {
		public void foo() {
		}
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三级| 精品人在线二区三区| 欧美精品在线视频| 国产日本亚洲高清| 午夜欧美一区二区三区在线播放| 国产一区在线视频| 欧美日韩免费观看一区三区| 国产精品天干天干在观线| 免费看欧美女人艹b| 在线观看国产日韩| 亚洲日本va在线观看| 国产一区二区三区在线看麻豆| 欧美日韩亚洲国产综合| 日韩理论片在线| 成人一区二区三区| 欧美tickle裸体挠脚心vk| 午夜成人在线视频| 一本色道**综合亚洲精品蜜桃冫| 中文字幕欧美激情一区| 国产制服丝袜一区| 欧美成人一区二区三区片免费| 亚洲成av人片在线| 在线亚洲+欧美+日本专区| 国产精品人妖ts系列视频| 韩国精品久久久| 欧美成人a∨高清免费观看| 五月激情六月综合| 欧美另类久久久品| 午夜亚洲国产au精品一区二区 | ...xxx性欧美| 成人高清免费观看| 中文字幕第一区| 成人激情视频网站| 亚洲天天做日日做天天谢日日欢| 成人免费视频国产在线观看| 欧美经典三级视频一区二区三区| 国产福利一区在线观看| 国产欧美日韩卡一| 不卡的av在线| 亚洲人成在线观看一区二区| 91免费版在线| 亚洲午夜免费电影| 欧美放荡的少妇| 青青草国产精品97视觉盛宴 | 91免费在线播放| 中文字幕亚洲欧美在线不卡| 成人福利电影精品一区二区在线观看| 国产日韩精品一区| 成+人+亚洲+综合天堂| 亚洲视频一区二区在线| 欧美亚洲日本一区| 日韩国产精品久久| 精品国产一区二区精华| 成人中文字幕电影| 亚洲一区二区三区四区在线免费观看 | 91老师国产黑色丝袜在线| 亚洲一区二区av电影| 欧美一区二区在线免费播放| 国产一区二区三区在线看麻豆| 中文字幕一区二| 91.成人天堂一区| 国产成a人亚洲精| 一区二区成人在线视频| 日韩精品一区二区三区老鸭窝 | 欧美国产精品中文字幕| 色哟哟日韩精品| 麻豆视频观看网址久久| 自拍偷拍欧美精品| 欧美一区二区视频在线观看| 懂色av中文一区二区三区| 亚洲已满18点击进入久久| 欧美成人伊人久久综合网| 91小视频免费看| 久久国产成人午夜av影院| 亚洲欧洲三级电影| 日韩网站在线看片你懂的| 成人理论电影网| 免费成人深夜小野草| 18欧美亚洲精品| 亚洲精品在线三区| 91成人免费网站| 国产91精品一区二区| 午夜精品在线看| 亚洲男人天堂av网| 国产色产综合产在线视频| 欧美午夜视频网站| av亚洲精华国产精华| 美女一区二区视频| 亚洲第一二三四区| 国产精品成人免费在线| 精品粉嫩超白一线天av| 欧美日韩一级二级三级| 色综合久久综合| 国产成人啪午夜精品网站男同| 五月婷婷综合网| 亚洲老司机在线| 国产精品天天看| 国产欧美日韩精品一区| 精品国产亚洲在线| 欧美一区二区不卡视频| 欧美日韩色综合| 欧美色图12p| 欧美丝袜丝nylons| 日本乱人伦一区| 色综合久久中文字幕| 91啦中文在线观看| 色综合久久久久久久| 成人av片在线观看| 高清不卡在线观看av| 国产精品 日产精品 欧美精品| 麻豆中文一区二区| 精品在线视频一区| 麻豆视频一区二区| 国产一区二区精品久久99| 精品午夜久久福利影院| 精品写真视频在线观看| 国产精品77777竹菊影视小说| 国产一区二区三区视频在线播放| 日本va欧美va精品| 久久精品国产一区二区| 精品无人码麻豆乱码1区2区| 国产一区二区主播在线| 国产成人精品影视| 成人av动漫在线| 91福利在线导航| 欧美老女人第四色| 精品美女一区二区| 国产三级精品三级| 亚洲色图一区二区| 亚洲午夜久久久久久久久电影网 | 亚洲欧美一区二区三区久本道91 | 亚洲第一成人在线| 看片的网站亚洲| 国产精品一区二区在线播放| 国产宾馆实践打屁股91| 91亚洲国产成人精品一区二三| 欧美四级电影网| 欧美电视剧在线观看完整版| 久久久久久久久岛国免费| 欧美韩国一区二区| 亚洲五码中文字幕| 久久精品国产99久久6| 夫妻av一区二区| 欧美影片第一页| 久久香蕉国产线看观看99| 国产精品久久久久久户外露出 | 亚洲午夜久久久| 日本午夜一本久久久综合| 精品一区二区三区免费毛片爱 | 国产精品自产自拍| 91国在线观看| 久久综合五月天婷婷伊人| 亚洲乱码国产乱码精品精小说| 日本中文字幕一区二区视频 | 欧美美女bb生活片| 中文字幕欧美国产| 男女男精品视频| 色综合久久久久网| www激情久久| 亚洲va韩国va欧美va| 国产成人av电影在线播放| 欧美日韩中文字幕精品| 国产日韩成人精品| 日本不卡高清视频| 91一区一区三区| 久久久亚洲欧洲日产国码αv| 亚洲综合区在线| 国产成人亚洲综合色影视| 欧美日本在线观看| 成人欧美一区二区三区小说| 久久精品国产一区二区三| 在线国产电影不卡| 国产精品视频九色porn| 久久精品国产99国产精品| 欧美三级在线看| 1024成人网| 成人av网站免费| 国产欧美一区二区精品忘忧草 | 欧美日韩成人在线一区| 最新中文字幕一区二区三区| 国产乱码精品一品二品| 欧美精品电影在线播放| 综合久久一区二区三区| 成人妖精视频yjsp地址| xnxx国产精品| 精久久久久久久久久久| 精品日产卡一卡二卡麻豆| 日韩av电影天堂| 这里是久久伊人| 日韩国产一二三区| 欧美日韩一区二区不卡| 一区二区在线看| 91麻豆成人久久精品二区三区| 国产精品美女久久久久久久久久久 | 婷婷亚洲久悠悠色悠在线播放| 欧美在线观看一区二区| 亚洲精品亚洲人成人网在线播放| 99久久国产综合精品麻豆| 国产精品久久免费看| 99久久精品免费看|