BloombergJmsTopicNameResolver topicNameResolver = new BloombergJmsTopicNameResolver(rdp);
ExternalId aaplEquity = idResolver.resolve(
ExternalIdBundle.of(ExternalSchemes.bloombergTickerSecurityId("AAPL US Equity")));
String spec = topicNameResolver.resolve(new JmsTopicNameResolveRequest(aaplEquity, rules));
assertEquals("LiveData.Bloomberg.Equity.NASDAQ GS.AAPL" + rules.getJmsTopicSuffix(), spec);
ExternalId usDomesticBond = idResolver.resolve(
ExternalIdBundle.of(ExternalSchemes.cusipSecurityId("607059AT9")));
spec = topicNameResolver.resolve(new JmsTopicNameResolveRequest(usDomesticBond, rules));
assertEquals("LiveData.Bloomberg.Bond.MOBIL CORP.607059AT9" + rules.getJmsTopicSuffix(), spec);
ExternalId globalBond = idResolver.resolve(
ExternalIdBundle.of(ExternalSchemes.cusipSecurityId("4581X0AD0")));
spec = topicNameResolver.resolve(new JmsTopicNameResolveRequest(globalBond, rules));
assertEquals("LiveData.Bloomberg.Bond.INTER-AMERICAN DEVEL BK.US4581X0AD07" + rules.getJmsTopicSuffix(), spec);
Set<ExternalId> options = BloombergDataUtils.getOptionChain(rdp, "AAPL US Equity");
assertFalse(options.isEmpty());
ExternalId aaplOptionId = options.iterator().next();
ExternalId aaplOption = idResolver.resolve(ExternalIdBundle.of(aaplOptionId));
spec = topicNameResolver.resolve(new JmsTopicNameResolveRequest(aaplOption, rules));
assertTrue(spec.startsWith("LiveData.Bloomberg.EquityOption.AAPL US."));
assertTrue(spec.endsWith(rules.getJmsTopicSuffix()));
// bulk request
Map<JmsTopicNameResolveRequest, String> request2TopicName = topicNameResolver.resolve(
Sets.newHashSet(
new JmsTopicNameResolveRequest(aaplEquity, rules),
new JmsTopicNameResolveRequest(usDomesticBond, rules)));
assertEquals(2, request2TopicName.size());
assertEquals("LiveData.Bloomberg.Equity.NASDAQ GS.AAPL" + rules.getJmsTopicSuffix(),
request2TopicName.get(new JmsTopicNameResolveRequest(aaplEquity, rules)));
assertEquals("LiveData.Bloomberg.Bond.MOBIL CORP.607059AT9" + rules.getJmsTopicSuffix(),
request2TopicName.get(new JmsTopicNameResolveRequest(usDomesticBond, rules)));
}