MessagingContext implements Serializable { public String getTopicName() { StringBuilder sb = new StringBuilder(); if( this.kind == RecipientKind.DM ) { if( this.applicationName != null ) sb.append( this.applicationName ); } else { if( this.thoseThat != null ) sb.append( this.thoseThat ); if( this.componentOrFacetName != null ) sb.append( this.componentOrFacetName ); } return sb.toString(); } MessagingContext( RecipientKind kind, String domain, String applicationName );  MessagingContext( RecipientKind kind, String domain, String topicName, String applicationName );  MessagingContext( RecipientKind kind, String domain, String componentOrFacetName, ThoseThat thoseThat, String applicationName ); RecipientKind getKind(); String getApplicationName(); String getComponentOrFacetName(); ThoseThat getAgentDirection(); String getDomain(); String getTopicName(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString(); static Collection<MessagingContext> forImportedVariables(
			String domain,
			String applicationName,
			Instance instance,
			ThoseThat thoseThat ); static List<MessagingContext> forExportedVariables(
			String domain,
			String applicationName,
			Instance instance,
			Map<String,String> externalExports,
			ThoseThat thoseThat );  }
@Test public void testGetTopicName() { MessagingContext ctx = new MessagingContext( RecipientKind.DM, "domain", null ); Assert.assertEquals( "", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.DM, "domain", "whatever" ); Assert.assertEquals( "whatever", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.INTER_APP, "domain", "whatever" ); Assert.assertEquals( "", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.INTER_APP, "domain", null ); Assert.assertEquals( "", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.INTER_APP, "domain", "facet", null, "whatever" ); Assert.assertEquals( "facet", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.INTER_APP, "domain", "facet", ThoseThat.EXPORT, "whatever" ); Assert.assertEquals( "those.that.export.facet", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.AGENTS, "domain", "whatever" ); Assert.assertEquals( "", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.AGENTS, "domain", null ); Assert.assertEquals( "", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.AGENTS, "domain", "facet", null, "whatever" ); Assert.assertEquals( "facet", ctx.getTopicName()); ctx = new MessagingContext( RecipientKind.AGENTS, "domain", "facet", ThoseThat.IMPORT, "whatever" ); Assert.assertEquals( "those.that.import.facet", ctx.getTopicName()); }