當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。