mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
refactor(framework): remove obsolete agent proxy and register test stubs
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
package factory;
|
||||
|
||||
public class AgentRegisterTest {
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package module;
|
||||
|
||||
import net.bytebuddy.ByteBuddy;
|
||||
import net.bytebuddy.implementation.MethodDelegation;
|
||||
import net.bytebuddy.matcher.ElementMatchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class AbstractAgentRunningProxyTest {
|
||||
@Test
|
||||
public void test() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException, IOException, ClassNotFoundException {
|
||||
Class<? extends AbstractAgentRunningModule> clazz = new ByteBuddy().subclass(MyAbstractAgentRunningAbstractAgentModule.class)
|
||||
.method(ElementMatchers.isOverriddenFrom(AbstractAgentRunningModule.class))
|
||||
.intercept(MethodDelegation.to(
|
||||
new MyModuleProxyInterceptor()
|
||||
))
|
||||
.make()
|
||||
.load(AbstractAgentRunningProxyTest.class.getClassLoader())
|
||||
.getLoaded();
|
||||
clazz.getConstructor().newInstance().execute(null);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package module;
|
||||
|
||||
import work.slhaf.partner.api.agent.runtime.interaction.flow.entity.RunningFlowContext;
|
||||
|
||||
public class MyAbstractAgentRunningAbstractAgentModule extends AbstractAgentRunningModule {
|
||||
@Override
|
||||
public void execute(RunningFlowContext context) {
|
||||
System.out.println("MyAbstractAgentRunningAbstractAgentModule");
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package module;
|
||||
|
||||
import net.bytebuddy.implementation.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class MyModuleProxyInterceptor {
|
||||
public MyModuleProxyInterceptor() {
|
||||
}
|
||||
|
||||
@RuntimeType
|
||||
public Object intercept(@Origin Method method, @AllArguments Object[] allArguments, @SuperCall Callable<?> zuper, @This Object proxy) throws Exception {
|
||||
System.out.println("22222");
|
||||
Object res = zuper.call();
|
||||
System.out.println("11111");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user