Search in sources :

Example 1 with ItemProcessor

use of org.craftercms.core.processors.ItemProcessor in project core by craftercms.

the class UrlPatternProcessorResolverTest method testGetProcessor.

@Test
public void testGetProcessor() throws Exception {
    Item item = new Item();
    item.setUrl(DESCRIPTOR_URL);
    ItemProcessor processor = resolver.getProcessor(item);
    assertSame(processor, pagesProcessor);
    item = new Item();
    item.setUrl(IMAGE_URL);
    processor = resolver.getProcessor(item);
    assertSame(processor, staticAssetsProcessor);
}
Also used : Item(org.craftercms.core.service.Item) ItemProcessor(org.craftercms.core.processors.ItemProcessor) Test(org.junit.Test)

Example 2 with ItemProcessor

use of org.craftercms.core.processors.ItemProcessor in project core by craftercms.

the class ItemProcessorResolverChainTest method testResolverChain.

@Test
public void testResolverChain() throws Exception {
    ItemProcessor processor = resolverChain.getProcessor(item1);
    assertSame(processor1, processor);
    processor = resolverChain.getProcessor(item2);
    assertSame(processor2, processor);
    processor = resolverChain.getProcessor(item3);
    assertSame(defaultProcessor, processor);
}
Also used : ItemProcessor(org.craftercms.core.processors.ItemProcessor) Test(org.junit.Test)

Example 3 with ItemProcessor

use of org.craftercms.core.processors.ItemProcessor in project core by craftercms.

the class SingleProcessorResolverTest method testResolver.

@Test
public void testResolver() throws Exception {
    ItemProcessor processor = resolver.getProcessor(null);
    assertSame(this.processor, processor);
}
Also used : ItemProcessor(org.craftercms.core.processors.ItemProcessor) Test(org.junit.Test)

Example 4 with ItemProcessor

use of org.craftercms.core.processors.ItemProcessor in project core by craftercms.

the class MetaDataProcessorResolverTest method setUpTestResolver.

private void setUpTestResolver() {
    Map<String, ItemProcessor> processors = new HashMap<String, ItemProcessor>();
    processors.put(PROCESSOR1_ELEMENT_VALUE, processor1);
    processors.put(PROCESSOR2_ELEMENT_VALUE, processor2);
    resolver = new MetaDataProcessorResolver();
    resolver.setProcessorElementXPathQuery(PROCESSOR_ELEMENT_XPATH_QUERY);
    resolver.setElementValueToProcessorMappings(processors);
}
Also used : MetaDataProcessorResolver(org.craftercms.core.processors.impl.resolvers.MetaDataProcessorResolver) ItemProcessor(org.craftercms.core.processors.ItemProcessor) HashMap(java.util.HashMap)

Example 5 with ItemProcessor

use of org.craftercms.core.processors.ItemProcessor in project core by craftercms.

the class MetaDataProcessorResolverTest method testGetProcessor.

@Test
public void testGetProcessor() throws Exception {
    Item item = new Item();
    item.setDescriptorDom(descriptorDomProcessor1);
    ItemProcessor processor = resolver.getProcessor(item);
    assertSame(processor1, processor);
    item = new Item();
    item.setDescriptorDom(descriptorDomProcessor2);
    processor = resolver.getProcessor(item);
    assertSame(processor2, processor);
}
Also used : Item(org.craftercms.core.service.Item) ItemProcessor(org.craftercms.core.processors.ItemProcessor) Test(org.junit.Test)

Aggregations

ItemProcessor (org.craftercms.core.processors.ItemProcessor)6 Test (org.junit.Test)4 HashMap (java.util.HashMap)2 Item (org.craftercms.core.service.Item)2 MetaDataProcessorResolver (org.craftercms.core.processors.impl.resolvers.MetaDataProcessorResolver)1 UrlPatternProcessorResolver (org.craftercms.core.processors.impl.resolvers.UrlPatternProcessorResolver)1