Search in sources :

Example 1 with N2oPage

use of net.n2oapp.framework.api.metadata.global.view.page.N2oPage in project n2o-framework by i-novus-llc.

the class LocalizedSourceCacheOperationTest method test.

@Test
public void test() {
    LocaleContextHolder.setLocale(new Locale("ru"));
    CacheTemplate cacheTemplate = mock(CacheTemplate.class);
    MetadataRegister metadataRegister = mock(MetadataRegister.class);
    when(cacheTemplate.execute(eq("n2o.source"), eq("test.N2oPage.ru"), any())).thenReturn(getPage());
    when(metadataRegister.get("test", N2oPage.class)).thenReturn(new XmlInfo("test", N2oPage.class, "", ""));
    LocalizedSourceCacheOperation operation = new LocalizedSourceCacheOperation(cacheTemplate, metadataRegister);
    Object testPage = operation.execute(new PageContext("test"), null, this::getPage, null, null, null);
    assertThat(testPage instanceof N2oPage, is(true));
}
Also used : Locale(java.util.Locale) N2oPage(net.n2oapp.framework.api.metadata.global.view.page.N2oPage) LocalizedSourceCacheOperation(net.n2oapp.framework.config.compile.pipeline.operation.LocalizedSourceCacheOperation) CacheTemplate(net.n2oapp.cache.template.CacheTemplate) PageContext(net.n2oapp.framework.config.metadata.compile.context.PageContext) XmlInfo(net.n2oapp.framework.config.register.XmlInfo) MetadataRegister(net.n2oapp.framework.api.register.MetadataRegister) Test(org.junit.Test)

Example 2 with N2oPage

use of net.n2oapp.framework.api.metadata.global.view.page.N2oPage in project n2o-framework by i-novus-llc.

the class TestDynamicMetadataProvider method read.

@Override
public List<? extends N2oMetadata> read(String context) {
    if (autogen) {
        N2oPage page = new N2oStandardPage();
        page.setId(code + '$' + context);
        return Arrays.asList(page);
    }
    return metadataList;
}
Also used : N2oPage(net.n2oapp.framework.api.metadata.global.view.page.N2oPage) N2oStandardPage(net.n2oapp.framework.api.metadata.global.view.page.N2oStandardPage)

Example 3 with N2oPage

use of net.n2oapp.framework.api.metadata.global.view.page.N2oPage in project n2o-framework by i-novus-llc.

the class SimpleMenuCompiler method initDefaultName.

private String initDefaultName(N2oAction action, CompileProcessor p) {
    String pageId = initPageId(action);
    if (pageId == null)
        return null;
    N2oPage page = p.getSource(pageId, N2oPage.class);
    return page.getName();
}
Also used : N2oPage(net.n2oapp.framework.api.metadata.global.view.page.N2oPage)

Aggregations

N2oPage (net.n2oapp.framework.api.metadata.global.view.page.N2oPage)3 Locale (java.util.Locale)1 CacheTemplate (net.n2oapp.cache.template.CacheTemplate)1 N2oStandardPage (net.n2oapp.framework.api.metadata.global.view.page.N2oStandardPage)1 MetadataRegister (net.n2oapp.framework.api.register.MetadataRegister)1 LocalizedSourceCacheOperation (net.n2oapp.framework.config.compile.pipeline.operation.LocalizedSourceCacheOperation)1 PageContext (net.n2oapp.framework.config.metadata.compile.context.PageContext)1 XmlInfo (net.n2oapp.framework.config.register.XmlInfo)1 Test (org.junit.Test)1