当前位置: 首页>>代码示例>>Java>>正文


Java Language类代码示例

本文整理汇总了Java中de.espirit.firstspirit.access.Language的典型用法代码示例。如果您正苦于以下问题:Java Language类的具体用法?Java Language怎么用?Java Language使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Language类属于de.espirit.firstspirit.access包,在下文中一共展示了Language类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mockLanguage

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
/**
 * Mock language.
 *
 * @return the language
 */
protected Language mockLanguage() {
    if (language == null) {
        language = context.getMock(Language.class);
        reset(language);
        when(language.getLocale()).thenReturn(locale);
        when(language.isMasterLanguage()).thenReturn(Boolean.TRUE);
        when(language.getAbbreviation()).thenReturn(locale.getLanguage());
        when(language.getDisplayName((Language) any())).then(new Answer<String>() {
            @Override
            public String answer(final InvocationOnMock invocation) throws Throwable {
                final Language mylanguage = (Language) invocation.getArguments()[0];
                return locale.getDisplayLanguage(mylanguage.getLocale());
            }
        });
    }
    return language;
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:23,代码来源:AbstractSetupMocksStrategy.java

示例2: getLanguage

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
/**
 * Method to get the current language.
 *
 * @return the current language.
 */
public Language getLanguage() {
    if (workflowScriptContext == null) {
        LanguageAgent languageAgent = baseContext.requestSpecialist(LanguageAgent.TYPE);
        Language language = languageAgent.getMasterLanguage();
        for (Language lang : languageAgent.getLanguages()) {
            if (lang.getLocale().equals(locale)) {
                language = lang;
                break;
            }
        }
        return language;
    } else {
        return workflowScriptContext.getProject().getLanguage(locale.getLanguage().toUpperCase());
    }
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:21,代码来源:FsLocale.java

示例3: setupMocks

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
@Override
@SuppressWarnings("squid:S1166")
public void setupMocks() {
    final WebeditUiAgent uiAgent = context.requestSpecialist(WebeditUiAgent.TYPE);
    final Language language = mockLanguage();
    final Locale locale = language.getLocale();
    when(uiAgent.getDisplayLanguage()).thenReturn(language);
    when(uiAgent.getPreviewLanguage()).thenReturn(language);
    when(uiAgent.getLocale()).thenReturn(locale);
    try {
        when(uiAgent.getLocale()).thenReturn(getLocale());
    } catch (NoSuchMethodError e) {
        // FS version smaller 5.2.609
    }
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:16,代码来源:WebEditMocksStrategy.java

示例4: mocksLanguageAgent

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
private void mocksLanguageAgent() {
    final LanguageAgent agent = context.requestSpecialist(LanguageAgent.TYPE);
    final Language localLanguage = mockLanguage();
    when(agent.getMasterLanguage()).thenReturn(localLanguage);
    when(agent.getMetaLanguage()).thenReturn(localLanguage);
    when(agent.getLanguages()).thenReturn(Arrays.asList(localLanguage));
    when(agent.getEditorialLanguages()).thenReturn(Arrays.asList(localLanguage));
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:9,代码来源:AbstractSetupMocksStrategy.java

示例5: testRequire

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
/**
 * Test require method.
 *
 * @throws Exception the exception
 */
@Test
public void testRequire() throws Exception {
    final LanguageAgent languageAgent = testling.requireSpecialist(LanguageAgent.TYPE);
    assertThat("Expect a non null value", languageAgent, is(notNullValue()));

    final Language masterLanguage = languageAgent.getMasterLanguage();
    assertThat("Expect a certain locale", masterLanguage.getLocale(), is(TEST_LOCALE));
    assertThat("Expect ISO 2-letter code value", masterLanguage.getAbbreviation(), is(TEST_LOCALE.getLanguage()));
    assertThat("Expect display name in specific locale", masterLanguage.getDisplayName(masterLanguage),
               is(TEST_LOCALE.getDisplayLanguage(TEST_LOCALE)));
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:17,代码来源:MockingBaseContextTest.java

示例6: changeDisplayName

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
/**
 * Changes the displayname of given element to given displayname in given language.
 */
private static void changeDisplayName(final IDProvider element, final Language language, final String displayName) throws Exception {
    element.setLock(true, false);
    try {
        element.getLanguageInfo(language).setDisplayName(displayName);
        element.save("change displayname '" + displayName + "'", false);
    } finally {
        element.setLock(false, false);
    }
}
 
开发者ID:e-Spirit,项目名称:FSDevTools,代码行数:13,代码来源:ExportCommandIT.java

示例7: testGetRefObjectsFromTemplateStoreElement

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
@Test
public void testGetRefObjectsFromTemplateStoreElement() throws Exception {
	ReferenceEntry[] referenceEntries = new ReferenceEntry[1];
	referenceEntries[0] = mock(ReferenceEntry.class);
	IDProvider referencedElement = mock(IDProvider.class);
	when(referenceEntries[0].getReferencedElement()).thenReturn(referencedElement);

	TemplateStoreElement templateStoreElement = mock(TemplateStoreElement.class);
	when(templateStoreElement.getIncomingReferences()).thenReturn(referenceEntries);

	Language language = mock(Language.class);
	when(language.getLocale()).thenReturn(Locale.GERMANY);

	UIAgent uiAgent = mock(UIAgent.class);
	when(uiAgent.getDisplayLanguage()).thenReturn(language);

	Project project = mock(Project.class);
	when(project.getLanguage(Locale.GERMANY.getLanguage().toUpperCase())).thenReturn(language);

	WorkflowScriptContext workflowScriptContext = mock(WorkflowScriptContext.class);
	when(workflowScriptContext.getWorkflowable()).thenReturn(templateStoreElement);
	when(workflowScriptContext.requireSpecialist(UIAgent.TYPE)).thenReturn(uiAgent);
	when(workflowScriptContext.getProject()).thenReturn(project);

	WorkflowObject workflowObject = new WorkflowObject(workflowScriptContext);
	List<Object> refObjectsFromStoreElement = workflowObject.getRefObjectsFromStoreElement();

	verify(templateStoreElement).getIncomingReferences();

	assertNotNull("List of referenced objects is null.", refObjectsFromStoreElement);
	assertEquals("Number of referenced objects does not match expected amount.", referenceEntries.length, refObjectsFromStoreElement.size());

	for (int i = 0; i < referenceEntries.length; i++) {
		assertEquals("Referenced element does not equal expected element.", referenceEntries[i].getReferencedElement(), refObjectsFromStoreElement.get(i));
	}
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:37,代码来源:WorkflowObjectTest.java

示例8: before

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
@Override
protected void before() throws Throwable {
    Language language = mock(Language.class);
    when(language.getLocale()).thenReturn(locale);

    WebeditUiAgent agent = mock(WebeditUiAgent.class);
    when(agent.getDisplayLanguage()).thenReturn(language);

    context = mock(BaseContext.class);
    when(context.requireSpecialist(WebeditUiAgent.TYPE)).thenReturn(agent);
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:12,代码来源:BaseContextRule.java

示例9: getLanguage

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
@Override
public Language getLanguage() {
    return null;
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:5,代码来源:TestGenerationContext.java

示例10: mediaReferenced

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
@Override
public void mediaReferenced(final Media media, final Language language, final Resolution resolution) throws IOException {
    throw new UnsupportedOperationException();
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:5,代码来源:TestGenerationContext.java

示例11: getLanguage

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
@Override
public Language getLanguage() {
    return requestSpecialist(LanguageAgent.TYPE).getMasterLanguage();
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:5,代码来源:AbstractMockingGenerationScriptContext.java

示例12: setupMocks

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
@Override
public void setupMocks() {
    final UIAgent uiAgent = context.requireSpecialist(UIAgent.TYPE);
    final Language language = mockLanguage();
    when(uiAgent.getDisplayLanguage()).thenReturn(language);
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:7,代码来源:PreviewMocksStrategy.java

示例13: initMocks

import de.espirit.firstspirit.access.Language; //导入依赖的package包/类
@Before
public void initMocks() {
    templateFolder = mock(TemplateFolder.class);
    schema = mock(Schema.class);

    RequestOperation.Answer noAnswer = mock(RequestOperation.Answer.class);
    RequestOperation.Answer yesAnswer = mock(RequestOperation.Answer.class);
    requestOperation = mock(RequestOperation.class);
    when(requestOperation.addNo()).thenReturn(noAnswer);
    when(requestOperation.addYes()).thenReturn(yesAnswer);

    language = mock(Language.class);
    when(language.getLocale()).thenReturn(Locale.GERMANY);

    resourceBundle = ResourceBundle.getBundle(WorkflowConstants.MESSAGES, language.getLocale());

    UIAgent uiAgent = mock(UIAgent.class);
    when(uiAgent.getDisplayLanguage()).thenReturn(language);

    Project project = mock(Project.class);
    when(project.getLanguage(Locale.GERMANY.getLanguage().toUpperCase())).thenReturn(language);

    Task task = mock(Task.class);
    when(task.getCustomAttributes()).thenReturn(new HashMap<Object, Object>());

    OperationAgent operationAgent = mock(OperationAgent.class);
    when(operationAgent.getOperation(RequestOperation.TYPE)).thenReturn(requestOperation);

    IDProvider idProvider = mock(IDProvider.class);
    when(idProvider.getUidType()).thenReturn(IDProvider.UidType.TEMPLATESTORE);
    when(idProvider.getUid()).thenReturn(new String());

    Workflow workflow = mock(Workflow.class);

    workflowScriptContext = mock(WorkflowScriptContext.class);
    when(workflowScriptContext.requireSpecialist(UIAgent.TYPE)).thenReturn(uiAgent);
    when(workflowScriptContext.getProject()).thenReturn(project);
    when(workflowScriptContext.getTask()).thenReturn(task);
    when(workflowScriptContext.requireSpecialist(OperationAgent.TYPE)).thenReturn(operationAgent);
    when(workflowScriptContext.getTask().getWorkflow()).thenReturn(workflow);

    Map<Object, Object> session = new HashMap<Object, Object>();
    session.put(WorkflowConstants.WF_SUPPRESS_DIALOG, WorkflowConstants.TRUE);
    when(workflowScriptContext.getSession()).thenReturn(session);
}
 
开发者ID:e-Spirit,项目名称:basicworkflows,代码行数:46,代码来源:WfCheckPrerequisitesExecutableTest.java


注:本文中的de.espirit.firstspirit.access.Language类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。