Search in sources :

Example 1 with PluginDataHandler

use of org.apache.shenyu.plugin.base.handler.PluginDataHandler in project incubator-shenyu by apache.

the class CommonPluginDataSubscriber method putExtendPluginDataHandler.

/**
 * Put extend plugin data handler.
 *
 * @param handlers the handlers
 */
public void putExtendPluginDataHandler(final List<PluginDataHandler> handlers) {
    if (CollectionUtils.isEmpty(handlers)) {
        return;
    }
    for (PluginDataHandler handler : handlers) {
        String pluginNamed = handler.pluginNamed();
        handlerMap.computeIfAbsent(pluginNamed, name -> {
            LOG.info("shenyu auto add extends plugin data handler name is :{}", pluginNamed);
            return handler;
        });
    }
}
Also used : PluginDataHandler(org.apache.shenyu.plugin.base.handler.PluginDataHandler)

Example 2 with PluginDataHandler

use of org.apache.shenyu.plugin.base.handler.PluginDataHandler in project incubator-shenyu by apache.

the class GrpcPluginConfigurationTest method testGrpcPluginDataHandler.

@Test
public void testGrpcPluginDataHandler() {
    applicationContextRunner.run(context -> {
        PluginDataHandler handler = context.getBean("grpcPluginDataHandler", PluginDataHandler.class);
        assertNotNull(handler);
    });
}
Also used : PluginDataHandler(org.apache.shenyu.plugin.base.handler.PluginDataHandler) Test(org.junit.jupiter.api.Test)

Example 3 with PluginDataHandler

use of org.apache.shenyu.plugin.base.handler.PluginDataHandler in project incubator-shenyu by apache.

the class HystrixPluginConfigurationTest method testHystrixPluginDataHandler.

@Test
public void testHystrixPluginDataHandler() {
    new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(HystrixPluginConfiguration.class)).withBean(HystrixPluginConfigurationTest.class).withPropertyValues("debug=true").run(context -> {
        PluginDataHandler handler = context.getBean("hystrixPluginDataHandler", PluginDataHandler.class);
        assertNotNull(handler);
    });
}
Also used : ApplicationContextRunner(org.springframework.boot.test.context.runner.ApplicationContextRunner) PluginDataHandler(org.apache.shenyu.plugin.base.handler.PluginDataHandler) Test(org.junit.jupiter.api.Test)

Example 4 with PluginDataHandler

use of org.apache.shenyu.plugin.base.handler.PluginDataHandler in project incubator-shenyu by apache.

the class JwtPluginConfigurationTest method testJwtPluginDataHandler.

@Test
public void testJwtPluginDataHandler() {
    new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(JwtPluginConfiguration.class)).withBean(JwtPluginConfigurationTest.class).withPropertyValues("debug=true").run(context -> {
        PluginDataHandler handler = context.getBean("jwtPluginDataHandler", PluginDataHandler.class);
        assertNotNull(handler);
    });
}
Also used : ApplicationContextRunner(org.springframework.boot.test.context.runner.ApplicationContextRunner) PluginDataHandler(org.apache.shenyu.plugin.base.handler.PluginDataHandler) Test(org.junit.jupiter.api.Test)

Example 5 with PluginDataHandler

use of org.apache.shenyu.plugin.base.handler.PluginDataHandler in project incubator-shenyu by apache.

the class ModifyResponsePluginConfigurationTest method testModifyResponsePluginDataHandler.

@Test
public void testModifyResponsePluginDataHandler() {
    new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(ModifyResponsePluginConfiguration.class)).withBean(ModifyResponsePluginConfigurationTest.class).withPropertyValues("debug=true").run(context -> {
        assertThat(context).hasSingleBean(ModifyResponsePluginDataHandler.class);
        PluginDataHandler handler = context.getBean("modifyResponsePluginDataHandler", PluginDataHandler.class);
        assertNotNull(handler);
    });
}
Also used : ApplicationContextRunner(org.springframework.boot.test.context.runner.ApplicationContextRunner) PluginDataHandler(org.apache.shenyu.plugin.base.handler.PluginDataHandler) ModifyResponsePluginDataHandler(org.apache.shenyu.plugin.modify.response.handler.ModifyResponsePluginDataHandler) Test(org.junit.jupiter.api.Test)

Aggregations

PluginDataHandler (org.apache.shenyu.plugin.base.handler.PluginDataHandler)25 Test (org.junit.jupiter.api.Test)22 ApplicationContextRunner (org.springframework.boot.test.context.runner.ApplicationContextRunner)11 Lists (com.google.common.collect.Lists)1 ByteStreams (com.google.common.io.ByteStreams)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Closeable (java.io.Closeable)1 File (java.io.File)1 IOException (java.io.IOException)1 Annotation (java.lang.annotation.Annotation)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Enumeration (java.util.Enumeration)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1