Search in sources :

Example 6 with ProcessorSlot

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

the class SpiLoaderTest method testLoadInstanceByClass.

@Test
public void testLoadInstanceByClass() {
    ProcessorSlot slot = SpiLoader.of(ProcessorSlot.class).loadInstance(StatisticSlot.class);
    assertNotNull(slot);
    assertTrue(slot instanceof StatisticSlot);
}
Also used : StatisticSlot(com.alibaba.csp.sentinel.slots.statistic.StatisticSlot) ProcessorSlot(com.alibaba.csp.sentinel.slotchain.ProcessorSlot) Test(org.junit.Test)

Example 7 with ProcessorSlot

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

the class SpiLoaderTest method testLoadInstanceByAliasName.

@Test
public void testLoadInstanceByAliasName() {
    ProcessorSlot slot = SpiLoader.of(ProcessorSlot.class).loadInstance("com.alibaba.csp.sentinel.slots.statistic.StatisticSlot");
    assertNotNull(slot);
    assertTrue(slot instanceof StatisticSlot);
}
Also used : StatisticSlot(com.alibaba.csp.sentinel.slots.statistic.StatisticSlot) ProcessorSlot(com.alibaba.csp.sentinel.slotchain.ProcessorSlot) Test(org.junit.Test)

Aggregations

ProcessorSlot (com.alibaba.csp.sentinel.slotchain.ProcessorSlot)7 Test (org.junit.Test)6 NodeSelectorSlot (com.alibaba.csp.sentinel.slots.nodeselector.NodeSelectorSlot)2 StatisticSlot (com.alibaba.csp.sentinel.slots.statistic.StatisticSlot)2 InitFunc (com.alibaba.csp.sentinel.init.InitFunc)1 MetricCallbackInit (com.alibaba.csp.sentinel.metric.extension.MetricCallbackInit)1 AbstractLinkedProcessorSlot (com.alibaba.csp.sentinel.slotchain.AbstractLinkedProcessorSlot)1 DefaultProcessorSlotChain (com.alibaba.csp.sentinel.slotchain.DefaultProcessorSlotChain)1 ProcessorSlotChain (com.alibaba.csp.sentinel.slotchain.ProcessorSlotChain)1 SlotChainBuilder (com.alibaba.csp.sentinel.slotchain.SlotChainBuilder)1 DefaultSlotChainBuilder (com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder)1 DegradeSlot (com.alibaba.csp.sentinel.slots.block.degrade.DegradeSlot)1 ArrayList (java.util.ArrayList)1