本文整理汇总了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));
}
示例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));
}
示例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));
}
示例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));
}
示例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;
}