+ public void deviceMastered() throws Exception {
+ registration.close();
+ contextChainHolder.createContextChain(connectionContext);
+ contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_FLOW_REGISTRY_FILL);
+ Assert.assertFalse(contextChainHolder.isAnyDeviceMastered());
+ contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_GATHERING);
+ Assert.assertFalse(contextChainHolder.isAnyDeviceMastered());
+ contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.RPC_REGISTRATION);
+ Assert.assertFalse(contextChainHolder.isAnyDeviceMastered());
+ contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.MASTER_ON_DEVICE);
+ Assert.assertFalse(contextChainHolder.isAnyDeviceMastered());
+ contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_SUBMIT);
+ Assert.assertTrue(contextChainHolder.isAnyDeviceMastered());
+ Assert.assertTrue(contextChainHolder.listOfMasteredDevices().size() == 1);