@Test
public void testSetOwnerProperties_propertiesAreMoved() throws Exception {

	// Init...
	InMemoryClient client = new InMemoryClient( new InMemoryRoutingContext(), RecipientKind.DM );
	RoboconfMessageQueue queue = new RoboconfMessageQueue();
	client.setMessageQueue( queue );
	client.openConnection();
	MessagingContext ctx = new MessagingContext( RecipientKind.AGENTS, "domain", "app" );
	client.subscribe( ctx );
	String ownerId_1 = client.getOwnerId();
	// Verify associations
	Map<String,Set<MessagingContext>> sub = client.getRoutingContext().subscriptions;
	Map<String,LinkedBlockingQueue<Message>> ctxToQueue = ((InMemoryRoutingContext) client.getRoutingContext()).ctxToQueue;
	Assert.assertEquals( queue, ctxToQueue.get( ownerId_1 ));
	Set<MessagingContext> subscribedContexts = sub.get( ownerId_1 );
	Assert.assertNotNull( subscribedContexts );
	Assert.assertEquals( 1, subscribedContexts.size());
	Assert.assertTrue( subscribedContexts.contains( ctx ));
	// Change the owner ID
	client.setOwnerProperties( RecipientKind.AGENTS, "domain", "app1", "root1" );
	// Verify properties were kept
	String ownerId_2 = client.getOwnerId();
	Assert.assertFalse( ownerId_2.equals( ownerId_1 ));
	Assert.assertEquals( queue, ctxToQueue.get( ownerId_2 ));
	Assert.assertNull( ctxToQueue.get( ownerId_1 ));
	Assert.assertNull( sub.get( ownerId_1 ));
	subscribedContexts = sub.get( ownerId_2 );
	Assert.assertNotNull( subscribedContexts );
	Assert.assertEquals( 1, subscribedContexts.size());
	Assert.assertTrue( subscribedContexts.contains( ctx ));
}