-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b19b6b
commit ac2bb45
Showing
25 changed files
with
968 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...tion/src/main/java/com/huaweicloud/agentcore/test/application/common/TestAnnotationA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.test.application.common; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* 示例注解,用于作为注解拦截的示例 | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-08 | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE, ElementType.METHOD}) | ||
public @interface TestAnnotationA { | ||
} |
33 changes: 33 additions & 0 deletions
33
...tion/src/main/java/com/huaweicloud/agentcore/test/application/common/TestAnnotationB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.test.application.common; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* 实例注解,用于作为注解拦截的示例 | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-08 | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE, ElementType.METHOD}) | ||
public @interface TestAnnotationB { | ||
} |
26 changes: 26 additions & 0 deletions
26
...ation/src/main/java/com/huaweicloud/agentcore/test/application/common/TestSuperTypeA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.test.application.common; | ||
|
||
/** | ||
* TestSuperTypeA | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-08 | ||
*/ | ||
public interface TestSuperTypeA { | ||
} |
26 changes: 26 additions & 0 deletions
26
...ation/src/main/java/com/huaweicloud/agentcore/test/application/common/TestSuperTypeB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.test.application.common; | ||
|
||
/** | ||
* TestSuperTypeB | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-08 | ||
*/ | ||
public interface TestSuperTypeB { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...va/com/huaweicloud/agentcore/tests/plugin/declarer/classmatch/TestAnnotationDeclarer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.tests.plugin.declarer.classmatch; | ||
|
||
import com.huaweicloud.agentcore.tests.plugin.interceptor.common.SetEnhanceFlagInterceptor; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher; | ||
|
||
/** | ||
* 测试通过单个注解匹配类 | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-07 | ||
*/ | ||
public class TestAnnotationDeclarer extends AbstractPluginDeclarer { | ||
@Override | ||
public ClassMatcher getClassMatcher() { | ||
return ClassMatcher.isAnnotatedWith("com.huaweicloud.agentcore.test.application.common.TestAnnotationA"); | ||
} | ||
|
||
@Override | ||
public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) { | ||
return new InterceptDeclarer[]{ | ||
InterceptDeclarer.build(MethodMatcher.isStaticMethod(), new SetEnhanceFlagInterceptor())}; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...a/com/huaweicloud/agentcore/tests/plugin/declarer/classmatch/TestAnnotationsDeclarer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.tests.plugin.declarer.classmatch; | ||
|
||
import com.huaweicloud.agentcore.tests.plugin.interceptor.common.SetEnhanceFlagInterceptor; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher; | ||
|
||
/** | ||
* 测试注解匹配类 | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-07 | ||
*/ | ||
public class TestAnnotationsDeclarer extends AbstractPluginDeclarer { | ||
@Override | ||
public ClassMatcher getClassMatcher() { | ||
return ClassMatcher.isAnnotatedWith("com.huaweicloud.agentcore.test.application.common.TestAnnotationA", | ||
"com.huaweicloud.agentcore.test.application.common.TestAnnotationB"); | ||
} | ||
|
||
@Override | ||
public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) { | ||
return new InterceptDeclarer[]{ | ||
InterceptDeclarer.build(MethodMatcher.isStaticMethod(), new SetEnhanceFlagInterceptor())}; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...in/java/com/huaweicloud/agentcore/tests/plugin/declarer/classmatch/TestInfixDeclarer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.tests.plugin.declarer.classmatch; | ||
|
||
import com.huaweicloud.agentcore.tests.plugin.interceptor.common.SetEnhanceFlagInterceptor; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher; | ||
|
||
/** | ||
* 测试通过中缀匹配类 | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-07 | ||
*/ | ||
public class TestInfixDeclarer extends AbstractPluginDeclarer { | ||
@Override | ||
public ClassMatcher getClassMatcher() { | ||
return ClassMatcher.nameInfixedWith("Infix"); | ||
} | ||
|
||
@Override | ||
public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) { | ||
return new InterceptDeclarer[]{ | ||
InterceptDeclarer.build(MethodMatcher.isStaticMethod(), new SetEnhanceFlagInterceptor())}; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...n/java/com/huaweicloud/agentcore/tests/plugin/declarer/classmatch/TestPrefixDeclarer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.tests.plugin.declarer.classmatch; | ||
|
||
import com.huaweicloud.agentcore.tests.plugin.interceptor.common.SetEnhanceFlagInterceptor; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher; | ||
|
||
/** | ||
* 测试通过前缀匹配类 | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-07 | ||
*/ | ||
public class TestPrefixDeclarer extends AbstractPluginDeclarer { | ||
@Override | ||
public ClassMatcher getClassMatcher() { | ||
return ClassMatcher.namePrefixedWith("com.huaweicloud.agentcore.test.application.tests.classmatch.Prefix"); | ||
} | ||
|
||
@Override | ||
public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) { | ||
return new InterceptDeclarer[]{ | ||
InterceptDeclarer.build(MethodMatcher.isStaticMethod(), new SetEnhanceFlagInterceptor())}; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...n/java/com/huaweicloud/agentcore/tests/plugin/declarer/classmatch/TestSuffixDeclarer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* 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 com.huaweicloud.agentcore.tests.plugin.declarer.classmatch; | ||
|
||
import com.huaweicloud.agentcore.tests.plugin.interceptor.common.SetEnhanceFlagInterceptor; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher; | ||
import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher; | ||
|
||
/** | ||
* 测试通过后缀匹配类 | ||
* | ||
* @author luanwenfei | ||
* @since 2023-09-07 | ||
*/ | ||
public class TestSuffixDeclarer extends AbstractPluginDeclarer { | ||
@Override | ||
public ClassMatcher getClassMatcher() { | ||
return ClassMatcher.nameSuffixedWith("Suffix"); | ||
} | ||
|
||
@Override | ||
public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) { | ||
return new InterceptDeclarer[]{ | ||
InterceptDeclarer.build(MethodMatcher.isStaticMethod(), new SetEnhanceFlagInterceptor())}; | ||
} | ||
} |
Oops, something went wrong.