Example #1
0
 /**
  * Gets the best descriptive name.
  *
  * @return the best descriptive name, not null
  */
 public String getBestName() {
   Security security = getTarget();
   ObjectId objectId = getObjectId();
   ExternalIdBundle bundle = getExternalId();
   if (security != null) {
     // Try to retrieve the security's assigned name
     String name = security.getName();
     if (StringUtils.isNotBlank(name)) {
       return name;
     }
     bundle = security.getExternalIdBundle();
   }
   if (bundle != null && bundle.size() > 0) {
     if (bundle.getValue(ExternalSchemes.BLOOMBERG_TICKER) != null) {
       return bundle.getValue(ExternalSchemes.BLOOMBERG_TICKER);
     } else if (bundle.getValue(ExternalSchemes.RIC) != null) {
       return bundle.getValue(ExternalSchemes.RIC);
     } else if (bundle.getValue(ExternalSchemes.ACTIVFEED_TICKER) != null) {
       return bundle.getValue(ExternalSchemes.ACTIVFEED_TICKER);
     } else {
       return bundle.getExternalIds().iterator().next().getValue();
     }
   }
   if (objectId != null) {
     return objectId.toString();
   }
   return "";
 }
Example #2
0
  // -------------------------------------------------------------------------
  @Test
  public void testGetConfigByUid() {
    final SimpleExchange target = new SimpleExchange();
    target.setName("Test");

    when(_underlying.getConfig(eq(SimpleExchange.class), eq(UID))).thenReturn(target);

    Response test =
        _resource.get(OID.toString(), SimpleExchange.class.getName(), UID.getVersion(), "", "");
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    assertSame(target, test.getEntity());
  }