Search in sources :

Example 1 with InitFunc

use of com.alibaba.csp.sentinel.init.InitFunc in project Sentinel by alibaba.

the class SpiLoaderTest method testLoadFirstInstance.

@Test
public void testLoadFirstInstance() {
    ProcessorSlot slot = SpiLoader.of(ProcessorSlot.class).loadFirstInstance();
    assertNotNull(slot);
    assertTrue(slot instanceof NodeSelectorSlot);
    SlotChainBuilder chainBuilder = SpiLoader.of(SlotChainBuilder.class).loadFirstInstance();
    assertNotNull(chainBuilder);
    assertTrue(chainBuilder instanceof SlotChainBuilder);
    InitFunc initFunc = SpiLoader.of(InitFunc.class).loadFirstInstance();
    assertNotNull(initFunc);
    assertTrue(initFunc instanceof MetricCallbackInit);
}
Also used : InitFunc(com.alibaba.csp.sentinel.init.InitFunc) SlotChainBuilder(com.alibaba.csp.sentinel.slotchain.SlotChainBuilder) DefaultSlotChainBuilder(com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder) MetricCallbackInit(com.alibaba.csp.sentinel.metric.extension.MetricCallbackInit) ProcessorSlot(com.alibaba.csp.sentinel.slotchain.ProcessorSlot) NodeSelectorSlot(com.alibaba.csp.sentinel.slots.nodeselector.NodeSelectorSlot) Test(org.junit.Test)

Aggregations

InitFunc (com.alibaba.csp.sentinel.init.InitFunc)1 MetricCallbackInit (com.alibaba.csp.sentinel.metric.extension.MetricCallbackInit)1 ProcessorSlot (com.alibaba.csp.sentinel.slotchain.ProcessorSlot)1 SlotChainBuilder (com.alibaba.csp.sentinel.slotchain.SlotChainBuilder)1 DefaultSlotChainBuilder (com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder)1 NodeSelectorSlot (com.alibaba.csp.sentinel.slots.nodeselector.NodeSelectorSlot)1 Test (org.junit.Test)1