MessagingUtils { public static String escapeInstancePath( String instancePath ) { String result; if( Utils.isEmptyOrWhitespaces( instancePath )) result = ""; else result = instancePath.replaceFirst( "^/*", "" ).replaceFirst( "/*$", "" ).replaceAll( "/+", "." ); return result; } private  MessagingUtils(); static String buildTopicNameForAgent( Instance instance ); static String buildTopicNameForAgent( String scopedInstancePath ); static String escapeInstancePath( String instancePath ); static String buildId(
			RecipientKind ownerKind,
			String domain,
			String applicationName,
			String scopedInstancePath );  }
@Test public void testEscapeInstancePath() { Assert.assertEquals( "", MessagingUtils.escapeInstancePath( null )); Assert.assertEquals( "", MessagingUtils.escapeInstancePath( " " )); Assert.assertEquals( "root", MessagingUtils.escapeInstancePath( "/root" )); Assert.assertEquals( "root.server.app", MessagingUtils.escapeInstancePath( "/root/server/app" )); }