- Mockito.when(deviceState.getNodeId()).thenReturn(nodeKey.getId());
- Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation(
- Matchers.<Class<RpcService>>any(), Matchers.any(RpcService.class)))
- .thenReturn(routedRpcRegistration);
- Mockito.when(conductor.getDeviceContext(Mockito.<NodeId>any())).thenReturn(deviceContext);
- Mockito.when(contexts.remove(nodeId)).thenReturn(removedContexts);
- }
-
- @Test
- public void onDeviceContextLevelUp() throws Exception {
- rpcManager.onDeviceContextLevelUp(nodeId);
- verify(conductor).getDeviceContext(Mockito.<NodeId>any());
- }
-
- @Test
- public void onDeviceContextLevelUpTwice() throws Exception {
- rpcManager.onDeviceContextLevelUp(nodeId);
- expectedException.expect(VerifyException.class);
- rpcManager.onDeviceContextLevelUp(nodeId);
- }
-
- @Test
- public void testOnDeviceContextLevelUpMaster() throws Exception {
- rpcManager.onDeviceContextLevelUp(nodeId);
- verify(deviceINitializationPhaseHandler).onDeviceContextLevelUp(nodeId);
- }
-
- @Test
- public void testOnDeviceContextLevelUpSlave() throws Exception {
- rpcManager.onDeviceContextLevelUp(nodeId);
- verify(deviceINitializationPhaseHandler).onDeviceContextLevelUp(nodeId);