org.alfresco.repo.i18n.StaticMessageLookup Java Examples

The following examples show how to use org.alfresco.repo.i18n.StaticMessageLookup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DictionaryDAOTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception
{   
    // register resource bundles for messages
    I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES);

    // Instantiate Dictionary Service
    TenantService tenantService = new MultiTServiceImpl();

    this.dictionaryDAO = new DictionaryDAOImpl();
    dictionaryDAO.setTenantService(tenantService);

    initDictionaryCaches(dictionaryDAO, tenantService);

    new AuthenticationUtil().afterPropertiesSet();

    // Populate with appropriate models
    DictionaryBootstrap bootstrap = new DictionaryBootstrap();
    List<String> bootstrapModels = new ArrayList<String>();
    bootstrapModels.add("alfresco/model/dictionaryModel.xml");
    bootstrapModels.add("alfresco/model/systemModel.xml");
    bootstrapModels.add("alfresco/model/contentModel.xml");
    List<String> labels = new ArrayList<String>();
    bootstrap.setModels(bootstrapModels);
    bootstrap.setLabels(labels);
    bootstrap.setDictionaryDAO(dictionaryDAO);
    bootstrap.setTenantService(tenantService);
    bootstrap.bootstrap();

    DictionaryComponent component = new DictionaryComponent();
    component.setDictionaryDAO(dictionaryDAO);
    component.setMessageLookup(new StaticMessageLookup());
    service = component;
}
 
Example #2
Source File: DictionaryComponentTest.java    From alfresco-data-model with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void testMessageLookup() throws Exception
{
    DictionaryComponent dc = new DictionaryComponent();
    dc.setDictionaryDAO(dictionaryDAO);
    dc.setMessageLookup(new StaticMessageLookup());

    assertNull(dc.getMessage("fred"));
    assertNull(dc.getMessage("fred", Locale.getDefault()));
    assertNull(dc.getMessage("fred","cat"));
    assertNull(dc.getMessage("fred", Locale.getDefault(), "dog"));

}
 
Example #3
Source File: DictionaryDAOTest.java    From alfresco-data-model with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception
{   
    // register resource bundles for messages
    I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES);

    // Instantiate Dictionary Service
    TenantService tenantService = new SingleTServiceImpl();

    this.dictionaryDAO = new DictionaryDAOImpl();
    dictionaryDAO.setTenantService(tenantService);
    initDictionaryCaches(dictionaryDAO, tenantService);

    // Populate with appropriate models
    DictionaryBootstrap bootstrap = new DictionaryBootstrap();
    List<String> bootstrapModels = new ArrayList<String>();
    bootstrapModels.add("alfresco/model/dictionaryModel.xml");
    bootstrapModels.add(TEST_MODEL);
    List<String> labels = new ArrayList<String>();
    labels.add(TEST_BUNDLE);
    bootstrap.setModels(bootstrapModels);
    bootstrap.setLabels(labels);
    bootstrap.setDictionaryDAO(dictionaryDAO);
    bootstrap.setTenantService(tenantService);
    bootstrap.bootstrap();

    DictionaryComponent component = new DictionaryComponent();
    component.setDictionaryDAO(dictionaryDAO);
    component.setMessageLookup(new StaticMessageLookup());
    service = component;
}
 
Example #4
Source File: RepoDictionaryDAOTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void setUp() throws Exception
{
    // Registered the required constraints
    ConstraintRegistry constraintRegistry = ConstraintRegistry.getInstance();
    AbstractConstraint constraintReg1 = new UserNameConstraint();
    constraintReg1.setShortName("cm:reg1");
    constraintReg1.setRegistry(constraintRegistry);
    constraintReg1.initialize();
    AbstractConstraint constraintReg2 = new UserNameConstraint();
    constraintReg2.setShortName("cm:reg2");
    constraintReg2.setRegistry(constraintRegistry);
    constraintReg2.initialize();
    
    // register resource bundles for messages
    I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES);
    
    // Instantiate Dictionary Service
    TenantService tenantService = new SingleTServiceImpl();

    DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl();
    dictionaryDAO.setTenantService(tenantService);
    initDictionaryCaches(dictionaryDAO, tenantService);

    // Populate with appropriate models
    DictionaryBootstrap bootstrap = new DictionaryBootstrap();
    List<String> bootstrapModels = new ArrayList<String>();
    bootstrapModels.add("alfresco/model/dictionaryModel.xml");
    bootstrapModels.add(TEST_MODEL);
    List<String> labels = new ArrayList<String>();
    labels.add(TEST_BUNDLE);
    bootstrap.setModels(bootstrapModels);
    bootstrap.setLabels(labels);
    bootstrap.setDictionaryDAO(dictionaryDAO);
    bootstrap.setTenantService(tenantService);
    bootstrap.bootstrap();
    
    DictionaryComponent component = new DictionaryComponent();
    component.setDictionaryDAO(dictionaryDAO);
    component.setMessageLookup(new StaticMessageLookup());
    service = component;
}
 
