Search in sources :

Example 1 with SlotChainBuilder

use of com.alibaba.csp.sentinel.slotchain.SlotChainBuilder in project Sentinel by alibaba.

the class SpiLoaderTest method testLoadFirstInstanceOrDefault.

@Test
public void testLoadFirstInstanceOrDefault() {
    SlotChainBuilder slotChainBuilder = SpiLoader.of(SlotChainBuilder.class).loadFirstInstanceOrDefault();
    assertNotNull(slotChainBuilder);
    assertTrue(slotChainBuilder instanceof DefaultSlotChainBuilder);
}
Also used : SlotChainBuilder(com.alibaba.csp.sentinel.slotchain.SlotChainBuilder) DefaultSlotChainBuilder(com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder) DefaultSlotChainBuilder(com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder) Test(org.junit.Test)

Example 2 with SlotChainBuilder

use of com.alibaba.csp.sentinel.slotchain.SlotChainBuilder 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)

Example 3 with SlotChainBuilder

use of com.alibaba.csp.sentinel.slotchain.SlotChainBuilder in project Sentinel by alibaba.

the class SpiLoaderTest method testLoadDefaultInstance.

@Test
public void testLoadDefaultInstance() {
    SlotChainBuilder slotChainBuilder = SpiLoader.of(SlotChainBuilder.class).loadDefaultInstance();
    assertNotNull(slotChainBuilder);
    assertTrue(slotChainBuilder instanceof DefaultSlotChainBuilder);
}
Also used : SlotChainBuilder(com.alibaba.csp.sentinel.slotchain.SlotChainBuilder) DefaultSlotChainBuilder(com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder) DefaultSlotChainBuilder(com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder) Test(org.junit.Test)

Aggregations

SlotChainBuilder (com.alibaba.csp.sentinel.slotchain.SlotChainBuilder)3 DefaultSlotChainBuilder (com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder)3 Test (org.junit.Test)3 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 NodeSelectorSlot (com.alibaba.csp.sentinel.slots.nodeselector.NodeSelectorSlot)1