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


Java Message.setObject方法代码示例

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


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

示例1: testReceive

import org.jgroups.Message; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testReceive() throws Exception {
    final Identifier<Jvm> jvmId = new Identifier<>("1");
    Jvm jvm = new Jvm(jvmId, "jvm-name");

    final Map<Object, Object> serverInfoMap = new HashMap();
    serverInfoMap.put(JvmStateReceiverAdapter.NAME_KEY, jvm.getJvmName());
    serverInfoMap.put(JvmStateReceiverAdapter.STATE_KEY, LifecycleState.STOPPING);

    msg = new Message();
    msg.setObject(serverInfoMap);

    when (mockJvmPersistenceService.findJvmByExactName(jvm.getJvmName())).thenReturn(jvm);
    jvmStateReceiverAdapter.receive(msg);
    verify(mockJvmStateService).updateState(eq(jvm), eq(JvmState.JVM_STOPPING), eq(StringUtils.EMPTY));
}
 
开发者ID:cerner,项目名称:jwala,代码行数:18,代码来源:JvmStateReceiverAdapterTest.java

示例2: testReceiveReportingJmsMessageKey

import org.jgroups.Message; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testReceiveReportingJmsMessageKey() throws Exception {
    final Identifier<Jvm> jvmId = new Identifier<>("1");
    Jvm jvm = new Jvm(jvmId, "jvm-name");

    final Map<Object, Object> serverInfoMap = new HashMap();
    serverInfoMap.put(ReportingJmsMessageTestKey.ID, "1");
    serverInfoMap.put(ReportingJmsMessageTestKey.STATE, "JVM_STOPPING");

    msg = new Message();
    msg.setObject(serverInfoMap);

    when (mockJvmPersistenceService.getJvm(jvmId)).thenReturn(jvm);
    jvmStateReceiverAdapter.receive(msg);
    verify(mockJvmStateService).updateState(eq(jvm), eq(JvmState.JVM_STOPPING), eq(StringUtils.EMPTY));
}
 
开发者ID:cerner,项目名称:jwala,代码行数:18,代码来源:JvmStateReceiverAdapterTest.java

示例3: testReceiveWithRuntimeException

import org.jgroups.Message; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testReceiveWithRuntimeException() throws Exception {
    final Identifier<Jvm> jvmId = new Identifier<>("1");
    Jvm jvm = new Jvm(jvmId, "jvm-name");

    final Map<Object, Object> serverInfoMap = new HashMap();
    serverInfoMap.put(JvmStateReceiverAdapter.NAME_KEY, jvm.getJvmName());
    serverInfoMap.put(JvmStateReceiverAdapter.STATE_KEY, LifecycleState.STOPPING);

    msg = new Message();
    msg.setObject(serverInfoMap);

    when (mockJvmPersistenceService.findJvmByExactName(jvm.getJvmName())).thenThrow(new NoResultException(""));

    jvmStateReceiverAdapter.receive(msg);
    verify(mockJvmStateService, never()).updateState(eq(jvm), eq(JvmState.JVM_STOPPING), eq(StringUtils.EMPTY));
}
 
开发者ID:cerner,项目名称:jwala,代码行数:19,代码来源:JvmStateReceiverAdapterTest.java

示例4: testReceiveNullId

import org.jgroups.Message; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testReceiveNullId() {
    final Identifier<Jvm> jvmId = new Identifier<>("1");
    Jvm jvm = new Jvm(jvmId, "jvm-name");

    final Map<Object, Object> serverInfoMap = new HashMap();
    serverInfoMap.put(JvmStateReceiverAdapter.NAME_KEY, jvm.getJvmName());
    serverInfoMap.put(JvmStateReceiverAdapter.STATE_KEY, LifecycleState.STOPPING);

    msg = new Message();
    msg.setObject(serverInfoMap);

    when (mockJvmPersistenceService.findJvmByExactName(jvm.getJvmName())).thenReturn(null);

    jvmStateReceiverAdapter.receive(msg);
    verify(mockJvmStateService, never()).updateState(eq(jvm), eq(JvmState.JVM_STOPPING), eq(StringUtils.EMPTY));
}
 
开发者ID:cerner,项目名称:jwala,代码行数:19,代码来源:JvmStateReceiverAdapterTest.java

示例5: createJGMessage

import org.jgroups.Message; //导入方法依赖的package包/类
private Message createJGMessage(byte[] msgBytes, Address src, Address dest, short version) {
  Message msg = new Message();
  msg.setDest(dest);
  msg.setSrc(src);
  msg.setObject(msgBytes);
  msg.setFlag(Message.Flag.NO_RELIABILITY);
  msg.setFlag(Message.Flag.NO_FC);
  msg.setFlag(Message.Flag.DONT_BUNDLE);
  msg.setFlag(Message.Flag.OOB);
  return msg;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:12,代码来源:GMSPingPonger.java


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