Example #5
Source File: SOLRAPIClientTest.java    From SearchServices with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void setUp() throws Exception
{
    if(client == null)
    {
        TenantService tenantService = new SingleTServiceImpl();

        dictionaryDAO = new DictionaryDAOImpl();
        NamespaceDAO namespaceDAO = dictionaryDAO;
        dictionaryDAO.setTenantService(tenantService);
        
        CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
        compiledModelsCache.setDictionaryDAO(dictionaryDAO);
        compiledModelsCache.setTenantService(tenantService);
        compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
        TraceableThreadFactory threadFactory = new TraceableThreadFactory();
        threadFactory.setThreadDaemon(true);
        threadFactory.setThreadPriority(Thread.NORM_PRIORITY);
        
        ThreadPoolExecutor threadPoolExecutor = new DynamicallySizedThreadPoolExecutor(20, 20, 90, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory,
                new ThreadPoolExecutor.CallerRunsPolicy());
        compiledModelsCache.setThreadPoolExecutor(threadPoolExecutor);
        dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
        // TODO: use config ....
        dictionaryDAO.setDefaultAnalyserResourceBundleName("alfresco/model/dataTypeAnalyzers");
        dictionaryDAO.setResourceClassLoader(getResourceClassLoader());
        dictionaryDAO.init();

        DictionaryComponent dictionaryComponent = new DictionaryComponent();
        dictionaryComponent.setDictionaryDAO(dictionaryDAO);
        dictionaryComponent.setMessageLookup(new StaticMessageLookup());

        // cmis dictionary
        CMISMapping cmisMapping = new CMISMapping();
        cmisMapping.setCmisVersion(CmisVersion.CMIS_1_0);
        DictionaryNamespaceComponent namespaceService = new DictionaryNamespaceComponent();
        namespaceService.setNamespaceDAO(namespaceDAO);
        cmisMapping.setNamespaceService(namespaceService);
        cmisMapping.setDictionaryService(dictionaryComponent);
        cmisMapping.afterPropertiesSet();

        cmisDictionaryService = new CMISStrictDictionaryService();
        cmisDictionaryService.setCmisMapping(cmisMapping);
        cmisDictionaryService.setDictionaryService(dictionaryComponent);
        cmisDictionaryService.setDictionaryDAO(dictionaryDAO);
        cmisDictionaryService.setSingletonCache(new MemoryCache<String, CMISDictionaryRegistry>());
        cmisDictionaryService.setTenantService(tenantService);
        cmisDictionaryService.init();

        RuntimePropertyLuceneBuilderMapping luceneBuilderMapping = new RuntimePropertyLuceneBuilderMapping();
        luceneBuilderMapping.setDictionaryService(dictionaryComponent);
        luceneBuilderMapping.setCmisDictionaryService(cmisDictionaryService);
        cmisDictionaryService.setPropertyLuceneBuilderMapping(luceneBuilderMapping);

        luceneBuilderMapping.afterPropertiesSet();

        // Load the key store from the classpath
        ClasspathKeyResourceLoader keyResourceLoader = new ClasspathKeyResourceLoader();
        client = new SOLRAPIClient(getRepoClient(keyResourceLoader), dictionaryComponent, dictionaryDAO);
        trackModels();
    }
}
 
Example #6
Source File: FacetablePropertiesGet.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 votes vote down vote up
public FacetablePropertiesGet() { messageLookup = new StaticMessageLookup(); }