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


Java Messages.get方法代码示例

本文整理汇总了Java中org.oscm.app.iaas.i18n.Messages.get方法的典型用法代码示例。如果您正苦于以下问题:Java Messages.get方法的具体用法?Java Messages.get怎么用?Java Messages.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.oscm.app.iaas.i18n.Messages的用法示例。


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

示例1: sendMailAboutModification

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Sends a notification email about a modification operation.
 * 
 * @param instanceId
 * @param paramHandler
 * @throws APPlatformException
 */
private void sendMailAboutModification(String instanceId,
        PropertyHandler paramHandler) throws APPlatformException {
    String mail = paramHandler.getMailForNotification();
    if (mail != null) {
        Operation operationState = paramHandler.getOperation();
        if (operationState.isModification()) {
            String locale = paramHandler.getCustomerLocale();
            String subject = Messages.get(locale,
                    "mail_notify_about_modification.subject",
                    new Object[] { instanceId });
            String text = Messages.get(locale,
                    "mail_notify_about_modification.text",
                    new Object[] { instanceId });
            platformService.sendMail(Collections.singletonList(mail),
                    subject, text);
        }
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:26,代码来源:ProcessManagerBean.java

示例2: recoverInline

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Make sure we don't attempt to recover inline; if the parser successfully
 * recovers, it won't throw an exception.
 */
@Override
public Token recoverInline(Parser recognizer) throws RecognitionException {
    InputMismatchException e = new InputMismatchException(recognizer);

    String policies = recognizer.getInputStream().getText();
    StringTokenizer tk = new StringTokenizer(policies, ";");
    String policy = "";
    int idx = 0;
    while (tk.hasMoreElements()) {
        policy = (String) tk.nextElement();
        idx += policy.length();
        if (idx >= e.getOffendingToken().getStartIndex()) {
            break;
        }
    }

    String message = Messages.get(Messages.DEFAULT_LOCALE,
            "error_invalid_firewallconfig", new Object[] {
                    e.getOffendingToken().getText(), policy });
    throw new RuntimeException(message);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:26,代码来源:FWPolicyErrorStrategy.java

示例3: getSuspendException

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
@Test
public void getSuspendException() {
    // given
    RORException rorException = spy(new RORException(EXCEPTIONMESSAGE));
    Throwable cause = new Throwable();
    String localizedMessage = Messages.get("en", EXCEPTIONMESSAGETYPE,
            cause.getClass().getName());
    doReturn(cause).when(rorException).getCause();

    // when
    SuspendException suspendException = rorVServerCommunication
            .getSuspendException(rorException, EXCEPTIONMESSAGETYPE);

    // then
    assertEquals(localizedMessage,
            suspendException.getLocalizedMessage("en"));
    assertEquals(cause, suspendException.getCause());
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:19,代码来源:RORVServerCommunicationTest.java

示例4: recover

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Instead of recovering from exception e, rethrow it wrapped in a generic
 * RuntimeException so it is not caught by the rule function catches.
 * Exception e is the "cause" of the RuntimeException.
 */

@Override
public void recover(Parser recognizer, RecognitionException e) {
    String message = Messages.get(Messages.DEFAULT_LOCALE,
            "error_invalid_firewallconfig", new Object[] {
                    e.getOffendingToken().getText(),
                    e.getInputStream().toString() });

    throw new RuntimeException(message);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:16,代码来源:FWPolicyErrorStrategy.java

示例5: testLocalizedResources

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
@Test
public void testLocalizedResources() throws Exception {
    String message1 = Messages.get("de", "status_INSTANCE_OVERALL");
    String message2 = Messages.get("en", "status_INSTANCE_OVERALL");
    String message3 = Messages.get("fr", "status_INSTANCE_OVERALL");
    assertFalse(message1.equals(message2));
    assertTrue(message2.equals(message3));
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:9,代码来源:PropertyHandlerTest.java

示例6: getSuspendException_MissingCause

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
@Test
public void getSuspendException_MissingCause() {
    // given
    RORException rorException = new RORException(EXCEPTIONMESSAGE);
    String localizedMessage = Messages.get("en", EXCEPTIONMESSAGETYPE,
            EXCEPTIONMESSAGE);

    // when
    SuspendException suspendException = rorVServerCommunication
            .getSuspendException(rorException, EXCEPTIONMESSAGETYPE);

    // then
    assertEquals(localizedMessage,
            suspendException.getLocalizedMessage("en"));
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:16,代码来源:RORVServerCommunicationTest.java

示例7: testMissingResource

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
@Test
public void testMissingResource() throws Exception {
    String message = Messages.get("de", "key");
    assertEquals("!key!", message);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:6,代码来源:PropertyHandlerTest.java


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