use of org.craftercms.engine.util.store.decorators.DecoratedStoreAdapterContext in project engine by craftercms.
the class TargetedContentStoreAdapterDecoratorTest method testFindItem.
@Test
public void testFindItem() throws Exception {
Context context = new DecoratedStoreAdapterContext(mock(Context.class), storeAdapter);
CachingOptions cachingOptions = CachingOptions.DEFAULT_CACHING_OPTIONS;
Item item = storeAdapter.findItem(context, cachingOptions, "/site/website/en", true);
assertNotNull(item);
assertEquals("en", item.getName());
assertEquals("/site/website/en", item.getUrl());
item = storeAdapter.findItem(context, cachingOptions, "/site/website/ja_jp_jp", true);
assertNotNull(item);
assertEquals("en", item.getName());
assertEquals("/site/website/en", item.getUrl());
item = storeAdapter.findItem(context, cachingOptions, "/site/website/ja_jp_jp/index.xml", true);
assertNotNull(item);
assertEquals("index.xml", item.getName());
assertEquals("/site/website/en/index.xml", item.getUrl());
item = storeAdapter.findItem(context, cachingOptions, "/site/website/index.xml", true);
assertNotNull(item);
assertEquals("index.xml", item.getName());
assertEquals("/site/website/index.xml", item.getUrl());
item = storeAdapter.findItem(context, cachingOptions, "/static-assets/css/main.css", true);
assertNotNull(item);
assertEquals("main.css", item.getName());
assertEquals("/static-assets/css/main.css", item.getUrl());
}
use of org.craftercms.engine.util.store.decorators.DecoratedStoreAdapterContext in project engine by craftercms.
the class TargetedContentStoreAdapterDecoratorTest method testExists.
@Test
public void testExists() throws Exception {
Context context = new DecoratedStoreAdapterContext(mock(Context.class), storeAdapter);
CachingOptions cachingOptions = CachingOptions.DEFAULT_CACHING_OPTIONS;
boolean exists = storeAdapter.exists(context, cachingOptions, "/site/website/en");
assertTrue(exists);
exists = storeAdapter.exists(context, cachingOptions, "/site/website/ja_jp_jp");
assertTrue(exists);
exists = storeAdapter.exists(context, cachingOptions, "/site/website/ja_jp_jp/index.xml");
assertTrue(exists);
exists = storeAdapter.exists(context, cachingOptions, "/site/website/index.xml");
assertTrue(exists);
exists = storeAdapter.exists(context, cachingOptions, "/static-assets/css/main.css");
assertTrue(exists);
}
use of org.craftercms.engine.util.store.decorators.DecoratedStoreAdapterContext in project engine by craftercms.
the class TargetedContentStoreAdapterDecoratorTest method testFindContent.
@Test
public void testFindContent() throws Exception {
Context context = new DecoratedStoreAdapterContext(mock(Context.class), storeAdapter);
CachingOptions cachingOptions = CachingOptions.DEFAULT_CACHING_OPTIONS;
Content content = storeAdapter.findContent(context, cachingOptions, "/site/website/en/index.xml");
assertNotNull(content);
content = storeAdapter.findContent(context, cachingOptions, "/site/website/ja_jp_jp/index.xml");
assertNotNull(content);
content = storeAdapter.findContent(context, cachingOptions, "/site/website/index.xml");
assertNotNull(content);
content = storeAdapter.findContent(context, cachingOptions, "/static-assets/css/main.css");
assertNotNull(content);
}
use of org.craftercms.engine.util.store.decorators.DecoratedStoreAdapterContext in project engine by craftercms.
the class TargetedContentStoreAdapterDecoratorTest method testFindItems.
@Test
public void testFindItems() throws Exception {
Context context = new DecoratedStoreAdapterContext(mock(Context.class), storeAdapter);
CachingOptions cachingOptions = CachingOptions.DEFAULT_CACHING_OPTIONS;
List<Item> items = storeAdapter.findItems(context, cachingOptions, "/site/website/en");
assertNotNull(items);
assertEquals(2, items.size());
assertEquals("index.xml", items.get(0).getName());
assertEquals("/site/website/en/index.xml", items.get(0).getUrl());
assertEquals("about-us", items.get(1).getName());
assertEquals("/site/website/en/about-us", items.get(1).getUrl());
items = storeAdapter.findItems(context, cachingOptions, "/site/website/ja_jp_jp");
assertNotNull(items);
assertEquals(2, items.size());
assertEquals("index.xml", items.get(0).getName());
assertEquals("/site/website/ja/index.xml", items.get(0).getUrl());
assertEquals("about-us", items.get(1).getName());
assertEquals("/site/website/en/about-us", items.get(1).getUrl());
config.setProperty(SiteProperties.MERGE_FOLDERS_CONFIG_KEY, false);
items = storeAdapter.findItems(context, cachingOptions, "/site/website/ja_jp_jp");
assertNotNull(items);
assertEquals(1, items.size());
assertEquals("index.xml", items.get(0).getName());
assertEquals("/site/website/ja/index.xml", items.get(0).getUrl());
}
Aggregations